DOLFIN
DOLFIN C++ interface
Public Member Functions | Friends | List of all members
dolfin::HDF5File Class Reference
Inheritance diagram for dolfin::HDF5File:
Inheritance graph
[legend]
Collaboration diagram for dolfin::HDF5File:
Collaboration graph
[legend]

Public Member Functions

 HDF5File (MPI_Comm comm, const std::string filename, const std::string file_mode)
 
 ~HDF5File ()
 Destructor.
 
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
 
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)
 
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)
 
void read (Mesh &mesh, const std::string data_path, bool use_partition_from_file) const
 
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
 
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.
 
HDF5Attribute attributes (const std::string dataset_name)
 
void set_mpi_atomicity (bool atomic)
 Set the MPI atomicity.
 
bool get_mpi_atomicity () const
 Get the MPI atomicity.
 
hid_t h5_id () const
 
- Public Member Functions inherited from dolfin::Variable
 Variable ()
 Create unnamed variable.
 
 Variable (const std::string name, const std::string label)
 Create variable with given name and label.
 
 Variable (const Variable &variable)
 Copy constructor.
 
virtual ~Variable ()
 Destructor.
 
const Variableoperator= (const Variable &variable)
 Assignment operator.
 
void rename (const std::string name, const std::string label)
 Rename variable.
 
std::string name () const
 Return name.
 
std::string label () const
 Return label (description)
 
std::size_t id () const
 
virtual std::string str (bool verbose) const
 Return informal string representation (pretty-print)
 

Friends

class XDMFFile
 
class TimeSeries
 

Additional Inherited Members

- Public Attributes inherited from dolfin::Variable
Parameters parameters
 Parameters.
 

Constructor & Destructor Documentation

◆ HDF5File()

HDF5File::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).

Member Function Documentation

◆ read() [1/4]

void HDF5File::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

◆ read() [2/4]

void HDF5File::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

◆ read() [3/4]

void HDF5File::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.

◆ read() [4/4]

void HDF5File::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 already been read from an XML file

◆ write()

void HDF5File::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


The documentation for this class was generated from the following files: