kspaceFirstOrder3D-CUDA  1.1
The CUDA/C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
THDF5_FileHeader Class Reference

Class for HDF5 header. More...

#include <HDF5_File.h>

Collaboration diagram for THDF5_FileHeader:

Public Types

enum  TFileHeaderItems {
  CREATED_BY = 0, CREATION_DATA = 1, FILE_DESCRIPTION = 2, MAJOR_VERSION = 3,
  MINOR_VERSION = 4, FILE_TYPE = 5, HOST_NAME = 6, TOTAL_MEMORY_CONSUMPTION = 7,
  PEAK_CORE_MEMORY_CONSUMPTION = 8, TOTAL_EXECUTION_TIME = 9, DATA_LOAD_TIME = 10, PREPROCESSING_TIME = 11,
  SIMULATION_TIME = 12, POST_PROCESSING_TIME = 13, NUMBER_OF_CORES = 14
}
 List of all header items. More...
 
enum  TFileType { INPUT = 0, OUTPUT = 1, CHECKPOINT = 2, UNKNOWN = 3 }
 HDF5 file type. More...
 
enum  TFileVersion { VERSION_10 = 0, VERSION_11 = 1, VERSION_UNKNOWN = 2 }
 HDF5 file version. More...
 

Public Member Functions

 THDF5_FileHeader ()
 Constructor. More...
 
 THDF5_FileHeader (const THDF5_FileHeader &src)
 Copy constructor. More...
 
 ~THDF5_FileHeader ()
 Destructor. More...
 
void ReadHeaderFromInputFile (THDF5_File &inputFile)
 Read header from the input file. More...
 
void ReadHeaderFromOutputFile (THDF5_File &outputFile)
 Read Header from output file (necessary for checkpoint-restart). More...
 
void ReadHeaderFromCheckpointFile (THDF5_File &checkpointFile)
 Read Header from checkpoint file (necessary for checkpoint-restart). More...
 
void WriteHeaderToOutputFile (THDF5_File &outputFile)
 Write header to the output file. More...
 
void WriteHeaderToCheckpointFile (THDF5_File &checkpointFile)
 Write header to the output file. More...
 
void SetCodeName (const std::string &codeName)
 Set code name. More...
 
void SetActualCreationTime ()
 Set creation time. More...
 
void SetMajorFileVersion ()
 Set major file version. More...
 
void SetMinorFileVersion ()
 Set minor file version. More...
 
TFileVersion GetFileVersion ()
 Set major file version in a string. More...
 
bool CheckMajorFileVersion ()
 Check major file version. More...
 
bool CheckMinorFileVersion ()
 Check minor file version. More...
 
THDF5_FileHeader::TFileType GetFileType ()
 Get File type. More...
 
