From d085d7b36898a15c1ca5c42fe205af1d1d45d7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 19 Aug 2022 00:55:54 +0200 Subject: [PATCH] use macros for compatibility internal code to be updated --- Mesh_2/test/Mesh_2/test_lloyd.cpp | 4 +- .../include/CGAL/Named_function_parameters.h | 126 +++++++----------- .../internal/parameters_interface.h | 113 ++++++++-------- 3 files changed, 105 insertions(+), 138 deletions(-) diff --git a/Mesh_2/test/Mesh_2/test_lloyd.cpp b/Mesh_2/test/Mesh_2/test_lloyd.cpp index dc49df49155..f2d663fca3b 100644 --- a/Mesh_2/test/Mesh_2/test_lloyd.cpp +++ b/Mesh_2/test/Mesh_2/test_lloyd.cpp @@ -62,8 +62,8 @@ struct Lloyd_tester CGAL::Mesh_optimization_return_code rc = CGAL::lloyd_optimize_mesh_2(cdt, CGAL::parameters::number_of_iterations(10). - convergence_ratio(0.001). - vertex_freeze_bound(0.001). + convergence(0.001). + freeze_bound(0.001). seeds(seeds)); const size_type number_of_vertices2 = cdt.number_of_vertices(); std::cerr << " done (return code = "<< rc <<").\n"; diff --git a/STL_Extension/include/CGAL/Named_function_parameters.h b/STL_Extension/include/CGAL/Named_function_parameters.h index 25f296e443c..bb61f49afb3 100644 --- a/STL_Extension/include/CGAL/Named_function_parameters.h +++ b/STL_Extension/include/CGAL/Named_function_parameters.h @@ -46,8 +46,13 @@ enum all_default_t { all_default }; // define enum types and values for new named parameters #define CGAL_add_named_parameter(X, Y, Z) \ enum X { Y }; +#define CGAL_add_named_parameter_with_compatibility(X, Y, Z) \ + enum X { Y }; +#define CGAL_add_extra_named_parameter_with_compatibility(X, Y, Z) #include #undef CGAL_add_named_parameter +#undef CGAL_add_named_parameter_with_compatibility +#undef CGAL_add_extra_named_parameter_with_compatibility template struct Named_params_impl : Base @@ -250,16 +255,34 @@ struct Named_function_parameters // create the functions for new named parameters and the one imported boost // used to concatenate several parameters -#define CGAL_add_named_parameter(X, Y, Z) \ - template \ +#define CGAL_add_named_parameter(X, Y, Z) \ + template \ Named_function_parameters \ - Z(const K& k) const \ - { \ + Z(const K& k) const \ + { \ typedef Named_function_parameters Params;\ - return Params(k, *this); \ + return Params(k, *this); \ + } +#define CGAL_add_named_parameter_with_compatibility(X, Y, Z) \ + template \ + Named_function_parameters \ + Z(const K& k) const \ + { \ + typedef Named_function_parameters Params;\ + return Params(k, *this); \ + } +#define CGAL_add_extra_named_parameter_with_compatibility(X, Y, Z) \ + template \ + Named_function_parameters \ + Z(const K& k) const \ + { \ + typedef Named_function_parameters Params;\ + return Params(k, *this); \ } #include #undef CGAL_add_named_parameter +#undef CGAL_add_named_parameter_with_compatibility +#undef CGAL_add_extra_named_parameter_with_compatibility template Named_function_parameters @@ -302,20 +325,6 @@ inline no_parameters(Named_function_parameters) return Params(); } -// define free functions for named parameters -#define CGAL_add_named_parameter(X, Y, Z) \ - template \ - Named_function_parameters \ - Z(const K& p) \ - { \ - typedef Named_function_parameters Params;\ - return Params(p); \ - } - -#include -#undef CGAL_add_named_parameter - -#ifndef CGAL_NO_DEPRECATED_CODE template struct Boost_parameter_compatibility_wrapper { @@ -336,69 +345,24 @@ struct Boost_parameter_compatibility_wrapper } }; +// define free functions and Boost_parameter_compatibility_wrapper for named parameters +#define CGAL_add_named_parameter(X, Y, Z) \ + template \ + Named_function_parameters \ + Z(const K& p) \ + { \ + typedef Named_function_parameters Params;\ + return Params(p); \ + } // TODO: need to make sure this works when using several compilation units -const Boost_parameter_compatibility_wrapper max_iteration_number; -const Boost_parameter_compatibility_wrapper convergence; -const Boost_parameter_compatibility_wrapper freeze_bound; -const Boost_parameter_compatibility_wrapper time_limit; -const Boost_parameter_compatibility_wrapper seeds_begin; -const Boost_parameter_compatibility_wrapper seeds_end; -const Boost_parameter_compatibility_wrapper mark; -const Boost_parameter_compatibility_wrapper do_freeze; -const Boost_parameter_compatibility_wrapper sliver_criterion; -const Boost_parameter_compatibility_wrapper perturbation_vector; -//Compatibility wrappers for exude_mesh_3.h -const Boost_parameter_compatibility_wrapper sliver_bound; -const Boost_parameter_compatibility_wrapper mesh_topology; -const Boost_parameter_compatibility_wrapper dump_after_init_prefix; -const Boost_parameter_compatibility_wrapper dump_after_refine_surface_prefix; -const Boost_parameter_compatibility_wrapper dump_after_refine_prefix; -const Boost_parameter_compatibility_wrapper dump_after_glob_opt_prefix; -const Boost_parameter_compatibility_wrapper dump_after_perturb_prefix; -const Boost_parameter_compatibility_wrapper dump_after_exude_prefix; -const Boost_parameter_compatibility_wrapper number_of_initial_points; -const Boost_parameter_compatibility_wrapper maximal_number_of_vertices; -const Boost_parameter_compatibility_wrapper nonlinear_growth_of_balls; -const Boost_parameter_compatibility_wrapper pointer_to_error_code; -const Boost_parameter_compatibility_wrapper pointer_to_stop_atomic_boolean; -const Boost_parameter_compatibility_wrapper exude_param; -const Boost_parameter_compatibility_wrapper perturb_param; -const Boost_parameter_compatibility_wrapper odt_param; -const Boost_parameter_compatibility_wrapper lloyd_param; -const Boost_parameter_compatibility_wrapper reset_param; -const Boost_parameter_compatibility_wrapper mesh_options_param; -const Boost_parameter_compatibility_wrapper manifold_options_param; -const Boost_parameter_compatibility_wrapper features_param; - -const Boost_parameter_compatibility_wrapper function; -const Boost_parameter_compatibility_wrapper bounding_object; -const Boost_parameter_compatibility_wrapper image; -const Boost_parameter_compatibility_wrapper iso_value; -const Boost_parameter_compatibility_wrapper image_values_to_subdomain_indices; -const Boost_parameter_compatibility_wrapper value_outside; -const Boost_parameter_compatibility_wrapper relative_error_bound; -const Boost_parameter_compatibility_wrapper p_rng; -const Boost_parameter_compatibility_wrapper null_subdomain_index; -const Boost_parameter_compatibility_wrapper construct_surface_patch_index; -const Boost_parameter_compatibility_wrapper weights; - -const Boost_parameter_compatibility_wrapper edge_size; -const Boost_parameter_compatibility_wrapper edge_sizing_field; -const Boost_parameter_compatibility_wrapper facet_angle; -const Boost_parameter_compatibility_wrapper facet_size; -const Boost_parameter_compatibility_wrapper facet_sizing_field; -const Boost_parameter_compatibility_wrapper facet_distance; -const Boost_parameter_compatibility_wrapper facet_topology; -const Boost_parameter_compatibility_wrapper cell_radius_edge; -const Boost_parameter_compatibility_wrapper cell_radius_edge_ratio; -const Boost_parameter_compatibility_wrapper cell_size; -const Boost_parameter_compatibility_wrapper cell_sizing_field; -const Boost_parameter_compatibility_wrapper sizing_field; - - - - -#endif +#define CGAL_add_named_parameter_with_compatibility(X, Y, Z) \ + const Boost_parameter_compatibility_wrapper Z; +#define CGAL_add_extra_named_parameter_with_compatibility(X, Y, Z) \ + const Boost_parameter_compatibility_wrapper Z; +#include +#undef CGAL_add_named_parameter +#undef CGAL_add_extra_named_parameter_with_compatibility +#undef CGAL_add_named_parameter_with_compatibility // function to extract a parameter template 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 f0792753812..2f0dff8e864 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -261,67 +261,70 @@ CGAL_add_named_parameter(adjust_directions_t, adjust_directions, adjust_directio CGAL_add_named_parameter(segment_t, segment_map, segment_map) // List of named parameters used in Mesh_2 package -CGAL_add_named_parameter(seeds_t, seeds, seeds) -CGAL_add_named_parameter(domain_is_initialized_t, domain_is_initialized, domain_is_initialized) -CGAL_add_named_parameter(seeds_are_in_domain_t, seeds_are_in_domain, seeds_are_in_domain) -CGAL_add_named_parameter(criteria_t, criteria, criteria) -CGAL_add_named_parameter(convergence_ratio_t, convergence_ratio, convergence_ratio) -CGAL_add_named_parameter(vertex_freeze_bound_t, vertex_freeze_bound, vertex_freeze_bound) -CGAL_add_named_parameter(i_seed_begin_iterator_t, i_seed_begin_iterator, i_seed_begin_iterator) -CGAL_add_named_parameter(i_seed_end_iterator_t, i_seed_end_iterator, i_seed_end_iterator) +CGAL_add_named_parameter_with_compatibility(seeds_t, seeds, seeds) +CGAL_add_named_parameter_with_compatibility(domain_is_initialized_t, domain_is_initialized, domain_is_initialized) +CGAL_add_named_parameter_with_compatibility(seeds_are_in_domain_t, seeds_are_in_domain, seeds_are_in_domain) +CGAL_add_extra_named_parameter_with_compatibility(seeds_are_in_domain_t, seeds_are_in_domain, mark) +CGAL_add_named_parameter_with_compatibility(criteria_t, criteria, criteria) +CGAL_add_named_parameter_with_compatibility(convergence_ratio_t, convergence_ratio, convergence) +CGAL_add_named_parameter_with_compatibility(vertex_freeze_bound_t, vertex_freeze_bound, freeze_bound) +CGAL_add_named_parameter_with_compatibility(i_seed_begin_iterator_t, i_seed_begin_iterator, seeds_begin) +CGAL_add_named_parameter_with_compatibility(i_seed_end_iterator_t, i_seed_end_iterator, seeds_end) //List of named parameters used in exude_mesh_3.h -CGAL_add_named_parameter(lower_sliver_bound_t,lower_sliver_bound,lower_sliver_bound) -CGAL_add_named_parameter(freeze_t,freeze,freeze) +CGAL_add_named_parameter_with_compatibility(lower_sliver_bound_t,lower_sliver_bound,sliver_bound) +CGAL_add_named_parameter_with_compatibility(freeze_t,freeze,do_freeze) //List of named parameters used in perturb_mesh_3.h -CGAL_add_named_parameter(sliver_criteria_t, sliver_criteria, sliver_criteria) -CGAL_add_named_parameter(perturb_vector_t, perturb_vector, perturb_vector) +CGAL_add_named_parameter_with_compatibility(sliver_criteria_t, sliver_criteria, sliver_criterion) +CGAL_add_named_parameter_with_compatibility(perturb_vector_t, perturb_vector, perturbation_vector) //List of named parameters used in refine_mesh_3.h -CGAL_add_named_parameter(mesh_topology_number_t, mesh_topology_number, mesh_topology_number) -CGAL_add_named_parameter(dump_after_init_prefix_param_t, dump_after_init_prefix_param, dump_after_init_prefix_param) -CGAL_add_named_parameter(dump_after_refine_surface_prefix_param_t, dump_after_refine_surface_prefix_param, dump_after_refine_surface_prefix_param) -CGAL_add_named_parameter(dump_after_refine_prefix_param_t, dump_after_refine_prefix_param, dump_after_refine_prefix_param) -CGAL_add_named_parameter(dump_after_glob_opt_prefix_param_t, dump_after_glob_opt_prefix_param, dump_after_glob_opt_prefix_param) -CGAL_add_named_parameter(dump_after_perturb_prefix_param_t, dump_after_perturb_prefix_param, dump_after_perturb_prefix_param) -CGAL_add_named_parameter(dump_after_exude_prefix_param_t, dump_after_exude_prefix_param, dump_after_exude_prefix_param) -CGAL_add_named_parameter(number_of_initial_points_param_t, number_of_initial_points_param, number_of_initial_points_param) -CGAL_add_named_parameter(maximal_number_of_vertices_param_t, maximal_number_of_vertices_param, maximal_number_of_vertices_param) -CGAL_add_named_parameter(nonlinear_growth_of_balls_param_t, nonlinear_growth_of_balls_param, nonlinear_growth_of_balls_param) -CGAL_add_named_parameter(pointer_to_error_code_param_t, pointer_to_error_code_param, pointer_to_error_code_param) -CGAL_add_named_parameter(pointer_to_stop_atomic_boolean_param_t, pointer_to_stop_atomic_boolean_param, pointer_to_stop_atomic_boolean_param) -CGAL_add_named_parameter(exude_options_param_t, exude_options_param, exude_options_param) -CGAL_add_named_parameter(perturb_options_param_t, perturb_options_param, perturb_options_param) -CGAL_add_named_parameter(odt_options_param_t, odt_options_param, odt_options_param) -CGAL_add_named_parameter(lloyd_options_param_t, lloyd_options_param, lloyd_options_param) -CGAL_add_named_parameter(reset_options_param_t, reset_options_param, reset_options_param) -CGAL_add_named_parameter(mesh_param_t, mesh_param, mesh_param) -CGAL_add_named_parameter(manifold_param_t, manifold_param, manifold_param) -CGAL_add_named_parameter(features_option_param_t,features_options_param,features_options_param) +CGAL_add_extra_named_parameter_with_compatibility(number_of_iterations_t, number_of_iterations, max_iteration_number) +CGAL_add_extra_named_parameter_with_compatibility(maximum_running_time_t, maximum_running_time, time_limit) +CGAL_add_named_parameter_with_compatibility(mesh_topology_number_t, mesh_topology_number, mesh_topology) +CGAL_add_named_parameter_with_compatibility(dump_after_init_prefix_param_t, dump_after_init_prefix_param, dump_after_init_prefix) +CGAL_add_named_parameter_with_compatibility(dump_after_refine_surface_prefix_param_t, dump_after_refine_surface_prefix_param, dump_after_refine_surface_prefix) +CGAL_add_named_parameter_with_compatibility(dump_after_refine_prefix_param_t, dump_after_refine_prefix_param, dump_after_refine_prefix) +CGAL_add_named_parameter_with_compatibility(dump_after_glob_opt_prefix_param_t, dump_after_glob_opt_prefix_param, dump_after_glob_opt_prefix) +CGAL_add_named_parameter_with_compatibility(dump_after_perturb_prefix_param_t, dump_after_perturb_prefix_param, dump_after_perturb_prefix) +CGAL_add_named_parameter_with_compatibility(dump_after_exude_prefix_param_t, dump_after_exude_prefix_param, dump_after_exude_prefix) +CGAL_add_named_parameter_with_compatibility(number_of_initial_points_param_t, number_of_initial_points_param, number_of_initial_points) +CGAL_add_named_parameter_with_compatibility(maximal_number_of_vertices_param_t, maximal_number_of_vertices_param, maximal_number_of_vertices) +CGAL_add_named_parameter_with_compatibility(nonlinear_growth_of_balls_param_t, nonlinear_growth_of_balls_param, nonlinear_growth_of_balls) +CGAL_add_named_parameter_with_compatibility(pointer_to_error_code_param_t, pointer_to_error_code_param, pointer_to_error_code) +CGAL_add_named_parameter_with_compatibility(pointer_to_stop_atomic_boolean_param_t, pointer_to_stop_atomic_boolean_param, pointer_to_stop_atomic_boolean) +CGAL_add_named_parameter(exude_options_param_t, exude_options_param, exude_options) +CGAL_add_named_parameter(perturb_options_param_t, perturb_options_param, perturb_options) +CGAL_add_named_parameter(odt_options_param_t, odt_options_param, odt_options) +CGAL_add_named_parameter(lloyd_options_param_t, lloyd_options_param, lloyd_options) +CGAL_add_named_parameter(reset_options_param_t, reset_options_param, reset_options) +CGAL_add_named_parameter(mesh_param_t, mesh_param, mesh_options) +CGAL_add_named_parameter(manifold_param_t, manifold_param, manifold_options) +CGAL_add_named_parameter(features_option_param_t,features_options_param,features_options) -CGAL_add_named_parameter(image_3_param_t, image_3_param, image_3_param) -CGAL_add_named_parameter(iso_value_param_t, iso_value_param, iso_value_param) -CGAL_add_named_parameter(image_subdomain_index_t, image_subdomain_index, image_subdomain_index) -CGAL_add_named_parameter(voxel_value_t, voxel_value, voxel_value) -CGAL_add_named_parameter(error_bound_t, error_bound, error_bound) -CGAL_add_named_parameter(rng_t, rng, rng) -CGAL_add_named_parameter(null_subdomain_index_param_t,null_subdomain_index_param, null_subdomain_index_param) -CGAL_add_named_parameter(surface_patch_index_t, surface_patch_index, surface_patch_index) -CGAL_add_named_parameter(weights_param_t, weights_param, weights_param) +CGAL_add_named_parameter_with_compatibility(image_3_param_t, image_3_param, image) +CGAL_add_named_parameter_with_compatibility(iso_value_param_t, iso_value_param, iso_value) +CGAL_add_named_parameter_with_compatibility(image_subdomain_index_t, image_subdomain_index, image_values_to_subdomain_indices) +CGAL_add_named_parameter_with_compatibility(voxel_value_t, voxel_value, value_outside) +CGAL_add_named_parameter_with_compatibility(error_bound_t, error_bound, relative_error_bound) +CGAL_add_named_parameter_with_compatibility(rng_t, rng, p_rng) +CGAL_add_named_parameter_with_compatibility(null_subdomain_index_param_t,null_subdomain_index_param, null_subdomain_index) +CGAL_add_named_parameter_with_compatibility(surface_patch_index_t, surface_patch_index, construct_surface_patch_index) +CGAL_add_named_parameter_with_compatibility(weights_param_t, weights_param, weights) -CGAL_add_named_parameter(edge_size_param_t, edge_size_param, edge_size_param) -CGAL_add_named_parameter(edge_sizing_field_param_t, edge_sizing_field_param, edge_sizing_field_param) -CGAL_add_named_parameter(facet_angle_param_t, facet_angle_param, facet_angle_param) -CGAL_add_named_parameter(facet_size_param_t, facet_size_param, facet_size_param) -CGAL_add_named_parameter(facet_sizing_field_param_t, facet_sizing_field_param, facet_sizing_field_param) -CGAL_add_named_parameter(facet_distance_param_t, facet_distance_param, facet_distance_param) -CGAL_add_named_parameter(facet_topology_param_t, facet_topology_param, facet_topology_param) -CGAL_add_named_parameter(cell_radius_edge_param_t, cell_radius_edge_param, cell_radius_edge_param) -CGAL_add_named_parameter(cell_radius_edge_ratio_param_t, cell_radius_edge_ratio_param, cell_radius_edge_ratio_param) -CGAL_add_named_parameter(cell_size_param_t, cell_size_param, cell_size_param) -CGAL_add_named_parameter(cell_sizing_field_param_t, cell_sizing_field_param, cell_sizing_field_param) -CGAL_add_named_parameter(sizing_field_param_t, sizing_field_param, sizing_field_param) +CGAL_add_named_parameter_with_compatibility(edge_size_param_t, edge_size_param, edge_size) +CGAL_add_named_parameter_with_compatibility(edge_sizing_field_param_t, edge_sizing_field_param, edge_sizing_field) +CGAL_add_named_parameter_with_compatibility(facet_angle_param_t, facet_angle_param, facet_angle) +CGAL_add_named_parameter_with_compatibility(facet_size_param_t, facet_size_param, facet_size) +CGAL_add_named_parameter_with_compatibility(facet_sizing_field_param_t, facet_sizing_field_param, facet_sizing_field) +CGAL_add_named_parameter_with_compatibility(facet_distance_param_t, facet_distance_param, facet_distance) +CGAL_add_named_parameter_with_compatibility(facet_topology_param_t, facet_topology_param, facet_topology) +CGAL_add_named_parameter_with_compatibility(cell_radius_edge_param_t, cell_radius_edge_param, cell_radius_edge) +CGAL_add_named_parameter_with_compatibility(cell_radius_edge_ratio_param_t, cell_radius_edge_ratio_param, cell_radius_edge_ratio) +CGAL_add_named_parameter_with_compatibility(cell_size_param_t, cell_size_param, cell_size) +CGAL_add_named_parameter_with_compatibility(cell_sizing_field_param_t, cell_sizing_field_param, cell_sizing_field) +CGAL_add_named_parameter_with_compatibility(sizing_field_param_t, sizing_field_param, sizing_field) -CGAL_add_named_parameter(function_param_t, function_param, function_param) -CGAL_add_named_parameter(bounding_object_param_t, bounding_object_param, bounding_object_param) +CGAL_add_named_parameter_with_compatibility(function_param_t, function_param, function) +CGAL_add_named_parameter_with_compatibility(bounding_object_param_t, bounding_object_param, bounding_object)