FEM: unit tests, add FEM_VTK check and reactivate vtk mesh test

This commit is contained in:
Bernd Hahnebach
2018-12-16 11:30:46 +01:00
committed by Yorik van Havre
parent ef34dd3a4f
commit 41e56ef9d0

View File

@@ -304,7 +304,6 @@ class TestMeshEleTetra10(unittest.TestCase):
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Volumes are different.\n"
)
'''
def test_tetra10_vkt(self):
# tetra10 element: reading from and writing to unv mesh file format
filetyp = 'vtk'
@@ -312,43 +311,45 @@ class TestMeshEleTetra10(unittest.TestCase):
testfile = self.base_testfile + filetyp
# fcc_print(outfile)
# fcc_print(testfile)
self.femmesh.write(outfile) # write the mesh
femmesh_outfile = Fem.read(outfile) # read the mesh from written mesh
femmesh_testfile = Fem.read(testfile) # read the mesh from test mesh
# reading the test mesh
self.assertEqual(
femmesh_testfile.Nodes,
self.expected_nodes['nodes'],
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Nodes are different.\n"
)
self.assertEqual(
[femmesh_testfile.Volumes[0], femmesh_testfile.getElementNodes(femmesh_outfile.Volumes[0])],
self.expected_elem['volumes'],
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Volumes are different.\n"
)
# reading the written mesh
self.assertEqual(
femmesh_outfile.Nodes,
self.expected_nodes['nodes'],
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Nodes are different.\n"
)
self.assertEqual(
[femmesh_outfile.Volumes[0], femmesh_outfile.getElementNodes(femmesh_outfile.Volumes[0])],
self.expected_elem['volumes'],
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Volumes are different.\n"
)
# both
self.assertEqual(
femmesh_outfile.Nodes,
femmesh_testfile.Nodes,
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Nodes are different.\n"
)
self.assertEqual(
femmesh_outfile.Volumes,
femmesh_testfile.Volumes,
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Volumes are different.\n"
)
'''
if "BUILD_FEM_VTK" in FreeCAD.__cmake__:
self.femmesh.write(outfile) # write the mesh
femmesh_outfile = Fem.read(outfile) # read the mesh from written mesh
femmesh_testfile = Fem.read(testfile) # read the mesh from test mesh
# reading the test mesh
self.assertEqual(
femmesh_testfile.Nodes,
self.expected_nodes['nodes'],
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Nodes are different.\n"
)
self.assertEqual(
[femmesh_testfile.Volumes[0], femmesh_testfile.getElementNodes(femmesh_outfile.Volumes[0])],
self.expected_elem['volumes'],
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Volumes are different.\n"
)
# reading the written mesh
self.assertEqual(
femmesh_outfile.Nodes,
self.expected_nodes['nodes'],
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Nodes are different.\n"
)
self.assertEqual(
[femmesh_outfile.Volumes[0], femmesh_outfile.getElementNodes(femmesh_outfile.Volumes[0])],
self.expected_elem['volumes'],
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Volumes are different.\n"
)
# both
self.assertEqual(
femmesh_outfile.Nodes,
femmesh_testfile.Nodes,
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Nodes are different.\n"
)
self.assertEqual(
femmesh_outfile.Volumes,
femmesh_testfile.Volumes,
"Test writing " + self.elem + " mesh to " + filetyp + " file failed. Volumes are different.\n"
)
else:
fcc_print('FEM_VTK post processing is disabled.')
def test_tetra10_z88(self):
# tetra10 element: reading from and writing to z88 mesh file format