Example : Parallel vs sequential Marching cubes

This commit is contained in:
Pierre Alliez 2024-01-05 15:50:11 +01:00
parent 254818cf70
commit 7b18855e0c
1 changed files with 4 additions and 3 deletions

View File

@ -3,7 +3,7 @@
#include <CGAL/Isosurfacing_3/marching_cubes_3.h> #include <CGAL/Isosurfacing_3/marching_cubes_3.h>
#include <CGAL/Bbox_3.h> #include <CGAL/Bbox_3.h>
#include <CGAL/boost/graph/IO/OFF.h> #include <CGAL/boost/graph/IO/OFF.h>
#include <CGAL/Timer.h> #include <CGAL/Real_timer.h>
#include <vector> #include <vector>
using Kernel = CGAL::Simple_cartesian<double>; using Kernel = CGAL::Simple_cartesian<double>;
@ -23,7 +23,7 @@ int main(int, char**)
{ {
// box domain and spacing vector // box domain and spacing vector
const CGAL::Bbox_3 bbox{ -1.0, -1.0, -1.0, 1.0, 1.0, 1.0 }; const CGAL::Bbox_3 bbox{ -1.0, -1.0, -1.0, 1.0, 1.0, 1.0 };
const FT spacing = 0.01; const FT spacing = 0.002;
const Vector vec_spacing(spacing, spacing, spacing); const Vector vec_spacing(spacing, spacing, spacing);
// create domain with sphere function // create domain with sphere function
@ -37,7 +37,7 @@ int main(int, char**)
// run marching cubes sequential // run marching cubes sequential
std::cout << "marching cubes sequential..."; std::cout << "marching cubes sequential...";
const FT isovalue = 0.8; const FT isovalue = 0.8;
CGAL::Timer timer; CGAL::Real_timer timer;
timer.start(); timer.start();
CGAL::Isosurfacing::marching_cubes<CGAL::Sequential_tag>(domain, isovalue, points, triangles); CGAL::Isosurfacing::marching_cubes<CGAL::Sequential_tag>(domain, isovalue, points, triangles);
timer.stop(); timer.stop();
@ -50,6 +50,7 @@ int main(int, char**)
// run marching cubes parallel // run marching cubes parallel
std::cout << "marching cubes parallel..."; std::cout << "marching cubes parallel...";
timer.reset();
timer.start(); timer.start();
CGAL::Isosurfacing::marching_cubes<CGAL::Parallel_tag>(domain, isovalue, points, triangles); CGAL::Isosurfacing::marching_cubes<CGAL::Parallel_tag>(domain, isovalue, points, triangles);
timer.stop(); timer.stop();