Newer
Older
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
#include "adios2/ADIOSMPI.h"
#include "adios2/helper/adiosFunctions.h" //CSVToVector
HDF5WriterP::HDF5WriterP(IO &io, const std::string &name, const Mode mode,
: Engine("HDF5Writer", io, name, mode, mpiComm), m_H5File(io.m_DebugMode)
m_EndMessage = ", in call to IO HDF5Writer Open " + m_Name + "\n";
HDF5WriterP::~HDF5WriterP() { Close(); }
StepStatus HDF5WriterP::BeginStep(StepMode mode, const float timeoutSeconds)
void HDF5WriterP::EndStep() { m_H5File.Advance(); }
void HDF5WriterP::Close(const int transportIndex) { m_H5File.Close(); }
// PRIVATE
void HDF5WriterP::Init()
if (m_OpenMode != Mode::Write && m_OpenMode != Mode::Append)
"ERROR: HDF5Writer only support OpenMode::Write or "
"OpenMode::Append "
m_H5File.Init(m_Name, m_MPIComm, true);
#else
// enforce .h5 ending
std::string suffix = ".h5";
std::string wrongSuffix = ".bp";
int ss = m_Name.size();
int wpos = m_Name.find(wrongSuffix);
if (wpos == ss - wrongSuffix.size())
{
// is a file with .bp ending
std::string updatedName = m_Name.substr(0, wpos) + suffix;
m_H5File.Init(updatedName, m_MPIComm, true);
}
else
{
m_H5File.Init(m_Name, m_MPIComm, true);
}
#endif
void HDF5WriterP::DoPutSync(Variable<T> &variable, const T *values) \
{ \
DoPutSyncCommon(variable, values); \
} \
void HDF5WriterP::DoPutDeferred(Variable<T> &variable, const T *values) \
DoPutSyncCommon(variable, values); \
}
ADIOS2_FOREACH_TYPE_1ARG(declare_type)
#undef declare_type
void HDF5WriterP::DoPutSyncCommon(Variable<T> &variable, const T *values)