Added CGAL_TRACE_STREAM object (== cerr if DEBUG_TRACE is defined, else nothing)

This commit is contained in:
Laurent Saboret 2008-08-28 13:48:50 +00:00
parent a43c578eeb
commit 8f1e17abcf
7 changed files with 65 additions and 80 deletions

View File

@ -37,6 +37,7 @@
#include <CGAL/average_spacing_3.h>
#include <CGAL/merge_epsilon_nearest_points_3.h>
#include <CGAL/random_simplification_points_3.h>
#include <CGAL/surface_reconstruction_assertions.h>
// STL
#include <iostream>
@ -938,15 +939,13 @@ void CPoissonDoc::OnReconstructionPoissonSurfaceMeshing()
m_sm_radius*size, // upper bound of Delaunay balls radii
m_sm_distance_poisson*size); // upper bound of distance to surface
#ifdef DEBUG_TRACE
std::cerr << " make_surface_mesh(dichotomy error="<<m_sm_error_bound<<" * point set radius,\n"
<< " sphere center=("<<sm_sphere_center << "),\n"
<< " sphere radius="<<sm_sphere_radius/size<<" * p.s.r.,\n"
<< " angle="<<m_sm_angle << " degrees,\n"
<< " radius="<<m_sm_radius<<" * p.s.r.,\n"
<< " distance="<<m_sm_distance_poisson<<" * p.s.r.,\n"
<< " Non_manifold_tag)\n";
#endif
CGAL_TRACE_STREAM << " make_surface_mesh(dichotomy error="<<m_sm_error_bound<<" * point set radius,\n"
<< " sphere center=("<<sm_sphere_center << "),\n"
<< " sphere radius="<<sm_sphere_radius/size<<" * p.s.r.,\n"
<< " angle="<<m_sm_angle << " degrees,\n"
<< " radius="<<m_sm_radius<<" * p.s.r.,\n"
<< " distance="<<m_sm_distance_poisson<<" * p.s.r.,\n"
<< " Non_manifold_tag)\n";
// meshing surface
CGAL::make_surface_mesh(m_surface_mesher_c2t3, surface, criteria, CGAL::Non_manifold_tag());
@ -1241,9 +1240,7 @@ void CPoissonDoc::OnReconstructionApssReconstruction()
m_surface.clear();
// Create implicit function
#ifdef DEBUG_TRACE
std::cerr << " APSS_implicit_function(knn="<<m_number_of_neighbours << ")\n";
#endif
CGAL_TRACE_STREAM << " APSS_implicit_function(knn="<<m_number_of_neighbours << ")\n";
m_apss_function = new APSS_implicit_function(m_points.begin(), m_points.end(),
m_number_of_neighbours);
@ -1274,15 +1271,13 @@ void CPoissonDoc::OnReconstructionApssReconstruction()
m_sm_radius*size, // upper bound of Delaunay balls radii
m_sm_distance_apss*size); // upper bound of distance to surface
#ifdef DEBUG_TRACE
std::cerr << " make_surface_mesh(dichotomy error="<<m_sm_error_bound<<" * point set radius,\n"
<< " sphere center=("<<sm_sphere_center << "),\n"
<< " sphere radius="<<sm_sphere_radius/size<<" * p.s.r.,\n"
<< " angle="<<m_sm_angle << " degrees,\n"
<< " radius="<<m_sm_radius<<" * p.s.r.,\n"
<< " distance="<<m_sm_distance_apss<<" * p.s.r.,\n"
<< " Non_manifold_tag)\n";
#endif
CGAL_TRACE_STREAM << " make_surface_mesh(dichotomy error="<<m_sm_error_bound<<" * point set radius,\n"
<< " sphere center=("<<sm_sphere_center << "),\n"
<< " sphere radius="<<sm_sphere_radius/size<<" * p.s.r.,\n"
<< " angle="<<m_sm_angle << " degrees,\n"
<< " radius="<<m_sm_radius<<" * p.s.r.,\n"
<< " distance="<<m_sm_distance_apss<<" * p.s.r.,\n"
<< " Non_manifold_tag)\n";
// meshing surface
CGAL::make_surface_mesh(m_surface_mesher_c2t3, surface, criteria, CGAL::Non_manifold_tag());

View File

