Chombo + EB
3.2
|
Methods for writing multiple LevelData to an HDF5 file. More...
#include <CH_HDF5.H>
Public Member Functions | |
WriteMultiData (HDF5Handle &a_handle, const BoxLayout &a_layout, const int a_numIntv, const string &a_name, const int a_policyFlags=CH_HDF5::IOPolicyDefault, const IntVect &a_outputGhost=IntVect::Zero, const bool a_newForm=false) | |
Constructor writes boxes and allocates dataset for LevelData. More... | |
~WriteMultiData () | |
Destructor. More... | |
int | writeData (const BoxLayoutData< T > &a_data, const Interval &a_intvMem, const Interval &a_intvFile) |
Write an interval of LevelData to the dataset. More... | |
Protected Attributes | |
const int | m_policyFlags |
Policies. More... | |
const IntVect | m_outputGhost |
Number of ghost cells written. More... | |
const bool | m_newForm |
? More... | |
char | m_dataname [128] |
Name for level data dataset. More... | |
hid_t | m_dataSet |
Dataset for level data. More... | |
Interval | m_allIntvFile |
Interval for components in file. More... | |
long | m_maxBoxPerProc |
Maximum boxes written by any proc. More... | |
Vector< Vector< long long > > | m_offsets |
Vector< hid_t > | m_types |
Type of data written. More... | |
Private Member Functions | |
WriteMultiData (const WriteMultiData &) | |
WriteMultiData & | operator= (const WriteMultiData) |
Methods for writing multiple LevelData to an HDF5 file.
While the write functions can be used to write a single LevelData, they do not support writing intervals from multiple LevelData. This is often the case when you want to add diagnostic information to the output file. The purpose of this class is to handle writing multiple LevelData to a single file. The dataset for the LevelData is created during construction, when the boxes are written. Any number of intervals from LevelData can then be written.
Special behavior can be selected with the policy flags:
With MPI-everywhere on x86 architectures, it is highly likely that the default policy CH_HDF5::IOPolicyDefault gives the best performance (i.e., use internal linearization and independent I/O). In some limited testing (2 procs, 20 cores each): IOPolicyDefault - 6.77 IOPolicyCollectiveWrite - 33.33 IOPolicyMultiDimHyperslab - 168.14 IOPolicyCollectiveWrite | IOPolicyMultiDimHyperslab - 30.94 which is difficult to make sense of.
WriteMultiData< T >::WriteMultiData | ( | HDF5Handle & | a_handle, |
const BoxLayout & | a_layout, | ||
const int | a_numIntv, | ||
const string & | a_name, | ||
const int | a_policyFlags = CH_HDF5::IOPolicyDefault , |
||
const IntVect & | a_outputGhost = IntVect::Zero , |
||
const bool | a_newForm = false |
||
) |
Constructor writes boxes and allocates dataset for LevelData.
Write boxes, processors, attributes and creates a dataset for all the level data to be written. The dataset is closed on destruction.
[in] | a_handle | Chombo HDF5 handle holding open file for writing |
[in] | a_layout | Box layout for all data to be written |
[in] | a_numIntv | Total number of components that will be written from all BoxLayoutData or LevelData |
[in] | a_name | Name of the dataset for the level data. |
[in] | a_policyFlags | Either CH_HDF5::IOPolicyDefault - Use internal T.linearOut(...) to linearize data and processes independently write to file, but still in parallel. or a union (|) of the following flags: CH_HDF5::IOPolicyMultiDimHyperslab - The memory dataspace will be set up so that HDF5 linearizes the data. Using this requires T.dataPtr() and contiguous memory (so things like T=FluxBox will not work). CH_HDF5::IOPolicyCollectiveWrite - The write for each dataset will be collective. |
[in] | a_outputGhost | Number of ghost cells that will be written to the data file. Any data written must have this many ghosts |
[in] | a_newForm | ? |
References CH_assert, CH_TIME, Interval::define(), HDF5Handle::getGroup(), HDF5Handle::groupID(), WriteMultiData< T >::m_allIntvFile, WriteMultiData< T >::m_dataname, WriteMultiData< T >::m_dataSet, HDF5HeaderData::m_int, HDF5HeaderData::m_intvect, WriteMultiData< T >::m_maxBoxPerProc, WriteMultiData< T >::m_newForm, WriteMultiData< T >::m_offsets, WriteMultiData< T >::m_outputGhost, HDF5HeaderData::m_string, WriteMultiData< T >::m_types, name(), procID(), HDF5Handle::setGroup(), Interval::size(), BoxLayout::size(), write(), and HDF5HeaderData::writeToFile().
|
inline |
Destructor.
|
private |
|
private |
int WriteMultiData< T >::writeData | ( | const BoxLayoutData< T > & | a_data, |
const Interval & | a_intvMem, | ||
const Interval & | a_intvFile | ||
) |
Write an interval of LevelData to the dataset.
Call this as many times as you want to write level data. User is resposible for making sure 'a_intvFile' has relevance to 'a_numIntv' specified during construction.
[in] | a_data | Level data to write |
[in] | a_intvMem | Interval of a_data to read |
[in] | a_intvFile | Interval to write to file |
References Interval::begin(), LayoutData< T >::box(), LayoutData< T >::boxLayout(), CH_assert, CH_TIME, CH_TIMELEAF, D_TERM6, LayoutData< T >::dataIterator(), Interval::end(), MayDay::Error(), freeMT, Box::grow(), BoxLayout::index(), BoxLayoutData< T >::interval(), CH_HDF5::IOPolicyCollectiveWrite, CH_HDF5::IOPolicyMultiDimHyperslab, WriteMultiData< T >::m_allIntvFile, WriteMultiData< T >::m_dataSet, WriteMultiData< T >::m_maxBoxPerProc, WriteMultiData< T >::m_offsets, WriteMultiData< T >::m_outputGhost, WriteMultiData< T >::m_policyFlags, WriteMultiData< T >::m_types, mallocMT, BoxLayoutData< T >::nComp(), Box::numPts(), LayoutIterator::ok(), pout(), Interval::size(), Box::size(), Box::smallEnd(), and SpaceDim.
|
protected |
Policies.
Referenced by WriteMultiData< T >::writeData().
|
protected |
Number of ghost cells written.
Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().
|
protected |
?
Referenced by WriteMultiData< T >::WriteMultiData().
|
protected |
Name for level data dataset.
Referenced by WriteMultiData< T >::WriteMultiData().
|
protected |
Dataset for level data.
Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().
|
protected |
Interval for components in file.
Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().
|
protected |
Maximum boxes written by any proc.
Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().
|
protected |
Offset in file for each process to write to
Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().
|
protected |
Type of data written.
Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().