diff --git a/Mesh_3/include/CGAL/Mesh_3/parameters.h b/Mesh_3/include/CGAL/Mesh_3/parameters.h index 15184d651b8..6df4476b0a1 100644 --- a/Mesh_3/include/CGAL/Mesh_3/parameters.h +++ b/Mesh_3/include/CGAL/Mesh_3/parameters.h @@ -206,47 +206,24 @@ struct Domain_features_generator< MeshDomain, true > } // end namespace internal -// Undocumented parameter for refine_mesh_3 and make_mesh_3. -// Default Mesh_3_options: dump at every stage of the mesh generation. -inline internal::Mesh_3_options mesh_3_dump() -{ - internal::Mesh_3_options options; - options.dump_after_init_prefix = "mesh_dump_after_init"; - options.dump_after_refine_surface_prefix = "mesh_dump_after_refine_surface"; - options.dump_after_refine_prefix = "mesh_dump_after_refine"; - options.dump_after_glob_opt_prefix = "mesh_dump_after_glob_opt"; - options.dump_after_perturb_prefix = "mesh_dump_after_perturb"; - options.dump_after_exude_prefix = "mesh_dump_after_exude"; - - return options; -} - -template -struct Base -{ - Base(T t) : t_(t) {} - T operator()() const { return t_; } -private: - T t_; -}; // ----------------------------------- // Reset_c3t3 (undocumented) // ----------------------------------- +inline +Named_function_parameters +reset_c3t3() +{ + return Named_function_parameters(true); +} -#define CGAL_BOOLEAN_PARAMETER(Class, function_true, function_false) \ - struct Class : public Base { Class(bool b) : Base(b){} }; \ - inline Named_function_parameters function_true() { \ - typedef Named_function_parameters Param; \ - return Param(Class(true)); } \ - inline Named_function_parameters function_false() {\ - typedef Named_function_parameters Param; \ - return Param(Class(false)); } - -CGAL_BOOLEAN_PARAMETER(Reset,reset_c3t3,no_reset_c3t3) - -#undef CGAL_BOOLEAN_PARAMETER +inline +Named_function_parameters +no_reset_c3t3() +{ + return Named_function_parameters(false); +} // ----------------------------------- // Perturb @@ -507,7 +484,6 @@ non_manifold() // Undocumented parameter for refine_mesh_3 and make_mesh_3. // Allows to dump the mesh at given stage of the mesh generation // algorithm. - template Named_function_parameters mesh_3_options(const CGAL_NP_CLASS& np = parameters::default_values()) @@ -542,6 +518,25 @@ mesh_3_options(const CGAL_NP_CLASS& ... nps) return mesh_3_options(internal_np::combine_named_parameters(nps...)); } +// Undocumented parameter for refine_mesh_3 and make_mesh_3. +// Default Mesh_3_options: dump at every stage of the mesh generation. +inline +Named_function_parameters +mesh_3_dump() +{ + typedef Named_function_parameters Param; + internal::Mesh_3_options options; + + options.dump_after_init_prefix = "mesh_dump_after_init"; + options.dump_after_refine_surface_prefix = "mesh_dump_after_refine_surface"; + options.dump_after_refine_prefix = "mesh_dump_after_refine"; + options.dump_after_glob_opt_prefix = "mesh_dump_after_glob_opt"; + options.dump_after_perturb_prefix = "mesh_dump_after_perturb"; + options.dump_after_exude_prefix = "mesh_dump_after_exude"; + + return Param(options); +} + // ----------------------------------- // Features_options // ----------------------------------- diff --git a/Mesh_3/include/CGAL/refine_mesh_3.h b/Mesh_3/include/CGAL/refine_mesh_3.h index 7e55cb69e38..9f7ebe370a2 100644 --- a/Mesh_3/include/CGAL/refine_mesh_3.h +++ b/Mesh_3/include/CGAL/refine_mesh_3.h @@ -269,7 +269,7 @@ void refine_mesh_3(C3T3& c3t3, MeshDomain& domain, MeshCriteria& criteria, const parameters::internal::Perturb_options perturb_param = choose_parameter(get_parameter(np, internal_np::perturb_options_param), parameters::perturb().v); parameters::internal::Odt_options odt_param = choose_parameter(get_parameter(np, internal_np::odt_options_param), parameters::no_odt().v); parameters::internal::Lloyd_options lloyd_param = choose_parameter(get_parameter(np, internal_np::lloyd_options_param), parameters::no_lloyd().v); - parameters::Reset reset_param = choose_parameter(get_parameter(np, internal_np::reset_options_param), parameters::reset_c3t3().v); + bool reset = choose_parameter(get_parameter(np, internal_np::do_reset_c3t3), false); parameters::internal::Mesh_3_options mesh_options_param = choose_parameter(get_parameter(np, internal_np::mesh_param), parameters::internal::Mesh_3_options()); parameters::internal::Manifold_options manifold_options_param = choose_parameter(get_parameter(np, internal_np::manifold_param), parameters::internal::Manifold_options()); @@ -280,7 +280,7 @@ void refine_mesh_3(C3T3& c3t3, MeshDomain& domain, MeshCriteria& criteria, const perturb_param, odt_param, lloyd_param, - reset_param(), + reset, mesh_options_param, manifold_options_param); } 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 0c3a1b8c7bb..25a468bbf6f 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 @@ -42,8 +42,8 @@ struct LM3_tester static FT shape_function (const Point_3& p) { - if (p.x() < 0) - return -1; + if (p.x() < 0) + return -1; const FT x2=p.x()*p.x(), y2=p.y()*p.y(), z2=p.z()*p.z(); return x2 + y2 + z2 - 1; } @@ -56,12 +56,12 @@ struct LM3_tester void operator() () const { - typedef typename K::Sphere_3 Sphere_3; - typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + typedef typename K::Sphere_3 Sphere_3; + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - test_domain(Sphere_3(CGAL::ORIGIN, 4.)); - test_domain(CGAL::Bbox_3(-2.,-2.,-2., 2.,2.,2.)); - test_domain(Iso_cuboid_3(Point_3(-2.,-2.,-2.), Point_3(2.,2.,2.))); + test_domain(Sphere_3(CGAL::ORIGIN, 4.)); + test_domain(CGAL::Bbox_3(-2.,-2.,-2., 2.,2.,2.)); + test_domain(Iso_cuboid_3(Point_3(-2.,-2.,-2.), Point_3(2.,2.,2.))); } private: @@ -72,12 +72,12 @@ private: Function f_sphere(&sphere_function); Function_wrapper wrapper_1(f_sphere); - Mesh_domain domain(wrapper_1, bounding_shape, error_bound); + Mesh_domain domain(wrapper_1, bounding_shape, CGAL::parameters::relative_error_bound(error_bound)); test_construct_initial_points(domain, error_bound); Function f_shape(&shape_function); Function_wrapper wrapper_2(f_shape); - Mesh_domain domain_2(wrapper_2, bounding_shape, error_bound); + Mesh_domain domain_2(wrapper_2, bounding_shape, CGAL::parameters::relative_error_bound(error_bound)); test_is_in_domain(domain_2); test_do_intersect_surface(domain_2); test_construct_intersection(domain_2); @@ -85,171 +85,171 @@ private: void test_construct_initial_points (const Mesh_domain& domain, FT error_bound) const { - typedef typename Mesh_domain::Construct_initial_points Construct_initial_points; - typedef typename Mesh_domain::Index Index; - typedef typename std::vector >::const_iterator Points_const_iterator; - typedef typename K::Compute_squared_distance_3 Compute_squared_distance_3; + typedef typename Mesh_domain::Construct_initial_points Construct_initial_points; + typedef typename Mesh_domain::Index Index; + typedef typename std::vector >::const_iterator Points_const_iterator; + typedef typename K::Compute_squared_distance_3 Compute_squared_distance_3; - Compute_squared_distance_3 squared_distance = K().compute_squared_distance_3_object(); + Compute_squared_distance_3 squared_distance = K().compute_squared_distance_3_object(); - Construct_initial_points construct_initial_points = domain.construct_initial_points_object(); - std::vector > points; - int point_count = 12; - construct_initial_points(std::back_inserter(points), point_count); + Construct_initial_points construct_initial_points = domain.construct_initial_points_object(); + std::vector > points; + int point_count = 12; + construct_initial_points(std::back_inserter(points), point_count); - for (Points_const_iterator iter = points.begin(), end_iter = points.end(); iter != end_iter; ++iter) - { - const Point_3& p = iter->first; + for (Points_const_iterator iter = points.begin(), end_iter = points.end(); iter != end_iter; ++iter) + { + const Point_3& p = iter->first; - FT sd = squared_distance(CGAL::ORIGIN, p); - FT diff = sd - 1; - if (diff < FT(0.)) - diff = -diff; - assert(diff <= error_bound); - } + FT sd = squared_distance(CGAL::ORIGIN, p); + FT diff = sd - 1; + if (diff < FT(0.)) + diff = -diff; + assert(diff <= error_bound); + } } void test_is_in_domain (const Mesh_domain& domain) const { - typedef typename Mesh_domain::Is_in_domain Is_in_domain; - typedef typename Mesh_domain::Subdomain Subdomain; - typedef typename Mesh_domain::Subdomain_index Subdomain_index; + typedef typename Mesh_domain::Is_in_domain Is_in_domain; + typedef typename Mesh_domain::Subdomain Subdomain; + typedef typename Mesh_domain::Subdomain_index Subdomain_index; - Is_in_domain is_in_domain = domain.is_in_domain_object(); + Is_in_domain is_in_domain = domain.is_in_domain_object(); - { - Subdomain subdomain = is_in_domain(Point_3(CGAL::ORIGIN)); - assert(subdomain); - Subdomain_index subdomain_index = *subdomain; - assert(subdomain_index == 1); - } + { + Subdomain subdomain = is_in_domain(Point_3(CGAL::ORIGIN)); + assert(subdomain); + Subdomain_index subdomain_index = *subdomain; + assert(subdomain_index == 1); + } - { - Subdomain subdomain = is_in_domain(Point_3(1.5, 0., 0.)); - assert(!subdomain); - } + { + Subdomain subdomain = is_in_domain(Point_3(1.5, 0., 0.)); + assert(!subdomain); + } } void test_do_intersect_surface (const Mesh_domain& domain) const { - typedef typename Mesh_domain::Do_intersect_surface Do_intersect_surface; - typedef typename Mesh_domain::Surface_patch Surface_patch; - typedef typename Mesh_domain::Surface_patch_index Surface_patch_index; - typedef typename Mesh_domain::Segment_3 Segment_3; - typedef typename Mesh_domain::Ray_3 Ray_3; - typedef typename Mesh_domain::Line_3 Line_3; - typedef typename Mesh_domain::Vector_3 Vector_3; + typedef typename Mesh_domain::Do_intersect_surface Do_intersect_surface; + typedef typename Mesh_domain::Surface_patch Surface_patch; + typedef typename Mesh_domain::Surface_patch_index Surface_patch_index; + typedef typename Mesh_domain::Segment_3 Segment_3; + typedef typename Mesh_domain::Ray_3 Ray_3; + typedef typename Mesh_domain::Line_3 Line_3; + typedef typename Mesh_domain::Vector_3 Vector_3; - Do_intersect_surface do_intersect_surface = domain.do_intersect_surface_object(); + Do_intersect_surface do_intersect_surface = domain.do_intersect_surface_object(); - { - Segment_3 s(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); - Surface_patch p = do_intersect_surface(s); - assert(p); - Surface_patch_index pi = *p; - assert(pi.first == 0 && pi.second == 1); - } + { + Segment_3 s(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); + Surface_patch p = do_intersect_surface(s); + assert(p); + Surface_patch_index pi = *p; + assert(pi.first == 0 && pi.second == 1); + } - { - Segment_3 s(Point_3(1.5, 1.5, 0.), Point_3(1.5, 0., 0.)); - Surface_patch p = do_intersect_surface(s); - assert(!p); - } + { + Segment_3 s(Point_3(1.5, 1.5, 0.), Point_3(1.5, 0., 0.)); + Surface_patch p = do_intersect_surface(s); + assert(!p); + } - { - Ray_3 r(Point_3(CGAL::ORIGIN), Vector_3(1., 0., 0.)); - Surface_patch p = do_intersect_surface(r); - assert(p); - Surface_patch_index pi = *p; - assert(pi.first == 0 && pi.second == 1); - } + { + Ray_3 r(Point_3(CGAL::ORIGIN), Vector_3(1., 0., 0.)); + Surface_patch p = do_intersect_surface(r); + assert(p); + Surface_patch_index pi = *p; + assert(pi.first == 0 && pi.second == 1); + } - { - Ray_3 r(Point_3(1.5, 0., 0.), Vector_3(0., 1., 0.)); - Surface_patch p = do_intersect_surface(r); - assert(!p); - } + { + Ray_3 r(Point_3(1.5, 0., 0.), Vector_3(0., 1., 0.)); + Surface_patch p = do_intersect_surface(r); + assert(!p); + } - { - Line_3 l(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); - Surface_patch p = do_intersect_surface(l); - assert(p); - Surface_patch_index pi = *p; - assert(pi.first == 0 && pi.second == 1); - } + { + Line_3 l(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); + Surface_patch p = do_intersect_surface(l); + assert(p); + Surface_patch_index pi = *p; + assert(pi.first == 0 && pi.second == 1); + } - { - Line_3 l(Point_3(1.5, 0., 0.), Point_3(1.5, 0.5, 0.)); - Surface_patch p = do_intersect_surface(l); - assert(!p); - } + { + Line_3 l(Point_3(1.5, 0., 0.), Point_3(1.5, 0.5, 0.)); + Surface_patch p = do_intersect_surface(l); + assert(!p); + } } void test_construct_intersection (const Mesh_domain& domain) const { - typedef typename Mesh_domain::Construct_intersection Construct_intersection; - typedef typename Mesh_domain::Intersection Intersection; - typedef typename Mesh_domain::Subdomain_index Subdomain_index; - typedef typename Mesh_domain::Surface_patch_index Surface_patch_index; - typedef typename Mesh_domain::Index Index; - typedef typename Mesh_domain::Segment_3 Segment_3; - typedef typename Mesh_domain::Ray_3 Ray_3; - typedef typename Mesh_domain::Line_3 Line_3; - typedef typename Mesh_domain::Vector_3 Vector_3; + typedef typename Mesh_domain::Construct_intersection Construct_intersection; + typedef typename Mesh_domain::Intersection Intersection; + typedef typename Mesh_domain::Subdomain_index Subdomain_index; + typedef typename Mesh_domain::Surface_patch_index Surface_patch_index; + typedef typename Mesh_domain::Index Index; + typedef typename Mesh_domain::Segment_3 Segment_3; + typedef typename Mesh_domain::Ray_3 Ray_3; + typedef typename Mesh_domain::Line_3 Line_3; + typedef typename Mesh_domain::Vector_3 Vector_3; - Construct_intersection construct_intersection = domain.construct_intersection_object(); + Construct_intersection construct_intersection = domain.construct_intersection_object(); - { - Segment_3 s(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); - Intersection i = construct_intersection(s); - assert(std::get<0>(i) != Point_3(1., 0., 0.)); - Index ii = std::get<1>(i); - assert(boost::get(&ii)); - assert(std::get<2>(i) == 2); - } + { + Segment_3 s(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); + Intersection i = construct_intersection(s); + assert(std::get<0>(i) != Point_3(1., 0., 0.)); + Index ii = std::get<1>(i); + assert(boost::get(&ii)); + assert(std::get<2>(i) == 2); + } - { - Segment_3 s(Point_3(1.5, 1.5, 0.), Point_3(1.5, 0., 0.)); - Intersection i = construct_intersection(s); - Index ii = std::get<1>(i); - assert(boost::get(&ii)); - assert(std::get<2>(i) == 0); - } + { + Segment_3 s(Point_3(1.5, 1.5, 0.), Point_3(1.5, 0., 0.)); + Intersection i = construct_intersection(s); + Index ii = std::get<1>(i); + assert(boost::get(&ii)); + assert(std::get<2>(i) == 0); + } - { - Ray_3 r(Point_3(CGAL::ORIGIN), Vector_3(1., 0., 0.)); - Intersection i = construct_intersection(r); - assert(std::get<0>(i) != Point_3(1., 0., 0.)); - Index ii = std::get<1>(i); - assert(boost::get(&ii)); - assert(std::get<2>(i) == 2); - } + { + Ray_3 r(Point_3(CGAL::ORIGIN), Vector_3(1., 0., 0.)); + Intersection i = construct_intersection(r); + assert(std::get<0>(i) != Point_3(1., 0., 0.)); + Index ii = std::get<1>(i); + assert(boost::get(&ii)); + assert(std::get<2>(i) == 2); + } - { - Ray_3 r(Point_3(1.5, 0., 0.), Vector_3(0., 1., 0.)); - Intersection i = construct_intersection(r); - Index ii = std::get<1>(i); - assert(boost::get(&ii)); - assert(std::get<2>(i) == 0); - } + { + Ray_3 r(Point_3(1.5, 0., 0.), Vector_3(0., 1., 0.)); + Intersection i = construct_intersection(r); + Index ii = std::get<1>(i); + assert(boost::get(&ii)); + assert(std::get<2>(i) == 0); + } - { - Line_3 l(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); - Intersection i = construct_intersection(l); - assert(std::get<0>(i) != Point_3(1., 0., 0.)); - Index ii = std::get<1>(i); - assert(boost::get(&ii)); - assert(std::get<2>(i) == 2); - } + { + Line_3 l(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); + Intersection i = construct_intersection(l); + assert(std::get<0>(i) != Point_3(1., 0., 0.)); + Index ii = std::get<1>(i); + assert(boost::get(&ii)); + assert(std::get<2>(i) == 2); + } - { - Line_3 l(Point_3(1.5, 0., 0.), Point_3(1.5, 0.5, 0.)); - Intersection i = construct_intersection(l); - Index ii = std::get<1>(i); - assert(boost::get(&ii)); - assert(std::get<2>(i) == 0); - } + { + Line_3 l(Point_3(1.5, 0., 0.), Point_3(1.5, 0.5, 0.)); + Intersection i = construct_intersection(l); + Index ii = std::get<1>(i); + assert(boost::get(&ii)); + assert(std::get<2>(i) == 0); + } } }; diff --git a/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h b/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h index f27e56761ee..a21c0a54bd2 100644 --- a/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h +++ b/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h @@ -311,7 +311,7 @@ void refine_periodic_3_mesh_3(C3T3& c3t3, MeshDomain& domain, MeshCriteria& crit parameters::internal::Perturb_options perturb_param = choose_parameter(get_parameter(np, internal_np::perturb_options_param), parameters::no_perturb().v); parameters::internal::Odt_options odt_param = choose_parameter(get_parameter(np, internal_np::odt_options_param), parameters::no_odt().v); parameters::internal::Lloyd_options lloyd_param = choose_parameter(get_parameter(np, internal_np::lloyd_options_param), parameters::no_lloyd().v); - parameters::Reset reset_param = choose_parameter(get_parameter(np, internal_np::reset_options_param), parameters::reset_c3t3().v); + bool reset = choose_parameter(get_parameter(np, internal_np::do_reset_c3t3), false); parameters::internal::Mesh_3_options mesh_options_param = choose_parameter(get_parameter(np, internal_np::mesh_param), parameters::internal::Mesh_3_options()); parameters::internal::Manifold_options manifold_options_param = choose_parameter(get_parameter(np, internal_np::manifold_param), parameters::internal::Manifold_options()); @@ -322,7 +322,7 @@ void refine_periodic_3_mesh_3(C3T3& c3t3, MeshDomain& domain, MeshCriteria& crit perturb_param, odt_param, lloyd_param, - reset_param(), + reset, mesh_options_param, manifold_options_param); } diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h index 01b9cae28ad..d252c0c227a 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -297,7 +297,7 @@ CGAL_add_named_parameter_with_compatibility(exude_options_param_t, exude_options CGAL_add_named_parameter_with_compatibility(perturb_options_param_t, perturb_options_param, perturb_options) CGAL_add_named_parameter_with_compatibility(odt_options_param_t, odt_options_param, odt_options) CGAL_add_named_parameter_with_compatibility(lloyd_options_param_t, lloyd_options_param, lloyd_options) -CGAL_add_named_parameter_with_compatibility(reset_options_param_t, reset_options_param, reset_options) +CGAL_add_named_parameter_with_compatibility(do_reset_c3t3_t, do_reset_c3t3, do_reset_c3t3) CGAL_add_named_parameter_with_compatibility(mesh_param_t, mesh_param, mesh_options) CGAL_add_named_parameter_with_compatibility(manifold_param_t, manifold_param, manifold_option) CGAL_add_named_parameter_with_compatibility(features_option_param_t,features_options_param,features_options)