API Reference#
Top-level package for ADIOS2Wrappers.
- class io4dolfinx.FileMode(*values)[source]#
Filen mode used for opening files.
- append = 10#
Append data to file
- read = 30#
Read data from file
- write = 20#
Write data to file
- class io4dolfinx.SubmeshCheckpoint(submesh: Mesh, cell_map: EntityMap, vertex_map: EntityMap, node_map: ndarray[tuple[Any, ...], dtype[int32]], post_code: ndarray[tuple[Any, ...], dtype[int64]])[source]#
A submesh re-derived from a parent mesh that was read from a checkpoint.
- node_map: ndarray[tuple[Any, ...], dtype[int32]]#
Map from geometry nodes of
submeshto nodes of the parent
- property parent_entities: ndarray[tuple[Any, ...], dtype[int32]]#
Parent entities of the submesh cells, aligned with
post_code.
- post_code: ndarray[tuple[Any, ...], dtype[int64]]#
Index the cell had in the stored submesh, per local cell (owned and ghost). This is the key both submeshes agree on:
transfer_submesh_function()derives from it the post office holding each cell, and so routes the data from the stored submesh to this one.
- submesh: Mesh#
The submesh, derived from the parent with
dolfinx.mesh.create_submesh()
- io4dolfinx.convert(input_file: ~pathlib.Path | str, output_file: ~pathlib.Path | str, comm: ~mpi4py.MPI.Comm = <mpi4py.MPI.Intracomm object>, names: ~collections.abc.Sequence[str] | None = None, meshtags: ~collections.abc.Sequence[str] = (), mesh_group: str = '/mesh', backend: str | None = None, backend_args: dict[str, ~typing.Any] | None = None, engine: str = 'BP4', overwrite: bool = False)[source]#
Convert a checkpoint of adios4dolfinx 0.7 or older, or the mesh and mesh functions of a legacy DOLFIN HDF5 file, to the current format.
The data is copied as stored, so the result is read as any checkpoint, with
io4dolfinx.read_mesh(),io4dolfinx.read_meshtags()andio4dolfinx.read_function(). A legacy DOLFIN file is recognised by the topology of its mesh, at mesh_group; any other file is read as an adios4dolfinx checkpoint.- Parameters:
input_file – The file to convert.
output_file – The checkpoint to write.
comm – The communicator to read and write with.
names – The name to give each function of an adios4dolfinx checkpoint, in the order they were written, as the file does not store names. Defaults to
["u"].meshtags – The mesh functions of a legacy DOLFIN file to convert to mesh tags of the same names.
mesh_group – The group of the mesh in a legacy DOLFIN file.
backend – The backend to write with,
"adios2"or"h5py". Chosen from the suffix of output_file if not given:.bpfor ADIOS2,.h5for h5py.backend_args – Arguments of the backend that writes.
engine – The ADIOS2 engine an adios4dolfinx checkpoint was written with.
overwrite – Replace output_file if it exists.
- Raises:
FileExistsError – If output_file exists and overwrite is not set.
ValueError – If input_file is neither kind of file, the number of names is not the number of functions in it, names are given for a legacy DOLFIN file or mesh tags for an adios4dolfinx checkpoint, or the backend is not given and cannot be chosen from the suffix of output_file.
- io4dolfinx.get_backend(backend: str | None = None) IOBackend[source]#
Get backend class from backend name.
- Parameters:
backend – Name of the backend to get
- Returns:
Backend class
- io4dolfinx.read_attributes(filename: Path | str, comm: Comm, name: str, backend_args: dict[str, Any] | None = None, backend: str | None = None) dict[str, Any][source]#
Read attributes from file.
- Parameters:
filename – Path to file to read from
comm – MPI communicator used in storage
name – Name of the attributes
backend_args – Arguments for backend, for instance file type.
backend – What backend to use for writing.
- Returns:
The attributes
- io4dolfinx.read_cell_data(filename: Path | str, name: str, mesh: Mesh, time: float | None = None, backend_args: dict[str, Any] | None = None, backend: str = 'xdmf', mesh_name: str | None = None) Function[source]#
Read data from the cells of a mesh.
Note
Backend has to implement
io4dolfinx.backends.IOBackend.read_cell_data().- Parameters:
filename – Path to file
name – Name of point data
mesh – The corresponding
dolfinx.mesh.Mesh. Its numbering must match the one the data was written in; see Choosing an ordering.time – Time-step to read from.
mesh_name – Name of the mesh in the file the data belongs to. Defaults to the mesh written without an explicit name.
- Returns:
A function in a DG-0 space on the mesh. The cells not found in input is set to zero.
- io4dolfinx.read_function(filename: Path | str, u: Function, time: float = 0.0, name: str | None = None, backend_args: dict[str, Any] | None = None, backend: str | None = None, mesh_name: str | None = None)[source]#
Read checkpoint from file and fill it into u.
- Parameters:
filename – Path to checkpoint
u – Function to fill. Its mesh’s numbering must match the one the function was written in; see Choosing an ordering.
time – Time-stamp associated with checkpoint
name – If not provided, u.name is used to search through the input file for the function
mesh_name – Name of the mesh in the file to act on. Defaults to the mesh written without an explicit name, so existing checkpoints and call sites are unaffected.
- io4dolfinx.read_function_from_legacy_h5(filename: Path, comm: Comm, u: Function, group: str = 'mesh', step: int | None = None, vector_group: str | None = None, backend: str | None = None)[source]#
Read function from a h5-file generated by legacy DOLFIN HDF5File.write or XDMF.write_checkpoint.
- Parameters:
comm – MPI communicator to distribute mesh over
filename – Path to h5 or xdmf file
u – The function used to stored the read values
group – Group within the h5 file where the function is stored, by default “mesh”
step – The time step used when saving the checkpoint. If not provided it will assume that the function is saved as a regular function (i.e with HDF5File.write)
backend – The IO backend
- io4dolfinx.read_function_names(filename: Path | str, comm: Comm, backend_args: dict[str, Any] | None = None, backend: str = 'h5py', mesh_name: str | None = None) list[str][source]#
Read all function names from a file.
- Parameters:
filename – Path to file
comm – MPI communicator to launch IO on.
backend_args – Arguments to backend
mesh_name – Name of the mesh in the file to act on. Defaults to the mesh written without an explicit name, so existing checkpoints and call sites are unaffected.
- Returns:
A list of function names.
- io4dolfinx.read_mesh(filename: Path | str, comm: Comm, ghost_mode: GhostMode = GhostMode.shared_facet, time: float | str | None = 0.0, read_from_partition: bool = False, backend_args: dict[str, Any] | None = None, backend: str | None = None, max_facet_to_cell_links: int = 2, mesh_name: str | None = None) Mesh[source]#
Read an ADIOS2 mesh into DOLFINx.
- Parameters:
filename – Path to input file
comm – The MPI communciator to distribute the mesh over
ghost_mode – Ghost mode to use for mesh. If read_from_partition is set to True this option is ignored.
time – Time stamp associated with mesh
read_from_partition – Read mesh with partition from file
backend_args – List of arguments to reader backend
max_facet_to_cell_links – Maximum number of cells a facet can be connected to.
mesh_name – Name of the mesh in the file to act on. Defaults to the mesh written without an explicit name, so existing checkpoints and call sites are unaffected.
- Returns:
The distributed mesh. A mesh with several cell types, which only some backends read, has no UFL domain and requires DOLFINx 0.11 or later.
- io4dolfinx.read_mesh_from_legacy_h5(filename: Path, comm: Comm, group: str, cell_type: str = 'tetrahedron', backend: str | None = None, max_facet_to_cell_links: int = 2) Mesh[source]#
Read mesh from h5-file generated by legacy DOLFIN HDF5File.write or XDMF.write_checkpoint.
- Parameters:
comm – MPI communicator to distribute mesh over
filename – Path to h5 or xdmf file
group – Name of mesh in h5-file
cell_type – What type of cell type, by default tetrahedron.
backend – The IO backend to use when reading the mesh (must support legacy mesh reading, e.g., “adios2”).
max_facet_to_cell_links – Maximum number of cells a facet can be connected to.
- io4dolfinx.read_meshtags(filename: Path | str, mesh: Mesh, meshtag_name: str, backend_args: dict[str, Any] | None = None, backend: str | None = None, mesh_name: str | None = None) MeshTags[source]#
Read meshtags from file and return a
dolfinx.mesh.MeshTagsobject.- Parameters:
filename – Path to meshtags file (with file-extension)
mesh – The mesh associated with the meshtags. Its numbering must match the one the meshtags were written in; see Choosing an ordering.
meshtag_name – The name of the meshtag to read
engine – Adios2 Engine
mesh_name – Name of the mesh in the file to act on. Defaults to the mesh written without an explicit name, so existing checkpoints and call sites are unaffected.
- Returns:
The meshtags
- io4dolfinx.read_point_data(filename: Path | str, name: str, mesh: Mesh, time: float | None = None, backend_args: dict[str, Any] | None = None, backend: str = 'xdmf', mesh_name: str | None = None) Function[source]#
Read data from the nodes of a mesh.
Note
Backend has to implement
io4dolfinx.backends.IOBackend.read_point_data().- Parameters:
filename – Path to file
name – Name of point data
mesh – The corresponding
dolfinx.mesh.Mesh. Its numbering must match the one the data was written in; see Choosing an ordering.time – Time-step to read from.
mesh_name – Name of the mesh in the file the data belongs to. Defaults to the mesh written without an explicit name.
- Returns:
A function in the space equivalent to the mesh coordinate element (up to shape).
- io4dolfinx.read_submesh(filename: Path | str, parent: Mesh, mesh_name: str, parent_mesh_name: str | None = None, backend_args: dict[str, Any] | None = None, backend: str | None = None) SubmeshCheckpoint[source]#
Re-derive a stored submesh from a parent mesh that has been read back.
The result is a genuine
dolfinx.mesh.create_submesh()submesh, so its entity maps are accepted bydolfinx.fem.form()for mixed-dimensional assembly againstparent.It does not carry the checkpointed data. Read that onto the standalone submesh with
io4dolfinx.read_mesh()andio4dolfinx.read_function(), then move it across withtransfer_submesh_function().- Parameters:
filename – File holding the parent mesh and the post codes, i.e. whatever was passed as
parent_filenametowrite_submesh()parent – The parent mesh, as read back from the checkpoint
mesh_name – Name the submesh was stored under
parent_mesh_name – Name the parent mesh is stored under
backend_args – Arguments for the backend
backend – Which backend to use
- Returns:
The re-derived submesh and the maps relating it to
parent.
- io4dolfinx.read_timestamps(filename: Path | str, comm: Comm, function_name: str, backend_args: dict[str, Any] | None = None, backend: str | None = None, mesh_name: str | None = None) ndarray[tuple[Any, ...], dtype[float64 | str]][source]#
Read time-stamps from a checkpoint file.
- Parameters:
comm – MPI communicator
filename – Path to file
function_name – Name of the function to read time-stamps for
backend_args – Arguments for backend, for instance file type.
backend – What backend to use for writing.
mesh_name – Name of the mesh in the file to act on. Defaults to the mesh written without an explicit name, so existing checkpoints and call sites are unaffected.
- Returns:
The time-stamps
- Raises:
KeyError – With the adios2 and h5py backends, if the file does not hold the function on that mesh. The message names the functions it does hold.
- io4dolfinx.set_default_backend(backend: str)[source]#
Set the global default backend for io4dolfinx.
- io4dolfinx.snapshot_checkpoint(uh: Function, file: Path, mode: FileMode, backend_args: dict[str, Any] | None = None, backend: str | None = None)[source]#
Read or write a snapshot checkpoint
This checkpoint is only meant to be used on the same mesh during the same simulation.
- Parameters:
uh – The function to write data from or read to
file – The file to write to or read from
mode – Either read or write
- io4dolfinx.transfer_submesh_function(u_source: Function, u_dest: Function, post_code: ndarray[tuple[Any, ...], dtype[int64]])[source]#
Move data from a standalone submesh onto one re-derived from a parent.
u_sourcelives on the submesh as it was stored – read withio4dolfinx.read_mesh()andio4dolfinx.read_function()– andu_deston the submeshread_submesh()derived from the parent. The two meshes cover the same cells but number their vertices differently and are partitioned independently, so the transfer cannot be a copy.Every cell of
u_dest’s mesh has a known counterpart inu_source’s, so each interpolation point is routed straight to the process and cell that can evaluate it, with no geometric point location. This is an evaluation followed by a scatter and a local interpolation: it assembles no form and needs no entity map between the two meshes, which would have no meaning as neither is derived from the other.- Parameters:
u_source – Function on the submesh as stored
u_dest – Function to fill, on the submesh re-derived from the parent
post_code – For each cell of
u_dest’s mesh (owned and ghost), the index that cell had in the stored submesh, which is what the cell is routed by. FromSubmeshCheckpoint.post_code.
- Raises:
NotImplementedError – For H(div)/H(curl) spaces on a manifold submesh with a DOLFINx lacking
FiniteElement.physical_base_value_size, whose interpolation would return wrong values without reporting an error.
- io4dolfinx.write_attributes(filename: Path | str, comm: Comm, name: str, attributes: dict[str, ndarray], backend_args: dict[str, Any] | None = None, backend: str | None = None)[source]#
Write attributes to file.
- Parameters:
filename – Path to file to write to
comm – MPI communicator used in storage
name – Name of the attributes
attributes – Dictionary of attributes to write to file
backend_args – Arguments for backend, for instance file type.
backend – What backend to use for writing.
- io4dolfinx.write_cell_data(filename: Path | str, u: Function, time: str | float | None, mode: FileMode, backend_args: dict[str, Any] | None, backend: str = 'vtkhdf', mesh_name: str | None = None, on_input_mesh: bool = False)[source]#
Write function to file by interpolating into cell midpoints.
- Parameters:
filename – Path to file
point_data – Data to write to file
time – Time stamp
mode – Append or write
backend_args – Backend-specific options. For VTKHDF compression, see VTKHDF-backend.
mesh_name – Name of the mesh in the file to write the data against. Defaults to the mesh written without an explicit name.
on_input_mesh – If True, the cell values are written in the cell ordering of the input mesh, matching a mesh written with
write_mesh_input_order().
- io4dolfinx.write_function(filename: Path | str, u: Function, time: float = 0.0, mode: FileMode = FileMode.append, name: str | None = None, backend_args: dict[str, Any] | None = None, backend: str | None = None, mesh_name: str | None = None, on_input_mesh: bool = False)[source]#
Write function checkpoint to file.
- Parameters:
u – Function to write to file
time – Time-stamp for simulation
filename – Path to write to
mode – Write or append.
name – Name of function to write. If None, the name of the function is used.
backend_args – Arguments to the IO backend.
backend – The backend to use
mesh_name – Name of the mesh in the file to act on. Defaults to the mesh written without an explicit name, so existing checkpoints and call sites are unaffected.
on_input_mesh – If True, the function is written against the input mesh, to be read with a mesh written with
on_input_mesh=True(or read from the input mesh file). Use the same value for every write to a file; see Choosing an ordering.
- io4dolfinx.write_function_on_input_mesh(filename: Path | str, u: Function, time: float = 0.0, name: str | None = None, mode: FileMode = FileMode.append, backend_args: dict[str, Any] | None = None, backend: str | None = None)[source]#
Write function checkpoint (to be read with the input mesh).
Deprecated: use
write_function()withon_input_mesh=True.Note
Requires backend to implement
io4dolfinx.backends.IOBackend.write_function().- Parameters:
filename – The filename to write to
u – The function to checkpoint
time – Time-stamp associated with function at current write step
mode – The mode to use (write or append)
name – Name of function. If None, the name of the function is used.
backend_args – Arguments to backend
backend – Choice of backend module
- io4dolfinx.write_mesh(filename: Path, mesh: Mesh, mode: FileMode = FileMode.write, time: float = 0.0, store_partition_info: bool = False, backend_args: dict[str, Any] | None = None, backend: str | None = None, mesh_name: str | None = None, on_input_mesh: bool = False)[source]#
Write a mesh to file.
- Parameters:
filename – Path to save mesh (without file-extension)
mesh – The mesh to write to file
store_partition_info – Store mesh partitioning (including ghosting) to file
backend_args – Backend-specific options. For VTKHDF compression, see VTKHDF-backend.
mesh_name – Name of the mesh in the file to act on. Defaults to the mesh written without an explicit name, so existing checkpoints and call sites are unaffected.
on_input_mesh – If True, the mesh is written with the node and cell ordering of the input mesh, so the file does not depend on the number of processes. Cannot be combined with
store_partition_info. Use the same value for every write to a file; see Choosing an ordering.
- io4dolfinx.write_mesh_input_order(filename: Path | str, mesh: Mesh, time: float = 0.0, mode: FileMode = FileMode.write, backend: str | None = None, backend_args: dict[str, Any] | None = None)[source]#
Write mesh to checkpoint file in original input ordering.
Deprecated: use
write_mesh()withon_input_mesh=True.Note
Requires backend to implement
io4dolfinx.backends.IOBackend.write_mesh().- Parameters:
filename – The filename to write to
mesh – Mesh to checkpoint
time – Time-stamp associated with function at current write step
mode – The mode to use (write or append)
backend_args – Arguments to backend
backend – Choice of backend module
- io4dolfinx.write_meshtags(filename: Path | str, mesh: Mesh, meshtags: MeshTags, meshtag_name: str | None = None, backend_args: dict[str, Any] | None = None, backend: str | None = None, on_input_mesh: bool = False, mesh_name: str | None = None)[source]#
Write meshtags associated with input mesh to file.
Note
For this checkpoint to work, the mesh must be written to file using
write_mesh()before calling this function.- Parameters:
filename – Path to save meshtags (with file-extension)
mesh – The mesh associated with the meshtags
meshtags – The meshtags to write to file
meshtag_name – Name of the meshtag. If None, the meshtag name is used.
backend_args – Backend-specific options. For VTKHDF compression, see VTKHDF-backend.
backend – IO backend
on_input_mesh – If True, the meshtags are written with the node ordering of the input mesh. Use the same value for every write to a file; see Choosing an ordering.
mesh_name – Name of the mesh in the file to act on. Defaults to the mesh written without an explicit name, so existing checkpoints and call sites are unaffected.
- io4dolfinx.write_point_data(filename: Path | str, u: Function, time: str | float | None, mode: FileMode, backend_args: dict[str, Any] | None, backend: str = 'vtkhdf', mesh_name: str | None = None, on_input_mesh: bool = False)[source]#
Write function to file by interpolating into geometry nodes.
- Parameters:
filename – Path to file
u – The function to store
time – Time stamp
mode – Append or write
backend_args – Backend-specific options. For VTKHDF compression, see VTKHDF-backend.
backend – Which backend to use.
mesh_name – Name of the mesh in the file to write the data against. Defaults to the mesh written without an explicit name.
on_input_mesh – If True, the node values are written in the node ordering of the input mesh, matching a mesh written with
write_mesh_input_order().
- io4dolfinx.write_submesh(filename: Path | str, submesh: Mesh, parent: Mesh, cell_map: Any, mesh_name: str, parent_mesh_name: str | None = None, parent_filename: Path | str | None = None, time: float = 0.0, mode: FileMode = FileMode.append, backend_args: dict[str, Any] | None = None, backend: str | None = None)[source]#
Write a submesh, and the post codes that tie it back to its parent.
The submesh is stored as an ordinary independent mesh under
mesh_name, soio4dolfinx.read_mesh()andio4dolfinx.read_function()read it back with no special handling. Alongside it goes a tag of post codes: every parent entity that became a submesh cell is given the index that cell has in the stored submesh. The entities are addressed by their parent geometry nodes, which is what letsread_submesh()find them again in a re-partitioned parent; the values come back asSubmeshCheckpoint.post_code.The post codes tag entities of the parent, so they are stored in the parent’s namespace, in
parent_filename. Leave that unset to keep everything in one checkpoint, or point it at the parent’s own file to keep the two apart; the submesh always goes tofilename. Either way the parent must already have been written there withio4dolfinx.write_mesh().- Parameters:
filename – Path to write the submesh to
submesh – The submesh, as returned by
dolfinx.mesh.create_submesh()parent – The mesh the submesh was derived from
cell_map – Map from submesh cells to parent entities, as returned by
dolfinx.mesh.create_submesh()mesh_name – Name to store the submesh under
parent_mesh_name – Name the parent mesh is stored under
parent_filename – File holding the parent mesh, if not
filenametime – Time stamp associated with the submesh geometry
mode – Whether to create the file or append to it
backend_args – Arguments for the backend
backend – Which backend to use
Checkpoint format#
Version of the layout of io4dolfinx checkpoints.
Every mesh, function and set of mesh tags in a checkpoint written by the h5py or
adios2 backend is stamped with the version of the checkpoint format it was written in,
when it is first written. The stamp is never changed, so a file appended to by several
versions of io4dolfinx records the format of each object.
The major version changes when the layout changes so that older versions of io4dolfinx can no longer read it. A checkpoint with a newer major version than
FORMAT_VERSIONis not read.The minor version changes when something optional is added. Readers ignore what they do not know, and treat what is missing as its default, so a checkpoint with a newer minor version is read, and an object with an older minor version can be appended to.
Objects without a stamp were written before checkpoints were stamped, and are read as format 1.0. The layout of each format is described in Checkpoint format.
- io4dolfinx.format.FORMAT_VERSION: tuple[int, int] = (1, 0)#
(major, minor)version of the checkpoint format written by this version of io4dolfinx
- io4dolfinx.format.check_appendable(metadata: dict[str, Any], what: str)[source]#
Check that this version of io4dolfinx can append to an existing object.
Appending keeps the stamp of the object, so it is allowed if the object has the same major version, whatever its minor version.
- Parameters:
metadata – The metadata of the object, empty if it does not exist yet
what – Description of the object for the error message
- Raises:
ValueError – If the object has another major version.
- io4dolfinx.format.check_readable(metadata: dict[str, Any], what: str) tuple[int, int][source]#
Check that an object can be read by this version of io4dolfinx.
- Parameters:
metadata – The metadata of the object, as read by the backend
what – Description of the object for the error message, e.g.
"Function 'u' in file.bp"
- Returns:
The checkpoint format version of the object,
(1, 0)if it has no stamp- Raises:
ValueError – If the object has a newer major version than this io4dolfinx reads.
- io4dolfinx.format.format_version(metadata: dict[str, Any]) tuple[int, int] | None[source]#
The checkpoint format version in the metadata of an object.
- Returns:
(major, minor), orNoneif the object has no stamp
- io4dolfinx.format.object_metadata(backend: Any, filename: Path | str, comm: Comm, kind: str, name: str | None = None, backend_args: dict[str, Any] | None = None) dict[str, Any][source]#
The metadata of an object in a file, if the backend stores metadata.
Only the checkpoint backends (
h5pyandadios2) do; for any other backend, and for an object that does not exist, the metadata is empty.- Parameters:
backend – The backend module
filename – Path to file
comm – MPI communicator
kind –
"mesh","function"or"meshtags"name – Name of the function or mesh tags, unused for a mesh
backend_args – Arguments to backend
Converting adios4dolfinx checkpoints#
Convert checkpoints of adios4dolfinx 0.7 and older, and mesh tags of legacy DOLFIN, to the current format.
convert() copies the stored data to a checkpoint of the current format, so no mesh or
function space is created. It reads two kinds of files:
Checkpoints of adios4dolfinx 0.7 and older (format 0, see
io4dolfinx.format), written with ADIOS2. They store no function names or time stamps: each function is in a step of its own under the same variable names. Each function is given a name and written at time 0.HDF5 files of legacy DOLFIN (
HDF5File), holding a mesh and mesh functions. The mesh and the named mesh functions are written as a mesh and mesh tags. Functions of these files are numbered by DOLFIN and need a function space: read them withio4dolfinx.read_function_from_legacy_h5()onto the mesh of the converted file, which has the node order of the DOLFIN file.
The conversion is also available from the command line, under MPI if wanted:
io4dolfinx-convert old.bp new.h5 --names u
io4dolfinx-convert dolfin_mesh.h5 new.h5 --meshtags facet_tags
or, equivalently, python3 -m io4dolfinx.converter.
- io4dolfinx.converter.convert(input_file: ~pathlib.Path | str, output_file: ~pathlib.Path | str, comm: ~mpi4py.MPI.Comm = <mpi4py.MPI.Intracomm object>, names: ~collections.abc.Sequence[str] | None = None, meshtags: ~collections.abc.Sequence[str] = (), mesh_group: str = '/mesh', backend: str | None = None, backend_args: dict[str, ~typing.Any] | None = None, engine: str = 'BP4', overwrite: bool = False)[source]#
Convert a checkpoint of adios4dolfinx 0.7 or older, or the mesh and mesh functions of a legacy DOLFIN HDF5 file, to the current format.
The data is copied as stored, so the result is read as any checkpoint, with
io4dolfinx.read_mesh(),io4dolfinx.read_meshtags()andio4dolfinx.read_function(). A legacy DOLFIN file is recognised by the topology of its mesh, at mesh_group; any other file is read as an adios4dolfinx checkpoint.- Parameters:
input_file – The file to convert.
output_file – The checkpoint to write.
comm – The communicator to read and write with.
names – The name to give each function of an adios4dolfinx checkpoint, in the order they were written, as the file does not store names. Defaults to
["u"].meshtags – The mesh functions of a legacy DOLFIN file to convert to mesh tags of the same names.
mesh_group – The group of the mesh in a legacy DOLFIN file.
backend – The backend to write with,
"adios2"or"h5py". Chosen from the suffix of output_file if not given:.bpfor ADIOS2,.h5for h5py.backend_args – Arguments of the backend that writes.
engine – The ADIOS2 engine an adios4dolfinx checkpoint was written with.
overwrite – Replace output_file if it exists.
- Raises:
FileExistsError – If output_file exists and overwrite is not set.
ValueError – If input_file is neither kind of file, the number of names is not the number of functions in it, names are given for a legacy DOLFIN file or mesh tags for an adios4dolfinx checkpoint, or the backend is not given and cannot be chosen from the suffix of output_file.