|
1 | 1 | import pysplashsurf |
2 | 2 | import numpy as np |
3 | | -import math |
4 | 3 | import meshio |
5 | 4 | import subprocess |
6 | 5 | import time |
|
9 | 8 |
|
10 | 9 | BINARY_PATH = "splashsurf" |
11 | 10 | DIR = pathlib.Path(__file__).parent.resolve() |
12 | | -BGEO_PATH = DIR.joinpath("ParticleData_Fluid_50.bgeo") |
13 | 11 | VTK_PATH = DIR.joinpath("ParticleData_Fluid_5.vtk") |
14 | 12 |
|
15 | 13 |
|
16 | 14 | def now_s(): |
17 | 15 | return time.process_time_ns() / (10**9) |
18 | 16 |
|
19 | 17 |
|
20 | | -def test_bgeo(): |
21 | | - particles = np.array(meshio.read(BGEO_PATH).points, dtype=np.float32) |
22 | | - |
23 | | - assert len(particles) == 4732 |
24 | | - |
25 | | - |
26 | | -def test_aabb_class(): |
27 | | - print("\nTesting AABB class") |
28 | | - |
29 | | - aabb = pysplashsurf.Aabb3d.from_min_max(min=[0.0, 0.0, 0.0], max=[1.0, 2.0, 3.0]) |
30 | | - assert (aabb.min == np.array([0.0, 0.0, 0.0])).all() |
31 | | - assert (aabb.max == np.array([1.0, 2.0, 3.0])).all() |
32 | | - |
33 | | - aabb = pysplashsurf.Aabb3d.from_min_max(min=np.array([0.0, 0.0, 0.0]), max=np.array([1.0, 2.0, 3.0])) |
34 | | - assert (aabb.min == np.array([0.0, 0.0, 0.0])).all() |
35 | | - assert (aabb.max == np.array([1.0, 2.0, 3.0])).all() |
36 | | - |
37 | | - aabb = pysplashsurf.Aabb3d.from_points( |
38 | | - np.array([[0.0, 0.0, 0.0], [1.0, 1.0, 1.0], [2.0, 0.5, 4.2]]) |
39 | | - ) |
40 | | - |
41 | | - print("AABB min:", aabb.min) |
42 | | - print("AABB max:", aabb.max) |
43 | | - |
44 | | - assert (aabb.min == np.array([0.0, 0.0, 0.0])).all() |
45 | | - assert (aabb.max == np.array([2.0, 1.0, 4.2])).all() |
46 | | - |
47 | | - assert aabb.contains_point([1.0, 0.9, 4.1]) |
48 | | - assert aabb.contains_point([0.0, 0.0, 0.0]) |
49 | | - assert not aabb.contains_point([2.0, 1.0, 4.2]) |
50 | | - assert not aabb.contains_point([1.0, -1.0, 5.0]) |
51 | | - |
52 | | - |
53 | 18 | def test_marching_cubes_calls(): |
54 | 19 | print("\nTesting marching cubes calls") |
55 | 20 |
|
@@ -284,4 +249,3 @@ def test_with_post_processing(): |
284 | 249 | print("Python verts:", python_verts) |
285 | 250 |
|
286 | 251 | assert np.allclose(binary_verts, python_verts) |
287 | | - |
0 commit comments