Skip to content

Commit

Permalink
tests added/updated
Browse files Browse the repository at this point in the history
  • Loading branch information
felicio93 committed Jun 17, 2024
1 parent e242aaa commit ae9d71b
Show file tree
Hide file tree
Showing 4 changed files with 1,706,223 additions and 193 deletions.
3 changes: 2 additions & 1 deletion ocsmesh/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2927,7 +2927,7 @@ def fix_small_el(mesh_w_problem: jigsaw_msh_t,

def merge_overlapping_meshes(all_msht: list,
adjacent_layers: int = 0,
buffer_size: float = 0.001,
buffer_size: float = 0.005,
buffer_domain: float = 0.01,
min_int_ang: int = 30,
crs=CRS.from_epsg(4326)
Expand Down Expand Up @@ -2988,6 +2988,7 @@ def merge_overlapping_meshes(all_msht: list,
msht_combined = clip_mesh_by_shape(msht_combined,
domain.unary_union
)
del carved_mesh,buff_mesh,domain,msht

msht_combined = cleanup_folded_bound_el(msht_combined)

Expand Down
18 changes: 14 additions & 4 deletions tests/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_create_patch_mesh(self):
filtered,
mesh_for_patch)

self.assertEqual(len(patch.tria3), 73)
self.assertEqual(len(patch.tria3), 101)

def test_clip_mesh_by_mesh(self):
p = Path(__file__).parents[1] / "data" / "test_mesh_1.2dm"
Expand All @@ -92,7 +92,7 @@ def test_create_mesh_from_mesh_diff(self):
patch.msh_t,
carved_mesh)

self.assertEqual(len(msht_buffer.tria3), 48)
self.assertEqual(len(msht_buffer.tria3), 49)

def test_merge_neighboring_meshes(self):
p0 = Path(__file__).parents[1] / "data" / "test_mesh_1.2dm"
Expand All @@ -110,7 +110,7 @@ def test_merge_neighboring_meshes(self):
carved_mesh,
msht_buffer.msh_t)

self.assertEqual(len(merged_mesh.tria3), 1130251)
self.assertEqual(len(merged_mesh.tria3), 1130280)

def test_fix_small_el(self):
p = Path(__file__).parents[1] / "data" / "test_mesh_1.2dm"
Expand All @@ -120,7 +120,17 @@ def test_fix_small_el(self):

fixed_mesh = utils.fix_small_el(mesh,mesh_for_patch)

self.assertEqual(len(fixed_mesh.tria3), 1130213)
self.assertEqual(len(fixed_mesh.tria3), 1130876)

def test_merge_overlapping_meshes(self):
p = Path(__file__).parents[1] / "data" / "test_mesh_1.2dm"
mesh = Mesh.open(p, crs=4326)
p3 = Path(__file__).parents[1] / "data" / "patch.2dm"
patch = Mesh.open(p3, crs=4326)

smooth = utils.merge_overlapping_meshes([mesh.msh_t,patch.msh_t])

self.assertEqual(len(smooth.tria3), 1130935)


