diff --git a/BGL/examples/BGL_surface_mesh/cube.off b/BGL/examples/BGL_surface_mesh/prim.cin similarity index 100% rename from BGL/examples/BGL_surface_mesh/cube.off rename to BGL/examples/BGL_surface_mesh/prim.cin diff --git a/BGL/examples/BGL_triangulation_2/emst.cpp b/BGL/examples/BGL_triangulation_2/emst.cpp index 7b3082b9593..2ce5c8f1817 100644 --- a/BGL/examples/BGL_triangulation_2/emst.cpp +++ b/BGL/examples/BGL_triangulation_2/emst.cpp @@ -84,8 +84,8 @@ main(int,char*[]) for(std::list::iterator it = mst.begin(); it != mst.end(); ++it){ edge_descriptor ed = *it; - vertex_descriptor svd = boost::source(ed,t); - vertex_descriptor tvd = boost::target(ed,t); + vertex_descriptor svd = source(ed,t); + vertex_descriptor tvd = target(ed,t); Triangulation::Vertex_handle sv = svd; Triangulation::Vertex_handle tv = tvd; std::cout << "[ " << sv->point() << " | " << tv->point() << " ] " << std::endl; diff --git a/BGL/examples/BGL_triangulation_2/face_graph.cpp b/BGL/examples/BGL_triangulation_2/face_graph.cpp index 1062ecc5cf1..db7c17ea491 100644 --- a/BGL/examples/BGL_triangulation_2/face_graph.cpp +++ b/BGL/examples/BGL_triangulation_2/face_graph.cpp @@ -9,6 +9,8 @@ #include #include +#include + typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic; typedef CGAL::Projection_traits_xy_3 K; typedef K::Point_2 Point; @@ -111,6 +113,7 @@ main(int,char*[]) for(boost::tie(eit,ee) = edges(t); eit!= ee; ++eit){ edge_descriptor ed = *eit; vertex_descriptor vd = source(ed,t); + CGAL_USE(vd); ++index; } @@ -121,6 +124,7 @@ main(int,char*[]) for(boost::tie(hit,he) = halfedges(t); hit!= he; ++hit){ halfedge_descriptor hd = *hit; vertex_descriptor vd = source(hd,t); + CGAL_USE(vd); ++index; } std::cerr << index << " halfedges" << std::endl; @@ -142,12 +146,12 @@ main(int,char*[]) // The surface and stop conditions are mandatory arguments. // The index maps are needed because the vertices and edges // of this surface lack an "id()" field. - int r = SMS::edge_collapse - (t - ,stop - ,CGAL::vertex_index_map(vertex_index_pmap) - .halfedge_index_map (halfedge_index_pmap) - ); + SMS::edge_collapse + (t + ,stop + ,CGAL::vertex_index_map(vertex_index_pmap) + .halfedge_index_map (halfedge_index_pmap) + ); ppmap[*(++vertices(t).first)] = Point(78,1,2); diff --git a/BGL/include/CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h b/BGL/include/CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h index 75b6aff68b8..e1cb66719bf 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h @@ -366,7 +366,7 @@ namespace CGAL { put(PropertyTag p, CGAL::Delaunay_triangulation_2& g, const Key& key, const Value& value) { - typedef typename property_map, PropertyTag>::type Map; + typedef typename boost::property_map, PropertyTag>::type Map; Map pmap = get(p, g); put(pmap, key, value); } diff --git a/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h b/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h index 96b5707b6a0..d2208fe9339 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h @@ -372,7 +372,7 @@ halfedge(typename boost::graph_traits >::vert // HalfedgeListGraph // template -CGA::Iterator_range >::halfedge_iterator> +CGAL::Iterator_range >::halfedge_iterator> halfedges(const OpenMesh::PolyMesh_ArrayKernelT& sm) { return CGAL::make_range(sm.halfedges_sbegin(), sm.halfedges_end()); diff --git a/BGL/include/CGAL/boost/graph/graph_traits_Surface_mesh.h b/BGL/include/CGAL/boost/graph/graph_traits_Surface_mesh.h index 1245d45bddb..aa4e388f9b4 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_Surface_mesh.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_Surface_mesh.h @@ -527,7 +527,7 @@ add_face(InputIterator begin, InputIterator end, CGAL::Surface_mesh

& sm) template bool is_valid(CGAL::Surface_mesh

& sm, bool verbose = false) { - return true; + return sm.is_valid(verbose); } } // namespace CGAL diff --git a/BGL/include/CGAL/boost/graph/graph_traits_Triangulation_2.h b/BGL/include/CGAL/boost/graph/graph_traits_Triangulation_2.h index ff309cd83b4..3444f063df9 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_Triangulation_2.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_Triangulation_2.h @@ -402,7 +402,7 @@ namespace CGAL { template typename boost::graph_traits< Triangulation_2 >::face_descriptor face(typename boost::graph_traits< Triangulation_2 >::halfedge_descriptor e, - const Triangulation_2& g) + const Triangulation_2&) { return e.first; } @@ -410,7 +410,7 @@ namespace CGAL { template typename boost::graph_traits< Triangulation_2 >::halfedge_descriptor halfedge(typename boost::graph_traits< Triangulation_2 >::face_descriptor f, - const Triangulation_2& g) + const Triangulation_2&) { typedef typename boost::graph_traits< Triangulation_2 >::halfedge_descriptor halfedge_descriptor; return halfedge_descriptor(f,0); @@ -431,7 +431,7 @@ namespace CGAL { template typename boost::graph_traits< Triangulation_2 >::halfedge_descriptor halfedge(typename boost::graph_traits< Triangulation_2 >::edge_descriptor e, - const Triangulation_2& g) + const Triangulation_2&) { typedef typename boost::graph_traits< Triangulation_2 >::halfedge_descriptor halfedge_descriptor; return halfedge_descriptor(e.first,e.second); @@ -440,7 +440,7 @@ namespace CGAL { template typename boost::graph_traits< Triangulation_2 >::edge_descriptor edge(typename boost::graph_traits< Triangulation_2 >::halfedge_descriptor e, - const Triangulation_2& g) + const Triangulation_2&) { typedef typename boost::graph_traits< Triangulation_2 >::edge_descriptor edge_descriptor; return edge_descriptor(e.first,e.second); @@ -619,23 +619,23 @@ namespace CGAL { template class T2_vertex_point_map - : public boost::put_get_helper > { public: - typedef boost::readable_property_map_tag category; + typedef boost::lvalue_property_map_tag category; typedef typename Tds::Vertex::Point value_type; typedef value_type& reference; typedef typename CGAL::Triangulation_2::Vertex_handle key_type; - - T2_vertex_point_map() - {} - - value_type operator[](key_type vh) const { + + friend reference get(T2_vertex_point_map, key_type vh) + { return vh->point(); } - - reference operator[](key_type vh) { - return vh->point(); + friend void put(T2_vertex_point_map, key_type vh, const reference v) + { + vh->point()=v; + } + reference operator[](key_type vh) const { + return vh->point(); } }; @@ -790,7 +790,7 @@ namespace CGAL { put(PropertyTag p, Triangulation_2& g, const Key& key, const Value& value) { - typedef typename property_map, PropertyTag>::type Map; + typedef typename boost::property_map, PropertyTag>::type Map; Map pmap = get(p, g); put(pmap, key, value); } diff --git a/BGL/include/CGAL/boost/graph/properties_Surface_mesh.h b/BGL/include/CGAL/boost/graph/properties_Surface_mesh.h index 94b6cab09e1..16a25d81d8a 100644 --- a/BGL/include/CGAL/boost/graph/properties_Surface_mesh.h +++ b/BGL/include/CGAL/boost/graph/properties_Surface_mesh.h @@ -94,7 +94,7 @@ template typename property_map, boost::vertex_property_t >::const_type get(boost::vertex_property_t vprop, const CGAL::Surface_mesh& sm) { - return sm.template property_map::Vertex_index, T>(vprop.s); + return sm.template get_property_map::Vertex_index, T>(vprop.s); } template @@ -261,7 +261,7 @@ put(CGAL::vertex_point_t p, const CGAL::Surface_mesh& g, const K& point) { typedef CGAL::Surface_mesh SM; CGAL_assertion(g.is_valid(x)); - typename SM::Property_map< typename boost::graph_traits::vertex_descriptor, + typename SM::template Property_map< typename boost::graph_traits::vertex_descriptor, K> prop = get(p, g); prop[x] = point; } diff --git a/BGL/test/BGL/test_graph_traits.cpp b/BGL/test/BGL/test_graph_traits.cpp index f05e6c6d07e..3d0fe51ddbb 100644 --- a/BGL/test/BGL/test_graph_traits.cpp +++ b/BGL/test/BGL/test_graph_traits.cpp @@ -50,12 +50,12 @@ void test_edge_iterators(const G& g) typedef typename Traits::edge_descriptor edge_descriptor; typedef typename Traits::edge_iterator edge_iterator; - assert(g.size_of_halfedges() / 2 == num_edges(g)); + // assert(g.size_of_halfedges() / 2 == num_edges(g)); // do we iterate as many as that? edge_iterator eb, ee; boost::tie(eb, ee) = edges(g); - assert(std::distance(eb, ee) == static_cast(g.size_of_halfedges() / 2)); + assert(std::distance(eb, ee) == num_edges(g)); id_map ids; unsigned int count = 0; diff --git a/Surface_mesh/examples/Surface_mesh/CMakeLists.txt b/Surface_mesh/examples/Surface_mesh/CMakeLists.txt index 1e648a54fd3..2f8a933a74a 100644 --- a/Surface_mesh/examples/Surface_mesh/CMakeLists.txt +++ b/Surface_mesh/examples/Surface_mesh/CMakeLists.txt @@ -22,16 +22,15 @@ if ( CGAL_FOUND ) include( CGAL_CreateSingleSourceCGALProgram ) include_directories (BEFORE "../../include") - include_directories (BEFORE "../include") create_single_source_cgal_program( "sm_aabbtree.cpp" ) + create_single_source_cgal_program( "sm_bgl.cpp" ) + create_single_source_cgal_program( "sm_circulators.cpp" ) create_single_source_cgal_program( "sm_do_intersect.cpp" ) create_single_source_cgal_program( "sm_iterators.cpp" ) - create_single_source_cgal_program( "sm_circulators.cpp" ) - create_single_source_cgal_program( "sm_properties.cpp" ) - create_single_source_cgal_program( "sm_memory.cpp" ) create_single_source_cgal_program( "sm_kruskal.cpp" ) - create_single_source_cgal_program( "sm_bgl.cpp" ) + create_single_source_cgal_program( "sm_memory.cpp" ) + create_single_source_cgal_program( "sm_properties.cpp" ) else() diff --git a/Surface_mesh/examples/Surface_mesh/sm_iterators.cpp b/Surface_mesh/examples/Surface_mesh/sm_iterators.cpp index 5838059e1e9..b6eb8892401 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_iterators.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_iterators.cpp @@ -29,7 +29,7 @@ int main() vertex_descriptor w = m.add_vertex(K::Point_3(1,0,0)); vertex_descriptor x = m.add_vertex(K::Point_3(1,1,0)); - face_descriptor f = m.add_face(u,v,w,x); + /* face_descriptor f = */ m.add_face(u,v,w,x); { std::cout << "all vertices " << std::endl; @@ -57,9 +57,11 @@ int main() } // or the C+11 for loop. Note that there is a ':' and not a ',' as in BOOST_FOREACH + #ifndef CGAL_NO_CPP0X_RANGE_BASED_FOR for(vertex_descriptor vd : m.vertices()){ std::cout << vd << std::endl; } + #endif } diff --git a/Surface_mesh/examples/Surface_mesh/sm_kruskal.cpp b/Surface_mesh/examples/Surface_mesh/sm_kruskal.cpp index d6a67be116e..59e99efc5f2 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_kruskal.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_kruskal.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -57,10 +58,11 @@ kruskal(const Mesh& P) } -int main() { +int main(int,char** argv) { Mesh P; - std::cin >> P; + std::ifstream input(argv[1]); + input >> P; kruskal(P); diff --git a/Surface_mesh/examples/Surface_mesh/sm_properties.cpp b/Surface_mesh/examples/Surface_mesh/sm_properties.cpp index 6e62153b149..aca06fffde5 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_properties.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_properties.cpp @@ -48,10 +48,6 @@ int main() boost::tie(gnus, found) = m.property_map("v:gnus"); assert(! found); - - typedef boost::property_map::type Ppmap; - Ppmap ppmap = m.points(); - // retrieve the point property for which exists a convenience function Mesh::Property_map location = m.points(); BOOST_FOREACH( vertex_descriptor vd, m.vertices()) { diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO.h b/Surface_mesh/include/CGAL/Surface_mesh/IO.h index 3a496b67258..abce9942e28 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO.h @@ -69,8 +69,8 @@ bool read_off_binary(Surface_mesh& mesh, typename Mesh::Vertex_index v; // properties - Mesh::Property_map normals; - Mesh::Property_map texcoords; + typename Mesh:: template Property_map normals; + typename Mesh:: template Property_map texcoords; if (has_normals) normals = mesh.template add_property_map("v:normal").first; if (has_texcoords) texcoords = mesh.template add_property_map("v:texcoord").first; @@ -145,8 +145,8 @@ bool read_off_ascii(Surface_mesh& mesh, typename Mesh::Vertex_index v; // properties - Mesh::Property_map normals; - Mesh::Property_map texcoords; + typename Mesh::template Property_map normals; + typename Mesh::template Property_map texcoords; if (has_normals) normals = mesh.template add_property_map("v:normal").first; if (has_texcoords) texcoords = mesh.template add_property_map("v:texcoord").first; @@ -343,7 +343,7 @@ bool write_off(const Surface_mesh& mesh, const std::string& filename) // vertices - Mesh::Property_map points + typename Mesh::template Property_map points = mesh.template property_map("v:point").first; for (typename Mesh::Vertex_iterator vit=mesh.vertices_begin(); vit!=mesh.vertices_end(); ++vit) { @@ -360,7 +360,7 @@ bool write_off(const Surface_mesh& mesh, const std::string& filename) typename Surface_mesh::Vertex_around_face_circulator fvit(mesh.halfedge(*fit),mesh), fvend=fvit; do { - Surface_mesh::size_type idx = *fvit; + typename Surface_mesh::size_type idx = *fvit; fprintf(out, " %d", idx); } while (++fvit != fvend); diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index a27d47e5251..0f9d21f3247 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -169,7 +169,7 @@ public: // virtual interface of Base_property_array virtual Base_property_array* clone() const { - Property_array* p = new Property_array(name_, value_); + Property_array* p = new Property_array(this->name_, this->value_); p->data_ = data_; return p; } @@ -338,7 +338,7 @@ public: // delete a property template void remove(Property_map& h) { - std::vector::iterator it=parrays_.begin(), end=parrays_.end(); + typename std::vector::iterator it=parrays_.begin(), end=parrays_.end(); for (; it!=end; ++it) { if (*it == h.parray_) @@ -1505,38 +1505,44 @@ public: valid = valid && next(*it).is_valid(); valid = valid && opposite(*it).is_valid(); if(!valid) { - std::cerr << "Integrity of halfedge " << *it << " corrupted." << std::endl; + if (verbose) + std::cerr << "Integrity of halfedge " << *it << " corrupted." << std::endl; break; } valid = valid && (opposite(*it) != *it); valid = valid && (opposite(opposite(*it)) == *it); if(!valid) { + if (verbose) std::cerr << "Integrity of opposite halfedge of " << *it << " corrupted." << std::endl; break; } valid = valid && (next(prev(*it)) == *it); if(!valid) { - std::cerr << "Integrity of previous halfedge of " << *it << " corrupted." << std::endl; + if (verbose) + std::cerr << "Integrity of previous halfedge of " << *it << " corrupted." << std::endl; break; } valid = valid && (prev(next(*it)) == *it); if(!valid) { - std::cerr << "Integrity of next halfedge of " << *it << " corrupted." << std::endl; + if (verbose) + std::cerr << "Integrity of next halfedge of " << *it << " corrupted." << std::endl; break; } valid = valid && target(*it).is_valid(); if(!valid) { - std::cerr << "Integrity of vertex of halfedge " << *it << " corrupted." << std::endl; + if (verbose) + std::cerr << "Integrity of vertex of halfedge " << *it << " corrupted." << std::endl; break; } valid = valid && (target(*it) == target(opposite(next(*it)))); if(!valid) { - std::cerr << "Halfedge vertex of next opposite is not the same for " << *it << "." << std::endl; + if (verbose) + std::cerr << "Halfedge vertex of next opposite is not the same for " << *it << "." << std::endl; break; } } @@ -1546,7 +1552,8 @@ public: // not an isolated vertex valid = valid && (target(halfedge(*it)) == *it); if(!valid) { - std::cerr << "Halfedge of " << *it << " is not an incoming halfedge." << std::endl; + if (verbose) + std::cerr << "Halfedge of " << *it << " is not an incoming halfedge." << std::endl; break; } } @@ -2138,8 +2145,6 @@ private: //------------------------------------------------------- private data std::istream& operator>>(std::istream& is, Surface_mesh

