API Reference#

Top-level package for ADIOS2Wrappers.

adios4dolfinx.read_attributes(filename: Path | str, comm: Intracomm, name: str, engine: str = 'BP4') dict[str, ndarray][source]#

Read attributes from file using ADIOS2.

Parameters:
  • filename – Path to file to read from

  • comm – MPI communicator used in storage

  • name – Name of the attributes

  • engine – ADIOS2 engine to use

Returns:

The attributes

adios4dolfinx.read_function(filename: Path | str, u: Function, engine: str = 'BP4', time: float = 0.0, legacy: bool = False, name: str | None = None)[source]#

Read checkpoint from file and fill it into u.

Parameters:
  • filename – Path to checkpoint

  • u – Function to fill

  • engine – ADIOS engine type used for reading

  • time – Time-stamp associated with checkpoint

  • legacy – If checkpoint is from prior to time-dependent writing set to True

  • name – If not provided, u.name is used to search through the input file for the function

adios4dolfinx.read_function_from_legacy_h5(filename: Path, comm: Intracomm, u: Function, group: str = 'mesh', step: int | 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)

adios4dolfinx.read_mesh(filename: Path | str, comm: Intracomm, engine: str = 'BP4', ghost_mode: GhostMode = GhostMode.shared_facet, time: float = 0.0, legacy: bool = False, read_from_partition: bool = False) Mesh[source]#

Read an ADIOS2 mesh into DOLFINx.

Parameters:
  • filename – Path to input file

  • comm – The MPI communciator to distribute the mesh over

  • engine – ADIOS engine to use for reading (BP4, BP5 or HDF5)

  • 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

  • legacy – If checkpoint was made prior to time-dependent mesh-writer set to True

  • read_from_partition – Read mesh with partition from file

Returns:

The distributed mesh

adios4dolfinx.read_mesh_from_legacy_h5(filename: Path, comm: Intracomm, group: str, cell_type: str = 'tetrahedron') 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.

adios4dolfinx.read_meshtags(filename: Path | str, mesh: Mesh, meshtag_name: str, engine: str = 'BP4') MeshTags[source]#

Read meshtags from file and return a dolfinx.mesh.MeshTags object.

Parameters:
  • filename – Path to meshtags file (with file-extension)

  • mesh – The mesh associated with the meshtags

  • meshtag_name – The name of the meshtag to read

  • engine – Adios2 Engine

Returns:

The meshtags

adios4dolfinx.snapshot_checkpoint(uh: Function, file: Path, mode: Mode)[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

adios4dolfinx.write_attributes(filename: Path | str, comm: Intracomm, name: str, attributes: dict[str, ndarray], engine: str = 'BP4')[source]#

Write attributes to file using ADIOS2.

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

  • engine – ADIOS2 engine to use

adios4dolfinx.write_function(filename: ~pathlib.Path | str, u: ~dolfinx.fem.function.Function, engine: str = 'BP4', mode: ~adios2.bindings.adios2_bindings.Mode = <Mode.Append: 3>, time: float = 0.0, name: str | None = None)[source]#

Write function checkpoint to file.

Parameters:
  • u – Function to write to file

  • filename – Path to write to

  • engine – ADIOS2 engine

  • mode – Write or append.

  • time – Time-stamp for simulation

  • name – Name of function to write. If None, the name of the function is used.

adios4dolfinx.write_function_on_input_mesh(filename: ~pathlib.Path | str, u: ~dolfinx.fem.function.Function, engine: str = 'BP4', mode: ~adios2.bindings.adios2_bindings.Mode = <Mode.Append: 3>, time: float = 0.0, name: str | None = None)[source]#

Write function checkpoint (to be read with the input mesh).

Parameters:
  • u – The function to checkpoint

  • filename – The filename to write to

  • engine – The ADIOS2 engine to use

  • mode – The ADIOS2 mode to use (write or append)

  • time – Time-stamp associated with function at current write step

  • name – Name of function. If None, the name of the function is used.

adios4dolfinx.write_mesh(filename: ~pathlib.Path, mesh: ~dolfinx.mesh.Mesh, engine: str = 'BP4', mode: ~adios2.bindings.adios2_bindings.Mode = <Mode.Write: 1>, time: float = 0.0, store_partition_info: bool = False)[source]#

Write a mesh to specified ADIOS2 format, see: https://adios2.readthedocs.io/en/stable/engines/engines.html for possible formats.

Parameters:
  • filename – Path to save mesh (without file-extension)

  • mesh – The mesh to write to file

  • engine – Adios2 Engine

  • store_partition_info – Store mesh partitioning (including ghosting) to file

adios4dolfinx.write_mesh_input_order(filename: Path | str, mesh: Mesh, engine: str = 'BP4')[source]#

Write mesh to checkpoint file in original input ordering

adios4dolfinx.write_meshtags(filename: Path | str, mesh: Mesh, meshtags: MeshTags, engine: str = 'BP4', meshtag_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

  • engine – Adios2 Engine

  • meshtag_name – Name of the meshtag. If None, the meshtag name is used.