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

Function test_save_vector_element

python/test/unit/io/test_vtk.py:187–202  ·  view source on GitHub ↗
(tempdir, cell_type)

Source from the content-addressed store, hash-verified

185
186@pytest.mark.parametrize("cell_type", cell_types_2D)
187def test_save_vector_element(tempdir, cell_type):
188 mesh = create_unit_square(MPI.COMM_WORLD, 16, 16, cell_type=cell_type)
189 u = Function(functionspace(mesh, ("RT", 1)))
190
191 def f(x):
192 vals = np.zeros((2, x.shape[1]))
193 vals[0] = x[0]
194 vals[1] = 2 * x[0] * x[1]
195 return vals
196
197 u.interpolate(f)
198 filename = Path(tempdir, "u.pvd")
199 with pytest.raises(RuntimeError):
200 with VTKFile(MPI.COMM_WORLD, filename, "w") as vtk:
201 vtk.write_function(u, 0.0)
202 vtk.write_function(u, 1.0)
203
204
205def test_save_vtk_cell_point(tempdir):

Callers

nothing calls this directly

Calls 6

interpolateMethod · 0.95
create_unit_squareFunction · 0.90
FunctionClass · 0.90
functionspaceFunction · 0.90
VTKFileClass · 0.90
write_functionMethod · 0.45

Tested by

no test coverage detected