diff --git a/Mesh_3/examples/Mesh_3/mesh_cubes_intersection.cpp b/Mesh_3/examples/Mesh_3/mesh_cubes_intersection.cpp index 3b9da29830e..f0d8e94348e 100644 --- a/Mesh_3/examples/Mesh_3/mesh_cubes_intersection.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_cubes_intersection.cpp @@ -29,7 +29,7 @@ typedef FT (*Function)(const Point&); typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper Function_wrapper; typedef Function_wrapper::Function_vector Function_vector; -typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; +typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; // Triangulation typedef CGAL::Mesh_triangulation_3::type Tr; diff --git a/Mesh_3/examples/Mesh_3/mesh_cubes_intersection_with_features.cpp b/Mesh_3/examples/Mesh_3/mesh_cubes_intersection_with_features.cpp index 0ab5d0d7ffc..60bd95f7815 100644 --- a/Mesh_3/examples/Mesh_3/mesh_cubes_intersection_with_features.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_cubes_intersection_with_features.cpp @@ -30,7 +30,7 @@ typedef FT (*Function)(const Point&); typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper Function_wrapper; typedef Function_wrapper::Function_vector Function_vector; -typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; +typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; typedef CGAL::Mesh_domain_with_polyline_features_3 Mesh_domain_with_features; // Triangulation diff --git a/Mesh_3/examples/Mesh_3/mesh_implicit_domains.cpp b/Mesh_3/examples/Mesh_3/mesh_implicit_domains.cpp index 073fb09082e..ba9c950f610 100644 --- a/Mesh_3/examples/Mesh_3/mesh_implicit_domains.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_implicit_domains.cpp @@ -20,7 +20,7 @@ typedef FT_to_point_function_wrapper Function; typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper Function_wrapper; typedef Function_wrapper::Function_vector Function_vector; -typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; +typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; // Triangulation typedef CGAL::Mesh_triangulation_3::type Tr; @@ -43,7 +43,7 @@ int main() v.push_back(f2); // Domain (Warning: Sphere_3 constructor uses square radius !) - Mesh_domain domain(v, K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6); + Mesh_domain domain(Function_wrapper(v), K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6); // Set mesh criteria Facet_criteria facet_criteria(30, 0.2, 0.02); // angle, size, approximation diff --git a/Mesh_3/examples/Mesh_3/mesh_implicit_domains_2.cpp b/Mesh_3/examples/Mesh_3/mesh_implicit_domains_2.cpp index 41daf9fd6dd..016ddcd331c 100644 --- a/Mesh_3/examples/Mesh_3/mesh_implicit_domains_2.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_implicit_domains_2.cpp @@ -20,7 +20,7 @@ typedef FT_to_point_function_wrapper Function; typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper Function_wrapper; typedef Function_wrapper::Function_vector Function_vector; -typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; +typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; // Triangulation typedef CGAL::Mesh_triangulation_3::type Tr; diff --git a/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h b/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h index 3ed0eca3436..d33971a8726 100644 --- a/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h @@ -61,13 +61,7 @@ template, typename Subdomain_index = int> class Gray_image_mesh_domain_3 - : public Labeled_mesh_domain_3< - Mesh_3::Image_to_labeled_function_wrapper , - BGT> + : public Labeled_mesh_domain_3 { public: typedef Image_word_type_ Image_word_type; @@ -77,7 +71,7 @@ public: Transform, false> Wrapper; - typedef Labeled_mesh_domain_3 Base; + typedef Labeled_mesh_domain_3 Base; typedef typename Base::Sphere_3 Sphere_3; typedef typename Base::FT FT; diff --git a/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h b/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h index a690ed5ee7b..ca0173fe3ee 100644 --- a/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h @@ -48,11 +48,11 @@ template > class Implicit_mesh_domain_3 - : public Labeled_mesh_domain_3 + : public Labeled_mesh_domain_3 { public: /// Base type - typedef Labeled_mesh_domain_3 Base; + typedef Labeled_mesh_domain_3 Base; /// Public types typedef typename Base::Sphere_3 Sphere_3; diff --git a/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h index e1d75276105..0ff62a48b6b 100644 --- a/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h @@ -52,16 +52,7 @@ template class Labeled_image_mesh_domain_3 -: public Labeled_mesh_domain_3 - - >::type, - BGT, - Null_subdomain_index - > + : public Labeled_mesh_domain_3 { public: typedef Image_word_type_ Image_word_type; @@ -74,7 +65,7 @@ public: typedef typename Default::Get::type Null; - typedef Labeled_mesh_domain_3 Base; + typedef Labeled_mesh_domain_3 Base; typedef typename Base::Sphere_3 Sphere_3; typedef typename Base::FT FT; diff --git a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h index 6dcad71f737..ead9c3d5447 100644 --- a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h @@ -48,6 +48,7 @@ #include #include +#include namespace CGAL { @@ -66,9 +67,11 @@ struct Construct_pair_from_subdomain_indices { }; // end class template Construct_pair_from_subdomain_indices template + typename Subdomain_index, + typename Surface_patch_index_> class Labeled_mesh_domain_3_impl_details { protected: + typedef Surface_patch_index_ Surface_patch_index; typedef typename Geom_traits::Point_3 Point_3; typedef typename Geom_traits::Iso_cuboid_3 Iso_cuboid_3; typedef typename Geom_traits::FT FT; @@ -101,12 +104,16 @@ protected: } /// The function which answers subdomain queries - CGAL::cpp11::function function_; + typedef CGAL::cpp11::function Function; + Function function_; /// The bounding box const Iso_cuboid_3 bbox_; + CGAL::cpp11::function cstr_s_p_index; /// The functor that decides which sub-domain indices correspond to the /// outside of the domain. - CGAL::cpp11::function null; + typedef CGAL::cpp11::function Null; + Null null; /// The random number generator used by Construct_initial_points CGAL::Random* p_rng_; bool delete_rng_; @@ -126,17 +133,49 @@ protected: * tags of it's incident subdomain. * Thus, a boundary facet of the domain is labelled <0,b>, where b!=0. */ -template -class Labeled_mesh_domain_3 - : protected Labeled_mesh_domain_3_impl_details +template +class Labeled_mesh_domain_3 : + protected Labeled_mesh_domain_3_impl_details +< + BGT, + Subdomain_index_, + typename Default::Get< Surface_patch_index_, + std::pair + >::type + > + { +public: + //------------------------------------------------------- + // Index Types + //------------------------------------------------------- + /// Type of indexes for cells of the input complex + typedef Subdomain_index_ Subdomain_index; + typedef boost::optional Subdomain; + + /// Type of indexes for cells of the input complex + typedef typename Default::Get< Surface_patch_index_, + std::pair + >::type Surface_patch_index; + typedef boost::optional Surface_patch; + + /// Type of indexes to characterize the lowest dimensional face of the input + /// complex on which a vertex lie + typedef typename CGAL::internal::Mesh_3:: + Index_generator::Index Index; + +private: typedef Labeled_mesh_domain_3_impl_details Impl_details; - typedef typename Default::Get::type Null; + Subdomain_index, + Surface_patch_index + > Impl_details; + typedef typename Impl_details::Null Null; + typedef typename Impl_details::Function Function; + public: /// Geometric object types typedef typename BGT::Point_3 Point_3; @@ -156,27 +195,6 @@ public: // access Function type from inherited class typedef Function Fct; - //------------------------------------------------------- - // Index Types - //------------------------------------------------------- - /// Type of indexes for cells of the input complex - typedef typename Function::return_type Subdomain_index; - typedef boost::optional Subdomain; - - typedef typename Default::Get - >::type Cstr_surface_patch_index; - - /// Type of indexes for surface patch of the input complex - typedef typename CGAL::cpp11::result_of - < - Cstr_surface_patch_index(Subdomain_index) - >::type Surface_patch_index; - typedef boost::optional Surface_patch; - /// Type of indexes to characterize the lowest dimensional face of the input - /// complex on which a vertex lie - typedef typename CGAL::internal::Mesh_3:: - Index_generator::Index Index; typedef CGAL::cpp11::tuple Intersection; @@ -189,7 +207,7 @@ public: Labeled_mesh_domain_3(const Function& f, const Sphere_3& bounding_sphere, const FT& error_bound = FT(1e-3), - Null null = Null(), + Null null = Null_subdomain_index(), CGAL::Random* p_rng = NULL) : Impl_details(f, iso_cuboid(bounding_sphere.bbox()), error_bound, null, p_rng) {} @@ -197,14 +215,15 @@ public: Labeled_mesh_domain_3(const Function& f, const Bbox_3& bbox, const FT& error_bound = FT(1e-3), - Null null = Null(), + Null null = Null_subdomain_index(), CGAL::Random* p_rng = NULL) - : Impl_details(f, iso_cuboid(bbox), error_bound, null, p_rng) {} + : Impl_details(f, iso_cuboid(bbox), + error_bound, null, p_rng) {} Labeled_mesh_domain_3(const Function& f, const Iso_cuboid_3& bbox, const FT& error_bound = FT(1e-3), - Null null = Null(), + Null null = Null_subdomain_index(), CGAL::Random* p_rng = NULL) : Impl_details(f, bbox, error_bound, null, p_rng) {} @@ -213,20 +232,21 @@ public: const FT& error_bound, CGAL::Random* p_rng) : Impl_details(f, iso_cuboid(bounding_sphere.bbox()), - error_bound, Null(), p_rng) {} + error_bound, Null_subdomain_index(), p_rng) {} Labeled_mesh_domain_3(const Function& f, const Bbox_3& bbox, const FT& error_bound, CGAL::Random* p_rng) - : Impl_details(f, iso_cuboid(bbox), error_bound, Null(), p_rng) {} + : Impl_details(f, iso_cuboid(bbox), + error_bound, Null_subdomain_index(), p_rng) {} Labeled_mesh_domain_3(const Function& f, const Iso_cuboid_3& bbox, const FT& error_bound, CGAL::Random* p_rng) - : Impl_details(f, bbox, error_bound, Null(), p_rng) {} + : Impl_details(f, bbox, error_bound, Null_subdomain_index(), p_rng) {} /** * Constructs a set of \ccc{n} points on the surface, and output them to @@ -595,10 +615,10 @@ private: //------------------------------------------------------- // Method implementation //------------------------------------------------------- -template +template template OutputIterator -Labeled_mesh_domain_3:: +Labeled_mesh_domain_3:: Construct_initial_points::operator()(OutputIterator pts, const int nb_points) const { diff --git a/Mesh_3/test/Mesh_3/test_c3t3_extract_subdomains_boundaries.cpp b/Mesh_3/test/Mesh_3/test_c3t3_extract_subdomains_boundaries.cpp index f606a7821da..bd666212ead 100644 --- a/Mesh_3/test/Mesh_3/test_c3t3_extract_subdomains_boundaries.cpp +++ b/Mesh_3/test/Mesh_3/test_c3t3_extract_subdomains_boundaries.cpp @@ -46,7 +46,7 @@ typedef FT_to_point_function_wrapper Function; typedef CGAL::Implicit_multi_domain_to_labeling_function_wrapper Function_wrapper; typedef Function_wrapper::Function_vector Function_vector; -typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; +typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; // Triangulation typedef CGAL::Mesh_triangulation_3::type Tr; @@ -68,7 +68,7 @@ int main() v.push_back(f1); v.push_back(f2); // Domain (Warning: Sphere_3 constructor uses square radius !) - Mesh_domain domain(v, K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6); + Mesh_domain domain(Function_wrapper(v), K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6); // Set mesh criteria Facet_criteria facet_criteria(30, 0.2, 0.02); // angle, size, approximation diff --git a/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp b/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp index 97f0b9ff927..8045a6772a5 100644 --- a/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp +++ b/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp @@ -47,7 +47,7 @@ struct LM3_tester }; typedef CGAL::Implicit_to_labeling_function_wrapper Function_wrapper; - typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; + typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; static FT shape_function (const Point_3& p) { diff --git a/Polyhedron/demo/Polyhedron/C3t3_type.h b/Polyhedron/demo/Polyhedron/C3t3_type.h index d3e09ef5380..6f22ad1828a 100644 --- a/Polyhedron/demo/Polyhedron/C3t3_type.h +++ b/Polyhedron/demo/Polyhedron/C3t3_type.h @@ -61,7 +61,7 @@ typedef CGAL::Mesh_domain_with_polyline_features_3 Image_mesh_doma #endif #ifdef CGAL_MESH_3_DEMO_ACTIVATE_IMPLICIT_FUNCTIONS typedef Wrapper Function_wrapper; -typedef CGAL::Labeled_mesh_domain_3 Function_domain; +typedef CGAL::Labeled_mesh_domain_3 Function_domain; typedef CGAL::Polyhedron_demo_labeled_mesh_domain_3 Function_mesh_domain; #endif