22import pytest
33import math
44import LimaScripting as lima
5+ import os
56
67def l2_norme (n0 , n1 ):
78 return math .sqrt ( pow (n1 .x ()- n0 .x (),2 ) + pow (n1 .y ()- n0 .y (),2 ) + pow (n1 .z ()- n0 .z (),2 ) )
@@ -32,7 +33,7 @@ def test_law_biexponential_Linear(capfd):
3233 ctx .getMeshManager ().newAllBlocksMesh ()
3334
3435 # Sauvegarde du maillage (mli)
35- filename = "meshing_law_biexponential.mli2"
36+ filename = "/dev/shm/ meshing_law_biexponential.mli2"
3637 mm .writeMli (filename )
3738 mesh_lima = lima .Maillage ()
3839 mesh_lima .lire (filename )
@@ -60,6 +61,8 @@ def test_law_biexponential_Linear(capfd):
6061 n107 = mesh_lima .noeud (107 )
6162 assert ( abs (l2_norme (n2 , n107 ) - s2_ar0011 ) < eps )
6263
64+ os .remove (filename )
65+
6366# Target sizes are not respected here. It is due to how
6467# the projected topological edge length is computed in
6568# the code. This also affects the other laws.
@@ -86,7 +89,7 @@ def test_law_biexponential_onCurve_1(capfd):
8689 ctx .getMeshManager ().newAllBlocksMesh ()
8790
8891 # Sauvegarde du maillage (mli)
89- filename = "meshing_law_biexponential.mli2"
92+ filename = "/dev/shm/ meshing_law_biexponential.mli2"
9093 mm .writeMli (filename )
9194 mesh_lima = lima .Maillage ()
9295 mesh_lima .lire (filename )
@@ -126,6 +129,7 @@ def test_law_biexponential_onCurve_1(capfd):
126129 # because the topological edge is straight)
127130 assert ( abs (l2_norme (n7 , n203 ) - s2_ar0000 ) < eps )
128131
132+ os .remove
129133
130134# Bi-exponential law with target first and last mesh edge size for a topological
131135# edge associated to a geometric curve with the two topological
@@ -174,7 +178,7 @@ def test_law_biexponential_onCurve_2(capfd):
174178 ctx .getMeshManager ().newAllBlocksMesh ()
175179
176180 # Sauvegarde du maillage (mli)
177- filename = "meshing_law_biexponential_3.mli2"
181+ filename = "/dev/shm/ meshing_law_biexponential_3.mli2"
178182 mm .writeMli (filename )
179183 mesh_lima = lima .Maillage ()
180184 mesh_lima .lire (filename )
@@ -215,6 +219,7 @@ def test_law_biexponential_onCurve_2(capfd):
215219 # real meshing edge size
216220 assert ( abs (l2_norme (n7 , n123 ) - 3.97338661590123e-1 ) < eps )
217221
222+ os .remove (filename )
218223
219224# Bi-exponential law with target first and last mesh edge size for a topological
220225# edge associated to a geometric surface.
@@ -268,7 +273,7 @@ def test_law_biexponential_onSurface(capfd):
268273 ctx .getMeshManager ().newAllBlocksMesh ()
269274
270275 # Sauvegarde du maillage (mli)
271- filename = "meshing_law_geometric_3.mli2"
276+ filename = "/dev/shm/ meshing_law_geometric_3.mli2"
272277 mm .writeMli (filename )
273278 mesh_lima = lima .Maillage ()
274279 mesh_lima .lire (filename )
@@ -307,4 +312,6 @@ def test_law_biexponential_onSurface(capfd):
307312 # target meshing edge size (not respected)
308313 assert ( abs (l2_norme (n8 , n192 ) - s2_ar0022 ) > eps )
309314 # real meshing edge size
310- assert ( abs (l2_norme (n8 , n192 ) - 4.9378232958398e-1 ) < eps )
315+ assert ( abs (l2_norme (n8 , n192 ) - 4.9378232958398e-1 ) < eps )
316+
317+ os .remove (filename )
0 commit comments