void SetFileType (const THDF5_FileHeader::TFileType 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. 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 GetCurrentHDF5_MajorVersion ()
 Get string version of current Major version. More...
 
static std::string GetCurrentHDF5_MinorVersion ()
 Get string version of current Minor version. More...
 

Private Member Functions

void PopulateHeaderFileMap ()
 Populate the map with the header items. More...
 

Private Attributes

std::map< TFileHeaderItems,
std::string > 
headerValues
 map for the header values.
 
std::map< TFileHeaderItems,
std::string > 
headerNames
 map for the header names.
 

Static Private Attributes

static const std::string hdf5_FileTypesNames [] = {"input", "output", "checkpoint", "unknown"}
 String representation of different file types.
 
static const std::string hdf5_MajorFileVersionsNames [] = {"1"}
 String representations of Major file versions.
 
static const std::string hdf5_MinorFileVersionsNames [] = {"0","1"}
 String representations of Major file versions.
 

Detailed Description

This class manages all information that can be stored in the input output or checkpoint file header.

Definition at line 730 of file HDF5_File.h.

Member Enumeration Documentation

List of all header items.

Todo:
In the future we should add number of GPUs, peak GPU memory.

Definition at line 740 of file HDF5_File.h.

HDF5 file type.

Definition at line 764 of file HDF5_File.h.

HDF5 file version.

Definition at line 777 of file HDF5_File.h.

Constructor & Destructor Documentation

THDF5_FileHeader::THDF5_FileHeader ( )

Constructor.

Definition at line 1205 of file HDF5_File.cpp.

Here is the call graph for this function:

THDF5_FileHeader::THDF5_FileHeader ( const THDF5_FileHeader src)

Copy constructor.

Parameters
[in]src- Source object

Definition at line 1216 of file HDF5_File.cpp.

THDF5_FileHeader::~THDF5_FileHeader ( )

Destructor.

Definition at line 1227 of file HDF5_File.cpp.

Member Function Documentation

bool THDF5_FileHeader::CheckMajorFileVersion ( )
inline

Check major file version.

Returns
true if ok

Definition at line 862 of file HDF5_File.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool THDF5_FileHeader::CheckMinorFileVersion ( )
inline

Check minor file version.

Returns
true if ok

Definition at line 872 of file HDF5_File.h.

Here is the call graph for this function:

Here is the caller graph for this function:

static std::string THDF5_FileHeader::GetCurrentHDF5_MajorVersion ( )
inlinestatic

Get string version of current Major version.

Returns
Current major version

Definition at line 821 of file HDF5_File.h.

Here is the caller graph for this function:

static std::string THDF5_FileHeader::GetCurrentHDF5_MinorVersion ( )
inlinestatic

Get string version of current Minor version.

Returns
Current minor version

Definition at line 831 of file HDF5_File.h.

Here is the caller graph for this function:

void THDF5_FileHeader::GetExecutionTimes ( double &  totalTime,
double &  loadTime,
double &  preProcessingTime,
double &  simulationTime,
double &  postprocessingTime 
)

Get execution times stored in the output file header.

Parameters
[out]totalTime- Total time
[out]loadTime- Time to load data
[out]preProcessingTime- Preprocessing time
[out]simulationTime- Simulation time
[out]postprocessingTime- Post processing time

Definition at line 1575 of file HDF5_File.cpp.

Here is the caller graph for this function:

THDF5_FileHeader::TFileType THDF5_FileHeader::GetFileType ( )

Get File type.

Returns
File type

Definition at line 1472 of file HDF5_File.cpp.

Here is the caller graph for this function:

THDF5_FileHeader::TFileVersion THDF5_FileHeader::GetFileVersion ( )

Get file version as an enum.

Returns
File version as an enum

Definition at line 1447 of file HDF5_File.cpp.

Here is the caller graph for this function:

void THDF5_FileHeader::PopulateHeaderFileMap ( )
private

Create map with names for the header.

Definition at line 1609 of file HDF5_File.cpp.

Here is the caller graph for this function:

void THDF5_FileHeader::ReadHeaderFromCheckpointFile ( THDF5_File checkpointFile)

Read the file header form the checkpoint file. We need the header to verify the file version and type.

Parameters
[in,out]checkpointFile- Checkpoint file handle

Definition at line 1336 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_FileHeader::ReadHeaderFromInputFile ( THDF5_File inputFile)

Read header from the input file.

Parameters
[in,out]inputFile- Input file handle
Exceptions
ios:failurewhen en error happens

Definition at line 1241 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_FileHeader::ReadHeaderFromOutputFile ( THDF5_File outputFile)

Read header from output file (necessary for checkpoint-restart). 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.

Parameters
[in,out]outputFile- Output file handle

Definition at line 1290 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_FileHeader::SetActualCreationTime ( )

Set actual date and time.

Definition at line 1429 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_FileHeader::SetCodeName ( const std::string &  codeName)
inline

Set code name to the header.

Parameters
[in]codeName- code version

Definition at line 808 of file HDF5_File.h.

Here is the caller graph for this function:

void THDF5_FileHeader::SetExecutionTimes ( const double  totalTime,
const double  loadTime,
const double  preProcessingTime,
const double  simulationTime,
const double  postprocessingTime 
)

Set execution times in file header.

Parameters
[in]totalTime- Total time
[in]loadTime- Time to load data
[in]preProcessingTime- Preprocessing time
[in]simulationTime- Simulation time
[in]postprocessingTime- Post processing time

Definition at line 1552 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_FileHeader::SetFileType ( const THDF5_FileHeader::TFileType  fileType)

Set File type.

Parameters
[in]fileType- File type

Definition at line 1491 of file HDF5_File.cpp.

Here is the caller graph for this function:

void THDF5_FileHeader::SetHostName ( )

Set Host name.

Definition at line 1503 of file HDF5_File.cpp.

Here is the caller graph for this function:

void THDF5_FileHeader::SetMajorFileVersion ( )
inline

Set major file version.

Definition at line 840 of file HDF5_File.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_FileHeader::SetMemoryConsumption ( const size_t  totalMemory)

Set memory consumption.

Parameters
[in]totalMemory- Total memory consumption

Definition at line 1531 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_FileHeader::SetMinorFileVersion ( )
inline

Set minor file version.

Definition at line 849 of file HDF5_File.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_FileHeader::SetNumberOfCores ( )

Set Number of cores.

Definition at line 1593 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_FileHeader::WriteHeaderToCheckpointFile ( THDF5_File checkpointFile)

Write header to the output file (only a subset of all possible fields are written).

Parameters
[in,out]checkpointFile- Checkpoint file handle

Definition at line 1386 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_FileHeader::WriteHeaderToOutputFile ( THDF5_File outputFile)

Write header into the output file.

Parameters
[in,out]outputFile- Output file handle

Definition at line 1369 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


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