Test writing cell-wise and point-wise data.
(tempdir)
| 203 | |
| 204 | |
| 205 | def test_save_vtk_cell_point(tempdir): |
| 206 | """Test writing cell-wise and point-wise data.""" |
| 207 | mesh = create_unit_cube(MPI.COMM_WORLD, 3, 3, 3) |
| 208 | P2 = element("Lagrange", mesh.basix_cell(), 1, shape=(3,), dtype=default_real_type) |
| 209 | P1 = element("Discontinuous Lagrange", mesh.basix_cell(), 0, dtype=default_real_type) |
| 210 | |
| 211 | V2, V1 = functionspace(mesh, P2), functionspace(mesh, P1) |
| 212 | U2, U1 = Function(V2), Function(V1) |
| 213 | U2.interpolate(lambda x: np.vstack((x[0], 0.2 * x[1], np.zeros_like(x[0])))) |
| 214 | U1.interpolate(lambda x: 0.5 * x[0]) |
| 215 | U2.name = "A" |
| 216 | U1.name = "B" |
| 217 | |
| 218 | filename = Path(tempdir, "u.pvd") |
| 219 | with VTKFile(mesh.comm, filename, "w") as vtk: |
| 220 | vtk.write_function([U2, U1], 0.0) |
| 221 | with VTKFile(mesh.comm, filename, "w") as vtk: |
| 222 | vtk.write_function((U1, U2), 0.0) |
| 223 | |
| 224 | |
| 225 | def test_save_1d_tensor(tempdir): |
nothing calls this directly
no test coverage detected