Improve reporting

This commit is contained in:
Andreas Fabri 2022-03-30 14:17:58 +01:00
parent ef19ead48a
commit 0afbfc9c65
4 changed files with 105 additions and 22 deletions

View File

@ -43,6 +43,40 @@ struct Visitor_rep{
}
}
void start_coplanar_faces(int tc)
{
std::cout << "Visitor::start_coplanar_faces() at " << t.time() << " sec." << std::endl;
tcoplanar= tc;
count_coplanar = 0;
bound_coplanar = tcoplanar/10;
}
void coplanar_faces_step()
{
++count_coplanar;
if(count_coplanar> bound_coplanar){
std::cout << "Visitor::coplanar_faces: " << double(count_coplanar)/double(tcoplanar) * 100 << " % " << std::endl;
bound_coplanar += tcoplanar/10;
}
}
void start_intersection_points(int ti)
{
std::cout << "Visitor::start_intersection_points() at " << t.time() << " sec." << std::endl;
tintersection= ti;
count_intersection = 0;
bound_intersection = tintersection/10;
}
void intersection_points_step()
{
++count_intersection;
if(count_intersection> bound_intersection){
std::cout << "Visitor::intersection_points: " << double(count_intersection)/double(tintersection) * 100 << " % " << std::endl;
bound_intersection += tintersection/10;
}
}
double time() const
{
return t.time();
@ -55,6 +89,14 @@ struct Visitor_rep{
int bound_faces = 0;
int tfaces = 0;
int bound_coplanar = 0;
int tcoplanar = 0;
int count_coplanar = 0;
int bound_intersection = 0;
int tintersection = 0;
int count_intersection = 0;
CGAL::Timer t;
};
@ -75,16 +117,16 @@ struct Visitor :
void start_filter_intersections() const
{
std::cout << "Visitor::start_filter_intersections() at " << sptr->time() << std::endl;
std::cout << "Visitor::start_filter_intersections() at " << sptr->time() << " sec." << std::endl;
}
void end_filter_intersections() const
{
std::cout << "Visitor::end_filter_intersections() at " << sptr->time() << std::endl;
std::cout << "Visitor::end_filter_intersections() at " << sptr->time() << " sec." << std::endl;
}
void start_triangulation(int tf)const
{
std::cout << "Visitor::start_triangulation() with " << tf << " faces at " << sptr->time() << std::endl;
std::cout << "Visitor::start_triangulation() with " << tf << " faces at " << sptr->time() << " sec." << std::endl;
sptr->start_triangulation(tf);
}
@ -95,37 +137,52 @@ struct Visitor :
void end_triangulation()const
{
std::cout << "Visitor::end_triangulation() at " << sptr->time() << std::endl;
std::cout << "Visitor::end_triangulation() at " << sptr->time() << " sec." << std::endl;
}
void start_coplanar_faces(int) const
void start_coplanar_faces(int i) const
{
std::cout << "Visitor::start_coplanar_faces() at " << sptr->time() << std::endl;
sptr->start_coplanar_faces(i);
}
void coplanar_faces_step() const
{
std::cout << "Visitor::coplanar_faces_step() at " << sptr->time() << std::endl;
sptr->coplanar_faces_step();
}
void end_coplanar_faces() const
{
std::cout << "Visitor::end_coplanar_faces() at " << sptr->time() << std::endl;
std::cout << "Visitor::end_coplanar_faces() at " << sptr->time() << " sec." << std::endl;
}
void start_intersection_points(int i) const
{
sptr->start_intersection_points(i);
}
void intersection_points_step() const
{
sptr->intersection_points_step();
}
void end_intersection_points() const
{
std::cout << "Visitor::end_intersection_points() at " << sptr->time() << " sec." << std::endl;
}
void start_build_output() const
{
std::cout << "Visitor::start_build_output() at " << sptr->time() << std::endl;
std::cout << "Visitor::start_build_output() at " << sptr->time() << " sec."<< std::endl;
}
void build_output_step() const
{
std::cout << "Visitor::build_output_step() at " << sptr->time() << std::endl;
std::cout << "Visitor::build_output_step() at " << sptr->time() << " sec." << std::endl;
}
void end_build_output() const
{
std::cout << "Visitor::end_build_output() at " << sptr->time() << std::endl;
std::cout << "Visitor::end_build_output() at " << sptr->time() << " sec." << std::endl;
}
};
@ -146,10 +203,10 @@ int main(int argc, char* argv[])
t.start();
Mesh out;
Visitor visitor;
// PMP::corefine(mesh1,mesh2, CGAL::parameters::visitor(visitor));
bool valid_union = PMP::corefine_and_compute_union (mesh1,mesh2, out, CGAL::parameters::visitor(visitor));
std::cout << "total time = " << t.time() << std::endl;
std::cout << "Global timer = " << t.time() << " sec." << std::endl;
if(valid_union)

View File

@ -570,19 +570,19 @@ public:
}
void start_build_output() const
void start_intersection_points(int i) const
{
user_visitor.start_build_output();
user_visitor.start_intersection_points(i);
}
void build_output_step() const
void intersection_points_step() const
{
user_visitor.build_output_step();
user_visitor.intersection_points_step();
}
void end_build_output() const
void end_intersection_points() const
{
user_visitor.end_build_output();
user_visitor.end_intersection_points();
}
void start_coplanar_faces(int i) const
@ -600,6 +600,21 @@ public:
user_visitor.end_coplanar_faces();
}
void start_build_output() const
{
user_visitor.start_build_output();
}
void build_output_step() const
{
user_visitor.build_output_step();
}
void end_build_output() const
{
user_visitor.end_build_output();
}
void
set_non_manifold_feature_map(
const TriangleMesh& tm,

View File

@ -465,15 +465,23 @@ struct Default_visitor{
void start_filter_intersections() const {}
void progress_filter_intersection(double ) const {}
void end_filter_intersections() const {}
void start_triangulation(int) const {}
void progress_triangulation(int) const {}
void end_triangulation() const {}
void start_coplanar_faces(int) const {}
void coplanar_faces_step() const {}
void end_coplanar_faces() const {}
void start_intersection_points(int) const {}
void intersection_points_step() const {}
void end_intersection_points() const {}
void start_build_output() const {}
void build_output_step() const {}
void end_build_output() const {}
void start_coplanar_faces() const {}
void coplanar_faces_step() const {}
void end_coplanar_faces() const {}
// calls commented in the code and probably incomplete due to the migration
// see NODE_VISITOR_TAG

View File

@ -854,10 +854,12 @@ class Intersection_of_triangle_meshes
{
typedef std::tuple<Intersection_type, halfedge_descriptor, bool,bool> Inter_type;
visitor.start_intersection_points(tm1_edge_to_tm2_faces.size());
for(typename Edge_to_faces::iterator it=tm1_edge_to_tm2_faces.begin();
it!=tm1_edge_to_tm2_faces.end();++it)
{
visitor.intersection_points_step();
edge_descriptor e_1=it->first;
halfedge_descriptor h_1=halfedge(e_1,tm1);
@ -1076,6 +1078,7 @@ class Intersection_of_triangle_meshes
} // end loop on all faces that intersect the edge
} // end loop on all entries (edges) in 'edge_to_face'
CGAL_assertion(nodes.size()==unsigned(current_node+1));
visitor.end_intersection_points();
}
struct Graph_node{