dolfinx.io
Tools for file input/output (IO).
Functions
|
Given a set of mesh entities and values, distribute them to the process that owns the entity. |
Classes
|
Interface to VTK files. |
|
- class dolfinx.io.VTKFile(self, comm: MPICommWrapper, filename: str | os.PathLike, mode: str)[source]
Bases:
VTKFile
Interface to VTK files.
VTK supports arbitrary order Lagrange finite elements for the geometry description. XDMF is the preferred format for geometry order <= 2.
- class dolfinx.io.XDMFFile(self, comm: MPICommWrapper, filename: str | os.PathLike, file_mode: str, encoding: dolfinx.cpp.io.XDMFFile.Encoding = Encoding.HDF5)[source]
Bases:
XDMFFile
- read_mesh(ghost_mode=GhostMode.shared_facet, name='mesh', xpath='/Xdmf/Domain') Mesh [source]
Read mesh data from file.
- read_meshtags(self, mesh: dolfinx.cpp.mesh.Mesh_float64, name: str, xpath: str = '/Xdmf/Domain') dolfinx.cpp.mesh.MeshTags_int32 [source]
- write_function(u: Function, t: float = 0.0, mesh_xpath="/Xdmf/Domain/Grid[@GridType='Uniform'][1]")[source]
Write function to file for a given time.
Note
Function is interpolated onto the mesh nodes, as a Nth order Lagrange function, where N is the order of the coordinate map. If the Function is a cell-wise constant, it is saved as a cell-wise constant.
- Parameters:
u – Function to write to file.
t – Time associated with Function output.
mesh_xpath – Path to mesh associated with the Function in the XDMFFile.
- dolfinx.io.distribute_entity_data(mesh: Mesh, entity_dim: int, entities: ndarray[Any, dtype[int64]], values: ndarray) tuple[ndarray[Any, dtype[int64]], ndarray] [source]
Given a set of mesh entities and values, distribute them to the process that owns the entity.
The entities are described by the global vertex indices of the mesh. These entity indices are using the original input ordering.
- Returns:
Entities owned by the process (and their local entity-to-vertex indices) and the corresponding values.