mirror of
https://github.com/NGSolve/netgen.git
synced 2025-04-03 14:24:30 +05:00
test pickling also non-empty mesh
This commit is contained in:
parent
b83d73e919
commit
167df9feb9
@ -87,19 +87,23 @@ def test_pickle_geom2d():
|
|||||||
|
|
||||||
def test_pickle_mesh():
|
def test_pickle_mesh():
|
||||||
import netgen.csg as csg
|
import netgen.csg as csg
|
||||||
geo = csg.CSGeometry()
|
geo1 = csg.CSGeometry()
|
||||||
|
geo2 = csg.CSGeometry()
|
||||||
brick = csg.OrthoBrick(csg.Pnt(-3,-3,-3), csg.Pnt(3,3,3))
|
brick = csg.OrthoBrick(csg.Pnt(-3,-3,-3), csg.Pnt(3,3,3))
|
||||||
mesh = geo.GenerateMesh(maxh=0.2)
|
geo2.Add(brick)
|
||||||
assert geo == mesh.GetGeometry()
|
|
||||||
dump = pickle.dumps([geo,mesh])
|
for geo in [geo1, geo2]:
|
||||||
geo2, mesh2 = pickle.loads(dump)
|
mesh = geo.GenerateMesh(maxh=2)
|
||||||
assert geo2 == mesh2.GetGeometry()
|
assert geo == mesh.GetGeometry()
|
||||||
mesh.Save("msh1.vol.gz")
|
dump = pickle.dumps([geo,mesh])
|
||||||
mesh2.Save("msh2.vol.gz")
|
geo2, mesh2 = pickle.loads(dump)
|
||||||
import filecmp, os
|
assert geo2 == mesh2.GetGeometry()
|
||||||
assert filecmp.cmp("msh1.vol.gz", "msh2.vol.gz")
|
mesh.Save("msh1.vol.gz")
|
||||||
os.remove("msh1.vol.gz")
|
mesh2.Save("msh2.vol.gz")
|
||||||
os.remove("msh2.vol.gz")
|
import filecmp, os
|
||||||
|
assert filecmp.cmp("msh1.vol.gz", "msh2.vol.gz")
|
||||||
|
os.remove("msh1.vol.gz")
|
||||||
|
os.remove("msh2.vol.gz")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_pickle_mesh()
|
test_pickle_mesh()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user