mirror of https://github.com/CGAL/cgal
Improved benchmark (comments, output...)
This commit is contained in:
parent
7fab99906a
commit
268cd0994b
|
|
@ -1,42 +1,54 @@
|
||||||
#---------------------------------------------------------------------------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
# Input PARAM1 PARAM2 PARAM3 NUM_P AMB INTR SPARSITY FIX_TIME_LIMIT NUM_ITERATIONS
|
# Input PARAM1 PARAM2 PARAM3 NUM_P AMB INTR SPARSITY PERTURB ADD_HDIM COLLAPSE FIX_TIME_LIMIT NUM_ITERATIONS
|
||||||
#---------------------------------------------------------------------------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#---------------------------------------------------------- Very small cases for Debug mode -------------------------------------------------------------
|
#---------------------------------------------------------- Very small cases for Debug mode --------------------------------------------------------------
|
||||||
#generate_sphere_d 3 - - 20 3 2 0.05 60 1
|
#generate_sphere_d 4 - - 20 3 2 0.05 N N Y 60 1
|
||||||
#generate_klein_bottle_4D 4 3 - 70 4 2 1.5 60 1
|
#generate_sphere_d 3 - - 70 3 2 0.05 Y Y Y 60 1
|
||||||
|
#generate_sphere_d 3 - - 1000 3 2 0.05 Y Y Y 60 1
|
||||||
|
#generate_sphere_d 3 - - 70 4 3 0.05 Y Y Y 60 1
|
||||||
|
#generate_sphere_d 3 - - 70 5 4 0.05 Y Y Y 60 1
|
||||||
|
#generate_klein_bottle_variant_5D 4 3 - 70 5 2 0.05 Y Y Y 60 1
|
||||||
|
#data/SO3_10000.txt - - - 0 9 3 0.7 Y Y Y 60 1
|
||||||
|
#generate_moment_curve 0 1 - 30 3 1 0.005 Y Y Y 60 1
|
||||||
|
|
||||||
#------------------------------------------------------------------ From files ---------------------------------------------------------------------------
|
#---------------------------------------------------------------- Alpha TC tests ------------------------------------------------------------------------
|
||||||
data/SO3_50000.txt - - - 0 9 3 0.2 60 1
|
#generate_sphere_d 0.302 - - 70 2 1 0.005 N N Y 60 1
|
||||||
data/SO3_10000.txt - - - 0 9 3 0.05 60 1
|
#generate_sphere_d 0.5 - - 70 2 1 0.005 N N Y 60 1
|
||||||
#data/cube3D_eps_0.1.txt - - - 0 3 2 0.05 3000 1
|
generate_klein_bottle_4D 40 15 - 130 4 2 0.2 N N Y 60 1
|
||||||
#data/cube4D_eps_0.1.txt - - - 0 4 3 0.05 3000 1
|
#generate_klein_bottle_4D 8 5 - 5000 4 2 0.2 Y Y Y 60 1 #Takes forever
|
||||||
#data/cube5D_eps_0.1.txt - - - 0 5 4 0.05 3000 1
|
|
||||||
data/Cy8.txt - - - 0 24 2 0.1 60 1
|
|
||||||
data/Kl.txt - - - 0 5 2 0.05 60 1
|
|
||||||
data/S3.txt - - - 0 4 3 0.05 60 1
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------- 3D meshes ------------------------------------------------------------------------
|
#------------------------------------------------------------------ From files --------------------------------------------------------------------------
|
||||||
data/buddha_100kv.txt - - - 0 3 2 0.005 60 1
|
#data/SO3_50000.txt - - - 0 9 3 0.2 Y Y Y 60 1
|
||||||
data/fandisk.txt - - - 0 3 2 0.01 60 1
|
#data/SO3_10000.txt - - - 0 9 3 0.05 Y Y Y 60 1
|
||||||
data/fertility.txt - - - 0 3 2 0.4 60 1
|
#data/cube3D_eps_0.1.txt - - - 0 3 2 0.05 Y Y Y 3000 1
|
||||||
data/bunny.txt - - - 0 3 2 0.5 60 1
|
#data/cube4D_eps_0.1.txt - - - 0 4 3 0.05 Y Y Y 3000 1
|
||||||
data/blob.txt - - - 0 3 2 0.01 60 1
|
#data/cube5D_eps_0.1.txt - - - 0 5 4 0.05 Y Y Y 3000 1
|
||||||
data/3holes.txt - - - 0 3 2 0.01 60 1
|
#data/Cy8.txt - - - 0 24 2 0.1 Y Y Y 60 1
|
||||||
data/785_hand_2500v.txt - - - 0 3 2 0.01 60 1
|
#data/Kl.txt - - - 0 5 2 0.05 Y Y Y 60 1
|
||||||
data/785_hand_50kv.txt - - - 0 3 2 0.01 60 1
|
#data/S3.txt - - - 0 4 3 0.05 Y Y Y 60 1
|
||||||
data/bumpy_sphere.txt - - - 0 3 2 0.01 60 1
|
|
||||||
|
|
||||||
#----------------------------------------------------------- Generated point sets ------------------------------------------------------------------------
|
#---------------------------------------------------------------------- 3D meshes -----------------------------------------------------------------------
|
||||||
#generate_sphere_d 3 - - 4 3 2 0.05 3000 1
|
#data/buddha_100kv.txt - - - 0 3 2 0.005 Y Y Y 60 1
|
||||||
#generate_sphere_d 3 - - 30000 2 1 0.005 3000 1
|
#data/fandisk.txt - - - 0 3 2 0.01 Y Y Y 60 1
|
||||||
#generate_sphere_d 3 - - 30000 3 2 0.005 3000 1
|
#data/fertility.txt - - - 0 3 2 0.4 Y Y Y 60 1
|
||||||
#generate_sphere_d 3 - - 30000 4 3 0.05 3000 1
|
#data/bunny.txt - - - 0 3 2 0.5 Y Y Y 60 1
|
||||||
#generate_plane - - - 30000 3 2 0.005 3000 1
|
#data/blob.txt - - - 0 3 2 0.01 Y Y Y 60 1
|
||||||
generate_moment_curve 0 1 - 30000 6 1 0.005 60 1
|
#data/3holes.txt - - - 0 3 2 0.01 Y Y Y 60 1
|
||||||
generate_klein_bottle_4D 4 3 - 1000 4 2 0.1 60 1
|
#data/785_hand_2500v.txt - - - 0 3 2 0.01 Y Y Y 60 1
|
||||||
generate_klein_bottle_variant_5D 4 3 - 30000 5 2 0.05 60 1
|
#data/785_hand_50kv.txt - - - 0 3 2 0.01 Y Y Y 60 1
|
||||||
|
#data/bumpy_sphere.txt - - - 0 3 2 0.01 Y Y Y 60 1
|
||||||
|
|
||||||
#----------------------------------------------------------- Performance testing -------------------------------------------------------------------------
|
#----------------------------------------------------------- Generated point sets -----------------------------------------------------------------------
|
||||||
|
#generate_sphere_d 3 - - 4 3 2 0.05 Y Y Y 3000 1
|
||||||
|
#generate_sphere_d 3 - - 30000 2 1 0.005 Y Y Y 3000 1
|
||||||
|
#generate_sphere_d 3 - - 30000 3 2 0.005 Y Y Y 3000 1
|
||||||
|
#generate_sphere_d 3 - - 30000 4 3 0.05 Y Y Y 3000 1
|
||||||
|
#generate_plane - - - 30000 3 2 0.005 Y Y Y 3000 1
|
||||||
|
#generate_moment_curve 0 1 - 30000 6 1 0.005 Y Y Y 60 1
|
||||||
|
#generate_klein_bottle_4D 4 3 - 1000 4 2 0.1 Y Y Y 60 1
|
||||||
|
#generate_klein_bottle_variant_5D 4 3 - 30000 5 2 0.05 Y Y Y 60 1
|
||||||
|
|
||||||
|
#----------------------------------------------------------- Performance testing ------------------------------------------------------------------------
|
||||||
# TC: 5.55 / 1st fix step : 0.2
|
# TC: 5.55 / 1st fix step : 0.2
|
||||||
#data/fertility.txt - - - 0 3 2 0.1 100 1
|
#data/fertility.txt - - - 0 3 2 0.1 Y Y Y 100 1
|
||||||
|
|
@ -91,12 +91,14 @@ protected:
|
||||||
subelements.push_back("Final_num_inconsistent_local_tr");
|
subelements.push_back("Final_num_inconsistent_local_tr");
|
||||||
subelements.push_back("Init_time");
|
subelements.push_back("Init_time");
|
||||||
subelements.push_back("Comput_time");
|
subelements.push_back("Comput_time");
|
||||||
subelements.push_back("Fix1_successful");
|
subelements.push_back("Perturb_successful");
|
||||||
subelements.push_back("Fix1_time");
|
subelements.push_back("Perturb_time");
|
||||||
subelements.push_back("Fix1_steps");
|
subelements.push_back("Perturb_steps");
|
||||||
subelements.push_back("Fix2_pure_manifold");
|
subelements.push_back("Add_higher_dim_simpl_time");
|
||||||
subelements.push_back("Fix2_num_wrong_number_of_cofaces");
|
subelements.push_back("Result_pure_pseudomanifold");
|
||||||
subelements.push_back("Fix2_time");
|
subelements.push_back("Result_num_wrong_dim_simplices");
|
||||||
|
subelements.push_back("Result_num_wrong_number_of_cofaces");
|
||||||
|
subelements.push_back("Result_num_unconnected_stars");
|
||||||
subelements.push_back("Info");
|
subelements.push_back("Info");
|
||||||
|
|
||||||
return subelements;
|
return subelements;
|
||||||
|
|
@ -125,13 +127,94 @@ protected:
|
||||||
XML_exporter::Element_with_map m_current_element;
|
XML_exporter::Element_with_map m_current_element;
|
||||||
};
|
};
|
||||||
|
|
||||||
void make_tc(std::vector<Point> &points, int intrinsic_dim,
|
template <typename TC>
|
||||||
double sparsity = 0., double time_limit_for_fix = 0.,
|
bool export_to_off(
|
||||||
|
TC const& tc,
|
||||||
|
std::string const& input_name_stripped,
|
||||||
|
std::string const& suffix,
|
||||||
|
bool color_inconsistencies = false,
|
||||||
|
typename TC::Simplicial_complex const* p_complex = NULL,
|
||||||
|
std::set<std::set<std::size_t> > const *p_simpl_to_color_in_red = NULL,
|
||||||
|
std::set<std::set<std::size_t> > const *p_simpl_to_color_in_green = NULL,
|
||||||
|
std::set<std::set<std::size_t> > const *p_simpl_to_color_in_blue = NULL)
|
||||||
|
{
|
||||||
|
if (tc.intrinsic_dimension() <= 3)
|
||||||
|
{
|
||||||
|
std::stringstream output_filename;
|
||||||
|
output_filename << "output/" << input_name_stripped << "_"
|
||||||
|
<< tc.intrinsic_dimension() << "_in_R"
|
||||||
|
<< tc.ambient_dimension() << suffix << ".off";
|
||||||
|
std::ofstream off_stream(output_filename.str().c_str());
|
||||||
|
|
||||||
|
if (p_complex)
|
||||||
|
{
|
||||||
|
tc.export_to_off(
|
||||||
|
*p_complex, off_stream,
|
||||||
|
p_simpl_to_color_in_red,
|
||||||
|
p_simpl_to_color_in_green,
|
||||||
|
p_simpl_to_color_in_blue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef CGAL_ALPHA_TC
|
||||||
|
TC::Simplicial_complex complex;
|
||||||
|
tc.export_TC(complex, false);
|
||||||
|
tc.export_to_off(
|
||||||
|
complex, off_stream,
|
||||||
|
p_simpl_to_color_in_red,
|
||||||
|
p_simpl_to_color_in_green,
|
||||||
|
p_simpl_to_color_in_blue);
|
||||||
|
#else
|
||||||
|
tc.export_to_off(
|
||||||
|
off_stream, color_inconsistencies,
|
||||||
|
p_simpl_to_color_in_red,
|
||||||
|
p_simpl_to_color_in_green,
|
||||||
|
p_simpl_to_color_in_blue);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void make_tc(std::vector<Point> &points,
|
||||||
|
int intrinsic_dim,
|
||||||
|
double sparsity = 0.,
|
||||||
|
bool perturb = true,
|
||||||
|
bool add_high_dim_simpl = false,
|
||||||
|
bool collapse = false,
|
||||||
|
double time_limit_for_perturb = 0.,
|
||||||
const char *input_name = "tc")
|
const char *input_name = "tc")
|
||||||
{
|
{
|
||||||
|
// CJTODO TEMP TEST
|
||||||
|
//TC::Simplicial_complex compl;
|
||||||
|
//{std::size_t ss[] = {0, 1, 2}; compl.add_simplex(std::set<std::size_t>(ss, ss + 3)); }
|
||||||
|
//{std::size_t ss[] = {0, 2, 3}; compl.add_simplex(std::set<std::size_t>(ss, ss + 3)); }
|
||||||
|
//{std::size_t ss[] = {0, 3, 4}; compl.add_simplex(std::set<std::size_t>(ss, ss + 3)); }
|
||||||
|
//{std::size_t ss[] = {0, 4, 1}; compl.add_simplex(std::set<std::size_t>(ss, ss + 3)); }
|
||||||
|
//{std::size_t ss[] = {0, 5, 6}; compl.add_simplex(std::set<std::size_t>(ss, ss + 3)); }
|
||||||
|
//compl.is_pure_pseudomanifold(2, 7, false, 10);
|
||||||
|
|
||||||
|
//TC::Simplicial_complex compl;
|
||||||
|
//{std::size_t ss[] = {0, 1, 2, 5}; compl.add_simplex(std::set<std::size_t>(ss, ss + 4)); }
|
||||||
|
//{std::size_t ss[] = {0, 2, 3, 5}; compl.add_simplex(std::set<std::size_t>(ss, ss + 4)); }
|
||||||
|
//{std::size_t ss[] = {0, 3, 4, 5}; compl.add_simplex(std::set<std::size_t>(ss, ss + 4)); }
|
||||||
|
//{std::size_t ss[] = {0, 4, 1, 5}; compl.add_simplex(std::set<std::size_t>(ss, ss + 4)); }
|
||||||
|
//{std::size_t ss[] = {0, 1, 2, 6}; compl.add_simplex(std::set<std::size_t>(ss, ss + 4)); }
|
||||||
|
//{std::size_t ss[] = {0, 2, 3, 6}; compl.add_simplex(std::set<std::size_t>(ss, ss + 4)); }
|
||||||
|
//{std::size_t ss[] = {0, 3, 4, 6}; compl.add_simplex(std::set<std::size_t>(ss, ss + 4)); }
|
||||||
|
//{std::size_t ss[] = {0, 4, 1, 6}; compl.add_simplex(std::set<std::size_t>(ss, ss + 4)); }
|
||||||
|
//{std::size_t ss[] = {0, 4, 7, 8}; compl.add_simplex(std::set<std::size_t>(ss, ss + 4)); }
|
||||||
|
//compl.is_pure_pseudomanifold(3, 9, false, 10);
|
||||||
|
// /CJTODO TEMP TEST
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// Init
|
||||||
|
//===========================================================================
|
||||||
Kernel k;
|
Kernel k;
|
||||||
Wall_clock_timer t;
|
Wall_clock_timer t;
|
||||||
|
|
||||||
|
// Get input_name_stripped
|
||||||
std::string input_name_stripped(input_name);
|
std::string input_name_stripped(input_name);
|
||||||
size_t slash_index = input_name_stripped.find_last_of('/');
|
size_t slash_index = input_name_stripped.find_last_of('/');
|
||||||
if (slash_index == std::string::npos)
|
if (slash_index == std::string::npos)
|
||||||
|
|
@ -160,6 +243,9 @@ void make_tc(std::vector<Point> &points, int intrinsic_dim,
|
||||||
std::vector<Point> points_not_sparse = points;
|
std::vector<Point> points_not_sparse = points;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// Sparsify point set if requested
|
||||||
|
//===========================================================================
|
||||||
if (sparsity != 0.)
|
if (sparsity != 0.)
|
||||||
{
|
{
|
||||||
std::size_t num_points_before = points.size();
|
std::size_t num_points_before = points.size();
|
||||||
|
|
@ -171,6 +257,10 @@ void make_tc(std::vector<Point> &points, int intrinsic_dim,
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Sparsity", sparsity);
|
CGAL_TC_SET_PERFORMANCE_DATA("Sparsity", sparsity);
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Num_points", points.size());
|
CGAL_TC_SET_PERFORMANCE_DATA("Num_points", points.size());
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// Compute Tangential Complex
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
#ifdef USE_ANOTHER_POINT_SET_FOR_TANGENT_SPACE_ESTIM
|
#ifdef USE_ANOTHER_POINT_SET_FOR_TANGENT_SPACE_ESTIM
|
||||||
TC tc(points.begin(), points.end(), sparsity, intrinsic_dim,
|
TC tc(points.begin(), points.end(), sparsity, intrinsic_dim,
|
||||||
points_not_sparse.begin(), points_not_sparse.end(), k);
|
points_not_sparse.begin(), points_not_sparse.end(), k);
|
||||||
|
|
@ -183,8 +273,10 @@ void make_tc(std::vector<Point> &points, int intrinsic_dim,
|
||||||
tc.compute_tangential_complex();
|
tc.compute_tangential_complex();
|
||||||
double computation_time = t.elapsed(); t.reset();
|
double computation_time = t.elapsed(); t.reset();
|
||||||
|
|
||||||
// CJTODO TEMP ===========================
|
//===========================================================================
|
||||||
{
|
// CJTODO TEMP
|
||||||
|
//===========================================================================
|
||||||
|
/*{
|
||||||
TC::Simplicial_complex complex;
|
TC::Simplicial_complex complex;
|
||||||
int max_dim = tc.export_TC(complex, false);
|
int max_dim = tc.export_TC(complex, false);
|
||||||
complex.display_stats();
|
complex.display_stats();
|
||||||
|
|
@ -204,42 +296,46 @@ void make_tc(std::vector<Point> &points, int intrinsic_dim,
|
||||||
std::ofstream off_stream(output_filename.str().c_str());
|
std::ofstream off_stream(output_filename.str().c_str());
|
||||||
tc.export_to_off(complex, off_stream);
|
tc.export_to_off(complex, off_stream);
|
||||||
}
|
}
|
||||||
std::size_t num_wrong_dim_simplices, num_wrong_number_of_cofaces;
|
std::size_t num_wrong_dim_simplices,
|
||||||
bool pure_manifold = complex.is_pure_manifold(
|
num_wrong_number_of_cofaces,
|
||||||
intrinsic_dim, false, 1,
|
num_unconnected_stars;
|
||||||
&num_wrong_dim_simplices, &num_wrong_number_of_cofaces);
|
bool pure_manifold = complex.is_pure_pseudomanifold(
|
||||||
|
intrinsic_dim, tc.number_of_vertices(), false, 1,
|
||||||
|
&num_wrong_dim_simplices, &num_wrong_number_of_cofaces,
|
||||||
|
&num_unconnected_stars);
|
||||||
complex.display_stats();
|
complex.display_stats();
|
||||||
}
|
}
|
||||||
|
return;*/
|
||||||
return;
|
|
||||||
// CJTODO TEMP ===========================
|
// CJTODO TEMP ===========================
|
||||||
|
|
||||||
//tc.check_if_all_simplices_are_in_the_ambient_delaunay();
|
//tc.check_if_all_simplices_are_in_the_ambient_delaunay();
|
||||||
|
|
||||||
double export_before_time = -1.;
|
//===========================================================================
|
||||||
if (intrinsic_dim <= 3)
|
// Export to OFF
|
||||||
|
//===========================================================================
|
||||||
|
t.reset();
|
||||||
|
double export_before_time =
|
||||||
|
(export_to_off(tc, input_name_stripped, "_BEFORE_FIX") ? t.elapsed() : -1);
|
||||||
|
t.reset();
|
||||||
|
|
||||||
|
unsigned int num_perturb_steps = 0;
|
||||||
|
double perturb_time = -1;
|
||||||
|
double export_after_perturb_time = -1.;
|
||||||
|
CGAL::Fix_inconsistencies_status perturb_ret = CGAL::FIX_NOT_PERFORMED;
|
||||||
|
if (perturb)
|
||||||
{
|
{
|
||||||
|
//=========================================================================
|
||||||
|
// Try to fix inconsistencies by perturbing points
|
||||||
|
//=========================================================================
|
||||||
t.reset();
|
t.reset();
|
||||||
std::stringstream output_filename;
|
|
||||||
output_filename << "output/" << input_name_stripped << "_" << intrinsic_dim
|
|
||||||
<< "_in_R" << ambient_dim << "_BEFORE_FIX.off";
|
|
||||||
std::ofstream off_stream(output_filename.str().c_str());
|
|
||||||
tc.export_to_off(off_stream, true);
|
|
||||||
export_before_time = t.elapsed(); t.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
t.reset();
|
|
||||||
unsigned int num_fix_steps;
|
|
||||||
std::size_t initial_num_inconsistent_local_tr;
|
std::size_t initial_num_inconsistent_local_tr;
|
||||||
std::size_t best_num_inconsistent_local_tr;
|
std::size_t best_num_inconsistent_local_tr;
|
||||||
std::size_t final_num_inconsistent_local_tr;
|
std::size_t final_num_inconsistent_local_tr;
|
||||||
CGAL::Fix_inconsistencies_status fix_ret = tc.fix_inconsistencies(
|
perturb_ret = tc.fix_inconsistencies(
|
||||||
num_fix_steps, initial_num_inconsistent_local_tr,
|
num_perturb_steps, initial_num_inconsistent_local_tr,
|
||||||
best_num_inconsistent_local_tr, final_num_inconsistent_local_tr,
|
best_num_inconsistent_local_tr, final_num_inconsistent_local_tr,
|
||||||
time_limit_for_fix);
|
time_limit_for_perturb);
|
||||||
double fix_time = t.elapsed(); t.reset();
|
perturb_time = t.elapsed(); t.reset();
|
||||||
|
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Initial_num_inconsistent_local_tr",
|
CGAL_TC_SET_PERFORMANCE_DATA("Initial_num_inconsistent_local_tr",
|
||||||
initial_num_inconsistent_local_tr);
|
initial_num_inconsistent_local_tr);
|
||||||
|
|
@ -248,96 +344,142 @@ void make_tc(std::vector<Point> &points, int intrinsic_dim,
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Final_num_inconsistent_local_tr",
|
CGAL_TC_SET_PERFORMANCE_DATA("Final_num_inconsistent_local_tr",
|
||||||
final_num_inconsistent_local_tr);
|
final_num_inconsistent_local_tr);
|
||||||
|
|
||||||
double export_after_fix_time = -1.;
|
//=========================================================================
|
||||||
if (intrinsic_dim <= 3)
|
// Export to OFF
|
||||||
{
|
//=========================================================================
|
||||||
t.reset();
|
t.reset();
|
||||||
std::stringstream output_filename;
|
bool exported = export_to_off(tc, input_name_stripped, "_AFTER_FIX", true);
|
||||||
output_filename << "output/" << input_name_stripped << "_" << intrinsic_dim
|
double export_after_perturb_time = (exported ? t.elapsed() : -1);
|
||||||
<< "_in_R" << ambient_dim << "_AFTER_FIX.off";
|
t.reset();
|
||||||
std::ofstream off_stream(output_filename.str().c_str());
|
}
|
||||||
tc.export_to_off(off_stream, true);
|
else
|
||||||
export_after_fix_time = t.elapsed(); t.reset();
|
{
|
||||||
|
CGAL_TC_SET_PERFORMANCE_DATA("Initial_num_inconsistent_local_tr", "N/A");
|
||||||
|
CGAL_TC_SET_PERFORMANCE_DATA("Best_num_inconsistent_local_tr", "N/A");
|
||||||
|
CGAL_TC_SET_PERFORMANCE_DATA("Final_num_inconsistent_local_tr", "N/A");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int max_dim = -1;
|
||||||
|
double fix2_time = -1;
|
||||||
|
double export_after_fix2_time = -1.;
|
||||||
|
TC::Simplicial_complex complex;
|
||||||
|
if (add_high_dim_simpl)
|
||||||
|
{
|
||||||
|
//=========================================================================
|
||||||
|
// Try to fix inconsistencies by adding higher-dimension simplices
|
||||||
|
//=========================================================================
|
||||||
t.reset();
|
t.reset();
|
||||||
// Try to solve the remaining inconstencies
|
// Try to solve the remaining inconstencies
|
||||||
tc.check_and_solve_inconsistencies_by_adding_higher_dim_simplices();
|
tc.check_and_solve_inconsistencies_by_adding_higher_dim_simplices();
|
||||||
double fix2_time = t.elapsed(); t.reset();
|
fix2_time = t.elapsed(); t.reset();
|
||||||
TC::Simplicial_complex complex;
|
max_dim = tc.export_TC(complex, false);
|
||||||
int max_dim = tc.export_TC(complex, false);
|
/*std::set<std::set<std::size_t> > not_delaunay_simplices;
|
||||||
std::set<std::set<std::size_t> > not_delaunay_simplices;
|
if (ambient_dim <= 4)
|
||||||
/*if (ambient_dim <= 4)
|
|
||||||
{
|
{
|
||||||
tc.check_if_all_simplices_are_in_the_ambient_delaunay(
|
tc.check_if_all_simplices_are_in_the_ambient_delaunay(
|
||||||
&complex, true, ¬_delaunay_simplices);
|
&complex, true, ¬_delaunay_simplices);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
double export_after_fix2_time = -1.;
|
//=========================================================================
|
||||||
if (intrinsic_dim <= 3)
|
// Export to OFF
|
||||||
{
|
//=========================================================================
|
||||||
t.reset();
|
t.reset();
|
||||||
std::stringstream output_filename;
|
bool exported = export_to_off(
|
||||||
output_filename << "output/" << input_name_stripped << "_" << intrinsic_dim
|
tc, input_name_stripped, "_AFTER_FIX2", false, &complex);
|
||||||
<< "_in_R" << ambient_dim << "_AFTER_FIX2.off";
|
double export_after_fix2_time = (exported ? t.elapsed() : -1);
|
||||||
std::ofstream off_stream(output_filename.str().c_str());
|
|
||||||
tc.export_to_off(complex, off_stream, ¬_delaunay_simplices);
|
|
||||||
export_after_fix2_time = t.elapsed(); t.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collapse
|
|
||||||
//complex.collapse(max_dim);
|
|
||||||
|
|
||||||
double export_after_collapse_time = -1.;
|
|
||||||
if (intrinsic_dim <= 3)
|
|
||||||
{
|
|
||||||
t.reset();
|
t.reset();
|
||||||
std::stringstream output_filename;
|
|
||||||
output_filename << "output/" << input_name_stripped << "_" << intrinsic_dim
|
|
||||||
<< "_in_R" << ambient_dim << "_AFTER_COLLAPSE.off";
|
|
||||||
std::ofstream off_stream(output_filename.str().c_str());
|
|
||||||
tc.export_to_off(complex, off_stream);
|
|
||||||
export_after_collapse_time = t.elapsed(); t.reset();
|
|
||||||
}
|
}
|
||||||
std::size_t num_wrong_dim_simplices, num_wrong_number_of_cofaces;
|
else
|
||||||
bool pure_manifold = complex.is_pure_manifold(
|
{
|
||||||
intrinsic_dim, false, 0,
|
max_dim = tc.export_TC(complex, false);
|
||||||
&num_wrong_dim_simplices, &num_wrong_number_of_cofaces);
|
}
|
||||||
|
|
||||||
complex.display_stats();
|
complex.display_stats();
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// Collapse
|
||||||
|
//===========================================================================
|
||||||
|
std::cerr << max_dim << std::endl;
|
||||||
|
if (collapse)
|
||||||
|
complex.collapse(max_dim);
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// Is the result a pure pseudomanifold?
|
||||||
|
//===========================================================================
|
||||||
|
std::size_t num_wrong_dim_simplices,
|
||||||
|
num_wrong_number_of_cofaces,
|
||||||
|
num_unconnected_stars;
|
||||||
|
std::set<std::set<std::size_t> > wrong_dim_simplices;
|
||||||
|
std::set<std::set<std::size_t> > wrong_number_of_cofaces_simplices;
|
||||||
|
std::set<std::set<std::size_t> > unconnected_stars_simplices;
|
||||||
|
bool is_pure_pseudomanifold = complex.is_pure_pseudomanifold(
|
||||||
|
intrinsic_dim, tc.number_of_vertices(), false, 1,
|
||||||
|
&num_wrong_dim_simplices, &num_wrong_number_of_cofaces,
|
||||||
|
&num_unconnected_stars,
|
||||||
|
&wrong_dim_simplices, &wrong_number_of_cofaces_simplices,
|
||||||
|
&unconnected_stars_simplices);
|
||||||
|
|
||||||
|
// Stats about the simplices
|
||||||
|
complex.display_stats();
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// Export to OFF
|
||||||
|
//===========================================================================
|
||||||
|
t.reset();
|
||||||
|
bool exported = export_to_off(
|
||||||
|
tc, input_name_stripped, "_AFTER_COLLAPSE", false, &complex,
|
||||||
|
&wrong_dim_simplices, &wrong_number_of_cofaces_simplices,
|
||||||
|
&unconnected_stars_simplices);
|
||||||
|
std::cerr
|
||||||
|
<< " OFF colors:" << std::endl
|
||||||
|
<< " * Red: wrong dim simplices" << std::endl
|
||||||
|
<< " * Green: wrong number of cofaces simplices" << std::endl
|
||||||
|
<< " * Blue: not-connected stars" << std::endl;
|
||||||
|
double export_after_collapse_time = (exported ? t.elapsed() : -1);
|
||||||
|
t.reset();
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// Display info
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
std::cerr << std::endl
|
std::cerr << std::endl
|
||||||
<< "================================================" << std::endl
|
<< "================================================" << std::endl
|
||||||
<< "Number of vertices: " << tc.number_of_vertices() << std::endl
|
<< "Number of vertices: " << tc.number_of_vertices() << std::endl
|
||||||
<< "Pure manifold: " << (pure_manifold ? "YES" : "NO") << std::endl
|
<< "Pure pseudomanifold: " << (is_pure_pseudomanifold ? "YES" : "NO") << std::endl
|
||||||
<< "Computation times (seconds): " << std::endl
|
<< "Computation times (seconds): " << std::endl
|
||||||
<< " * Tangential complex: " << init_time + computation_time
|
<< " * Tangential complex: " << init_time + computation_time << std::endl
|
||||||
<< std::endl
|
|
||||||
<< " - Init + kd-tree = " << init_time << std::endl
|
<< " - Init + kd-tree = " << init_time << std::endl
|
||||||
<< " - TC computation = " << computation_time << std::endl
|
<< " - TC computation = " << computation_time << std::endl
|
||||||
<< " * Export to OFF (before fix): " << export_before_time << std::endl
|
<< " * Export to OFF (before perturb): " << export_before_time << std::endl
|
||||||
<< " * Fix inconsistencies 1: " << fix_time
|
<< " * Fix inconsistencies 1: " << perturb_time
|
||||||
<< " (" << num_fix_steps << " steps) ==> "
|
<< " (" << num_perturb_steps << " steps) ==> "
|
||||||
<< (fix_ret == CGAL::TC_FIXED ? "FIXED" : "NOT fixed") << std::endl
|
<< (perturb_ret == CGAL::TC_FIXED ? "FIXED" : "NOT fixed") << std::endl
|
||||||
<< " * Fix inconsistencies 2: " << fix2_time << std::endl
|
<< " * Fix inconsistencies 2: " << fix2_time << std::endl
|
||||||
<< " * Export to OFF (after fix): " << export_after_fix_time << std::endl
|
<< " * Export to OFF (after perturb): " << export_after_perturb_time << std::endl
|
||||||
<< " * Export to OFF (after fix2): "<< export_after_fix2_time << std::endl
|
<< " * Export to OFF (after fix2): "<< export_after_fix2_time << std::endl
|
||||||
<< " * Export to OFF (after collapse): "
|
<< " * Export to OFF (after collapse): "
|
||||||
<< export_after_collapse_time << std::endl
|
<< export_after_collapse_time << std::endl
|
||||||
<< "================================================" << std::endl
|
<< "================================================" << std::endl
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// Export info
|
||||||
|
//===========================================================================
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Init_time", init_time);
|
CGAL_TC_SET_PERFORMANCE_DATA("Init_time", init_time);
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Comput_time", computation_time);
|
CGAL_TC_SET_PERFORMANCE_DATA("Comput_time", computation_time);
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Fix1_successful",
|
CGAL_TC_SET_PERFORMANCE_DATA("Perturb_successful",
|
||||||
(fix_ret == CGAL::TC_FIXED ? "Y" : "N"));
|
(perturb_ret == CGAL::TC_FIXED ? "Y" : "N"));
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Fix1_time", fix_time);
|
CGAL_TC_SET_PERFORMANCE_DATA("Perturb_time", perturb_time);
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Fix1_steps", num_fix_steps);
|
CGAL_TC_SET_PERFORMANCE_DATA("Perturb_steps", num_perturb_steps);
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Fix2_pure_manifold",
|
CGAL_TC_SET_PERFORMANCE_DATA("Add_higher_dim_simpl_time", fix2_time);
|
||||||
(pure_manifold ? "Y" : "N"));
|
CGAL_TC_SET_PERFORMANCE_DATA("Result_pure_pseudomanifold",
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Fix2_num_wrong_number_of_cofaces",
|
(is_pure_pseudomanifold ? "Y" : "N"));
|
||||||
|
CGAL_TC_SET_PERFORMANCE_DATA("Result_num_wrong_dim_simplices",
|
||||||
|
num_wrong_dim_simplices);
|
||||||
|
CGAL_TC_SET_PERFORMANCE_DATA("Result_num_wrong_number_of_cofaces",
|
||||||
num_wrong_number_of_cofaces);
|
num_wrong_number_of_cofaces);
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Fix2_time", fix2_time);
|
CGAL_TC_SET_PERFORMANCE_DATA("Result_num_unconnected_stars",
|
||||||
|
num_unconnected_stars);
|
||||||
CGAL_TC_SET_PERFORMANCE_DATA("Info", "");
|
CGAL_TC_SET_PERFORMANCE_DATA("Info", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -406,7 +548,8 @@ int main()
|
||||||
int ambient_dim;
|
int ambient_dim;
|
||||||
int intrinsic_dim;
|
int intrinsic_dim;
|
||||||
double sparsity;
|
double sparsity;
|
||||||
double time_limit_for_fix;
|
char perturb, add_high_dim_simpl, collapse;
|
||||||
|
double time_limit_for_perturb;
|
||||||
int num_iteration;
|
int num_iteration;
|
||||||
sstr >> input;
|
sstr >> input;
|
||||||
sstr >> param1;
|
sstr >> param1;
|
||||||
|
|
@ -416,7 +559,10 @@ int main()
|
||||||
sstr >> ambient_dim;
|
sstr >> ambient_dim;
|
||||||
sstr >> intrinsic_dim;
|
sstr >> intrinsic_dim;
|
||||||
sstr >> sparsity;
|
sstr >> sparsity;
|
||||||
sstr >> time_limit_for_fix;
|
sstr >> perturb;
|
||||||
|
sstr >> add_high_dim_simpl;
|
||||||
|
sstr >> collapse;
|
||||||
|
sstr >> time_limit_for_perturb;
|
||||||
sstr >> num_iteration;
|
sstr >> num_iteration;
|
||||||
|
|
||||||
for (int j = 0 ; j < num_iteration ; ++j)
|
for (int j = 0 ; j < num_iteration ; ++j)
|
||||||
|
|
@ -490,7 +636,8 @@ int main()
|
||||||
if (!points.empty())
|
if (!points.empty())
|
||||||
{
|
{
|
||||||
make_tc(points, intrinsic_dim, sparsity,
|
make_tc(points, intrinsic_dim, sparsity,
|
||||||
time_limit_for_fix, input.c_str());
|
perturb=='Y', add_high_dim_simpl=='Y', collapse=='Y',
|
||||||
|
time_limit_for_perturb, input.c_str());
|
||||||
|
|
||||||
std::cerr << "TC #" << i++ << " done." << std::endl;
|
std::cerr << "TC #" << i++ << " done." << std::endl;
|
||||||
std::cerr << std::endl << "---------------------------------"
|
std::cerr << std::endl << "---------------------------------"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue