Chombo + EB + MF  3.2
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
WriteMultiData< T > Class Template Reference

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 &)
 
WriteMultiDataoperator= (const WriteMultiData)
 

Detailed Description

template<class T>
class WriteMultiData< T >

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.

Note
  • Users are resposible for matching the total number of components used to allocate the dataset match the number of levelData added to the dataset
  • Only a single datatype is supported per file
  • Since the dataset must be created in advance, T can only be statically allocatable (T::preAllocatable() == 0)
  • API 1.6 is not supported

Constructor & Destructor Documentation

◆ WriteMultiData() [1/2]

template<class T >
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.

Parameters
[in]a_handleChombo HDF5 handle holding open file for writing
[in]a_layoutBox layout for all data to be written
[in]a_numIntvTotal number of components that will be written from all BoxLayoutData or LevelData
[in]a_nameName of the dataset for the level data.
[in]a_policyFlagsEither 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_outputGhostNumber 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()

template<class T >
WriteMultiData< T >::~WriteMultiData ( )
inline

Destructor.

◆ WriteMultiData() [2/2]

template<class T >
WriteMultiData< T >::WriteMultiData ( const WriteMultiData< T > &  )
private

Member Function Documentation

◆ operator=()

template<class T >
WriteMultiData& WriteMultiData< T >::operator= ( const WriteMultiData< T >  )
private

◆ writeData()

template<class T >
int WriteMultiData< T >::writeData ( const BoxLayoutData< T > &  a_data,
const Interval a_intvMem,
const Interval a_intvFile 
)

Member Data Documentation

◆ m_policyFlags

template<class T >
const int WriteMultiData< T >::m_policyFlags
protected

Policies.

Referenced by WriteMultiData< T >::writeData().

◆ m_outputGhost

template<class T >
const IntVect WriteMultiData< T >::m_outputGhost
protected

Number of ghost cells written.

Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().

◆ m_newForm

template<class T >
const bool WriteMultiData< T >::m_newForm
protected

◆ m_dataname

template<class T >
char WriteMultiData< T >::m_dataname[128]
protected

Name for level data dataset.

Referenced by WriteMultiData< T >::WriteMultiData().

◆ m_dataSet

template<class T >
hid_t WriteMultiData< T >::m_dataSet
protected

Dataset for level data.

Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().

◆ m_allIntvFile

template<class T >
Interval WriteMultiData< T >::m_allIntvFile
protected

◆ m_maxBoxPerProc

template<class T >
long WriteMultiData< T >::m_maxBoxPerProc
protected

Maximum boxes written by any proc.

Referenced by WriteMultiData< T >::writeData(), and WriteMultiData< T >::WriteMultiData().

◆ m_offsets

template<class T >
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().

◆ m_types

template<class T >
Vector<hid_t> WriteMultiData< T >::m_types
protected

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