dolfinx.io

IO module for input data, post-processing 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 collects 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 VTK supports arbitrary order Lagrangian finite elements for the geometry description.

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

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

Bases: dolfinx.cpp.io.VTKFile

Interface to VTK files VTK supports arbitrary order Lagrangian 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.cpp.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: str, 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')[source]
write_function(*args, **kwargs)[source]

Overloaded function.

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

  2. write_function(self: dolfinx.cpp.io.XDMFFile, function: dolfinx::fem::Function<std::complex<double> >, t: float, mesh_xpath: str) -> None

dolfinx.io.extract_gmsh_geometry(gmsh_model, model_name=None)[source]

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.

dolfinx.io.extract_gmsh_topology_and_markers(gmsh_model, model_name=None)[source]

Extract all entities tagged with a physical marker in the gmsh model, and collects the data per cell type. Returns a nested dictionary where the first key is the gmsh MSH element type integer. Each element type present in the model contains the cell topology of the elements and corresponding markers.

dolfinx.io.ufl_mesh_from_gmsh(gmsh_cell: int, gdim: int)[source]

Create a UFL mesh from a Gmsh cell identifier and the geometric dimension. See: # http://gmsh.info//doc/texinfo/gmsh.html#MSH-file-format