dolfinx.io

IO module for input data, post-processing file outout and checkpointing

Functions

extract_gmsh_geometry(gmsh_model[, model_name])

For a given gmsh model, extract the mesh geometry as a numpy (N, 3) array where the i-th row corresponds to the i-th node in the mesh.

extract_gmsh_topology_and_markers(gmsh_model)

Extract all entities tagged with a physical marker in the gmsh model, and collect the data per cell type.

ufl_mesh_from_gmsh(gmsh_cell, gdim)

Create a UFL mesh from a Gmsh cell identifier and the geometric dimension.

Classes

VTKFile(self, comm, filename, mode)

Interface to VTK files

XDMFFile(self, comm, filename, file_mode, ...)

class dolfinx.io.VTKFile(self: dolfinx.cpp.io.VTKFile, comm: MPICommWrapper, filename: os.PathLike, mode: str) None[source]

Bases: dolfinx.cpp.io.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.

write_function(u: Union[List[dolfinx.fem.function.Function], dolfinx.fem.function.Function], t: float = 0.0) None[source]

Write a single function or a list of functions to file for a given time (default 0.0)

write_mesh(mesh: dolfinx.mesh.Mesh, t: float = 0.0) None[source]

Write mesh to file for a given time (default 0.0)

class dolfinx.io.XDMFFile(self: dolfinx.cpp.io.XDMFFile, comm: MPICommWrapper, filename: os.PathLike, file_mode: str, encoding: dolfinx.cpp.io.XDMFFile.Encoding = <Encoding.HDF5: 0>) None[source]

Bases: dolfinx.cpp.io.XDMFFile

read_mesh(ghost_mode=<GhostMode.shared_facet: 1>, name='mesh', xpath='/Xdmf/Domain') dolfinx.mesh.Mesh[source]

Read mesh data from file

read_meshtags(self: dolfinx.cpp.io.XDMFFile, mesh: dolfinx.cpp.mesh.Mesh, name: str, xpath: str = '/Xdmf/Domain') dolfinx.cpp.mesh.MeshTags_int32[source]
write_function(*args, **kwargs)[source]

Overloaded function.

  1. write_function(self: dolfinx.cpp.io.XDMFFile, function: dolfinx.cpp.fem.Function_float64, t: float, mesh_xpath: str) -> None

  2. write_function(self: dolfinx.cpp.io.XDMFFile, function: dolfinx.cpp.fem.Function_complex128, t: float, mesh_xpath: str) -> None

write_mesh(mesh: dolfinx.mesh.Mesh) None[source]

Write mesh to file for a given time (default 0.0)

dolfinx.io.cell_perm_gmsh()

perm_gmsh(arg0: dolfinx.cpp.mesh.CellType, arg1: int) -> List[int]

Permutation array to map from Gmsh to DOLFINx node ordering

dolfinx.io.distribute_entity_data(arg0: dolfinx.cpp.mesh.Mesh, arg1: int, arg2: numpy.ndarray[numpy.int64], arg3: numpy.ndarray[numpy.int32]) Tuple[numpy.ndarray[numpy.int32], numpy.ndarray[numpy.int32]]