27
27
file_options = ["ascii", "base64", "compressed"]
28
mesh_functions = [CellFunction, FacetFunction, FaceFunction, EdgeFunction, VertexFunction]
29
mesh_function_types = ["size_t", "int", "double", "bool"]
31
class VTK_MeshFunction_Output(unittest.TestCase):
32
"""Test output of MeshFunctions to VTK files"""
33
def test_save_1d_meshfunctions(self):
34
#if MPI.num_processes() == 1:
35
mesh = UnitIntervalMesh(32)
36
for F in mesh_functions:
37
if F in [FaceFunction, EdgeFunction]: continue
38
for t in mesh_function_types:
44
for file_option in file_options:
45
File("mf.pvd", file_option) << mf
47
def test_save_2d_meshfunctions(self):
48
mesh = UnitSquareMesh(32, 32)
49
for F in mesh_functions:
50
for t in mesh_function_types:
56
for file_option in file_options:
57
File("mf.pvd", file_option) << mf
59
def test_save_3d_meshfunctions(self):
60
mesh = UnitCubeMesh(8, 8, 8)
61
for F in mesh_functions:
62
for t in mesh_function_types:
68
for file_option in file_options:
69
File("mf.pvd", file_option) << mf
29
71
class VTK_Mesh_Output(unittest.TestCase):
30
72
"""Test output of Meshes to VTK files"""
32
74
def test_save_1d_mesh(self):
33
if MPI.num_processes() == 1:
34
mesh = UnitIntervalMesh(32)
35
File("mesh.pvd") << mesh
36
for file_option in file_options:
37
File("mesh.pvd", file_option) << mesh
75
mesh = UnitIntervalMesh(32)
76
File("mesh.pvd") << mesh
80
for file_option in file_options:
81
File("mesh.pvd", file_option) << mesh
39
83
def test_save_2d_mesh(self):
40
84
mesh = UnitSquareMesh(32, 32)
41
85
File("mesh.pvd") << mesh
42
89
for file_option in file_options:
43
90
File("mesh.pvd", file_option) << mesh
45
92
def test_save_3d_mesh(self):
46
93
mesh = UnitCubeMesh(8, 8, 8)
47
94
File("mesh.pvd") << mesh
48
98
for file_option in file_options:
49
99
File("mesh.pvd", file_option) << mesh