From 7cbf80b02b49a2f00b97fedb590c5e8b5b40a57f Mon Sep 17 00:00:00 2001 From: Lingjie Zhu Date: Fri, 10 Nov 2017 16:47:34 +0800 Subject: [PATCH] rename initialization from seeding_by_x to init_by_x --- .../vsa_autoinit_timing_benchmark.cpp | 2 +- .../vsa_timing_benchmark.cpp | 2 +- .../NamedParameters.txt | 6 +-- .../vsa_class_interface_example.cpp | 2 +- .../vsa_example.cpp | 2 +- .../vsa_metric_example.cpp | 2 +- .../include/CGAL/VSA_approximation.h | 40 +++++++++---------- .../parameters_interface.h | 4 +- .../include/CGAL/vsa_mesh_approximation.h | 12 +++--- .../vsa_class_interface_test.cpp | 6 +-- .../vsa_correctness_test.cpp | 2 +- .../vsa_error_decrease_test.cpp | 2 +- .../vsa_free_function_test.cpp | 2 +- .../vsa_kernel_test.cpp | 2 +- .../vsa_meshing_manifold_test.cpp | 2 +- .../vsa_metric_test.cpp | 2 +- .../vsa_teleportation_test.cpp | 2 +- 17 files changed, 46 insertions(+), 46 deletions(-) diff --git a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_autoinit_timing_benchmark.cpp b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_autoinit_timing_benchmark.cpp index ab42b68b31b..abd7434a5fc 100644 --- a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_autoinit_timing_benchmark.cpp +++ b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_autoinit_timing_benchmark.cpp @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) Timer t; std::cerr << "start initialization" << std::endl; t.start(); - l21_vsa.seeding_by_error( + l21_vsa.init_by_error( static_cast(init), tol, iterations); t.stop(); std::cerr << "initialization time " << t.time() << " sec." << std::endl; diff --git a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_timing_benchmark.cpp b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_timing_benchmark.cpp index c871fb6bc36..8efedf631af 100644 --- a/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_timing_benchmark.cpp +++ b/Surface_mesh_approximation/benchmark/Surface_mesh_approximation/vsa_timing_benchmark.cpp @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) std::cerr << "start initialization" << std::endl; t0.reset(); t0.start(); - l21_vsa.seeding_by_number( + l21_vsa.init_by_number( static_cast(init), num_proxies); t0.stop(); std::cerr << "initialization time " << t0.time() << " sec." << std::endl; diff --git a/Surface_mesh_approximation/doc/Surface_mesh_approximation/NamedParameters.txt b/Surface_mesh_approximation/doc/Surface_mesh_approximation/NamedParameters.txt index f4c68d44a44..290384817c2 100644 --- a/Surface_mesh_approximation/doc/Surface_mesh_approximation/NamedParameters.txt +++ b/Surface_mesh_approximation/doc/Surface_mesh_approximation/NamedParameters.txt @@ -34,7 +34,7 @@ See below a sample call of a function that uses the optional BGL named parameter vsa_mesh_approximation(input, , output , CGAL::VSA::parameters::init_method(method) - .seeding_by_number(num_proxies) + .init_by_number(num_proxies) .iterations(num_iterations) .anchor_point(std::back_inserter(anchors))); \endcode @@ -79,13 +79,13 @@ the selection of seed initialization method, `0` for random, `1` for incremental \b Default value is `0` \cgalNPEnd -\cgalNPBegin{seeding_by_number} \anchor VSA_seeding_by_number +\cgalNPBegin{init_by_number} \anchor VSA_init_by_number the number of proxies used to approximate the input mesh.\n \b Type : `std::size_t` \n \b Default value is `0` \cgalNPEnd -\cgalNPBegin{seeding_by_error} \anchor VSA_seeding_by_error +\cgalNPBegin{init_by_error} \anchor VSA_init_by_error the total error drop to approximate the input mesh.\n \b Type : `GeomTraits::FT` \n \b Default value is `0.01` diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_class_interface_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_class_interface_example.cpp index a4312888bf3..ce9e959c29d 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_class_interface_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_class_interface_example.cpp @@ -35,7 +35,7 @@ int main() l21_approx.set_metric(metric, proxy_fitting); // initialize proxies randomly on the mesh - l21_approx.seeding_by_number(L21VSA::Random, 100); + l21_approx.init_by_number(L21VSA::Random, 100); // run the iteration to minimize the error for (std::size_t i = 0; i < 30; ++i) diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_example.cpp index b2abf3c89d2..df253fd9606 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_example.cpp @@ -27,7 +27,7 @@ int main() // free function interface with named parameters, seperated with dots CGAL::vsa_mesh_approximation(input, output, - CGAL::VSA::parameters::seeding_by_number(200). // seeding by target number of proxies + CGAL::VSA::parameters::init_by_number(200). // seeding by target number of proxies init_method(1). // hierarchical init iterations(30). // number of relaxation iterations after seeding anchor_point(std::back_inserter(anchors)). // get anchor points diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_metric_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_metric_example.cpp index b56e528c561..220015f8ded 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_metric_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_metric_example.cpp @@ -108,7 +108,7 @@ int main() compact_approx.set_metric(metric, proxy_fitting); // using 200 proxies to approximate the shape - compact_approx.seeding_by_number(CompactVSA::Hierarchical, 200); + compact_approx.init_by_number(CompactVSA::Hierarchical, 200); for (std::size_t i = 0; i < 30; ++i) compact_approx.run_one_step(); diff --git a/Surface_mesh_approximation/include/CGAL/VSA_approximation.h b/Surface_mesh_approximation/include/CGAL/VSA_approximation.h index 252401de70c..e5b14fa9a02 100644 --- a/Surface_mesh_approximation/include/CGAL/VSA_approximation.h +++ b/Surface_mesh_approximation/include/CGAL/VSA_approximation.h @@ -326,47 +326,47 @@ public: } /*! - * @brief Seeding by targeted number of proxies. + * @brief Initialize with targeted number of proxies. * @param method seeding method * @param num_seed target number of proxies seed * @param num_iterations number of re-fitting iterations * in incremental and hierarchical seeding * @return number of proxies initialized */ - std::size_t seeding_by_number( + std::size_t init_by_number( const Method method, const std::size_t num_seed, const std::size_t num_iterations = 5) { switch (method) { case Random: - return seed_random(num_seed); + return init_random(num_seed); case Incremental: - return seed_incremental(num_seed, num_iterations); + return init_incremental(num_seed, num_iterations); case Hierarchical: - return seed_hierarchical(num_seed, num_iterations); + return init_hierarchical(num_seed, num_iterations); default: return 0; } } /*! - * @brief Seeding by targeted error drop. + * @brief Initialize proxies to targeted error drop. * @param method seeding method * @param target_drop targeted error drop to initial state, usually in range (0, 1) * @param num_iterations number of re-fitting iterations * @return number of proxies initialized */ - std::size_t seeding_by_error( + std::size_t init_by_error( const Method method, const FT target_drop, const std::size_t num_iterations = 5) { switch (method) { case Random: - return seed_error_random(target_drop, num_iterations); + return init_error_random(target_drop, num_iterations); case Incremental: - return seed_error_incremental(target_drop, num_iterations); + return init_error_incremental(target_drop, num_iterations); case Hierarchical: - return seed_error_hierarchical(target_drop, num_iterations); + return init_error_hierarchical(target_drop, num_iterations); default: return 0; } @@ -930,7 +930,7 @@ private: * @param num_seed number of proxies seed * @return number of proxies initialized */ - std::size_t seed_random(const std::size_t num_seed) { + std::size_t init_random(const std::size_t num_seed) { proxies.clear(); if (num_faces(*m_pmesh) < num_seed) return 0; @@ -954,7 +954,7 @@ private: * before each incremental proxy insertion * @return number of proxies initialized */ - std::size_t seed_incremental(const std::size_t num_seed, + std::size_t init_incremental(const std::size_t num_seed, const std::size_t num_iterations) { proxies.clear(); if (num_faces(*m_pmesh) < num_seed) @@ -976,7 +976,7 @@ private: * before each hierarchical proxy insertion * @return number of proxies initialized */ - std::size_t seed_hierarchical(const std::size_t num_seed, + std::size_t init_hierarchical(const std::size_t num_seed, const std::size_t num_iterations) { proxies.clear(); if (num_faces(*m_pmesh) < num_seed) @@ -1004,12 +1004,12 @@ private: } /*! - * @brief Initialize by targeted error drop. + * @brief Initialize by targeted error drop with random seeding. * @param target_drop targeted error drop to initial state, usually in range (0, 1) * @param num_iterations number of re-fitting iterations * @return number of proxies initialized */ - std::size_t seed_error_random(const FT target_drop, + std::size_t init_error_random(const FT target_drop, const std::size_t num_iterations) { // maximum allowed number of proxies const std::size_t max_proxies = num_faces(*m_pmesh) / 3; @@ -1028,7 +1028,7 @@ private: std::size_t target_px = 2; do { proxies.clear(); - seed_random(target_px); + init_random(target_px); for (std::size_t i = 0; i < num_iterations; ++i) { partition(); fit(); @@ -1042,12 +1042,12 @@ private: } /*! - * @brief Initialize by targeted error drop. + * @brief Initialize by targeted error dropwith incremental seeding. * @param target_drop targeted error drop to initial state, usually in range (0, 1) * @param num_iterations number of re-fitting iterations * @return number of proxies initialized */ - std::size_t seed_error_incremental(const FT target_drop, + std::size_t init_error_incremental(const FT target_drop, const std::size_t num_iterations) { // maximum allowed number of proxies const std::size_t max_proxies = num_faces(*m_pmesh) / 3; @@ -1077,12 +1077,12 @@ private: } /*! - * @brief Initialize by targeted error drop. + * @brief Initialize by targeted error drop with hierarchical seeding. * @param target_drop targeted error drop to initial state, usually in range (0, 1) * @param num_iterations number of re-fitting iterations * @return number of proxies initialized */ - std::size_t seed_error_hierarchical(const FT target_drop, + std::size_t init_error_hierarchical(const FT target_drop, const std::size_t num_iterations) { // maximum allowed number of proxies const std::size_t max_proxies = num_faces(*m_pmesh) / 3; diff --git a/Surface_mesh_approximation/include/CGAL/internal/Surface_mesh_approximation/parameters_interface.h b/Surface_mesh_approximation/include/CGAL/internal/Surface_mesh_approximation/parameters_interface.h index a9f1d317671..8131cf74b41 100644 --- a/Surface_mesh_approximation/include/CGAL/internal/Surface_mesh_approximation/parameters_interface.h +++ b/Surface_mesh_approximation/include/CGAL/internal/Surface_mesh_approximation/parameters_interface.h @@ -3,8 +3,8 @@ CGAL_add_named_parameter(geom_traits_t, geom_traits, geom_traits) // approximation parameters CGAL_add_named_parameter(init_method_t, init_method, init_method) -CGAL_add_named_parameter(seeding_by_number_t, seeding_by_number, seeding_by_number) -CGAL_add_named_parameter(seeding_by_error_t, seeding_by_error, seeding_by_error) +CGAL_add_named_parameter(init_by_number_t, init_by_number, init_by_number) +CGAL_add_named_parameter(init_by_error_t, init_by_error, init_by_error) CGAL_add_named_parameter(iterations_t, iterations, iterations) CGAL_add_named_parameter(inner_iterations_t, inner_iterations, inner_iterations) CGAL_add_named_parameter(chord_subdivide_t, chord_subdivide, chord_subdivide) diff --git a/Surface_mesh_approximation/include/CGAL/vsa_mesh_approximation.h b/Surface_mesh_approximation/include/CGAL/vsa_mesh_approximation.h index 46d3cdc805a..67374c02313 100644 --- a/Surface_mesh_approximation/include/CGAL/vsa_mesh_approximation.h +++ b/Surface_mesh_approximation/include/CGAL/vsa_mesh_approximation.h @@ -44,9 +44,9 @@ namespace CGAL * \cgalParamEnd * \cgalParamBegin{init_method} the selection of seed initialization method. * \cgalParamEnd - * \cgalParamBegin{seeding_by_number} the number of proxies to approximate the geometry. + * \cgalParamBegin{init_by_number} the number of proxies to approximate the geometry. * \cgalParamEnd - * \cgalParamBegin{seeding_by_error} the error drop of the approximation. + * \cgalParamBegin{init_by_error} the error drop of the approximation. * \cgalParamEnd * \cgalParamBegin{iterations} the relaxation iterations after seeding. * \cgalParamEnd @@ -94,15 +94,15 @@ bool vsa_mesh_approximation(const TriangleMesh &tm_in, // default random initialization int init = choose_param(get_param(np, internal_np::init_method), 0); - std::size_t num_proxies = choose_param(get_param(np, internal_np::seeding_by_number), 0); + std::size_t num_proxies = choose_param(get_param(np, internal_np::init_by_number), 0); std::size_t inner_iterations = choose_param(get_param(np, internal_np::inner_iterations), 10); if (num_proxies == 0 || num_proxies > num_faces(tm_in)) { - FT drop = choose_param(get_param(np, internal_np::seeding_by_error), FT(0.01)); - vsa_l21.seeding_by_error( + FT drop = choose_param(get_param(np, internal_np::init_by_error), FT(0.01)); + vsa_l21.init_by_error( static_cast(init), drop, inner_iterations); } else { - vsa_l21.seeding_by_number( + vsa_l21.init_by_number( static_cast(init), num_proxies, inner_iterations); } diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_class_interface_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_class_interface_test.cpp index 44f69393ab6..1823a4a9ac1 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_class_interface_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_class_interface_test.cpp @@ -53,7 +53,7 @@ int main() // random init and run std::cout << "random init and run" << std::endl; - l2_approx.seeding_by_number(L2VSA::Random, 10); + l2_approx.init_by_number(L2VSA::Random, 10); for (std::size_t i = 0; i < 10; ++i) l2_approx.run_one_step(); if (l2_approx.get_proxies_size() != 10) @@ -124,7 +124,7 @@ int main() l2_approx.rebuild(); if (l2_approx.get_proxies_size() != 0) return EXIT_FAILURE; - l2_approx.seeding_by_error(L2VSA::Hierarchical, drop, iterations); + l2_approx.init_by_error(L2VSA::Hierarchical, drop, iterations); for (std::size_t i = 0; i < 10; ++i) l2_approx.run_one_step(); std::cout << "#proxies " << l2_approx.get_proxies_size() << std::endl; @@ -133,7 +133,7 @@ int main() l2_approx.rebuild(); if (l2_approx.get_proxies_size() != 0) return EXIT_FAILURE; - l2_approx.seeding_by_error(L2VSA::Incremental, drop, iterations); + l2_approx.init_by_error(L2VSA::Incremental, drop, iterations); for (std::size_t i = 0; i < 10; ++i) l2_approx.run_one_step(); std::cout << "#proxies " << l2_approx.get_proxies_size() << std::endl; diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_correctness_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_correctness_test.cpp index 79321388b7d..a5111aa60cb 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_correctness_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_correctness_test.cpp @@ -40,7 +40,7 @@ bool test_shape(const char *file_name, const std::size_t target_num_proxies) const FT drop(1e-8); const std::size_t num_iterations = 20; const std::size_t inner_iterations = 10; - vsa_l21.seeding_by_error(L21VSA::Incremental, drop, inner_iterations); + vsa_l21.init_by_error(L21VSA::Incremental, drop, inner_iterations); for (std::size_t i = 0; i < num_iterations; ++i) vsa_l21.run_one_step(); diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_error_decrease_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_error_decrease_test.cpp index ea548477556..f5d43f78d79 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_error_decrease_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_error_decrease_test.cpp @@ -51,7 +51,7 @@ int main() L21ProxyFitting l21_fitting(mesh); vsa_l21.set_metric(l21_metric, l21_fitting); - vsa_l21.seeding_by_number(L21VSA::Random, 100); + vsa_l21.init_by_number(L21VSA::Random, 100); std::vector error; for (std::size_t i = 0; i < 30; ++i) error.push_back(vsa_l21.run_one_step()); diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_free_function_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_free_function_test.cpp index 95bb5d6988b..1597ab91a3b 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_free_function_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_free_function_test.cpp @@ -30,7 +30,7 @@ int main() std::map fidxmap; boost::associative_property_map > fpxmap(fidxmap); CGAL::vsa_mesh_approximation(mesh, out_mesh, - CGAL::VSA::parameters::seeding_by_number(6). + CGAL::VSA::parameters::init_by_number(6). iterations(30). inner_iterations(5). chord_subdivide(0.5). diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_kernel_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_kernel_test.cpp index 717ed13dbfc..43cb9ab58e7 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_kernel_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_kernel_test.cpp @@ -27,7 +27,7 @@ int test() { typedef CGAL::Polyhedron_3 Polyhedron; Polyhedron out_mesh; CGAL::vsa_mesh_approximation(tm, out_mesh, - CGAL::VSA::parameters::seeding_by_number(6). + CGAL::VSA::parameters::init_by_number(6). iterations(30). inner_iterations(5). chord_subdivide(0.5)); diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_meshing_manifold_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_meshing_manifold_test.cpp index 43fd624a0e9..156615890f7 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_meshing_manifold_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_meshing_manifold_test.cpp @@ -38,7 +38,7 @@ bool test_manifold(const char *file_name, const FT drop = FT(1e-8)) // approximation, init from error, drop to the target error incrementally const std::size_t num_iterations = 20; const std::size_t inner_iterations = 5; - vsa_l21.seeding_by_error(L21VSA::Incremental, drop, inner_iterations); + vsa_l21.init_by_error(L21VSA::Incremental, drop, inner_iterations); for (std::size_t i = 0; i < num_iterations; ++i) vsa_l21.run_one_step(); std::cout << "#proxies " << vsa_l21.get_proxies_size() << std::endl; diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp index ea762cf8fe2..6c0cba9816b 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp @@ -99,7 +99,7 @@ int main() compact_approx.set_metric(metric, proxy_fitting); std::cout << "random init and run" << std::endl; - compact_approx.seeding_by_number(CompactVSA::Random, 20); + compact_approx.init_by_number(CompactVSA::Random, 20); for (std::size_t i = 0; i < 20; ++i) compact_approx.run_one_step(); if (compact_approx.get_proxies_size() != 20) diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_teleportation_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_teleportation_test.cpp index 2059dc9eb98..3157f9c868a 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_teleportation_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_teleportation_test.cpp @@ -66,7 +66,7 @@ int main() l21_vsa.set_metric(l21_metric, l21_fitting); std::cout << "Seeding by number." << std::endl; - l21_vsa.seeding_by_number(L21VSA::Random, 50); + l21_vsa.init_by_number(L21VSA::Random, 50); if (l21_vsa.get_proxies_size() != 50) return EXIT_FAILURE; for (std::size_t i = 0; i < 10; ++i) {