diff --git a/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h b/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h index 849127d20fc..c814c8fe7fb 100644 --- a/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h +++ b/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h @@ -127,9 +127,10 @@ Property maps can be wrapped with `Graph_with_descriptor_with_graph_property_map \cgalModels `MutableFaceGraph` if `Graph` is a model of `MutableFaceGraph` */ -template +template struct Graph_with_descriptor_with_graph { + typedef Graph_ Graph; Graph* graph; typedef boost::graph_traits gt; diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp index f09a888cf49..0ca7f593605 100644 --- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp @@ -1,3 +1,12 @@ + + + + + + + + + #include #include diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features_sm.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features_sm.cpp index 78463d685f9..71662181797 100644 --- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features_sm.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features_sm.cpp @@ -9,6 +9,7 @@ #include #include #include +#include // Domain typedef CGAL::Exact_predicates_inexact_constructions_kernel K; @@ -47,6 +48,8 @@ int main(int argc, char*argv[]) std::cerr << "Error: Cannot read file " << fname << std::endl; return EXIT_FAILURE; } + CGAL::Timer t; + t.start(); // Create domain Mesh_domain domain(polyhedron); @@ -61,6 +64,7 @@ int main(int argc, char*argv[]) // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); + std::cerr << t.time() << " sec." << std::endl; // Output std::ofstream medit_file("out.mesh"); c3t3.output_to_medit(medit_file); diff --git a/Mesh_3/include/CGAL/Mesh_polyhedron_3.h b/Mesh_3/include/CGAL/Mesh_polyhedron_3.h index 5a35dd0d213..23fb96a4b82 100644 --- a/Mesh_3/include/CGAL/Mesh_polyhedron_3.h +++ b/Mesh_3/include/CGAL/Mesh_polyhedron_3.h @@ -270,6 +270,15 @@ get(CGAL::face_patch_id_t, return Patch_id_pmap(); } +template +CGAL::static_property_map > >::face_descriptor,std::pair > + inline get(CGAL::face_patch_id_t, Polyhedron_3 >& polyhedron) +{ + typedef CGAL::static_property_map > >::face_descriptor,std::pair > Pmap; + + return Pmap(std::make_pair(0,1)); +} + template struct vertex_num_feature_edges_pmap { diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h index 59919aae39f..e0f4dce3562 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h @@ -83,8 +83,42 @@ max_length(const Bbox_3& b) // Surface_patch_index_generator // To use patch_id enclosed in AABB_primitives or not // ----------------------------------- -template < typename Subdomain_index, typename Polyhedron, typename Tag > + +// here we had Tag_true instead of Patch_id +template < typename Subdomain_index, typename Polyhedron, typename Patch_id> struct Surface_patch_index_generator +{ + typedef Patch_id Surface_patch_index; + typedef Surface_patch_index type; + + template < typename Primitive_id > + Surface_patch_index operator()(const Primitive_id& primitive_id) + { + return primitive_id->patch_id(); + } +}; + + +template < typename Subdomain_index, typename P, typename Patch_id> +struct Surface_patch_index_generator >, Patch_id> +{ + typedef Patch_id Surface_patch_index; + typedef Surface_patch_index type; + + template < typename Primitive_id > + Surface_patch_index operator()(const Primitive_id& primitive_id) + { + typedef boost::property_map, face_patch_id_t >::type Fpim; + typename Fpim fpim = get(face_patch_id_t(),*((*primitive_id).graph)); + Surface_patch_index spi = get(fpim, (*primitive_id).descriptor); + return spi; + } +}; + + + +template < typename Subdomain_index, typename Polyhedron> +struct Surface_patch_index_generator { typedef std::pair Surface_patch_index; typedef Surface_patch_index type; @@ -94,17 +128,6 @@ struct Surface_patch_index_generator { return Surface_patch_index(0,1); } }; -template < typename Subdomain_index, typename Polyhedron > -struct Surface_patch_index_generator -{ - typedef typename Polyhedron::Face::Patch_id Surface_patch_index; // AF: change for Surface_mesh - typedef Surface_patch_index type; - - template < typename Primitive_id > - Surface_patch_index operator()(const Primitive_id& primitive_id) - { return primitive_id->patch_id(); } // AF partial specialization for GwDwG ?? -}; - // ----------------------------------- // Index_generator @@ -162,14 +185,18 @@ struct IGT_generator template, - class Use_patch_id_tag=Tag_false, + class Patch_id_ = void, class Use_exact_intersection_construction_tag = CGAL::Tag_true> class Polyhedral_mesh_domain_3 { + typedef typename Mesh_3::details::IGT_generator< IGT_,Use_exact_intersection_construction_tag>::type IGT; public: + + typedef Patch_id_ Patch_id; + /// Geometric object types typedef typename IGT::Point_3 Point_3; typedef typename IGT::Segment_3 Segment_3; @@ -186,7 +213,7 @@ public: typedef boost::optional Subdomain; /// Type of indexes for surface patch of the input complex typedef Mesh_3::details::Surface_patch_index_generator< - Subdomain_index,Polyhedron,Use_patch_id_tag> Surface_patch_index_generator; + Subdomain_index,Polyhedron,Patch_id> Surface_patch_index_generator; typedef typename Surface_patch_index_generator::type Surface_patch_index; typedef boost::optional Surface_patch; /// Type of indexes to characterize the lowest dimensional face of the input @@ -584,7 +611,7 @@ public: { Mesh_3::details::Surface_patch_index_generator generator; + Patch_id> generator; return generator(primitive_id); } diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h index 48bee2dde60..0a46321ab87 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h @@ -193,28 +193,27 @@ struct Extract_polyline_with_context_visitor template < class IGT_, class Polyhedron_ = typename Mesh_polyhedron_3::type, class TriangleAccessor=Triangle_accessor_3, - class Use_patch_id_tag = Tag_true, + class Patch_id=int, class Use_exact_intersection_construction_tag = Tag_true > class Polyhedral_mesh_domain_with_features_3 : public Mesh_domain_with_polyline_features_3< Polyhedral_mesh_domain_3< Polyhedron_, IGT_, TriangleAccessor, - Use_patch_id_tag, + Patch_id, Use_exact_intersection_construction_tag > > { typedef Mesh_domain_with_polyline_features_3< Polyhedral_mesh_domain_3< Polyhedron_, IGT_, TriangleAccessor, - Use_patch_id_tag, Use_exact_intersection_construction_tag > > Base; + Patch_id, Use_exact_intersection_construction_tag > > Base; typedef boost::adjacency_list< boost::setS, // this avoids parallel edges boost::vecS, boost::undirectedS, typename IGT_::Point_3, - // AF typename Polyhedron_::Vertex::Set_of_indices> Featured_edges_copy_graph; - std::set > Featured_edges_copy_graph; + std::set > Featured_edges_copy_graph; public: typedef Polyhedron_ Polyhedron; @@ -372,9 +371,9 @@ initialize_ts(Polyhedron& p) typedef boost::property_map::type Vtmap; typedef boost::property_map::type Htmap; typedef boost::property_map::type Ftmap; - Vtmap vtm; - Htmap htm; - Ftmap ftm; + Vtmap vtm = get(vertex_time_stamp,p); + Htmap htm = get(halfedge_time_stamp,p); + Ftmap ftm = get(face_time_stamp,p); std::size_t ts = 0; BOOST_FOREACH(typename boost::graph_traits::vertex_descriptor vd, vertices(p)) @@ -437,10 +436,9 @@ detect_features(FT angle_in_degree, std::vector& poly) // TODO: replace this map by and unordered_map P2vmap p2vmap; - typedef int ID; // AF - typedef typename boost::property_map >::type Face_patch_id_pmap; - CGAL::Polygon_mesh_processing::Detect_features_in_polyhedra detect_features(get(face_patch_id_t(), poly.front())); + typedef typename boost::property_map >::type Face_patch_id_pmap; + CGAL::Polygon_mesh_processing::Detect_features_in_polyhedra detect_features(get(face_patch_id_t(), poly.front())); BOOST_FOREACH(Polyhedron& p, poly) { @@ -544,9 +542,8 @@ add_featured_edges_to_graph(const Polyhedron& p, } } - typedef int ID; // AF - typedef typename boost::property_map >::type Face_patch_id_pmap; - Face_patch_id_pmap fpm = get(face_patch_id_t(),p); + typedef typename boost::property_map >::type Face_patch_id_pmap; + Face_patch_id_pmap fpm = get(face_patch_id_t(),p); BOOST_FOREACH(Graph_edge_descriptor e, edges(graph)){ vertex_descriptor vs = p2vmap[get(vpm,source(e,graph))]; diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_type.h b/Polyhedron/demo/Polyhedron/Polyhedron_type.h index cac09d088b3..3eecb079d3e 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_type.h +++ b/Polyhedron/demo/Polyhedron/Polyhedron_type.h @@ -292,7 +292,8 @@ struct vertex_incident_patches_pmap { } }; -inline vertex_incident_patches_pmap get(CGAL::vertex_incident_patches_t, const Polyhedron&) +template +inline vertex_incident_patches_pmap get(CGAL::vertex_incident_patches_t, const Polyhedron&) { return vertex_incident_patches_pmap(); } @@ -343,8 +344,8 @@ namespace boost { { typedef vertex_num_feature_edges_pmap type; }; - template <> - struct property_map + template + struct property_map > { typedef vertex_incident_patches_pmap type; }; diff --git a/Polyhedron/demo/Polyhedron/SMesh_type.h b/Polyhedron/demo/Polyhedron/SMesh_type.h index eb330ec352f..c9c448de847 100644 --- a/Polyhedron/demo/Polyhedron/SMesh_type.h +++ b/Polyhedron/demo/Polyhedron/SMesh_type.h @@ -40,6 +40,14 @@ inline get(CGAL::face_patch_id_t, SMesh& smesh) } + CGAL::static_property_map ::face_descriptor,std::pair > + inline get(CGAL::face_patch_id_t, SMesh & smesh) + { + typedef CGAL::static_property_map::face_descriptor, + std::pair > Pmap; + + return Pmap(std::make_pair(0,1)); + } SMesh::Property_map< boost::graph_traits::face_descriptor,int> inline get(CGAL::face_selection_t, SMesh& smesh) @@ -91,6 +99,15 @@ struct property_map > typedef SMesh::Property_map type; }; +template <> + struct property_map > + { + + typedef typename boost::graph_traits::face_descriptor face_descriptor; + + typedef CGAL::static_property_map< boost::graph_traits::face_descriptor,std::pair > type; + typedef type const_type; + }; template<> diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 6691edc100b..0754b7e2964 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -39,6 +39,31 @@ namespace CGAL { /// \cond SKIP_DOXYGEN + template +class static_property_map +{ + typedef K key_type; + typedef const V& value_type; + typedef const V& reference; + typedef boost::read_write_property_map_tag category; + V v; + +public: + static_property_map(V pv) + :v(pv){} + inline friend + value_type + get(const static_property_map& pm, const key_type&) + { + return pm.v; + } + + inline friend + void + put(static_property_map& pm, const key_type&, const value_type&) + {} +}; + template class OR_property_map {