use macros for compatibility

internal code to be updated
This commit is contained in:
Sébastien Loriot 2022-08-19 00:55:54 +02:00
parent ce44ebf64d
commit d085d7b368
3 changed files with 105 additions and 138 deletions

View File

@ -62,8 +62,8 @@ struct Lloyd_tester
CGAL::Mesh_optimization_return_code rc CGAL::Mesh_optimization_return_code rc
= CGAL::lloyd_optimize_mesh_2(cdt, = CGAL::lloyd_optimize_mesh_2(cdt,
CGAL::parameters::number_of_iterations(10). CGAL::parameters::number_of_iterations(10).
convergence_ratio(0.001). convergence(0.001).
vertex_freeze_bound(0.001). freeze_bound(0.001).
seeds(seeds)); seeds(seeds));
const size_type number_of_vertices2 = cdt.number_of_vertices(); const size_type number_of_vertices2 = cdt.number_of_vertices();
std::cerr << " done (return code = "<< rc <<").\n"; std::cerr << " done (return code = "<< rc <<").\n";

View File

@ -46,8 +46,13 @@ enum all_default_t { all_default };
// define enum types and values for new named parameters // define enum types and values for new named parameters
#define CGAL_add_named_parameter(X, Y, Z) \ #define CGAL_add_named_parameter(X, Y, Z) \
enum X { Y }; 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 <CGAL/STL_Extension/internal/parameters_interface.h> #include <CGAL/STL_Extension/internal/parameters_interface.h>
#undef CGAL_add_named_parameter #undef CGAL_add_named_parameter
#undef CGAL_add_named_parameter_with_compatibility
#undef CGAL_add_extra_named_parameter_with_compatibility
template <typename T, typename Tag, typename Base> template <typename T, typename Tag, typename Base>
struct Named_params_impl : Base struct Named_params_impl : Base
@ -258,8 +263,26 @@ struct Named_function_parameters
typedef Named_function_parameters<K, internal_np::X, self> Params;\ typedef Named_function_parameters<K, internal_np::X, self> Params;\
return Params(k, *this); \ return Params(k, *this); \
} }
#define CGAL_add_named_parameter_with_compatibility(X, Y, Z) \
template<typename K> \
Named_function_parameters<K, internal_np::X, self> \
Z(const K& k) const \
{ \
typedef Named_function_parameters<K, internal_np::X, self> Params;\
return Params(k, *this); \
}
#define CGAL_add_extra_named_parameter_with_compatibility(X, Y, Z) \
template<typename K> \
Named_function_parameters<K, internal_np::X, self> \
Z(const K& k) const \
{ \
typedef Named_function_parameters<K, internal_np::X, self> Params;\
return Params(k, *this); \
}
#include <CGAL/STL_Extension/internal/parameters_interface.h> #include <CGAL/STL_Extension/internal/parameters_interface.h>
#undef CGAL_add_named_parameter #undef CGAL_add_named_parameter
#undef CGAL_add_named_parameter_with_compatibility
#undef CGAL_add_extra_named_parameter_with_compatibility
template <typename OT, typename OTag> template <typename OT, typename OTag>
Named_function_parameters<OT, OTag, self> Named_function_parameters<OT, OTag, self>
@ -302,20 +325,6 @@ inline no_parameters(Named_function_parameters<T,Tag,Base>)
return Params(); return Params();
} }
// define free functions for named parameters
#define CGAL_add_named_parameter(X, Y, Z) \
template <typename K> \
Named_function_parameters<K, internal_np::X> \
Z(const K& p) \
{ \
typedef Named_function_parameters<K, internal_np::X> Params;\
return Params(p); \
}
#include <CGAL/STL_Extension/internal/parameters_interface.h>
#undef CGAL_add_named_parameter
#ifndef CGAL_NO_DEPRECATED_CODE
template <class Tag> template <class Tag>
struct Boost_parameter_compatibility_wrapper 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 <typename K> \
Named_function_parameters<K, internal_np::X> \
Z(const K& p) \
{ \
typedef Named_function_parameters<K, internal_np::X> Params;\
return Params(p); \
}
// TODO: need to make sure this works when using several compilation units // TODO: need to make sure this works when using several compilation units
const Boost_parameter_compatibility_wrapper<internal_np::number_of_iterations_t> max_iteration_number; #define CGAL_add_named_parameter_with_compatibility(X, Y, Z) \
const Boost_parameter_compatibility_wrapper<internal_np::convergence_ratio_t> convergence; const Boost_parameter_compatibility_wrapper<internal_np::X> Z;
const Boost_parameter_compatibility_wrapper<internal_np::vertex_freeze_bound_t> freeze_bound; #define CGAL_add_extra_named_parameter_with_compatibility(X, Y, Z) \
const Boost_parameter_compatibility_wrapper<internal_np::maximum_running_time_t> time_limit; const Boost_parameter_compatibility_wrapper<internal_np::X> Z;
const Boost_parameter_compatibility_wrapper<internal_np::i_seed_begin_iterator_t> seeds_begin; #include <CGAL/STL_Extension/internal/parameters_interface.h>
const Boost_parameter_compatibility_wrapper<internal_np::i_seed_end_iterator_t> seeds_end; #undef CGAL_add_named_parameter
const Boost_parameter_compatibility_wrapper<internal_np::seeds_are_in_domain_t> mark; #undef CGAL_add_extra_named_parameter_with_compatibility
const Boost_parameter_compatibility_wrapper<internal_np::freeze_t> do_freeze; #undef CGAL_add_named_parameter_with_compatibility
const Boost_parameter_compatibility_wrapper<internal_np::sliver_criteria_t> sliver_criterion;
const Boost_parameter_compatibility_wrapper<internal_np::perturb_vector_t> perturbation_vector;
//Compatibility wrappers for exude_mesh_3.h
const Boost_parameter_compatibility_wrapper<internal_np::lower_sliver_bound_t> sliver_bound;
const Boost_parameter_compatibility_wrapper<internal_np::mesh_topology_number_t> mesh_topology;
const Boost_parameter_compatibility_wrapper<internal_np::dump_after_init_prefix_param_t> dump_after_init_prefix;
const Boost_parameter_compatibility_wrapper<internal_np::dump_after_refine_surface_prefix_param_t> dump_after_refine_surface_prefix;
const Boost_parameter_compatibility_wrapper<internal_np::dump_after_refine_prefix_param_t> dump_after_refine_prefix;
const Boost_parameter_compatibility_wrapper<internal_np::dump_after_glob_opt_prefix_param_t> dump_after_glob_opt_prefix;
const Boost_parameter_compatibility_wrapper<internal_np::dump_after_perturb_prefix_param_t> dump_after_perturb_prefix;
const Boost_parameter_compatibility_wrapper<internal_np::dump_after_exude_prefix_param_t> dump_after_exude_prefix;
const Boost_parameter_compatibility_wrapper<internal_np::number_of_initial_points_param_t> number_of_initial_points;
const Boost_parameter_compatibility_wrapper<internal_np::maximal_number_of_vertices_param_t> maximal_number_of_vertices;
const Boost_parameter_compatibility_wrapper<internal_np::nonlinear_growth_of_balls_param_t> nonlinear_growth_of_balls;
const Boost_parameter_compatibility_wrapper<internal_np::pointer_to_error_code_param_t> pointer_to_error_code;
const Boost_parameter_compatibility_wrapper<internal_np::pointer_to_stop_atomic_boolean_param_t> pointer_to_stop_atomic_boolean;
const Boost_parameter_compatibility_wrapper<internal_np::exude_options_param_t> exude_param;
const Boost_parameter_compatibility_wrapper<internal_np::perturb_options_param_t> perturb_param;
const Boost_parameter_compatibility_wrapper<internal_np::odt_options_param_t> odt_param;
const Boost_parameter_compatibility_wrapper<internal_np::lloyd_options_param_t> lloyd_param;
const Boost_parameter_compatibility_wrapper<internal_np::reset_options_param_t> reset_param;
const Boost_parameter_compatibility_wrapper<internal_np::mesh_param_t> mesh_options_param;
const Boost_parameter_compatibility_wrapper<internal_np::manifold_param_t> manifold_options_param;
const Boost_parameter_compatibility_wrapper<internal_np::features_option_param_t> features_param;
const Boost_parameter_compatibility_wrapper<internal_np::function_param_t> function;
const Boost_parameter_compatibility_wrapper<internal_np::bounding_object_param_t> bounding_object;
const Boost_parameter_compatibility_wrapper<internal_np::image_3_param_t> image;
const Boost_parameter_compatibility_wrapper<internal_np::iso_value_param_t> iso_value;
const Boost_parameter_compatibility_wrapper<internal_np::image_subdomain_index_t> image_values_to_subdomain_indices;
const Boost_parameter_compatibility_wrapper<internal_np::voxel_value_t> value_outside;
const Boost_parameter_compatibility_wrapper<internal_np::error_bound_t> relative_error_bound;
const Boost_parameter_compatibility_wrapper<internal_np::rng_t> p_rng;
const Boost_parameter_compatibility_wrapper<internal_np::null_subdomain_index_param_t> null_subdomain_index;
const Boost_parameter_compatibility_wrapper<internal_np::surface_patch_index_t> construct_surface_patch_index;
const Boost_parameter_compatibility_wrapper<internal_np::weights_param_t> weights;
const Boost_parameter_compatibility_wrapper<internal_np::edge_size_param_t> edge_size;
const Boost_parameter_compatibility_wrapper<internal_np::edge_sizing_field_param_t> edge_sizing_field;
const Boost_parameter_compatibility_wrapper<internal_np::facet_angle_param_t> facet_angle;
const Boost_parameter_compatibility_wrapper<internal_np::facet_size_param_t> facet_size;
const Boost_parameter_compatibility_wrapper<internal_np::facet_sizing_field_param_t> facet_sizing_field;
const Boost_parameter_compatibility_wrapper<internal_np::facet_distance_param_t> facet_distance;
const Boost_parameter_compatibility_wrapper<internal_np::facet_topology_param_t> facet_topology;
const Boost_parameter_compatibility_wrapper<internal_np::cell_radius_edge_param_t> cell_radius_edge;
const Boost_parameter_compatibility_wrapper<internal_np::cell_radius_edge_ratio_param_t> cell_radius_edge_ratio;
const Boost_parameter_compatibility_wrapper<internal_np::cell_size_param_t> cell_size;
const Boost_parameter_compatibility_wrapper<internal_np::cell_sizing_field_param_t> cell_sizing_field;
const Boost_parameter_compatibility_wrapper<internal_np::sizing_field_param_t> sizing_field;
#endif
// function to extract a parameter // function to extract a parameter
template <typename T, typename Tag, typename Base, typename Query_tag> template <typename T, typename Tag, typename Base, typename Query_tag>

