int main() { std::vector<Point> points; points.push_back(Point(0,0)); points.push_back(Point(1,0)); points.push_back(Point(0,1)); points.push_back(Point(4,10)); points.push_back(Point(2,2)); points.push_back(Point(-1,0)); Delaunay T; T.insert( boost::make_transform_iterator(points.begin(),Auto_count()), boost::make_transform_iterator(points.end(), Auto_count() ) ); CGAL_assertion( T.number_of_vertices() == 6 ); // check that the info was correctly set. Delaunay::Finite_vertices_iterator vit; for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) if( points[ vit->info() ] != vit->point() ){ std::cerr << "Error different info" << std::endl; exit(EXIT_FAILURE); } std::cout << "OK" << std::endl; return 0; }
void test_transform_iterator() const { typedef std::vector< Weighted_point > Container; typedef typename boost::mpl::if_<boost::mpl::bool_<is_const>, typename boost::add_const<Container>::type, Container >::type Cast_type; Container points; points.push_back(Weighted_point(Bare_point(0,0,0),1)); points.push_back(Weighted_point(Bare_point(1,0,0),2)); points.push_back(Weighted_point(Bare_point(0,1,0),3)); points.push_back(Weighted_point(Bare_point(0,0,1),4)); points.push_back(Weighted_point(Bare_point(2,2,2),5)); points.push_back(Weighted_point(Bare_point(-1,0,1),6)); RT R(boost::make_transform_iterator(static_cast<Cast_type&>(points).begin(), Auto_count()), boost::make_transform_iterator(static_cast<Cast_type&>(points).end(), Auto_count())); assert(R.number_of_vertices() == 6); // check that the info was correctly set. typename RT::Finite_vertices_iterator vit; for(vit = R.finite_vertices_begin(); vit != R.finite_vertices_end(); ++vit) assert(points[ vit->info() ] == vit->point()); #ifdef CGAL_LINKED_WITH_TBB { // Construct the locking data-structure, using the bounding-box of the points typename RT_parallel::Lock_data_structure locking_ds(CGAL::Bbox_3(-1., 0., 0., 2, 2, 2), 50); // Contruct the triangulation in parallel RT_parallel R(boost::make_transform_iterator(static_cast<Cast_type&>(points).begin(), Auto_count()), boost::make_transform_iterator(static_cast<Cast_type&>(points).end(), Auto_count()), &locking_ds); assert(R.number_of_vertices() == 6); // check that the info was correctly set. typename RT_parallel::Finite_vertices_iterator vit; for(vit = R.finite_vertices_begin(); vit != R.finite_vertices_end(); ++vit) { assert(points[vit->info()] == vit->point()); } } #endif }