Skip to content

Commit

Permalink
Replace some VTK data files with BGEO files
Browse files Browse the repository at this point in the history
  • Loading branch information
w1th0utnam3 committed Jul 5, 2023
1 parent e3a6c14 commit 91da718
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 29 deletions.
Binary file added data/dam_break_frame_23_24389_particles.bgeo
Binary file not shown.
Binary file removed data/dam_break_frame_23_24389_particles.vtk
Binary file not shown.
Binary file removed data/dual_dodec_41273_particles.vtk
Binary file not shown.
Binary file added data/hilbert_46843_particles.bgeo
Binary file not shown.
Binary file removed data/hilbert_46843_particles.vtk
Binary file not shown.
Binary file added data/octocat_32614_particles.bgeo
Binary file not shown.
Binary file removed data/octocat_32614_particles.vtk
Binary file not shown.
Binary file not shown.
Binary file removed data/pentagonal_hexecontahedron_32286_particles.vtk
Binary file not shown.
6 changes: 3 additions & 3 deletions splashsurf_lib/benches/benches/bench_aabb.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use criterion::{criterion_group, Criterion};
use nalgebra::Vector3;
use splashsurf_lib::io::vtk_format::particles_from_vtk;
use splashsurf_lib::io::particles_from_file;
use splashsurf_lib::Aabb3d;
use std::time::Duration;

