diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse.h index ac1d04667f9..11511803df7 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse.h @@ -60,7 +60,7 @@ public: typedef GetPlacement_ GetPlacement ; typedef ShouldStop_ ShouldStop ; typedef EdgeIdxMap_ EdgeIdxMap ; - typedef EdgeCachedPtrMap_ EdgeCachedPtrMap ; + typedef EdgeCachedPtrMap_ EdgeExtraPtrMap ; typedef VertexIsFixedMap_ VertexIsFixedMap ; typedef VisitorT_ VisitorT ; @@ -170,7 +170,7 @@ public: , GetPlacement const& aGetPlacement , ShouldStop const& aShouldStop , EdgeIdxMap const& aEdge_idx_map - , EdgeCachedPtrMap const& aEdge_cached_ptr_map + , EdgeExtraPtrMap const& aEdge_extra_ptr_map , VertexIsFixedMap const& aVertex_is_fixed_map , VisitorT* aVisitor ) ; @@ -212,12 +212,12 @@ private: return is_border(aEdge) || is_border(opposite_edge(aEdge,mSurface)) ; } - Edge_data_ptr get_data ( edge_descriptor const& aEdge ) const { return static_cast(get(Edge_cached_ptr_map,aEdge)) ; } + Edge_data_ptr get_data ( edge_descriptor const& aEdge ) const { return static_cast(get(Edge_extra_ptr_map,aEdge)) ; } void set_data ( edge_descriptor const& aEdge, Edge_data_ptr aData ) { - put(Edge_cached_ptr_map,aEdge,aData) ; - put(Edge_cached_ptr_map,opposite_edge(aEdge,mSurface),aData) ; + put(Edge_extra_ptr_map,aEdge,aData) ; + put(Edge_extra_ptr_map,opposite_edge(aEdge,mSurface),aData) ; } tuple get_vertices( const_edge_descriptor const& aEdge ) const @@ -326,7 +326,7 @@ private: GetPlacement const& Get_placement ; ShouldStop const& Should_stop ; EdgeIdxMap const& Edge_idx_map ; - EdgeCachedPtrMap const& Edge_cached_ptr_map ; + EdgeExtraPtrMap const& Edge_extra_ptr_map ; VertexIsFixedMap const& Vertex_is_fixed_map ; VisitorT* Visitor ; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse_impl.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse_impl.h index 299f7e16bac..980395b53c4 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse_impl.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Detail/Edge_collapse_impl.h @@ -23,15 +23,15 @@ CGAL_BEGIN_NAMESPACE namespace Triangulated_surface_mesh { namespace Simplification { namespace Edge_collapse { -template -EdgeCollapse::EdgeCollapse( TSM& aSurface +template +EdgeCollapse::EdgeCollapse( TSM& aSurface , Params const* aParams , SetCollapseData const& aSet_collapse_data , GetCost const& aGet_cost , GetPlacement const& aGet_placement , ShouldStop const& aShould_stop , EdgeIdxMap const& aEdge_idx_map - , EdgeCachedPtrMap const& aEdge_cached_ptr_map + , EdgeExtraPtrMap const& aEdge_extra_ptr_map , VertexIsFixedMap const& aVertex_is_fixed_map , VisitorT* aVisitor ) @@ -44,14 +44,14 @@ EdgeCollapse::EdgeCollapse( TSM& aSurfac ,Get_placement (aGet_placement) ,Should_stop (aShould_stop) ,Edge_idx_map (Edge_idx_map) - ,Edge_cached_ptr_map(Edge_cached_ptr_map) + ,Edge_extra_ptr_map (Edge_extra_ptr_map) ,Vertex_is_fixed_map(Vertex_is_fixed_map) ,Visitor (aVisitor) { CGAL_expensive_precondition( is_valid_triangulated_surface_mesh(mSurface) ); - CGAL_expensive_precondition( check_max_id(mSurface) ); + CGAL_expensive_precondition( check_max_id() ); mPQ.reset( new PQ (num_edges(aSurface), Compare_cost(this), Edge_idx_map) ) ; @@ -70,8 +70,8 @@ EdgeCollapse::EdgeCollapse( TSM& aSurfac #endif } -template -int EdgeCollapse::run() +template +int EdgeCollapse::run() { if ( Visitor ) Visitor->OnStarted(mSurface); @@ -94,8 +94,8 @@ int EdgeCollapse::run() return r ; } -template -void EdgeCollapse::Collect() +template +void EdgeCollapse::Collect() { CGAL_TSMS_TRACE(0,"Collecting edges..."); @@ -151,8 +151,8 @@ void EdgeCollapse::Collect() CGAL_TSMS_TRACE(0,"Initial edge count: " << mInitialEdgeCount ) ; } -template -void EdgeCollapse::Loop() +template +void EdgeCollapse::Loop() { CGAL_TSMS_TRACE(0,"Collapsing edges...") ; @@ -212,8 +212,8 @@ void EdgeCollapse::Loop() // // The link conidition is as follows: for every vertex 'k' adjacent to both 'p and 'q', "p,k,q" is a facet of the mesh. // -template -bool EdgeCollapse::Is_collapsable( edge_descriptor const& aEdgePQ ) +template +bool EdgeCollapse::Is_collapsable( edge_descriptor const& aEdgePQ ) { bool rR = true ; @@ -304,8 +304,8 @@ bool EdgeCollapse::Is_collapsable( edge_descriptor const& a return rR ; } -template -typename EdgeCollapse::vertex_descriptor EdgeCollapse::Collapse( edge_descriptor const& aEdgePQ ) +template +typename EdgeCollapse::vertex_descriptor EdgeCollapse::Collapse( edge_descriptor const& aEdgePQ ) { CGAL_TSMS_TRACE(1,"S" << mStep << ". Collapsig " << edge_to_string(aEdgePQ) ) ; @@ -415,8 +415,8 @@ typename EdgeCollapse::vertex_descriptor EdgeCollapse -void EdgeCollapse::Update_neighbors( vertex_descriptor const& aKeptV ) +template +void EdgeCollapse::Update_neighbors( vertex_descriptor const& aKeptV ) { CGAL_TSMS_TRACE(3,"Updating cost of neighboring edges..." ) ; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_collapse.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_collapse.h index 87c89dfa215..589f736613c 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_collapse.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_collapse.h @@ -39,7 +39,7 @@ namespace Triangulated_surface_mesh { namespace Simplification { namespace Edge_ // // For each non-fixed edge in the mesh, a "collapse data" record is constructed by calling the user-supplied function // "SetCollapseData". -// The edge is then associated with its collapse data via the "EdgeCachedPtrMap" property map. +// The edge is then associated with its collapse data via the "EdgeExtraPtrMap" property map. // // The user-supplied function "GetCost" is called, for each non-fixed edge. // This function returns a value which defines the collapsing cost of the edge. Edges with a lower cost are collapsed first. @@ -66,7 +66,7 @@ template @@ -77,7 +77,7 @@ int edge_collapse ( TSM& aSurface , GetNewVertexPoint const& aGet_new_vertex_point , ShouldStop const& aShould_stop , EdgeIdxMap const& aEdge_idx_map - , EdgeCachedPtrMap const& aEdge_cached_ptr_map + , EdgeExtraPtrMap const& aEdge_extra_ptr_map , VertexIsFixedMap const& aVertex_is_fixed_map , Visitor* aVisitor = 0 ) @@ -89,7 +89,7 @@ int edge_collapse ( TSM& aSurface ,GetNewVertexPoint ,ShouldStop ,EdgeIdxMap - ,EdgeCachedPtrMap + ,EdgeExtraPtrMap ,VertexIsFixedMap ,Visitor > @@ -103,7 +103,7 @@ int edge_collapse ( TSM& aSurface ,aGet_new_vertex_point ,aShould_stop ,aEdge_idx_map - ,aEdge_cached_ptr_map + ,aEdge_extra_ptr_map ,aVertex_is_fixed_map ,aVisitor ) ; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_stored_index_map.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_stored_index_map.h index eefdd725ec3..d5fbae2782b 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_stored_index_map.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_stored_index_map.h @@ -23,7 +23,7 @@ namespace boost { -template +template class Edge_stored_index_map : public put_get_helper< typename Graph_::size_type, Edge_stored_index_map > { private: @@ -32,7 +32,7 @@ private: public: - typedef typename G::size_type size_type ; + typedef typename Graph::size_type size_type ; typedef readable_property_map_tag category; typedef size_type value_type; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Vertex_stored_is_fixed_map.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Vertex_stored_is_fixed_map.h index 14c71d2cda1..27828100bbe 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Vertex_stored_is_fixed_map.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Vertex_stored_is_fixed_map.h @@ -37,7 +37,7 @@ public: typedef bool reference; typedef typename graph_traits::vertex_descriptor key_type; - reference operator[](key_type const& v) const { v->is_fixed() ; } + reference operator[](key_type const& v) const { return v->is_fixed() ; } }; diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.cpp index feeec2ac1d0..be16e07858a 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.cpp @@ -73,15 +73,15 @@ struct My_vertex : public HalfedgeDS_vertex_base { typedef HalfedgeDS_vertex_base Base ; - My_vertex() : ID(-1), IsFixed(false) {} - My_vertex( Point p ) : Base(p), ID(-1), IsFixed(false) {} + My_vertex() : mID(-1), mIsFixed(false) {} + My_vertex( Point p ) : Base(p), mID(-1), mIsFixed(false) {} - int id() const { return ID ; } + int id() const { return mID ; } - bool is_fixed() const { return IsFixed ; } + bool is_fixed() const { return mIsFixed ; } - int ID; - bool IsFixed ; + int mID; + bool mIsFixed ; } ; template @@ -89,17 +89,16 @@ struct My_halfedge : public HalfedgeDS_halfedge_base { My_halfedge() : - ID(-1) - , extra_pointer(0) + mID(-1) + , mExtraPointer(0) {} - int id() const { return ID ; } + int id() const { return mID ; } - void* extra_pointer() { return extra_pointer ; } + void*& extra_pointer() { return mExtraPointer ; } - int ID; - - void* extra_pointer ; + int mID; + void* mExtraPointer ; }; template @@ -107,12 +106,12 @@ struct My_face : public HalfedgeDS_face_base Base ; - My_face() : ID(-1) {} - My_face( typename Traits::Plane_3 plane ) : Base(plane) {} + My_face() : mID(-1) {} + My_face( typename Traits::Plane_3 plane ) : Base(plane), mID(-1) {} - int id() const { return ID ; } + int id() const { return mID ; } - int ID; + int mID; }; struct My_items : public Polyhedron_items_3 @@ -520,15 +519,15 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me int lVertexID = 0 ; for ( Polyhedron::Vertex_iterator vi = lP.vertices_begin(); vi != lP.vertices_end() ; ++ vi ) - vi->ID = lVertexID ++ ; + vi->mID = lVertexID ++ ; int lHalfedgeID = 0 ; for ( Polyhedron::Halfedge_iterator hi = lP.halfedges_begin(); hi != lP.halfedges_end() ; ++ hi ) - hi->ID = lHalfedgeID++ ; + hi->mID = lHalfedgeID++ ; int lFacetID = 0 ; for ( Polyhedron::Facet_iterator fi = lP.facets_begin(); fi != lP.facets_end() ; ++ fi ) - fi->ID = lFacetID ++ ; + fi->mID = lFacetID ++ ; #ifdef AUDIT sAuditData .clear(); @@ -558,7 +557,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me Dummy_params lDummy_params; LT_params lLT_params ; - Edge_index_map P_Edge_index_map ; + Edge_stored_index_map edge_index_map ; + Edge_stored_extra_pointer_map edge_extra_pointer_map ; + Vertex_stored_is_fixed_map vertex_is_fixed_map ; Visitor lVisitor(lRequestedEdgeCount) ; @@ -579,6 +580,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me ,get_MP_cost ,get_MP_placement ,should_stop + ,edge_index_map + ,edge_extra_pointer_map + ,vertex_is_fixed_map ,&lVisitor ); break ; @@ -591,6 +595,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me ,get_cached_cost ,get_MP_placement ,should_stop + ,edge_index_map + ,edge_extra_pointer_map + ,vertex_is_fixed_map ,&lVisitor ); break ; @@ -603,6 +610,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me ,get_cached_cost ,get_cached_placement ,should_stop + ,edge_index_map + ,edge_extra_pointer_map + ,vertex_is_fixed_map ,&lVisitor ); break ; @@ -623,6 +633,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me ,get_LT_cost ,get_LT_placement ,should_stop + ,edge_index_map + ,edge_extra_pointer_map + ,vertex_is_fixed_map ,&lVisitor ); break ; @@ -635,6 +648,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me ,get_cached_cost ,get_LT_placement ,should_stop + ,edge_index_map + ,edge_extra_pointer_map + ,vertex_is_fixed_map ,&lVisitor ); break ; @@ -647,6 +663,9 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me ,get_cached_cost ,get_cached_placement ,should_stop + ,edge_index_map + ,edge_extra_pointer_map + ,vertex_is_fixed_map ,&lVisitor ); break ;