MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / test_save_2d_vector_CG2

Function test_save_2d_vector_CG2

python/test/unit/io/test_vtk.py:130–147  ·  view source on GitHub ↗
(tempdir)

Source from the content-addressed store, hash-verified

128
129@pytest.mark.skip_in_parallel
130def test_save_2d_vector_CG2(tempdir):
131 points = np.array(
132 [[0, 0], [1, 0], [1, 2], [0, 2], [1 / 2, 0], [1, 1], [1 / 2, 2], [0, 1], [1 / 2, 1]],
133 dtype=default_real_type,
134 )
135 points = np.array(
136 [[0, 0], [1, 0], [0, 2], [0.5, 1], [0, 1], [0.5, 0], [1, 2], [0.5, 2], [1, 1]],
137 dtype=default_real_type,
138 )
139 cells = np.array([[0, 1, 2, 3, 4, 5], [1, 6, 2, 7, 3, 8]])
140 domain = ufl.Mesh(element("Lagrange", "triangle", 2, shape=(2,), dtype=default_real_type))
141 mesh = create_mesh(MPI.COMM_WORLD, cells, domain, points)
142 gdim = mesh.geometry.dim
143 u = Function(functionspace(mesh, ("Lagrange", 2, (gdim,))))
144 u.interpolate(lambda x: np.vstack((x[0], x[1])))
145 filename = Path(tempdir, "u.pvd")
146 with VTKFile(mesh.comm, filename, "w") as vtk:
147 vtk.write_function(u, 0.0)
148
149
150def test_save_vtk_mixed(tempdir):

Callers

nothing calls this directly

Calls 8

interpolateMethod · 0.95
create_meshFunction · 0.90
FunctionClass · 0.90
functionspaceFunction · 0.90
VTKFileClass · 0.90
MeshMethod · 0.80
arrayMethod · 0.45
write_functionMethod · 0.45

Tested by

no test coverage detected