@ -28,6 +28,7 @@
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/IO/surface_reconstruction_output.h>
#include <CGAL/IO/surface_reconstruction_read_xyz.h>
#include <CGAL/surface_reconstruction_assertions.h>
// This test
#include "enriched_polyhedron.h"
@ -204,9 +205,7 @@ int main(int argc, char * argv[])
std::cerr << "Compute implicit function...\n";
// Create implicit function
#ifdef DEBUG_TRACE
std::cerr << " APSS_implicit_function(knn="<<number_of_neighbours << ")\n";
#endif
CGAL_TRACE_STREAM << " APSS_implicit_function(knn="<<number_of_neighbours << ")\n";
APSS_implicit_function apss_function(pwns.begin(), pwns.end(),
number_of_neighbours);
@ -252,15 +251,13 @@ int main(int argc, char * argv[])
sm_radius*size, // upper bound of Delaunay balls radii
sm_distance*size); // upper bound of distance to surface
#ifdef DEBUG_TRACE
std::cerr << " make_surface_mesh(dichotomy error="<<sm_error_bound<<" * point set radius,\n"
<< " sphere center=("<<sm_sphere_center << "),\n"
<< " sphere radius="<<sm_sphere_radius/size<<" * p.s.r.,\n"
<< " angle="<<sm_angle << " degrees,\n"
<< " radius="<<sm_radius<<" * p.s.r.,\n"
<< " distance="<<sm_distance<<" * p.s.r.,\n"
<< " Non_manifold_tag)\n";
#endif
CGAL_TRACE_STREAM << " make_surface_mesh(dichotomy error="<<sm_error_bound<<" * point set radius,\n"
<< " sphere center=("<<sm_sphere_center << "),\n"
<< " sphere radius="<<sm_sphere_radius/size<<" * p.s.r.,\n"
<< " angle="<<sm_angle << " degrees,\n"
<< " radius="<<sm_radius<<" * p.s.r.,\n"
<< " distance="<<sm_distance<<" * p.s.r.,\n"
<< " Non_manifold_tag)\n";
// meshing surface
CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());

View File

@ -33,6 +33,7 @@
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/IO/surface_reconstruction_output.h>
#include <CGAL/IO/surface_reconstruction_read_xyz.h>
#include <CGAL/surface_reconstruction_assertions.h>
// This test
#include "enriched_polyhedron.h"
@ -263,15 +264,13 @@ int main(int argc, char * argv[])
sm_radius*size, // upper bound of Delaunay balls radii
sm_distance*size); // upper bound of distance to surface
#ifdef DEBUG_TRACE
std::cerr << " make_surface_mesh(dichotomy error="<<sm_error_bound<<" * point set radius,\n"
<< " sphere center=("<<sm_sphere_center << "),\n"
<< " sphere radius="<<sm_sphere_radius/size<<" * p.s.r.,\n"
<< " angle="<<sm_angle << " degrees,\n"
<< " radius="<<sm_radius<<" * p.s.r.,\n"
<< " distance="<<sm_distance<<" * p.s.r.,\n"
<< " Non_manifold_tag)\n";
#endif
CGAL_TRACE_STREAM << " make_surface_mesh(dichotomy error="<<sm_error_bound<<" * point set radius,\n"
<< " sphere center=("<<sm_sphere_center << "),\n"
<< " sphere radius="<<sm_sphere_radius/size<<" * p.s.r.,\n"
<< " angle="<<sm_angle << " degrees,\n"
<< " radius="<<sm_radius<<" * p.s.r.,\n"
<< " distance="<<sm_distance<<" * p.s.r.,\n"
<< " Non_manifold_tag)\n";
// meshing surface
CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());

View File

@ -290,10 +290,8 @@ public:
/// TODO: add parameters to compute_implicit_function()?
bool compute_implicit_function()
{
#ifdef DEBUG_TRACE
CGAL::Timer task_timer; task_timer.start();
std::cerr << "Delaunay refinement...\n";
#endif
CGAL_TRACE_STREAM << "Delaunay refinement...\n";
// Delaunay refinement
int nb_vertices = m_dt.number_of_vertices();
@ -302,24 +300,20 @@ public:
const FT enlarge_ratio = 1.5;
delaunay_refinement(quality,max_vertices,enlarge_ratio,50000);
#ifdef DEBUG_TRACE
// Print status
long memory = CGAL::Memory_sizer().virtual_size();
int nb_vertices2 = m_dt.number_of_vertices();
std::cerr << "Delaunay refinement: " << "added " << nb_vertices2-nb_vertices << " Steiner points, "
<< task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
CGAL_TRACE_STREAM << "Delaunay refinement: " << "added " << nb_vertices2-nb_vertices << " Steiner points, "
<< task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
task_timer.reset();
#endif
// Smooth normals field.
// Commented out as it shrinks the reconstructed model.
//extrapolate_normals();
#ifdef DEBUG_TRACE
std::cerr << "Solve Poisson equation...\n";
#endif
CGAL_TRACE_STREAM << "Solve Poisson equation...\n";
/// Compute the Poisson indicator function f()
/// at each vertex of the triangulation.
@ -336,14 +330,12 @@ public:
// - f() < 0 inside the surface.
set_contouring_value(median_value_at_input_vertices());
#ifdef DEBUG_TRACE
// Print status
/*long*/ memory = CGAL::Memory_sizer().virtual_size();
std::cerr << "Solve Poisson equation: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
CGAL_TRACE_STREAM << "Solve Poisson equation: " << task_timer.time() << " seconds, "
<< (memory>>20) << " Mb allocated"
<< std::endl;
task_timer.reset();
#endif
return true;
}

View File

@ -296,4 +296,10 @@
#define CGAL_TRACE if (false) printf
#endif
#ifdef DEBUG_TRACE
#define CGAL_TRACE_STREAM std::cerr
#else
#define CGAL_TRACE_STREAM if (false) std::cerr
#endif

View File

@ -27,6 +27,7 @@
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/IO/surface_reconstruction_output.h>
#include <CGAL/IO/surface_reconstruction_read_xyz.h>
#include <CGAL/surface_reconstruction_assertions.h>
// This test
#include "enriched_polyhedron.h"
@ -200,9 +201,7 @@ int main(int argc, char * argv[])
std::cerr << "Compute implicit function...\n";
// Create implicit function
#ifdef DEBUG_TRACE
std::cerr << " APSS_implicit_function(knn="<<number_of_neighbours << ")\n";
#endif
CGAL_TRACE_STREAM << " APSS_implicit_function(knn="<<number_of_neighbours << ")\n";
APSS_implicit_function apss_function(pwns.begin(), pwns.end(),
number_of_neighbours);
@ -249,15 +248,13 @@ int main(int argc, char * argv[])
sm_radius*size, // upper bound of Delaunay balls radii
sm_distance*size); // upper bound of distance to surface
#ifdef DEBUG_TRACE
std::cerr << " make_surface_mesh(dichotomy error="<<sm_error_bound<<" * point set radius,\n"
<< " sphere center=("<<sm_sphere_center << "),\n"
<< " sphere radius="<<sm_sphere_radius/size<<" * p.s.r.,\n"
<< " angle="<<sm_angle << " degrees,\n"
<< " radius="<<sm_radius<<" * p.s.r.,\n"
<< " distance="<<sm_distance<<" * p.s.r.,\n"
<< " Non_manifold_tag)\n";
#endif
CGAL_TRACE_STREAM << " make_surface_mesh(dichotomy error="<<sm_error_bound<<" * point set radius,\n"
<< " sphere center=("<<sm_sphere_center << "),\n"
<< " sphere radius="<<sm_sphere_radius/size<<" * p.s.r.,\n"
<< " angle="<<sm_angle << " degrees,\n"
<< " radius="<<sm_radius<<" * p.s.r.,\n"
<< " distance="<<sm_distance<<" * p.s.r.,\n"
<< " Non_manifold_tag)\n";
// meshing surface
CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());

View File

@ -32,6 +32,7 @@
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/IO/surface_reconstruction_output.h>
#include <CGAL/IO/surface_reconstruction_read_xyz.h>
#include <CGAL/surface_reconstruction_assertions.h>
// This test
#include "enriched_polyhedron.h"
@ -267,15 +268,13 @@ int main(int argc, char * argv[])
sm_radius*size, // upper bound of Delaunay balls radii
sm_distance*size); // upper bound of distance to surface
#ifdef DEBUG_TRACE
std::cerr << " make_surface_mesh(dichotomy error="<<sm_error_bound<<" * point set radius,\n"
<< " sphere center=("<<sm_sphere_center << "),\n"
<< " sphere radius="<<sm_sphere_radius/size<<" * p.s.r.,\n"
<< " angle="<<sm_angle << " degrees,\n"
<< " radius="<<sm_radius<<" * p.s.r.,\n"
<< " distance="<<sm_distance<<" * p.s.r.,\n"
<< " Non_manifold_tag)\n";
#endif
CGAL_TRACE_STREAM << " make_surface_mesh(dichotomy error="<<sm_error_bound<<" * point set radius,\n"
<< " sphere center=("<<sm_sphere_center << "),\n"
<< " sphere radius="<<sm_sphere_radius/size<<" * p.s.r.,\n"
<< " angle="<<sm_angle << " degrees,\n"
<< " radius="<<sm_radius<<" * p.s.r.,\n"
<< " distance="<<sm_distance<<" * p.s.r.,\n"
<< " Non_manifold_tag)\n";
// meshing surface
CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());