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

Class VTKFile

python/dolfinx/io/utils.py:116–139  ·  view source on GitHub ↗

Interface to VTK files. VTK supports arbitrary order Lagrange finite elements for the geometry description. XDMF is the preferred format for geometry order <= 2.

Source from the content-addressed store, hash-verified

114
115
116class VTKFile(_cpp.io.VTKFile):
117 """Interface to VTK files.
118
119 VTK supports arbitrary order Lagrange finite elements for the
120 geometry description. XDMF is the preferred format for geometry
121 order <= 2.
122 """
123
124 def __enter__(self):
125 """Enter context manager."""
126 return self
127
128 def __exit__(self, exception_type, exception_value, traceback):
129 """Exit context manager and close file."""
130 self.close()
131
132 def write_mesh(self, mesh: Mesh, t: float = 0.0) -> None:
133 """Write mesh to file for a given time."""
134 self.write(mesh._cpp_object, t)
135
136 def write_function(self, u: list[Function] | Function, t: float = 0.0) -> None:
137 """Write a functions to file with a given time."""
138 cpp_objects = [u._cpp_object] if isinstance(u, Function) else [_u._cpp_object for _u in u]
139 super().write(cpp_objects, t)
140
141
142class XDMFFile(_cpp.io.XDMFFile):

Callers 15

test_save_1d_mesh_subdirFunction · 0.90
test_save_2d_meshFunction · 0.90
test_save_3d_meshFunction · 0.90
test_save_1d_scalarFunction · 0.90
test_save_2d_scalarFunction · 0.90
test_save_3d_scalarFunction · 0.90
test_save_1d_vectorFunction · 0.90
test_save_2d_vectorFunction · 0.90
test_save_2d_vector_CG2Function · 0.90
test_save_vtk_mixedFunction · 0.90
test_save_vector_elementFunction · 0.90
test_save_vtk_cell_pointFunction · 0.90

Calls

no outgoing calls

Tested by 15

test_save_1d_mesh_subdirFunction · 0.72
test_save_2d_meshFunction · 0.72
test_save_3d_meshFunction · 0.72
test_save_1d_scalarFunction · 0.72
test_save_2d_scalarFunction · 0.72
test_save_3d_scalarFunction · 0.72
test_save_1d_vectorFunction · 0.72
test_save_2d_vectorFunction · 0.72
test_save_2d_vector_CG2Function · 0.72
test_save_vtk_mixedFunction · 0.72
test_save_vector_elementFunction · 0.72
test_save_vtk_cell_pointFunction · 0.72