HDF5File.h

Note

The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.

class HDF5File

Parent class(es)

HDF5File(MPI_Comm comm, const std::string filename, const std::string file_mode)

Constructor. file_mode should be “a” (append), “w” (write) or “r” (read).

void close()

Close file

void flush()

Flush buffered I/O to disk

void write(const std::vector<Point> &points, const std::string name)

Write points to file

void write(const std::vector<double> &values, const std::string name)

Write simple vector of double to file

void write(const GenericVector &x, const std::string name)

Write Vector to file in a format suitable for re-reading

void read(GenericVector &x, const std::string dataset_name, const bool use_partition_from_file) const

Read vector from file and optionally re-use any partitioning that is available in the file

void write(const Mesh &mesh, const std::string name)

Write Mesh to file in a format suitable for re-reading

void write(const Mesh &mesh, const std::size_t cell_dim, const std::string name)

Write Mesh of given cell dimension to file in a format suitable for re-reading

void write(const Function &u, const std::string name)

Write Function to file in a format suitable for re-reading

void write(const Function &u, const std::string name, double timestamp)

Write Function to file with a timestamp

void read(Function &u, const std::string name)

Read Function from file and distribute data according to the Mesh and dofmap associated with the Function. If the ‘name’ refers to a HDF5 group, then it is assumed that the Function data is stored in the datasets within that group. If the ‘name’ refers to a HDF5 dataset within a group, then it is assumed that it is a Vector, and the Function will be filled from that Vector

void read(Mesh &mesh, const std::string data_path, bool use_partition_from_file) const

Read Mesh from file, using attribute data (e.g., cell type) stored in the HDF5 file. Optionally re-use any partition data in the file. This function requires all necessary data for constructing a Mesh to be present in the HDF5 file.

void read(Mesh &input_mesh, const std::string topology_path, const std::string geometry_path, const int gdim, const CellType &cell_type, const std::int64_t expected_num_global_cells, const std::int64_t expected_num_global_points, bool use_partition_from_file) const

Construct Mesh with paths to topology and geometry datasets, and providing essential meta-data, e.g. geometric dimension and cell type. If this data is available in the HDF5 file, it will be checked for consistency. Set expected_num_global_cells to a negative value if not known.

This function is typically called when using the XDMF format, in which case the meta data has alreayd been read from an XML file

void write(const MeshFunction<std::size_t> &meshfunction, const std::string name)

Write MeshFunction to file in a format suitable for re-reading

void write(const MeshFunction<int> &meshfunction, const std::string name)

Write MeshFunction to file in a format suitable for re-reading

void write(const MeshFunction<double> &meshfunction, const std::string name)

Write MeshFunction to file in a format suitable for re-reading

void write(const MeshFunction<bool> &meshfunction, const std::string name)

Write MeshFunction to file in a format suitable for re-reading

void read(MeshFunction<std::size_t> &meshfunction, const std::string name) const

Read MeshFunction from file

void read(MeshFunction<int> &meshfunction, const std::string name) const

Read MeshFunction from file

void read(MeshFunction<double> &meshfunction, const std::string name) const

Read MeshFunction from file

void read(MeshFunction<bool> &meshfunction, const std::string name) const

Read MeshFunction from file

void write(const MeshValueCollection<std::size_t> &mesh_values, const std::string name)

Write MeshValueCollection to file

void write(const MeshValueCollection<double> &mesh_values, const std::string name)

Write MeshValueCollection to file

void write(const MeshValueCollection<bool> &mesh_values, const std::string name)

Write MeshValueCollection to file

void read(MeshValueCollection<std::size_t> &mesh_values, const std::string name) const

Read MeshValueCollection from file

void read(MeshValueCollection<double> &mesh_values, const std::string name) const

Read MeshValueCollection from file

void read(MeshValueCollection<bool> &mesh_values, const std::string name) const

Read MeshValueCollection from file

bool has_dataset(const std::string dataset_name) const

Check if dataset exists in HDF5 file

void set_mpi_atomicity(bool atomic)

Set the MPI atomicity

bool get_mpi_atomicity() const

Get the MPI atomicity