View File

@ -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) CGAL_add_named_parameter(segment_t, segment_map, segment_map)
// List of named parameters used in Mesh_2 package // List of named parameters used in Mesh_2 package
CGAL_add_named_parameter(seeds_t, seeds, seeds) CGAL_add_named_parameter_with_compatibility(seeds_t, seeds, seeds)
CGAL_add_named_parameter(domain_is_initialized_t, domain_is_initialized, domain_is_initialized) CGAL_add_named_parameter_with_compatibility(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_with_compatibility(seeds_are_in_domain_t, seeds_are_in_domain, seeds_are_in_domain)
CGAL_add_named_parameter(criteria_t, criteria, criteria) CGAL_add_extra_named_parameter_with_compatibility(seeds_are_in_domain_t, seeds_are_in_domain, mark)
CGAL_add_named_parameter(convergence_ratio_t, convergence_ratio, convergence_ratio) CGAL_add_named_parameter_with_compatibility(criteria_t, criteria, criteria)
CGAL_add_named_parameter(vertex_freeze_bound_t, vertex_freeze_bound, vertex_freeze_bound) CGAL_add_named_parameter_with_compatibility(convergence_ratio_t, convergence_ratio, convergence)
CGAL_add_named_parameter(i_seed_begin_iterator_t, i_seed_begin_iterator, i_seed_begin_iterator) CGAL_add_named_parameter_with_compatibility(vertex_freeze_bound_t, vertex_freeze_bound, freeze_bound)
CGAL_add_named_parameter(i_seed_end_iterator_t, i_seed_end_iterator, i_seed_end_iterator) 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 //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_with_compatibility(lower_sliver_bound_t,lower_sliver_bound,sliver_bound)
CGAL_add_named_parameter(freeze_t,freeze,freeze) CGAL_add_named_parameter_with_compatibility(freeze_t,freeze,do_freeze)
//List of named parameters used in perturb_mesh_3.h //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_with_compatibility(sliver_criteria_t, sliver_criteria, sliver_criterion)
CGAL_add_named_parameter(perturb_vector_t, perturb_vector, perturb_vector) CGAL_add_named_parameter_with_compatibility(perturb_vector_t, perturb_vector, perturbation_vector)
//List of named parameters used in refine_mesh_3.h //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_extra_named_parameter_with_compatibility(number_of_iterations_t, number_of_iterations, max_iteration_number)
CGAL_add_named_parameter(dump_after_init_prefix_param_t, dump_after_init_prefix_param, dump_after_init_prefix_param) CGAL_add_extra_named_parameter_with_compatibility(maximum_running_time_t, maximum_running_time, time_limit)
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_with_compatibility(mesh_topology_number_t, mesh_topology_number, mesh_topology)
CGAL_add_named_parameter(dump_after_refine_prefix_param_t, dump_after_refine_prefix_param, dump_after_refine_prefix_param) 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(dump_after_glob_opt_prefix_param_t, dump_after_glob_opt_prefix_param, dump_after_glob_opt_prefix_param) 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(dump_after_perturb_prefix_param_t, dump_after_perturb_prefix_param, dump_after_perturb_prefix_param) 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(dump_after_exude_prefix_param_t, dump_after_exude_prefix_param, dump_after_exude_prefix_param) 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(number_of_initial_points_param_t, number_of_initial_points_param, number_of_initial_points_param) 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(maximal_number_of_vertices_param_t, maximal_number_of_vertices_param, maximal_number_of_vertices_param) 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(nonlinear_growth_of_balls_param_t, nonlinear_growth_of_balls_param, nonlinear_growth_of_balls_param) 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(pointer_to_error_code_param_t, pointer_to_error_code_param, pointer_to_error_code_param) 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(pointer_to_stop_atomic_boolean_param_t, pointer_to_stop_atomic_boolean_param, pointer_to_stop_atomic_boolean_param) 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(exude_options_param_t, exude_options_param, exude_options_param) 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(perturb_options_param_t, perturb_options_param, perturb_options_param) 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(odt_options_param_t, odt_options_param, odt_options_param) CGAL_add_named_parameter(exude_options_param_t, exude_options_param, exude_options)
CGAL_add_named_parameter(lloyd_options_param_t, lloyd_options_param, lloyd_options_param) CGAL_add_named_parameter(perturb_options_param_t, perturb_options_param, perturb_options)
CGAL_add_named_parameter(reset_options_param_t, reset_options_param, reset_options_param) CGAL_add_named_parameter(odt_options_param_t, odt_options_param, odt_options)
CGAL_add_named_parameter(mesh_param_t, mesh_param, mesh_param) CGAL_add_named_parameter(lloyd_options_param_t, lloyd_options_param, lloyd_options)
CGAL_add_named_parameter(manifold_param_t, manifold_param, manifold_param) CGAL_add_named_parameter(reset_options_param_t, reset_options_param, reset_options)
CGAL_add_named_parameter(features_option_param_t,features_options_param,features_options_param) 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_with_compatibility(image_3_param_t, image_3_param, image)
CGAL_add_named_parameter(iso_value_param_t, iso_value_param, iso_value_param) CGAL_add_named_parameter_with_compatibility(iso_value_param_t, iso_value_param, iso_value)
CGAL_add_named_parameter(image_subdomain_index_t, image_subdomain_index, image_subdomain_index) CGAL_add_named_parameter_with_compatibility(image_subdomain_index_t, image_subdomain_index, image_values_to_subdomain_indices)
CGAL_add_named_parameter(voxel_value_t, voxel_value, voxel_value) CGAL_add_named_parameter_with_compatibility(voxel_value_t, voxel_value, value_outside)
CGAL_add_named_parameter(error_bound_t, error_bound, error_bound) CGAL_add_named_parameter_with_compatibility(error_bound_t, error_bound, relative_error_bound)
CGAL_add_named_parameter(rng_t, rng, rng) CGAL_add_named_parameter_with_compatibility(rng_t, rng, p_rng)
CGAL_add_named_parameter(null_subdomain_index_param_t,null_subdomain_index_param, null_subdomain_index_param) CGAL_add_named_parameter_with_compatibility(null_subdomain_index_param_t,null_subdomain_index_param, null_subdomain_index)
CGAL_add_named_parameter(surface_patch_index_t, surface_patch_index, surface_patch_index) CGAL_add_named_parameter_with_compatibility(surface_patch_index_t, surface_patch_index, construct_surface_patch_index)
CGAL_add_named_parameter(weights_param_t, weights_param, weights_param) 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_with_compatibility(edge_size_param_t, edge_size_param, edge_size)
CGAL_add_named_parameter(edge_sizing_field_param_t, edge_sizing_field_param, edge_sizing_field_param) CGAL_add_named_parameter_with_compatibility(edge_sizing_field_param_t, edge_sizing_field_param, edge_sizing_field)
CGAL_add_named_parameter(facet_angle_param_t, facet_angle_param, facet_angle_param) CGAL_add_named_parameter_with_compatibility(facet_angle_param_t, facet_angle_param, facet_angle)
CGAL_add_named_parameter(facet_size_param_t, facet_size_param, facet_size_param) CGAL_add_named_parameter_with_compatibility(facet_size_param_t, facet_size_param, facet_size)
CGAL_add_named_parameter(facet_sizing_field_param_t, facet_sizing_field_param, facet_sizing_field_param) CGAL_add_named_parameter_with_compatibility(facet_sizing_field_param_t, facet_sizing_field_param, facet_sizing_field)
CGAL_add_named_parameter(facet_distance_param_t, facet_distance_param, facet_distance_param) CGAL_add_named_parameter_with_compatibility(facet_distance_param_t, facet_distance_param, facet_distance)
CGAL_add_named_parameter(facet_topology_param_t, facet_topology_param, facet_topology_param) CGAL_add_named_parameter_with_compatibility(facet_topology_param_t, facet_topology_param, facet_topology)
CGAL_add_named_parameter(cell_radius_edge_param_t, cell_radius_edge_param, cell_radius_edge_param) CGAL_add_named_parameter_with_compatibility(cell_radius_edge_param_t, cell_radius_edge_param, cell_radius_edge)
CGAL_add_named_parameter(cell_radius_edge_ratio_param_t, cell_radius_edge_ratio_param, cell_radius_edge_ratio_param) 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(cell_size_param_t, cell_size_param, cell_size_param) CGAL_add_named_parameter_with_compatibility(cell_size_param_t, cell_size_param, cell_size)
CGAL_add_named_parameter(cell_sizing_field_param_t, cell_sizing_field_param, cell_sizing_field_param) CGAL_add_named_parameter_with_compatibility(cell_sizing_field_param_t, cell_sizing_field_param, cell_sizing_field)
CGAL_add_named_parameter(sizing_field_param_t, sizing_field_param, sizing_field_param) 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_with_compatibility(function_param_t, function_param, function)
CGAL_add_named_parameter(bounding_object_param_t, bounding_object_param, bounding_object_param) CGAL_add_named_parameter_with_compatibility(bounding_object_param_t, bounding_object_param, bounding_object)