mirror of https://github.com/CGAL/cgal
remove init_by_ interfaces
This commit is contained in:
parent
431570427c
commit
b11b32e35e
|
|
@ -60,8 +60,8 @@ int main(int argc, char *argv[])
|
||||||
Timer t;
|
Timer t;
|
||||||
std::cerr << "start initialization" << std::endl;
|
std::cerr << "start initialization" << std::endl;
|
||||||
t.start();
|
t.start();
|
||||||
approx.init_by_error(
|
approx.init(
|
||||||
static_cast<CGAL::VSA::Seeding>(init), tol, iterations);
|
static_cast<CGAL::VSA::Seeding>(init), boost::none, tol, iterations);
|
||||||
t.stop();
|
t.stop();
|
||||||
std::cerr << "initialization time " << t.time() << " sec." << std::endl;
|
std::cerr << "initialization time " << t.time() << " sec." << std::endl;
|
||||||
std::cerr << "#proxies " << approx.get_proxies_size() << std::endl;
|
std::cerr << "#proxies " << approx.get_proxies_size() << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
|
||||||
std::cerr << "start initialization" << std::endl;
|
std::cerr << "start initialization" << std::endl;
|
||||||
t0.reset();
|
t0.reset();
|
||||||
t0.start();
|
t0.start();
|
||||||
approx.init_by_number(
|
approx.init(
|
||||||
static_cast<CGAL::VSA::Seeding>(init), num_proxies);
|
static_cast<CGAL::VSA::Seeding>(init), num_proxies);
|
||||||
t0.stop();
|
t0.stop();
|
||||||
std::cerr << "initialization time " << t0.time() << " sec." << std::endl;
|
std::cerr << "initialization time " << t0.time() << " sec." << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ int main()
|
||||||
approx.set_metric(metric, proxy_fitting);
|
approx.set_metric(metric, proxy_fitting);
|
||||||
|
|
||||||
// initialize 100 random proxies
|
// initialize 100 random proxies
|
||||||
approx.init_by_number(CGAL::VSA::Random, 100);
|
approx.init(CGAL::VSA::Random, 100);
|
||||||
|
|
||||||
// run 30 iterations
|
// run 30 iterations
|
||||||
approx.run(30);
|
approx.run(30);
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ int main()
|
||||||
approx.set_metric(metric, proxy_fitting);
|
approx.set_metric(metric, proxy_fitting);
|
||||||
|
|
||||||
// approximation via 200 proxies and 30 iterations
|
// approximation via 200 proxies and 30 iterations
|
||||||
approx.init_by_number(CGAL::VSA::Hierarchical, 200);
|
approx.init(CGAL::VSA::Hierarchical, 200);
|
||||||
approx.run(30);
|
approx.run(30);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
|
||||||
|
|
@ -399,35 +399,6 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Initialize with targeted number of proxies.
|
|
||||||
* @param method seeding method
|
|
||||||
* @param max_nb_proxies target maximum number of proxies
|
|
||||||
* @param num_iterations number of re-fitting iterations
|
|
||||||
* in incremental and hierarchical seeding
|
|
||||||
* @return number of proxies initialized
|
|
||||||
*/
|
|
||||||
std::size_t init_by_number(
|
|
||||||
const Seeding method,
|
|
||||||
const std::size_t max_nb_proxies,
|
|
||||||
const std::size_t num_iterations = 5) {
|
|
||||||
return init(method, max_nb_proxies, boost::none, num_iterations);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* @brief Initialize proxies to targeted error drop.
|
|
||||||
* @param method seeding method
|
|
||||||
* @param target_drop targeted error drop to initial state, in range (0, 1)
|
|
||||||
* @param num_iterations number of re-fitting iterations
|
|
||||||
* @return number of proxies initialized
|
|
||||||
*/
|
|
||||||
std::size_t init_by_error(
|
|
||||||
const Seeding method,
|
|
||||||
const FT target_drop,
|
|
||||||
const std::size_t num_iterations = 5) {
|
|
||||||
return init(method, boost::none, target_drop, num_iterations);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Run the partitioning and fitting processes.
|
* @brief Run the partitioning and fitting processes.
|
||||||
* @param num_iterations number of iterations.
|
* @param num_iterations number of iterations.
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ int main()
|
||||||
|
|
||||||
// random init and run
|
// random init and run
|
||||||
std::cout << "random init and run" << std::endl;
|
std::cout << "random init and run" << std::endl;
|
||||||
approx.init_by_number(CGAL::VSA::Random, 10);
|
approx.init(CGAL::VSA::Random, 10);
|
||||||
approx.run(10);
|
approx.run(10);
|
||||||
if (approx.get_proxies_size() != 10)
|
if (approx.get_proxies_size() != 10)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
@ -125,7 +125,7 @@ int main()
|
||||||
approx.rebuild();
|
approx.rebuild();
|
||||||
if (approx.get_proxies_size() != 0)
|
if (approx.get_proxies_size() != 0)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
approx.init_by_error(CGAL::VSA::Hierarchical, drop, iterations);
|
approx.init(CGAL::VSA::Hierarchical, boost::none, drop, iterations);
|
||||||
approx.run(10);
|
approx.run(10);
|
||||||
std::cout << "#proxies " << approx.get_proxies_size() << std::endl;
|
std::cout << "#proxies " << approx.get_proxies_size() << std::endl;
|
||||||
|
|
||||||
|
|
@ -133,7 +133,7 @@ int main()
|
||||||
approx.rebuild();
|
approx.rebuild();
|
||||||
if (approx.get_proxies_size() != 0)
|
if (approx.get_proxies_size() != 0)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
approx.init_by_error(CGAL::VSA::Incremental, drop, iterations);
|
approx.init(CGAL::VSA::Incremental, boost::none, drop, iterations);
|
||||||
approx.run(10);
|
approx.run(10);
|
||||||
std::cout << "#proxies " << approx.get_proxies_size() << std::endl;
|
std::cout << "#proxies " << approx.get_proxies_size() << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ bool test_shape(const char *file_name, const std::size_t target_num_proxies)
|
||||||
const FT drop(1e-8);
|
const FT drop(1e-8);
|
||||||
const std::size_t num_iterations = 20;
|
const std::size_t num_iterations = 20;
|
||||||
const std::size_t inner_iterations = 10;
|
const std::size_t inner_iterations = 10;
|
||||||
approx.init_by_error(CGAL::VSA::Incremental, drop, inner_iterations);
|
approx.init(CGAL::VSA::Incremental, boost::none, drop, inner_iterations);
|
||||||
approx.run(num_iterations);
|
approx.run(num_iterations);
|
||||||
|
|
||||||
// eliminate redundant area (local minima) by merging
|
// eliminate redundant area (local minima) by merging
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ int main()
|
||||||
L21_proxy_fitting proxy_fitting(mesh);
|
L21_proxy_fitting proxy_fitting(mesh);
|
||||||
approx.set_metric(error_metric, proxy_fitting);
|
approx.set_metric(error_metric, proxy_fitting);
|
||||||
|
|
||||||
approx.init_by_number(CGAL::VSA::Random, 100);
|
approx.init(CGAL::VSA::Random, 100);
|
||||||
std::vector<FT> error;
|
std::vector<FT> error;
|
||||||
for (std::size_t i = 0; i < 30; ++i)
|
for (std::size_t i = 0; i < 30; ++i)
|
||||||
error.push_back(approx.run());
|
error.push_back(approx.run());
|
||||||
|
|
|
||||||
|
|
@ -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
|
// approximation, init from error, drop to the target error incrementally
|
||||||
const std::size_t num_iterations = 20;
|
const std::size_t num_iterations = 20;
|
||||||
const std::size_t inner_iterations = 5;
|
const std::size_t inner_iterations = 5;
|
||||||
approx.init_by_error(CGAL::VSA::Incremental, drop, inner_iterations);
|
approx.init(CGAL::VSA::Incremental, boost::none, drop, inner_iterations);
|
||||||
approx.run(num_iterations);
|
approx.run(num_iterations);
|
||||||
std::cout << "#proxies " << approx.get_proxies_size() << std::endl;
|
std::cout << "#proxies " << approx.get_proxies_size() << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ int main()
|
||||||
approx.set_metric(error_metric, proxy_fitting);
|
approx.set_metric(error_metric, proxy_fitting);
|
||||||
|
|
||||||
std::cout << "random init and run" << std::endl;
|
std::cout << "random init and run" << std::endl;
|
||||||
approx.init_by_number(CGAL::VSA::Random, 20);
|
approx.init(CGAL::VSA::Random, 20);
|
||||||
approx.run(20);
|
approx.run(20);
|
||||||
if (approx.get_proxies_size() != 20)
|
if (approx.get_proxies_size() != 20)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ int main()
|
||||||
approx.set_metric(error_metric, proxy_fitting);
|
approx.set_metric(error_metric, proxy_fitting);
|
||||||
|
|
||||||
std::cout << "Seeding by number." << std::endl;
|
std::cout << "Seeding by number." << std::endl;
|
||||||
approx.init_by_number(CGAL::VSA::Random, 50);
|
approx.init(CGAL::VSA::Random, 50);
|
||||||
if (approx.get_proxies_size() != 50)
|
if (approx.get_proxies_size() != 50)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
for (std::size_t i = 0; i < 10; ++i) {
|
for (std::size_t i = 0; i < 10; ++i) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue