Port to g++ 4.1.2

This commit is contained in:
Laurent Saboret 2008-10-06 15:59:17 +00:00
parent 2c8cd4f7b3
commit f90fa90e3e
3 changed files with 40 additions and 40 deletions

View File

@ -159,12 +159,12 @@ CPoissonDoc::CPoissonDoc()
m_number_of_neighbours = 7; m_number_of_neighbours = 7;
// Outliers removal // Outliers removal
m_min_cameras_cone_angle = 0.5; // min angle of camera's cone (degrees) m_min_cameras_cone_angle = 0.5; // min angle of camera's cone (degrees)
m_threshold_percent_avg_knn_sq_dst = 5.0; // percentage of outliers to remove m_threshold_percent_avg_knn_sq_dst = 5.0; // percentage of outliers to remove
// Point set simplification // Point set simplification
m_clustering_step = 0.004; // Grid's step for simplification by clustering m_clustering_step = 0.004; // Grid's step for simplification by clustering
m_random_simplification_percentage = 50.0; // percentage of random points to remove m_random_simplification_percentage = 50.0; // percentage of random points to remove
} }
CPoissonDoc::~CPoissonDoc() CPoissonDoc::~CPoissonDoc()
@ -303,7 +303,7 @@ BOOL CPoissonDoc::OnOpenDocument(LPCTSTR lpszPathName)
prompt_message("Unable to read file"); prompt_message("Unable to read file");
return FALSE; return FALSE;
} }
// Set options for Gyroviz file // Set options for Gyroviz file
m_number_of_neighbours = 50; m_number_of_neighbours = 50;
} }
@ -320,7 +320,7 @@ BOOL CPoissonDoc::OnOpenDocument(LPCTSTR lpszPathName)
prompt_message("Unable to read file"); prompt_message("Unable to read file");
return FALSE; return FALSE;
} }
// Set options for Gyroviz file // Set options for Gyroviz file
m_number_of_neighbours = 50; m_number_of_neighbours = 50;
} }
@ -486,9 +486,9 @@ void CPoissonDoc::update_status()
selected_points.Format("%d selected",m_points.nb_selected_points()); selected_points.Format("%d selected",m_points.nb_selected_points());
// write message to cerr // write message to cerr
std::cerr << "=> " << points << " (" << selected_points << "), " std::cerr << "=> " << points << " (" << selected_points << "), "
<< (CGAL::Memory_sizer().virtual_size()>>20) << " Mb allocated, " << (CGAL::Memory_sizer().virtual_size()>>20) << " Mb allocated, "
<< "largest free block=" << (long(taucs_available_memory_size())>>20) << " Mb, " << "largest free block=" << long(taucs_available_memory_size()/1048576.0) << " Mb, "
<< "#blocks over 100 Mb=" << CGAL::Peak_memory_sizer().count_free_memory_blocks(100*1048576) << "#blocks over 100 Mb=" << CGAL::Peak_memory_sizer().count_free_memory_blocks(100*1048576)
<< std::endl; << std::endl;
@ -510,7 +510,7 @@ void CPoissonDoc::update_status()
// write message to cerr // write message to cerr
std::cerr << "=> " << vertices << ", " << tets << ", " std::cerr << "=> " << vertices << ", " << tets << ", "
<< (CGAL::Memory_sizer().virtual_size()>>20) << " Mb allocated, " << (CGAL::Memory_sizer().virtual_size()>>20) << " Mb allocated, "
<< "largest free block=" << (long(taucs_available_memory_size())>>20) << " Mb, " << "largest free block=" << long(taucs_available_memory_size()/1048576.0) << " Mb, "
<< "#blocks over 100 Mb=" << CGAL::Peak_memory_sizer().count_free_memory_blocks(100*1048576) << "#blocks over 100 Mb=" << CGAL::Peak_memory_sizer().count_free_memory_blocks(100*1048576)
<< std::endl; << std::endl;
@ -652,13 +652,13 @@ void CPoissonDoc::OnAlgorithmsOrientNormalsWithMST()
BeginWaitCursor(); BeginWaitCursor();
status_message("Orient Normals with MST..."); status_message("Orient Normals with MST...");
CGAL::Timer task_timer; task_timer.start(); CGAL::Timer task_timer; task_timer.start();
CGAL::orient_normals_minimum_spanning_tree_3(m_points.begin(), m_points.end(), CGAL::orient_normals_minimum_spanning_tree_3(m_points.begin(), m_points.end(),
get(boost::vertex_index, m_points), get(boost::vertex_index, m_points),
get(CGAL::vertex_point, m_points), get(CGAL::vertex_point, m_points),
get(boost::vertex_normal, m_points), get(boost::vertex_normal, m_points),
m_number_of_neighbours); m_number_of_neighbours);
// Select non-oriented normals // Select non-oriented normals
m_points.select(m_points.begin(), m_points.end(), false); m_points.select(m_points.begin(), m_points.end(), false);
for (int i=0; i<m_points.size(); i++) for (int i=0; i<m_points.size(); i++)
@ -693,7 +693,7 @@ void CPoissonDoc::OnAlgorithmsOrientNormalsWrtCameras()
get(CGAL::vertex_point, m_points), get(CGAL::vertex_point, m_points),
get(boost::vertex_normal, m_points), get(boost::vertex_normal, m_points),
get(boost::vertex_cameras, m_points)); get(boost::vertex_cameras, m_points));
// Select swapped normals // Select swapped normals
m_points.select(m_points.begin(), m_points.end(), false); m_points.select(m_points.begin(), m_points.end(), false);
for (int i=0; i<m_points.size(); i++) for (int i=0; i<m_points.size(); i++)
@ -771,7 +771,7 @@ void CPoissonDoc::OnReconstructionDelaunayRefinement()
m_triangulation_refined = true; m_triangulation_refined = true;
status_message("Delaunay refinement...done (%.2lf s, %d vertices inserted)", status_message("Delaunay refinement...done (%.2lf s, %d vertices inserted)",
task_timer.time(), nb_vertices_added); task_timer.time(), nb_vertices_added);
update_status(); update_status();
UpdateAllViews(NULL); UpdateAllViews(NULL);
@ -798,7 +798,7 @@ void CPoissonDoc::OnAlgorithmsRefineInShell()
unsigned int nb_vertices_added = m_poisson_function->delaunay_refinement_shell(m_dr_shell_size,m_dr_sizing,m_dr_max_vertices); unsigned int nb_vertices_added = m_poisson_function->delaunay_refinement_shell(m_dr_shell_size,m_dr_sizing,m_dr_max_vertices);
m_triangulation_refined = true; m_triangulation_refined = true;
status_message("Delaunay refinement in surface shell...done (%.2lf s, %d vertices inserted)", status_message("Delaunay refinement in surface shell...done (%.2lf s, %d vertices inserted)",
task_timer.time(), nb_vertices_added); task_timer.time(), nb_vertices_added);
update_status(); update_status();
UpdateAllViews(NULL); UpdateAllViews(NULL);
@ -994,7 +994,7 @@ void CPoissonDoc::OnAlgorithmsMarchingTetContouring()
int nb = m_poisson_dt->marching_tet(std::back_inserter(triangles), m_contouring_value); int nb = m_poisson_dt->marching_tet(std::back_inserter(triangles), m_contouring_value);
m_contour.insert(m_contour.end(), triangles.begin(), triangles.end()); m_contour.insert(m_contour.end(), triangles.begin(), triangles.end());
status_message("Marching tet contouring...done (%d triangles, %.2lf s)", status_message("Marching tet contouring...done (%d triangles, %.2lf s)",
nb, task_timer.time()); nb, task_timer.time());
update_status(); update_status();
UpdateAllViews(NULL); UpdateAllViews(NULL);
@ -1160,7 +1160,7 @@ void CPoissonDoc::OnAlgorithmsOutliersRemovalWrtCamerasConeAngle()
CGAL::Timer task_timer; task_timer.start(); CGAL::Timer task_timer; task_timer.start();
// Select points to delete // Select points to delete
Point_set::iterator first_iterator_to_remove = Point_set::iterator first_iterator_to_remove =
remove_outliers_wrt_camera_cone_angle_3( remove_outliers_wrt_camera_cone_angle_3(
m_points.begin(), m_points.end(), m_points.begin(), m_points.end(),
m_min_cameras_cone_angle*M_PI/180.0); m_min_cameras_cone_angle*M_PI/180.0);
@ -1187,9 +1187,9 @@ void CPoissonDoc::OnOutliersRemovalWrtAvgKnnSqDist()
BeginWaitCursor(); BeginWaitCursor();
status_message("Remove outliers wrt average squared distance to knn..."); status_message("Remove outliers wrt average squared distance to knn...");
CGAL::Timer task_timer; task_timer.start(); CGAL::Timer task_timer; task_timer.start();
// Select points to delete // Select points to delete
Point_set::iterator first_iterator_to_remove = Point_set::iterator first_iterator_to_remove =
CGAL::remove_outliers_wrt_avg_knn_sq_distance_3( CGAL::remove_outliers_wrt_avg_knn_sq_distance_3(
m_points.begin(), m_points.end(), m_points.begin(), m_points.end(),
m_number_of_neighbours, m_number_of_neighbours,
@ -1243,7 +1243,7 @@ void CPoissonDoc::OnReconstructionApssReconstruction()
// Create implicit function // Create implicit function
CGAL_TRACE_STREAM << " APSS_implicit_function(knn="<<m_number_of_neighbours << ")\n"; 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_apss_function = new APSS_implicit_function(m_points.begin(), m_points.end(),
m_number_of_neighbours); m_number_of_neighbours);
// Get inner point // Get inner point
@ -1293,7 +1293,7 @@ void CPoissonDoc::OnReconstructionApssReconstruction()
m_edit_mode = APSS; m_edit_mode = APSS;
// Print status // Print status
status_message("APSS reconstruction...done (%d vertices, %.2lf s)", status_message("APSS reconstruction...done (%d vertices, %.2lf s)",
m_surface_mesher_dt.number_of_vertices(), task_timer.time()); m_surface_mesher_dt.number_of_vertices(), task_timer.time());
update_status(); update_status();
UpdateAllViews(NULL); UpdateAllViews(NULL);
@ -1402,7 +1402,7 @@ void CPoissonDoc::OnPointCloudSimplificationByClustering()
FT size = sqrt(bounding_sphere.squared_radius()); FT size = sqrt(bounding_sphere.squared_radius());
// Select points to delete // Select points to delete
Point_set::iterator first_iterator_to_remove = Point_set::iterator first_iterator_to_remove =
CGAL::merge_epsilon_nearest_points_3( CGAL::merge_epsilon_nearest_points_3(
m_points.begin(), m_points.end(), m_points.begin(), m_points.end(),
m_clustering_step*size); m_clustering_step*size);
@ -1426,7 +1426,7 @@ void CPoissonDoc::OnPointCloudSimplificationRandom()
CGAL::Timer task_timer; task_timer.start(); CGAL::Timer task_timer; task_timer.start();
// Select points to delete // Select points to delete
Point_set::iterator first_iterator_to_remove = Point_set::iterator first_iterator_to_remove =
CGAL::random_simplification_points_3( CGAL::random_simplification_points_3(
m_points.begin(), m_points.end(), m_points.begin(), m_points.end(),
m_random_simplification_percentage); m_random_simplification_percentage);

View File

@ -14,8 +14,8 @@
// //
// $URL$ // $URL$
// $Id$ // $Id$
// //
// Author(s) : Laurent Saboret // Author(s) : Laurent Saboret
// (based on Memory_sizer.h by Sylvain Pion and Andreas Fabri) // (based on Memory_sizer.h by Sylvain Pion and Andreas Fabri)
#ifndef CGAL_PEAK_MEMORY_SIZER_H #ifndef CGAL_PEAK_MEMORY_SIZER_H
@ -43,20 +43,20 @@ struct Peak_memory_sizer : public Memory_sizer
void* block; void* block;
while ((block = malloc(min_block_size)) != NULL) while ((block = malloc(min_block_size)) != NULL)
blocks.push_back(block); blocks.push_back(block);
// Return value // Return value
size_type count = blocks.size(); size_type count = blocks.size();
// Free large memory blocks // Free large memory blocks
for (int i=0; i<count; i++) for (size_type i=0; i<count; i++)
free(blocks[i]); free(blocks[i]);
return count; return count;
} }
private: private:
size_type get_peak_memory (bool virtual_size) const size_type get_peak_memory (bool virtual_size) const
{ {
#ifdef _MSC_VER #ifdef _MSC_VER
DWORD pid = GetCurrentProcessId(); DWORD pid = GetCurrentProcessId();
@ -72,12 +72,12 @@ private:
//CGAL_TRACE(" Peak_memory_sizer: PagefileUsage=%ld Mb\n", pmc.PagefileUsage>>20); //CGAL_TRACE(" Peak_memory_sizer: PagefileUsage=%ld Mb\n", pmc.PagefileUsage>>20);
//CGAL_TRACE(" Peak_memory_sizer: PeakWorkingSetSize=%ld Mb\n", pmc.PeakWorkingSetSize>>20); //CGAL_TRACE(" Peak_memory_sizer: PeakWorkingSetSize=%ld Mb\n", pmc.PeakWorkingSetSize>>20);
//CGAL_TRACE(" Peak_memory_sizer: PeakPagefileUsage=%ld Mb\n", pmc.PeakPagefileUsage>>20); //CGAL_TRACE(" Peak_memory_sizer: PeakPagefileUsage=%ld Mb\n", pmc.PeakPagefileUsage>>20);
// LS 10/2008: PeakPagefileUsage seems unreliable, thus we use an approximation: // LS 10/2008: PeakPagefileUsage seems unreliable, thus we use an approximation:
size_t memory_paged_out = (pmc.PagefileUsage>pmc.WorkingSetSize) ? (pmc.PagefileUsage-pmc.WorkingSetSize) : 0; size_t memory_paged_out = (pmc.PagefileUsage>pmc.WorkingSetSize) ? (pmc.PagefileUsage-pmc.WorkingSetSize) : 0;
size_t approximate_peak_virtual_size = pmc.PeakWorkingSetSize + memory_paged_out; size_t approximate_peak_virtual_size = pmc.PeakWorkingSetSize + memory_paged_out;
//CGAL_TRACE(" Peak_memory_sizer: approximate_peak_virtual_size=%ld Mb\n", approximate_peak_virtual_size>>20); //CGAL_TRACE(" Peak_memory_sizer: approximate_peak_virtual_size=%ld Mb\n", approximate_peak_virtual_size>>20);
result = virtual_size ? approximate_peak_virtual_size : pmc.PeakWorkingSetSize; result = virtual_size ? approximate_peak_virtual_size : pmc.PeakWorkingSetSize;
} }
@ -86,7 +86,7 @@ private:
#else #else
// Not yet implemented // Not yet implemented
return 0; return 0;
#endif #endif
} }
}; };

