More stats + fixed a bug when there are infinite cells in the star

This commit is contained in:
Clement Jamin 2015-01-28 16:06:36 +01:00
parent b42bdf8c3c
commit 19a229254a
2 changed files with 35 additions and 9 deletions

View File

@ -83,8 +83,11 @@ protected:
subelements.push_back("Input");
subelements.push_back("Intrinsic_dim");
subelements.push_back("Ambient_dim");
subelements.push_back("Num_points");
subelements.push_back("Sparsity");
subelements.push_back("Num_points_in_input");
subelements.push_back("Num_points");
subelements.push_back("Initial_num_inconsistent_local_tr");
subelements.push_back("Best_num_inconsistent_local_tr");
subelements.push_back("Init_time");
subelements.push_back("Comput_time");
subelements.push_back("Fix_successful");
@ -119,7 +122,8 @@ protected:
};
void make_tc(std::vector<Point> &points, int intrinsic_dim,
double sparsity = 0., double time_limit_for_fix = 0.)
double sparsity = 0., double time_limit_for_fix = 0.,
const char *input_name = "tc")
{
Kernel k;
Wall_clock_timer t;
@ -134,6 +138,8 @@ void make_tc(std::vector<Point> &points, int intrinsic_dim,
std::cerr << "Point set generated in " << t_gen.elapsed()
<< " seconds." << std::endl;
#endif
CGAL_TC_SET_PERFORMANCE_DATA("Num_points_in_input", points.size());
if (sparsity != 0.)
{
@ -144,8 +150,8 @@ void make_tc(std::vector<Point> &points, int intrinsic_dim,
<< num_points_before << " / " << points.size() << std::endl;
}
CGAL_TC_SET_PERFORMANCE_DATA("Num_points", points.size());
CGAL_TC_SET_PERFORMANCE_DATA("Sparsity", sparsity);
CGAL_TC_SET_PERFORMANCE_DATA("Num_points", points.size());
TC tc(points.begin(), points.end(), intrinsic_dim, k);
double init_time = t.elapsed(); t.reset();
@ -161,7 +167,7 @@ void make_tc(std::vector<Point> &points, int intrinsic_dim,
{
t.reset();
std::stringstream output_filename;
output_filename << "output/test_tc_" << intrinsic_dim
output_filename << "output/" << input_name << "_" << 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, &incorrect_simplices, true);
@ -171,16 +177,24 @@ void make_tc(std::vector<Point> &points, int intrinsic_dim,
t.reset();
unsigned int num_fix_steps;
CGAL::Fix_inconsistencies_status fix_ret =
tc.fix_inconsistencies(num_fix_steps, time_limit_for_fix);
std::size_t initial_num_inconsistent_local_tr;
std::size_t best_num_inconsistent_local_tr;
CGAL::Fix_inconsistencies_status fix_ret = tc.fix_inconsistencies(
num_fix_steps, initial_num_inconsistent_local_tr,
best_num_inconsistent_local_tr, time_limit_for_fix);
double fix_time = t.elapsed(); t.reset();
CGAL_TC_SET_PERFORMANCE_DATA("Initial_num_inconsistent_local_tr",
initial_num_inconsistent_local_tr);
CGAL_TC_SET_PERFORMANCE_DATA("Best_num_inconsistent_local_tr",
best_num_inconsistent_local_tr);
double export_after_time = -1.;
if (intrinsic_dim <= 3)
{
t.reset();
std::stringstream output_filename;
output_filename << "output/test_tc_" << intrinsic_dim
output_filename << "output/" << input_name << "_" << intrinsic_dim
<< "_in_R" << ambient_dim << "_AFTER_FIX.off";
std::ofstream off_stream(output_filename.str().c_str());
tc.export_to_off(off_stream, true, &incorrect_simplices, true);
@ -362,7 +376,8 @@ int main()
if (!points.empty())
{
make_tc(points, intrinsic_dim, sparsity, time_limit_for_fix);
make_tc(points, intrinsic_dim, sparsity,
time_limit_for_fix, input.c_str());
std::cerr << "TC #" << i++ << " done." << std::endl;
std::cerr << std::endl << "---------------------------------"

View File

@ -338,7 +338,8 @@ public:
// time_limit in seconds
Fix_inconsistencies_status fix_inconsistencies(
unsigned int &num_steps, double time_limit = 0.)
unsigned int &num_steps, std::size_t &initial_num_inconsistent_local_tr,
std::size_t &best_num_inconsistent_local_tr, double time_limit = 0.)
{
Wall_clock_timer t;
@ -368,6 +369,7 @@ public:
#endif // CGAL_TC_SHOW_DETAILED_STATS_FOR_INCONSISTENCIES
bool done = false;
best_num_inconsistent_local_tr = m_triangulations.size();
num_steps = 0;
while (!done)
{
@ -454,6 +456,12 @@ public:
# endif
#endif // CGAL_TC_SHOW_DETAILED_STATS_FOR_INCONSISTENCIES
if (num_steps == 0)
initial_num_inconsistent_local_tr = num_inconsistent_local_tr;
if (num_inconsistent_local_tr < best_num_inconsistent_local_tr)
best_num_inconsistent_local_tr = num_inconsistent_local_tr;
++num_steps;
done = (num_inconsistent_local_tr == 0);
if (time_limit != 0 && t.elapsed() > time_limit)
@ -1268,6 +1276,9 @@ private:
// For each cell
for ( ; it_c != it_c_end ; ++it_c)
{
if (tr.is_infinite(*it_c)) // Don't check infinite cells
continue;
//*****************************************************************************
// STRATEGY 1: perturb all the points of the first inconsistent simplex
//*****************************************************************************