Acoustic FDTD Solver
Functions
H5.hpp File Reference
#include <string>
#include <vector>
#include <cassert>
#include "H5Cpp.h"
#include "constant.hpp"

Go to the source code of this file.

Functions

bool H5Exist (const std::string &file_name, const std::string &name)
 Check if a group or a dataset exists in the file.
bool H5GroupExist (const std::string &file_name, const std::string &name)
bool H5DataSetExist (const std::string &file_name, const std::string &name)
bool H5AttributeExist (const std::string &file_name, const std::string &name, const std::string &attribute_name)
 Check if the attribute is associated with the Group or Dataset.
void readFromH5File (double **out, const std::string &file_name, const std::string &dataset_name, const int M, const int N)
 Read the dataset into an array.
std::vector< std::vector
< double > > 
readFromH5File (const std::string &file_name, const std::string &dataset_name)
void readAttributeFromH5File (unsigned out, const std::string &file_name, const std::string &name, const std::string &attribute_name)
void readAttributeFromH5File (int out, const std::string &file_name, const std::string &name, const std::string &attribute_name)
void readAttributeFromH5File (double out, const std::string &file_name, const std::string &name, const std::string &attribute_name)
void writeToH5File (const std::string &file_name, const std::string &dataset_name, const std::vector< double > &data, const std::string &mode="overwrite")
void writeToH5File (const std::string &file_name, const std::string &dataset_name, const std::vector< int > &data, const std::string &mode="overwrite")
void writeToH5File (const std::string &file_name, const std::string &dataset_name, const std::vector< std::vector< double > > &data, const std::string &mode="overwrite")
void writeToH5File (const std::string &file_name, const std::string &dataset_name, const double *const *data, const unsigned nJ, const unsigned nK, const std::string &mode="overwrite")
 This declearation of the data ensures that, even if data does not take a contiguous memeory space, data is writen to the H5 file.
void writeAttributeToH5File (const std::string &file_name, const std::string &name, const std::string &attribute_name, const std::string &data)
void writeAttributeToH5File (const std::string &file_name, const std::string &name, const std::string &attribute_name, const int data)
void writeAttributeToH5File (const std::string &file_name, const std::string &name, const std::string &attribute_name, const double data)
double readMaximum (const std::string &file_name, const std::string &dataset_name)
double readMinimum (const std::string &file_name, const std::string &dataset_name)

Function Documentation

bool H5AttributeExist ( const std::string &  file_name,
const std::string &  name,
const std::string &  attribute_name 
)

Check if the attribute is associated with the Group or Dataset.

Parameters
file_nameH5 file
namename of the group or the dataset.
attribute_namename of the attribute.
bool H5DataSetExist ( const std::string &  file_name,
const std::string &  name 
)
bool H5Exist ( const std::string &  file_name,
const std::string &  name 
)

Check if a group or a dataset exists in the file.

Notice that in the design of the H5 format, the Group and Dataset are H5Object. It calls Utility::H5GroupExist() and Utility::H5DatasetExist().

Parameters
file_nameH5 file
namename of the group or the dataset.
bool H5GroupExist ( const std::string &  file_name,
const std::string &  name 
)
void readAttributeFromH5File ( unsigned  out,
const std::string &  file_name,
const std::string &  name,
const std::string &  attribute_name 
)
void readAttributeFromH5File ( int  out,
const std::string &  file_name,
const std::string &  name,
const std::string &  attribute_name 
)
void readAttributeFromH5File ( double  out,
const std::string &  file_name,
const std::string &  name,
const std::string &  attribute_name 
)
void readFromH5File ( double **  out,
const std::string &  file_name,
const std::string &  dataset_name,
const int  M,
const int  N 
)

Read the dataset into an array.

Parameters
outoutput vector
file_name
dataset_name
M
N
std::vector<std::vector<double> > readFromH5File ( const std::string &  file_name,
const std::string &  dataset_name 
)
double readMaximum ( const std::string &  file_name,
const std::string &  dataset_name 
)
double readMinimum ( const std::string &  file_name,
const std::string &  dataset_name 
)
void writeAttributeToH5File ( const std::string &  file_name,
const std::string &  name,
const std::string &  attribute_name,
const std::string &  data 
)
void writeAttributeToH5File ( const std::string &  file_name,
const std::string &  name,
const std::string &  attribute_name,
const int  data 
)
void writeAttributeToH5File ( const std::string &  file_name,
const std::string &  name,
const std::string &  attribute_name,
const double  data 
)
void writeToH5File ( const std::string &  file_name,
const std::string &  dataset_name,
const std::vector< double > &  data,
const std::string &  mode = "overwrite" 
)
Parameters
file_name
dataset_name
data
modeeither "overwrite" or "append"
void writeToH5File ( const std::string &  file_name,
const std::string &  dataset_name,
const std::vector< int > &  data,
const std::string &  mode = "overwrite" 
)
void writeToH5File ( const std::string &  file_name,
const std::string &  dataset_name,
const std::vector< std::vector< double > > &  data,
const std::string &  mode = "overwrite" 
)
void writeToH5File ( const std::string &  file_name,
const std::string &  dataset_name,
const double *const *  data,
const unsigned  nJ,
const unsigned  nK,
const std::string &  mode = "overwrite" 
)

This declearation of the data ensures that, even if data does not take a contiguous memeory space, data is writen to the H5 file.