pub fn aabb_from_points(c: &mut Criterion) {
let particle_positions: &Vec<Vector3<f32>> =
&particles_from_vtk("../data/hilbert_46843_particles.vtk").unwrap();
&particles_from_file("../data/hilbert_46843_particles.bgeo").unwrap();

let mut group = c.benchmark_group("aabb");
group.sample_size(200);
Expand All @@ -22,7 +22,7 @@ pub fn aabb_from_points(c: &mut Criterion) {

pub fn aabb_from_points_par(c: &mut Criterion) {
let particle_positions: &Vec<Vector3<f32>> =
&particles_from_vtk("../data/hilbert_46843_particles.vtk").unwrap();
&particles_from_file("../data/hilbert_46843_particles.bgeo").unwrap();

let mut group = c.benchmark_group("aabb");
group.sample_size(500);
Expand Down
8 changes: 4 additions & 4 deletions splashsurf_lib/benches/benches/bench_full.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use criterion::{criterion_group, Criterion};
use nalgebra::Vector3;
use splashsurf_lib::io::vtk_format::particles_from_vtk;
use splashsurf_lib::io::particles_from_file;
#[allow(dead_code)]
use splashsurf_lib::io::vtk_format::write_vtk;
use splashsurf_lib::{
Expand Down Expand Up @@ -89,7 +89,7 @@ pub fn surface_reconstruction_canyon(c: &mut Criterion) {

pub fn surface_reconstruction_dam_break(c: &mut Criterion) {
let particle_positions: &Vec<Vector3<f32>> =
&particles_from_vtk("../data/dam_break_frame_23_24389_particles.vtk").unwrap();
&particles_from_file("../data/dam_break_frame_23_24389_particles.bgeo").unwrap();

let particle_radius = 0.025;
let compact_support_radius = 4.0 * particle_radius;
Expand Down Expand Up @@ -180,7 +180,7 @@ pub fn surface_reconstruction_dam_break(c: &mut Criterion) {

pub fn surface_reconstruction_double_dam_break(c: &mut Criterion) {
let particle_positions: &Vec<Vector3<f32>> =
&particles_from_vtk("../data/double_dam_break_frame_26_4732_particles.vtk").unwrap();
&particles_from_file("../data/double_dam_break_frame_26_4732_particles.vtk").unwrap();

let particle_radius = 0.025;
let compact_support_radius = 4.0 * particle_radius;
Expand Down Expand Up @@ -271,7 +271,7 @@ pub fn surface_reconstruction_double_dam_break(c: &mut Criterion) {

pub fn surface_reconstruction_double_dam_break_inplace(c: &mut Criterion) {
let particle_positions: &Vec<Vector3<f32>> =
&particles_from_vtk("../data/double_dam_break_frame_26_4732_particles.vtk").unwrap();
&particles_from_file("../data/double_dam_break_frame_26_4732_particles.vtk").unwrap();

let particle_radius = 0.025;
let compact_support_radius = 4.0 * particle_radius;
Expand Down
8 changes: 4 additions & 4 deletions splashsurf_lib/benches/benches/bench_mesh.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use criterion::{criterion_group, Criterion};
use splashsurf_lib::io::vtk_format::particles_from_vtk;
use splashsurf_lib::io::particles_from_file;
use splashsurf_lib::nalgebra::Vector3;
use splashsurf_lib::{
reconstruct_surface, Parameters, ParticleDensityComputationStrategy,
Expand All @@ -9,7 +9,7 @@ use std::path::Path;
use std::time::Duration;

fn reconstruct_particles<P: AsRef<Path>>(particle_file: P) -> SurfaceReconstruction<i64, f32> {
let particle_positions: &Vec<Vector3<f32>> = &particles_from_vtk(particle_file).unwrap();
let particle_positions: &Vec<Vector3<f32>> = &particles_from_file(particle_file).unwrap();

let particle_radius = 0.011;
let compact_support_radius = 4.0 * particle_radius;
Expand Down Expand Up @@ -37,7 +37,7 @@ fn reconstruct_particles<P: AsRef<Path>>(particle_file: P) -> SurfaceReconstruct

pub fn mesh_vertex_normals(c: &mut Criterion) {
//let reconstruction = reconstruct_particles("../../canyon_13353401_particles.vtk");
let reconstruction = reconstruct_particles("../data/hilbert_46843_particles.vtk");
let reconstruction = reconstruct_particles("../data/hilbert_46843_particles.bgeo");
let mesh = reconstruction.mesh();

let mut group = c.benchmark_group("mesh");
Expand All @@ -57,7 +57,7 @@ pub fn mesh_vertex_normals(c: &mut Criterion) {

pub fn mesh_vertex_normals_parallel(c: &mut Criterion) {
//let reconstruction = reconstruct_particles("../../canyon_13353401_particles.vtk");
let reconstruction = reconstruct_particles("../data/hilbert_46843_particles.vtk");
let reconstruction = reconstruct_particles("../data/hilbert_46843_particles.bgeo");
let mesh = reconstruction.mesh();

let mut group = c.benchmark_group("mesh");
Expand Down
4 changes: 2 additions & 2 deletions splashsurf_lib/benches/benches/bench_octree.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use criterion::{criterion_group, BatchSize, Criterion};
use nalgebra::Vector3;
use splashsurf_lib::io::vtk_format::particles_from_vtk;
use splashsurf_lib::io::particles_from_file;
use splashsurf_lib::octree::Octree;
use splashsurf_lib::{grid_for_reconstruction, SubdivisionCriterion, UniformGrid};
use std::time::Duration;

pub fn subdivide_recursively_benchmark(c: &mut Criterion) {
let particle_positions: &Vec<Vector3<f32>> =
&particles_from_vtk("../data/hilbert_46843_particles.vtk").unwrap();
&particles_from_file("../data/hilbert_46843_particles.bgeo").unwrap();
let particles_per_cell = 20000;

let particle_radius = 0.011;
Expand Down
5 changes: 0 additions & 5 deletions splashsurf_lib/src/io/vtk_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,11 +464,6 @@ pub mod test {
test_load_num_particles("../data/cube_8_particles.vtk", 250)
}

#[test]
fn test_hilbert_46843_particles_from_vtk() -> Result<(), anyhow::Error> {
test_load_num_particles("../data/hilbert_46843_particles.vtk", 46843)
}

#[test]
fn test_fluid_250_particles_from_vtu_encoded() -> Result<(), anyhow::Error> {
test_load_num_particles("../data/fluid_encoded_250_particles.vtu", 250)
Expand Down
17 changes: 9 additions & 8 deletions splashsurf_lib/tests/integration_tests/test_full.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use nalgebra::Vector3;
use splashsurf_lib::io::vtk_format::{particles_from_vtk, write_vtk};
use splashsurf_lib::io::particles_from_file;
use splashsurf_lib::io::vtk_format::write_vtk;
use splashsurf_lib::marching_cubes::check_mesh_consistency;
use splashsurf_lib::{
reconstruct_surface, Aabb3d, Parameters, ParticleDensityComputationStrategy, Real,
Expand Down Expand Up @@ -116,7 +117,7 @@ macro_rules! generate_test {
let output_file = Path::new("../out/").join($output_file);

let particle_positions: &Vec<Vector3<$floating_point_type>> =
&particles_from_vtk(input_file).unwrap();
&particles_from_file(input_file).unwrap();

let parameters = $parameters;

Expand Down Expand Up @@ -163,16 +164,16 @@ generate_test!(f32, surface_reconstruction_bunny_no_stitching, "bunny_frame_14_7
generate_test!(f32, surface_reconstruction_bunny_stitching, "bunny_frame_14_7705_particles.vtk" => "reconstruct_surface_bunny_par_stitching.vtk", default_params_with(Strategy::OctreeStitching), 60000, 80000, cfg_attr(debug_assertions, ignore));
generate_test!(f32, surface_reconstruction_bunny_grid, "bunny_frame_14_7705_particles.vtk" => "reconstruct_surface_bunny_par_grid.vtk", default_params_with(Strategy::SubdomainGrid), 60000, 80000, cfg_attr(debug_assertions, ignore));

generate_test!(f32, surface_reconstruction_hexecontahedron_stitching, "pentagonal_hexecontahedron_32286_particles.vtk" => "reconstruct_surface_pentagonal_hexecontahedron_par_stitching.vtk", default_params_with(Strategy::OctreeStitching), 550000, 650000, cfg_attr(debug_assertions, ignore));
generate_test!(f32, surface_reconstruction_hexecontahedron_grid, "pentagonal_hexecontahedron_32286_particles.vtk" => "reconstruct_surface_pentagonal_hexecontahedron_par_grid.vtk", default_params_with(Strategy::SubdomainGrid), 550000, 650000, cfg_attr(debug_assertions, ignore));
generate_test!(f32, surface_reconstruction_hexecontahedron_stitching, "pentagonal_hexecontahedron_32286_particles.bgeo" => "reconstruct_surface_pentagonal_hexecontahedron_par_stitching.vtk", default_params_with(Strategy::OctreeStitching), 550000, 650000, cfg_attr(debug_assertions, ignore));
generate_test!(f32, surface_reconstruction_hexecontahedron_grid, "pentagonal_hexecontahedron_32286_particles.bgeo" => "reconstruct_surface_pentagonal_hexecontahedron_par_grid.vtk", default_params_with(Strategy::SubdomainGrid), 550000, 650000, cfg_attr(debug_assertions, ignore));

generate_test!(f32, surface_reconstruction_hilbert_stitching, "hilbert_46843_particles.vtk" => "reconstruct_surface_hilbert_par_stitching.vtk", default_params_with(Strategy::OctreeStitching), 360000, 400000, cfg_attr(debug_assertions, ignore));
generate_test!(f32, surface_reconstruction_hilbert_stitching, "hilbert_46843_particles.bgeo" => "reconstruct_surface_hilbert_par_stitching.vtk", default_params_with(Strategy::OctreeStitching), 360000, 400000, cfg_attr(debug_assertions, ignore));
generate_test!(f32, surface_reconstruction_hilbert2_stitching, "hilbert2_7954_particles.vtk" => "reconstruct_surface_hilbert2_par_stitching.vtk", params(0.025, 4.0, 1.1, 0.6, Strategy::OctreeStitching), 90000, 100000);
generate_test!(f32, surface_reconstruction_octocat_stitching, "octocat_32614_particles.vtk" => "reconstruct_surface_octocat_par_stitching.vtk", params(0.025, 4.0, 0.75, 0.6, Strategy::OctreeStitching), 140000, 180000, cfg_attr(debug_assertions, ignore));
generate_test!(f32, surface_reconstruction_octocat_stitching, "octocat_32614_particles.bgeo" => "reconstruct_surface_octocat_par_stitching.vtk", params(0.025, 4.0, 0.75, 0.6, Strategy::OctreeStitching), 140000, 180000, cfg_attr(debug_assertions, ignore));

generate_test!(f32, surface_reconstruction_hilbert_grid, "hilbert_46843_particles.vtk" => "reconstruct_surface_hilbert_par_grid.vtk", default_params_with(Strategy::SubdomainGrid), 360000, 400000, cfg_attr(debug_assertions, ignore));
generate_test!(f32, surface_reconstruction_hilbert_grid, "hilbert_46843_particles.bgeo" => "reconstruct_surface_hilbert_par_grid.vtk", default_params_with(Strategy::SubdomainGrid), 360000, 400000, cfg_attr(debug_assertions, ignore));
generate_test!(f32, surface_reconstruction_hilbert2_grid, "hilbert2_7954_particles.vtk" => "reconstruct_surface_hilbert2_par_grid.vtk", params(0.025, 4.0, 1.1, 0.6, Strategy::SubdomainGrid), 90000, 100000);
generate_test!(f32, surface_reconstruction_octocat_grid, "octocat_32614_particles.vtk" => "reconstruct_surface_octocat_par_grid.vtk", params(0.025, 4.0, 0.75, 0.6, Strategy::SubdomainGrid), 140000, 180000, cfg_attr(debug_assertions, ignore));
generate_test!(f32, surface_reconstruction_octocat_grid, "octocat_32614_particles.bgeo" => "reconstruct_surface_octocat_par_grid.vtk", params(0.025, 4.0, 0.75, 0.6, Strategy::SubdomainGrid), 140000, 180000, cfg_attr(debug_assertions, ignore));

generate_test!(f32, surface_reconstruction_knot_global, "sailors_knot_19539_particles.vtk" => "reconstruct_surface_knot_par_global.vtk", params(0.025, 4.0, 1.1, 0.6, Strategy::Global), 40000, 70000, cfg_attr(debug_assertions, ignore));
generate_test!(f32, surface_reconstruction_knot_stitching, "sailors_knot_19539_particles.vtk" => "reconstruct_surface_knot_par_stitching.vtk", params(0.025, 4.0, 1.1, 0.6, Strategy::OctreeStitching), 40000, 70000);
Expand Down
6 changes: 3 additions & 3 deletions splashsurf_lib/tests/integration_tests/test_octree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ fn build_octree_par_consistency<I: Index, R: Real, P: AsRef<Path>>(
file: P,
parameters: TestParameters<R>,
) {
let particles = io::vtk_format::particles_from_vtk::<R, _>(file).unwrap();
let particles = io::particles_from_file::<R, _>(file).unwrap();

let grid = parameters.build_grid::<I>(particles.as_slice());

Expand Down Expand Up @@ -369,7 +369,7 @@ fn build_octree_double_dam_break() {
#[cfg_attr(debug_assertions, ignore)]
fn build_octree_dam_break() {
build_octree_par_consistency::<i64, f64, _>(
"../data/dam_break_frame_23_24389_particles.vtk",
"../data/dam_break_frame_23_24389_particles.bgeo",
TestParameters::default()
.with_margin(Some(1.0))
.with_max_particles_per_cell(Some(1000)),
Expand All @@ -390,7 +390,7 @@ fn build_octree_bunny() {
#[cfg_attr(debug_assertions, ignore)]
fn build_octree_hilbert() {
build_octree_par_consistency::<i64, f64, _>(
"../data/hilbert_46843_particles.vtk",
"../data/hilbert_46843_particles.bgeo",
TestParameters::default()
.with_margin(Some(1.0))
.with_max_particles_per_cell(Some(1000)),
Expand Down

0 comments on commit 91da718

Please sign in to comment.