class FinalizeMesh(unittest.TestCase):
Expand Down
124 changes: 63 additions & 61 deletions tests/data/msht_buffer.2dm
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
MESH2D
E3T 1 27 26 28
E3T 2 46 33 32
E3T 3 28 26 52
E3T 4 52 50 28
E3T 5 28 50 49
E3T 6 29 31 30
E3T 7 28 49 29
E3T 8 32 31 46
E3T 9 48 31 29
E3T 10 49 48 29
E3T 11 50 52 51
E3T 12 31 47 46
E3T 13 39 38 37
E3T 14 39 37 41
E3T 15 39 41 40
E3T 16 41 37 42
E3T 17 37 43 42
E3T 18 45 35 34
E3T 19 45 33 46
E3T 20 34 33 45
E3T 21 36 43 37
E3T 22 36 35 43
E3T 23 43 35 44
E3T 24 35 45 44
E3T 25 31 48 47
E3T 1 51 27 53
E3T 2 26 53 27
E3T 3 51 28 27
E3T 4 50 29 28
E3T 5 51 53 52
E3T 6 29 50 30
E3T 7 49 32 30
E3T 8 32 47 33
E3T 9 32 31 30
E3T 10 32 48 47
E3T 11 33 47 46
E3T 12 30 50 49
E3T 13 28 51 50
E3T 14 40 39 38
E3T 15 40 38 42
E3T 16 40 42 41
E3T 17 42 38 43
E3T 18 38 44 43
E3T 19 36 35 34
E3T 20 36 34 45
E3T 21 37 44 38
E3T 22 37 36 44
E3T 23 44 36 45
E3T 24 34 46 45
E3T 25 34 33 46
E3T 26 18 17 4
E3T 27 19 18 4
E3T 28 20 23 21
E3T 28 23 21 20
E3T 29 19 3 20
E3T 30 19 4 3
E3T 31 17 16 4
E3T 32 15 14 6
E3T 32 15 14 5
E3T 33 15 5 4
E3T 34 5 15 6
E3T 34 5 14 6
E3T 35 13 12 6
E3T 36 14 13 6
E3T 37 11 6 12
E3T 37 6 12 11
E3T 38 15 4 16
E3T 39 20 2 23
E3T 40 23 22 21
E3T 41 23 2 25
E3T 42 24 23 25
E3T 43 2 1 25
E3T 44 7 6 11
E3T 45 7 11 9
E3T 46 10 9 11
E3T 47 8 7 9
E3T 48 2 20 3
E3T 42 49 48 32
E3T 43 23 25 24
E3T 44 2 1 25
E3T 45 7 6 11
E3T 46 7 11 9
E3T 47 10 9 11
E3T 48 8 7 9
E3T 49 2 20 3
ND 1 -8.1800709129552274E+01 2.6858668796405841E+01 0.0000000000000000E+00
ND 2 -8.1802830619795543E+01 2.6857151760970847E+01 0.0000000000000000E+00
ND 3 -8.1800757433913247E+01 2.6847968629634860E+01 0.0000000000000000E+00
ND 4 -8.1792375664825400E+01 2.6842970869608500E+01 0.0000000000000000E+00
ND 5 -8.1785173075939184E+01 2.6846573552879789E+01 0.0000000000000000E+00
ND 5 -8.1783128762445727E+01 2.6839407007739286E+01 0.0000000000000000E+00
ND 6 -8.1774911488055807E+01 2.6844234486015861E+01 0.0000000000000000E+00
ND 7 -8.1770651107923172E+01 2.6853575586827912E+01 0.0000000000000000E+00
ND 8 -8.1771829530607221E+01 2.6858623174206880E+01 0.0000000000000000E+00
Expand All @@ -72,30 +73,31 @@ ND 22 -8.1826021579152069E+01 2.6854356929787592E+01 0.0000000000000000E+00
ND 23 -8.1819894019569503E+01 2.6861063748952585E+01 0.0000000000000000E+00
ND 24 -8.1820606284914049E+01 2.6871498007083449E+01 0.0000000000000000E+00
ND 25 -8.1809300532495371E+01 2.6866194153893414E+01 0.0000000000000000E+00
ND 26 -8.2391944678709066E+01 2.6914505787210793E+01 0.0000000000000000E+00
ND 27 -8.2390983776010259E+01 2.6916802550709711E+01 0.0000000000000000E+00
ND 26 -8.2391927571087209E+01 2.6914477689095165E+01 0.0000000000000000E+00
ND 27 -8.2389397004283737E+01 2.6915297898189518E+01 0.0000000000000000E+00
ND 28 -8.2387587372883473E+01 2.6916584638968949E+01 0.0000000000000000E+00
ND 29 -8.2387263709992339E+01 2.6918733266002342E+01 0.0000000000000000E+00
ND 30 -8.2388250942804632E+01 2.6920712558191497E+01 0.0000000000000000E+00
ND 30 -8.2384609758394035E+01 2.6920170097923446E+01 0.0000000000000000E+00
ND 31 -8.2386677433944058E+01 2.6922949282413629E+01 0.0000000000000000E+00
ND 32 -8.2387781896475644E+01 2.6925519884989082E+01 0.0000000000000000E+00
ND 33 -8.2388525014643122E+01 2.6927830734180528E+01 0.0000000000000000E+00
ND 34 -8.2389307161527810E+01 2.6929975711320623E+01 0.0000000000000000E+00
ND 35 -8.2390124661606833E+01 2.6932149088661159E+01 0.0000000000000000E+00
ND 36 -8.2393040525505498E+01 2.6932734963334607E+01 0.0000000000000000E+00
ND 37 -8.2397764601215073E+01 2.6933887815998361E+01 0.0000000000000000E+00
ND 38 -8.2403387994573663E+01 2.6932690609234768E+01 0.0000000000000000E+00
ND 39 -8.2405043383134839E+01 2.6935258632362938E+01 0.0000000000000000E+00
ND 40 -8.2407815553080312E+01 2.6939558590039230E+01 0.0000000000000000E+00
ND 41 -8.2400755298546230E+01 2.6940750971728438E+01 0.0000000000000000E+00
ND 42 -8.2394128306488028E+01 2.6940982517527324E+01 0.0000000000000000E+00
ND 43 -8.2391208225469981E+01 2.6936749618659402E+01 0.0000000000000000E+00
ND 44 -8.2385882685490927E+01 2.6936771797279590E+01 0.0000000000000000E+00
ND 45 -8.2382765873858133E+01 2.6932550666841262E+01 0.0000000000000000E+00
ND 46 -8.2380069624270860E+01 2.6928871653166155E+01 0.0000000000000000E+00
ND 47 -8.2378051593881295E+01 2.6924892521577213E+01 0.0000000000000000E+00
ND 48 -8.2379607460096338E+01 2.6920276557920165E+01 0.0000000000000000E+00
ND 49 -8.2382660182991032E+01 2.6916440582362910E+01 0.0000000000000000E+00
ND 50 -8.2384164362433708E+01 2.6911774239225295E+01 0.0000000000000000E+00
ND 51 -8.2387604067068779E+01 2.6907376237782572E+01 0.0000000000000000E+00
ND 52 -8.2390164923156561E+01 2.6911582658695067E+01 0.0000000000000000E+00
ND 32 -8.2385137354009828E+01 2.6925286489576770E+01 0.0000000000000000E+00
ND 33 -8.2386061554730247E+01 2.6927365363601620E+01 0.0000000000000000E+00
ND 34 -8.2386843652012573E+01 2.6929510356437813E+01 0.0000000000000000E+00
ND 35 -8.2389307161527810E+01 2.6929975711320623E+01 0.0000000000000000E+00
ND 36 -8.2390124661606833E+01 2.6932149088661159E+01 0.0000000000000000E+00
ND 37 -8.2393040525505498E+01 2.6932734963334607E+01 0.0000000000000000E+00
ND 38 -8.2397764601215073E+01 2.6933887815998361E+01 0.0000000000000000E+00
ND 39 -8.2403387994573663E+01 2.6932690609234768E+01 0.0000000000000000E+00
ND 40 -8.2405043383134839E+01 2.6935258632362938E+01 0.0000000000000000E+00
ND 41 -8.2407815553080312E+01 2.6939558590039230E+01 0.0000000000000000E+00
ND 42 -8.2400755298546230E+01 2.6940750971728438E+01 0.0000000000000000E+00
ND 43 -8.2394128306488028E+01 2.6940982517527324E+01 0.0000000000000000E+00
ND 44 -8.2391208225469981E+01 2.6936749618659402E+01 0.0000000000000000E+00
ND 45 -8.2385882685490927E+01 2.6936771797279590E+01 0.0000000000000000E+00
ND 46 -8.2382765873858133E+01 2.6932550666841262E+01 0.0000000000000000E+00
ND 47 -8.2380069624270860E+01 2.6928871653166155E+01 0.0000000000000000E+00
ND 48 -8.2378051593881295E+01 2.6924892521577213E+01 0.0000000000000000E+00
ND 49 -8.2379607460096338E+01 2.6920276557920165E+01 0.0000000000000000E+00
ND 50 -8.2382660182991032E+01 2.6916440582362910E+01 0.0000000000000000E+00
ND 51 -8.2384164362433708E+01 2.6911774239225295E+01 0.0000000000000000E+00
ND 52 -8.2387604067068779E+01 2.6907376237782572E+01 0.0000000000000000E+00
ND 53 -8.2390164923156561E+01 2.6911582658695067E+01 0.0000000000000000E+00
Loading

0 comments on commit ae9d71b

Please sign in to comment.