kspaceFirstOrder3D-OMP
1.2
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
|
Class for HDF5 file header. More...
#include <Hdf5FileHeader.h>
Public Types | |
enum | FileHeaderItems { FileHeaderItems::kCreatedBy = 0, FileHeaderItems::kCreationDate = 1, FileHeaderItems::kFileDescription = 2, FileHeaderItems::kMajorVersion = 3, FileHeaderItems::kMinorVersion = 4, FileHeaderItems::kFileType = 5, FileHeaderItems::kHostName = 6, FileHeaderItems::kTotalMemoryConsumption = 7, FileHeaderItems::kPeakMemoryConsumption = 8, FileHeaderItems::kTotalExecutionTime = 9, FileHeaderItems::kDataLoadTime = 10, FileHeaderItems::kPreProcessingTime = 11, FileHeaderItems::kSimulationTime = 12, FileHeaderItems::kPostProcessingTime = 13, FileHeaderItems::kNumberOfCores = 14 } |
List of all header items. More... | |
enum | FileType { FileType::kInput = 0, FileType::kOutput = 1, FileType::kCheckpoint = 2, FileType::kUnknown = 3 } |
HDF5 file type. More... | |
enum | FileVersion { FileVersion::kVersion10 = 0, FileVersion::kVersion11 = 1, FileVersion::kVersionUnknown = 2 } |
HDF5 file version. More... | |
Public Member Functions | |
Hdf5FileHeader () | |
Constructor. More... | |
Hdf5FileHeader (const Hdf5FileHeader &src) | |
Copy constructor. More... | |
~Hdf5FileHeader () | |
Destructor. More... | |
void | readHeaderFromInputFile (Hdf5File &inputFile) |
Read header from the input file. More... | |
void | readHeaderFromOutputFile (Hdf5File &outputFile) |
Read header from output file (necessary for checkpoint-restart). More... | |
void | readHeaderFromCheckpointFile (Hdf5File &checkpointFile) |
Read the file header form the checkpoint file. More... | |
void | writeHeaderToOutputFile (Hdf5File &outputFile) |
Write header into the output file. More... | |
void | writeHeaderToCheckpointFile (Hdf5File &checkpointFile) |
Write header to the output file (only a subset of all possible fields are written). More... | |
void | setCodeName (const std::string &codeName) |
Set code name. More... | |
void | setActualCreationTime () |
Set creation time. More... | |
void | setMajorFileVersion () |
Set major file version. | |
void | setMinorFileVersion () |
Set minor file version. | |
FileVersion | getFileVersion () |
Get file version as an enum. More... | |
bool | checkMajorFileVersion () |
Check major file version. More... | |
bool | checkMinorFileVersion () |
Check minor file version. More... | |
Hdf5FileHeader::FileType | getFileType () |
Get File type. More... | |
void | setFileType (const Hdf5FileHeader::FileType fileType) |
Set File type. More... | |
void | setHostName () |
Set host name. More... | |
void | setMemoryConsumption (const size_t totalMemory) |
Set memory consumption. More... | |
void | setExecutionTimes (const double totalTime, const double loadTime, const double preProcessingTime, const double simulationTime, const double postprocessingTime) |
Set execution times in file header. More... | |
void | getExecutionTimes (double &totalTime, double &loadTime, double &preProcessingTime, double &simulationTime, double &postprocessingTime) |
Get execution times stored in the output file header. More... | |
void | setNumberOfCores () |
Set number of cores. More... | |
Static Public Member Functions | |
static std::string | getFileMajorVersion () |
Get string representing of current Major version of the file. More... | |
static std::string | getFileMinorVersion () |
Get string representing of current Minor version of the file. More... | |
Private Attributes | |
std::map< FileHeaderItems, std::string > | mHeaderValues |
map for the header values. | |
Static Private Attributes | |
static std::map< FileHeaderItems, std::string > | sHeaderNames |
map for the header names. More... | |
static const std::string | kFileTypesNames [] = {"input", "output", "checkpoint", "unknown"} |
String representation of different file types. | |
static const std::string | kMajorFileVersionsNames [] = {"1"} |
String representations of Major file versions. | |
static const std::string | kMinorFileVersionsNames [] = {"0","1"} |
String representations of Major file versions. | |
This class manages all information that can be stored in the input output or checkpoint file header.
Definition at line 89 of file Hdf5FileHeader.h.
|
strong |
List of all header items.
Definition at line 99 of file Hdf5FileHeader.h.
|
strong |
HDF5 file type.
Enumerator | |
---|---|
kInput | Input file. |
kOutput | Output file. |
kCheckpoint | Checkpoint file. |
kUnknown | Unknown file. |
Definition at line 138 of file Hdf5FileHeader.h.
|
strong |
HDF5 file version.
Enumerator | |
---|---|
kVersion10 | Version 1.0. |
kVersion11 | Version 1.1. |
kVersionUnknown | Version unknown. |
Definition at line 155 of file Hdf5FileHeader.h.
Hdf5FileHeader::Hdf5FileHeader | ( | ) |
Constructor.
Definition at line 97 of file Hdf5FileHeader.cpp.
Hdf5FileHeader::Hdf5FileHeader | ( | const Hdf5FileHeader & | src | ) |
[in] | src | - Source object. |
Copy constructor.
Definition at line 107 of file Hdf5FileHeader.cpp.
Hdf5FileHeader::~Hdf5FileHeader | ( | ) |
Destructor.
Definition at line 117 of file Hdf5FileHeader.cpp.
|
inline |
Definition at line 267 of file Hdf5FileHeader.h.
|
inline |
Definition at line 275 of file Hdf5FileHeader.h.
void Hdf5FileHeader::getExecutionTimes | ( | double & | totalTime, |
double & | loadTime, | ||
double & | preProcessingTime, | ||
double & | simulationTime, | ||
double & | postprocessingTime | ||
) |
[out] | totalTime | - Total time. |
[out] | loadTime | - Time to load data. |
[out] | preProcessingTime | - Preprocessing time. |
[out] | simulationTime | - Simulation time. |
[out] | postprocessingTime | - Post processing time. |
Get execution times stored in the output file header.
Definition at line 406 of file Hdf5FileHeader.cpp.
|
inlinestatic |
Definition at line 233 of file Hdf5FileHeader.h.
|
inlinestatic |
Definition at line 241 of file Hdf5FileHeader.h.
Hdf5FileHeader::FileType Hdf5FileHeader::getFileType | ( | ) |
Hdf5FileHeader::FileVersion Hdf5FileHeader::getFileVersion | ( | ) |
Get file version as an enum.
Definition at line 300 of file Hdf5FileHeader.cpp.
void Hdf5FileHeader::readHeaderFromCheckpointFile | ( | Hdf5File & | checkpointFile | ) |
We need the header to verify the file version and type.
[in,out] | checkpointFile | - Checkpoint file handle. |
ios:failure | - If error happens. |
Read the file header form the checkpoint file.
Definition at line 192 of file Hdf5FileHeader.cpp.
void Hdf5FileHeader::readHeaderFromInputFile | ( | Hdf5File & | inputFile | ) |
[in,out] | inputFile | - Input file handle. |
ios:failure | - If error happens. |
Read header from the input file.
Definition at line 126 of file Hdf5FileHeader.cpp.
void Hdf5FileHeader::readHeaderFromOutputFile | ( | Hdf5File & | outputFile | ) |
Read only execution times (the others are read from the input file, or calculated based on the very last leg of the simulation). This function is called only if checkpoint-restart is enabled.
[in,out] | outputFile | - Output file handle. |
ios:failure | - If error happens. |
Read header from output file (necessary for checkpoint-restart).
Definition at line 160 of file Hdf5FileHeader.cpp.
void Hdf5FileHeader::setActualCreationTime | ( | ) |
Set actual date and time.
Definition at line 284 of file Hdf5FileHeader.cpp.
|
inline |
[in] | codeName | - Code version. |
Definition at line 221 of file Hdf5FileHeader.h.
void Hdf5FileHeader::setExecutionTimes | ( | const double | totalTime, |
const double | loadTime, | ||
const double | preProcessingTime, | ||
const double | simulationTime, | ||
const double | postprocessingTime | ||
) |
[in] | totalTime | - Total time. |
[in] | loadTime | - Time to load data. |
[in] | preProcessingTime | - Preprocessing time. |
[in] | simulationTime | - Simulation time. |
[in] | postprocessingTime | - Post processing time. |
Set execution times in file header.
Definition at line 389 of file Hdf5FileHeader.cpp.
void Hdf5FileHeader::setFileType | ( | const Hdf5FileHeader::FileType | fileType | ) |
[in] | fileType | - File type. |
Set File type.
Definition at line 340 of file Hdf5FileHeader.cpp.
void Hdf5FileHeader::setHostName | ( | ) |
Set Host name.
Definition at line 349 of file Hdf5FileHeader.cpp.
void Hdf5FileHeader::setMemoryConsumption | ( | const size_t | totalMemory | ) |
[in] | totalMemory | - Total memory consumption. |
Set memory consumption.
Definition at line 375 of file Hdf5FileHeader.cpp.
void Hdf5FileHeader::setNumberOfCores | ( | ) |
Set Number of cores.
Definition at line 424 of file Hdf5FileHeader.cpp.
void Hdf5FileHeader::writeHeaderToCheckpointFile | ( | Hdf5File & | checkpointFile | ) |
[in,out] | checkpointFile | - Checkpoint file handle. |
ios:failure | - If error happens. |
Write header to the output file (only a subset of all possible fields are written).
Definition at line 241 of file Hdf5FileHeader.cpp.
void Hdf5FileHeader::writeHeaderToOutputFile | ( | Hdf5File & | outputFile | ) |
[in,out] | outputFile | - Output file handle. |
ios:failure | - If error happens. |
Write header into the output file.
Definition at line 225 of file Hdf5FileHeader.cpp.
|
staticprivate |
Initialisation of static map with header attribute names.
Definition at line 335 of file Hdf5FileHeader.h.