& sm) { typedef Surface_mesh

Mesh; - typedef typename Mesh::Vertex_index Vertex_index; - typedef typename Mesh::Face_index Face_index; typedef typename Mesh::size_type size_type; sm.clear(); int n, f, e; diff --git a/Surface_mesh/test/Surface_mesh/sm_remove.cpp b/Surface_mesh/test/Surface_mesh/sm_remove.cpp index f7744702436..510c913c7d0 100644 --- a/Surface_mesh/test/Surface_mesh/sm_remove.cpp +++ b/Surface_mesh/test/Surface_mesh/sm_remove.cpp @@ -11,12 +11,12 @@ int main() { Sm m; Sm::vertex_index u; - std::cout << m.num_vertices() << " " << m.num_removed_vertices() << std::endl; + std::cout << m.num_vertices() << " " << m.number_of_removed_vertices() << std::endl; for(int i=0; i < 10; i++){ u = m.add_vertex(Point_3(0,0,0)); m.remove_vertex(u); } - std::cout << m.num_vertices() << " " << m.num_removed_vertices() << std::endl; + std::cout << m.num_vertices() << " " << m.number_of_removed_vertices() << std::endl; return 0; } diff --git a/Surface_mesh/test/Surface_mesh/surface_mesh_test.cpp b/Surface_mesh/test/Surface_mesh/surface_mesh_test.cpp index d1fc200e2ca..5dacadcced6 100644 --- a/Surface_mesh/test/Surface_mesh/surface_mesh_test.cpp +++ b/Surface_mesh/test/Surface_mesh/surface_mesh_test.cpp @@ -10,6 +10,8 @@ #include #include +#include + BOOST_AUTO_TEST_CASE( constructors_test ) { Sm mesh; @@ -141,7 +143,6 @@ BOOST_AUTO_TEST_CASE( memory_reuse_test ) BOOST_CHECK_EQUAL(f.m.number_of_faces() , 0); BOOST_CHECK_EQUAL(f.m.number_of_removed_edges(), old_edge_size + old_removed_edge_size); - int fc = 0; // add all again for(Faces::iterator it = faces.begin(); it != faces.end(); ++it) { Sm::Face_index fd = f.m.add_face(*it); @@ -151,7 +152,7 @@ BOOST_AUTO_TEST_CASE( memory_reuse_test ) Sm::Halfedge_index h = f.m.halfedge(*it2); Sm::Face_index fa = f.m.face(h); - + CGAL_USE(fa); } } diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cmd b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cmd old mode 100755 new mode 100644 diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp index 87aee61c52d..53eba6495c4 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp @@ -73,7 +73,7 @@ int main( int argc, char** argv ) Surface_mesh::Property_map > constrained_halfedges; - constrained_halfedges = surface_mesh.add_property_map>("h:vertices").first; + constrained_halfedges = surface_mesh.add_property_map >("h:vertices").first; std::size_t nb_border_edges=0; BOOST_FOREACH(halfedge_descriptor hd, halfedges(surface_mesh)){ diff --git a/BGL/examples/BGL_surface_mesh/prim.cmd b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cmd old mode 100755 new mode 100644 similarity index 100% rename from BGL/examples/BGL_surface_mesh/prim.cmd rename to Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_surface_mesh.cmd