View File

@ -647,9 +647,9 @@ public:
long old_max_memory = CGAL::Peak_memory_sizer().peak_virtual_size(); long old_max_memory = CGAL::Peak_memory_sizer().peak_virtual_size();
CGAL_TRACE(" %ld Mb allocated, largest free memory block=%ld Mb, #blocks over 100 Mb=%ld\n", CGAL_TRACE(" %ld Mb allocated, largest free memory block=%ld Mb, #blocks over 100 Mb=%ld\n",
long(CGAL::Memory_sizer().virtual_size())>>20, long(CGAL::Memory_sizer().virtual_size())>>20,
long(taucs_available_memory_size())>>20, long(taucs_available_memory_size()/1048576.0),
long(CGAL::Peak_memory_sizer().count_free_memory_blocks(100*1048576))); long(CGAL::Peak_memory_sizer().count_free_memory_blocks(100*1048576)));
CGAL_TRACE(" Create matrix\n"); CGAL_TRACE(" Create matrix\n");
@ -690,9 +690,9 @@ public:
*duration_solve = (clock() - time_init)/CLOCKS_PER_SEC; *duration_solve = (clock() - time_init)/CLOCKS_PER_SEC;
*/ */
CGAL_TRACE(" %ld Mb allocated, largest free memory block=%ld Mb, #blocks over 100 Mb=%ld\n", CGAL_TRACE(" %ld Mb allocated, largest free memory block=%ld Mb, #blocks over 100 Mb=%ld\n",
long(CGAL::Memory_sizer().virtual_size())>>20, long(CGAL::Memory_sizer().virtual_size())>>20,
long(taucs_available_memory_size())>>20, long(taucs_available_memory_size()/1048576.0),
long(CGAL::Peak_memory_sizer().count_free_memory_blocks(100*1048576))); long(CGAL::Peak_memory_sizer().count_free_memory_blocks(100*1048576)));
CGAL_TRACE(" Choleschy factorization\n"); CGAL_TRACE(" Choleschy factorization\n");
@ -707,10 +707,10 @@ public:
if (max_memory > old_max_memory) if (max_memory > old_max_memory)
CGAL_TRACE(" Max allocation = %ld Mb\n", max_memory>>20); CGAL_TRACE(" Max allocation = %ld Mb\n", max_memory>>20);
CGAL_TRACE(" %ld Mb allocated, largest free memory block=%ld Mb, #blocks over 100 Mb=%ld\n", CGAL_TRACE(" %ld Mb allocated, largest free memory block=%ld Mb, #blocks over 100 Mb=%ld\n",
long(CGAL::Memory_sizer().virtual_size())>>20, long(CGAL::Memory_sizer().virtual_size())>>20,
long(taucs_available_memory_size())>>20, long(taucs_available_memory_size()/1048576.0),
CGAL::Peak_memory_sizer().count_free_memory_blocks(100*1048576)); long(CGAL::Peak_memory_sizer().count_free_memory_blocks(100*1048576)));
CGAL_TRACE(" Direct solve by forward and backward substitution\n"); CGAL_TRACE(" Direct solve by forward and backward substitution\n");
// Direct solve by forward and backward substitution // Direct solve by forward and backward substitution
@ -741,9 +741,9 @@ public:
if(!v->constrained()) if(!v->constrained())
v->f() = X[index++]; v->f() = X[index++];
CGAL_TRACE(" %ld Mb allocated, largest free memory block=%ld Mb, #blocks over 100 Mb=%ld\n", CGAL_TRACE(" %ld Mb allocated, largest free memory block=%ld Mb, #blocks over 100 Mb=%ld\n",
long(CGAL::Memory_sizer().virtual_size())>>20, long(CGAL::Memory_sizer().virtual_size())>>20,
long(taucs_available_memory_size())>>20, long(taucs_available_memory_size()/1048576.0),
long(CGAL::Peak_memory_sizer().count_free_memory_blocks(100*1048576))); long(CGAL::Peak_memory_sizer().count_free_memory_blocks(100*1048576)));
CGAL_TRACE("End of solve_poisson()\n"); CGAL_TRACE("End of solve_poisson()\n");