#include <CH_HDF5.H>
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.
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. | |
~WriteMultiData () | |
Destructor. | |
int | writeData (const BoxLayoutData< T > &a_data, const Interval &a_intvMem, const Interval &a_intvFile) |
Write an interval of LevelData to the dataset. | |
Protected Attributes | |
const int | m_policyFlags |
Policies. | |
const IntVect | m_outputGhost |
Number of ghost cells written. | |
const bool | m_newForm |
? | |
char | m_dataname [128] |
Name for level data dataset. | |
hid_t | m_dataSet |
Dataset for level data. | |
Interval | m_allIntvFile |
Interval for components in file. | |
long | m_maxBoxPerProc |
Maximum boxes written by any proc. | |
Vector< Vector< long long > > | m_offsets |
Vector< hid_t > | m_types |
Type of data written. | |
Private Member Functions | |
WriteMultiData (const WriteMultiData &) | |
WriteMultiData & | operator= (const WriteMultiData) |
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 | |||
) | [inline] |
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().
WriteMultiData< T >::~WriteMultiData | ( | ) | [inline] |
WriteMultiData< T >::WriteMultiData | ( | const WriteMultiData< T > & | ) | [private] |
WriteMultiData& WriteMultiData< T >::operator= | ( | const | WriteMultiData | ) | [private] |
int WriteMultiData< T >::writeData | ( | const BoxLayoutData< T > & | a_data, | |
const Interval & | a_intvMem, | |||
const Interval & | a_intvFile | |||
) | [inline] |
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(), Box::size(), Interval::size(), Box::smallEnd(), and SpaceDim.
const int WriteMultiData< T >::m_policyFlags [protected] |
const IntVect WriteMultiData< T >::m_outputGhost [protected] |
Number of ghost cells written.
Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().
const bool WriteMultiData< T >::m_newForm [protected] |
char WriteMultiData< T >::m_dataname[128] [protected] |
hid_t WriteMultiData< T >::m_dataSet [protected] |
Dataset for level data.
Referenced by WriteMultiData< T >::writeData(), WriteMultiData< T >::WriteMultiData(), and WriteMultiData< T >::~WriteMultiData().
Interval WriteMultiData< T >::m_allIntvFile [protected] |
Interval for components in file.
Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().
long WriteMultiData< T >::m_maxBoxPerProc [protected] |
Maximum boxes written by any proc.
Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().
Vector<Vector<long long> > WriteMultiData< T >::m_offsets [protected] |
Offset in file for each process to write to
Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().
Vector<hid_t> WriteMultiData< T >::m_types [protected] |
Type of data written.
Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().