mirror of https://github.com/CGAL/cgal
Fix benchmarks again?
This commit is contained in:
parent
af3c23df26
commit
399acf83da
|
|
@ -12,4 +12,8 @@ find_package(TBB)
|
||||||
include(CGAL_TBB_support)
|
include(CGAL_TBB_support)
|
||||||
if(TARGET CGAL::TBB_support)
|
if(TARGET CGAL::TBB_support)
|
||||||
target_link_libraries(benchmark PUBLIC CGAL::TBB_support)
|
target_link_libraries(benchmark PUBLIC CGAL::TBB_support)
|
||||||
|
target_compile_definitions(benchmark PUBLIC ${SCENARIO})
|
||||||
|
target_compile_definitions(benchmark PUBLIC ${KERNEL})
|
||||||
|
target_compile_definitions(benchmark PUBLIC ${ALGO})
|
||||||
|
target_compile_definitions(benchmark PUBLIC ${TAG})
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -38,15 +38,20 @@ struct Implicit_sphere {
|
||||||
typedef CGAL::Isosurfacing::Implicit_domain<GeomTraits, SphereValue<GeomTraits>, SphereGradient<GeomTraits>> Domain;
|
typedef CGAL::Isosurfacing::Implicit_domain<GeomTraits, SphereValue<GeomTraits>, SphereGradient<GeomTraits>> Domain;
|
||||||
typedef typename GeomTraits::Vector_3 Vector;
|
typedef typename GeomTraits::Vector_3 Vector;
|
||||||
|
|
||||||
Domain domain(const std::size_t N) const {
|
Implicit_sphere(const std::size_t N) : res(2.0 / N, 2.0 / N, 2.0 / N) {}
|
||||||
|
|
||||||
const Vector res(2.0 / N, 2.0 / N, 2.0 / N);
|
Domain domain() const {
|
||||||
return Domain({-1, -1, -1, 1, 1, 1}, res, SphereValue<GeomTraits>(), SphereGradient<GeomTraits>());
|
return Domain({-1, -1, -1, 1, 1, 1}, res, val, grad);
|
||||||
}
|
}
|
||||||
|
|
||||||
typename GeomTraits::FT iso() const {
|
typename GeomTraits::FT iso() const {
|
||||||
return 0.8;
|
return 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
SphereValue<GeomTraits> val;
|
||||||
|
SphereGradient<GeomTraits> grad;
|
||||||
|
Vector res;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class GeomTraits>
|
template <class GeomTraits>
|
||||||
|
|
@ -57,14 +62,11 @@ struct Grid_sphere {
|
||||||
typedef typename GeomTraits::FT FT;
|
typedef typename GeomTraits::FT FT;
|
||||||
typedef typename GeomTraits::Point_3 Point;
|
typedef typename GeomTraits::Point_3 Point;
|
||||||
|
|
||||||
Domain domain(const std::size_t N) const {
|
Grid_sphere(const std::size_t N) : grid(N, N, N, {-1, -1, -1, 1, 1, 1}) {
|
||||||
|
|
||||||
const FT resolution = 2.0 / N;
|
const FT resolution = 2.0 / N;
|
||||||
SphereValue<GeomTraits> val;
|
SphereValue<GeomTraits> val;
|
||||||
SphereGradient<GeomTraits> grad;
|
SphereGradient<GeomTraits> grad;
|
||||||
|
|
||||||
Grid grid(N, N, N, {-1, -1, -1, 1, 1, 1});
|
|
||||||
|
|
||||||
for (std::size_t x = 0; x < grid.xdim(); x++) {
|
for (std::size_t x = 0; x < grid.xdim(); x++) {
|
||||||
const FT xp = x * resolution - 1.0;
|
const FT xp = x * resolution - 1.0;
|
||||||
|
|
||||||
|
|
@ -79,12 +81,18 @@ struct Grid_sphere {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Domain domain() const {
|
||||||
return Domain(grid);
|
return Domain(grid);
|
||||||
}
|
}
|
||||||
|
|
||||||
typename GeomTraits::FT iso() const {
|
typename GeomTraits::FT iso() const {
|
||||||
return 0.8;
|
return 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Grid grid;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class GeomTraits>
|
template <class GeomTraits>
|
||||||
|
|
@ -93,8 +101,7 @@ struct Skull_image {
|
||||||
typedef CGAL::Isosurfacing::Cartesian_grid_domain<GeomTraits> Domain;
|
typedef CGAL::Isosurfacing::Cartesian_grid_domain<GeomTraits> Domain;
|
||||||
typedef CGAL::Cartesian_grid_3<GeomTraits> Grid;
|
typedef CGAL::Cartesian_grid_3<GeomTraits> Grid;
|
||||||
|
|
||||||
Domain domain(const std::size_t N) const {
|
Skull_image(const std::size_t N) : grid(2, 2, 2, {-1, -1, -1, 1, 1, 1}) {
|
||||||
|
|
||||||
const std::string fname = "../data/skull_2.9.inr";
|
const std::string fname = "../data/skull_2.9.inr";
|
||||||
CGAL::Image_3 image;
|
CGAL::Image_3 image;
|
||||||
if (!image.read(fname)) {
|
if (!image.read(fname)) {
|
||||||
|
|
@ -102,13 +109,19 @@ struct Skull_image {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Grid grid(image);
|
grid = Grid(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
Domain domain() const {
|
||||||
return Domain(grid);
|
return Domain(grid);
|
||||||
}
|
}
|
||||||
|
|
||||||
typename GeomTraits::FT iso() const {
|
typename GeomTraits::FT iso() const {
|
||||||
return 2.9;
|
return 2.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Grid grid;
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
|
@ -143,13 +156,13 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
#if defined SCENARIO_GRID_SPHERE
|
#if defined SCENARIO_GRID_SPHERE
|
||||||
std::cout << "SCENARIO_GRID_SPHERE" << std::endl;
|
std::cout << "SCENARIO_GRID_SPHERE" << std::endl;
|
||||||
auto scenario = Grid_sphere<Kernel>();
|
auto scenario = Grid_sphere<Kernel>(N);
|
||||||
#elif defined SCENARIO_IMPLICIT_SPHERE
|
#elif defined SCENARIO_IMPLICIT_SPHERE
|
||||||
std::cout << "SCENARIO_IMPLICIT_SPHERE" << std::endl;
|
std::cout << "SCENARIO_IMPLICIT_SPHERE" << std::endl;
|
||||||
auto scenario = Implicit_sphere<Kernel>();
|
auto scenario = Implicit_sphere<Kernel>(N);
|
||||||
#elif defined SCENARIO_SKULL_IMAGE
|
#elif defined SCENARIO_SKULL_IMAGE
|
||||||
std::cout << "SCENARIO_SKULL_IMAGE" << std::endl;
|
std::cout << "SCENARIO_SKULL_IMAGE" << std::endl;
|
||||||
auto scenario = Skull_image<Kernel>();
|
auto scenario = Skull_image<Kernel>(N);
|
||||||
#else
|
#else
|
||||||
std::cout << "no scenario selected!" << std::endl;
|
std::cout << "no scenario selected!" << std::endl;
|
||||||
auto scenario = Implicit_sphere<Kernel>();
|
auto scenario = Implicit_sphere<Kernel>();
|
||||||
|
|
@ -173,14 +186,14 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
#if defined ALGO_MARCHING_CUBES
|
#if defined ALGO_MARCHING_CUBES
|
||||||
std::cout << "ALGO_MARCHING_CUBES" << std::endl;
|
std::cout << "ALGO_MARCHING_CUBES" << std::endl;
|
||||||
CGAL::Isosurfacing::make_triangle_mesh_using_marching_cubes<Tag>(scenario.domain(N), scenario.iso(), points,
|
CGAL::Isosurfacing::make_triangle_mesh_using_marching_cubes<Tag>(scenario.domain(), scenario.iso(), points,
|
||||||
polygons);
|
polygons);
|
||||||
#elif defined ALGO_DUAL_CONTOURING
|
#elif defined ALGO_DUAL_CONTOURING
|
||||||
std::cout << "ALGO_DUAL_CONTOURING" << std::endl;
|
std::cout << "ALGO_DUAL_CONTOURING" << std::endl;
|
||||||
CGAL::Isosurfacing::make_quad_mesh_using_dual_contouring<Tag>(scenario.domain(N), scenario.iso(), points, polygons);
|
CGAL::Isosurfacing::make_quad_mesh_using_dual_contouring<Tag>(scenario.domain(), scenario.iso(), points, polygons);
|
||||||
#else
|
#else
|
||||||
std::cout << "no algorithm selected!" << std::endl;
|
std::cout << "no algorithm selected!" << std::endl;
|
||||||
CGAL::Isosurfacing::make_triangle_mesh_using_marching_cubes<Tag>(scenario.domain(N), scenario.iso(), points,
|
CGAL::Isosurfacing::make_triangle_mesh_using_marching_cubes<Tag>(scenario.domain(), scenario.iso(), points,
|
||||||
polygons);
|
polygons);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ def run(cmd, output=True):
|
||||||
|
|
||||||
def build(scenario, kernel, algorithm, tag):
|
def build(scenario, kernel, algorithm, tag):
|
||||||
run(["cmake", "-E", "make_directory", "build"])
|
run(["cmake", "-E", "make_directory", "build"])
|
||||||
run(["cmake", "-B", "build", "-DCMAKE_BUILD_TYPE=Release", "-DCGAL_DIR=../../../"])
|
run(["cmake", "-B", "build", "-DCMAKE_BUILD_TYPE=Release", "-DSCENARIO=" + scenario, "-DKERNEL=" + kernel, "-DALGO=" + algorithm, "-DTAG=" + tag, "-DCGAL_DIR=../../../"])
|
||||||
run(["make", "-C", "build", "CXX_FLAGS='-D" + scenario + " -D" + kernel + " -D" + algorithm + " -D" + tag + "'"])
|
run(["make", "-C", "build"])
|
||||||
|
|
||||||
def execute(n, threads, times=1):
|
def execute(n, threads, times=1):
|
||||||
time = 0
|
time = 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue