-
William F Godoy authored
Passed ctest (MPI and nonMPI) excluding ADIOS1 engine, and Python bindings HDF5, C bindings and C++ tests working Introduced BeginStep EndStep functions Renamed IO GetVariable/Attribute to InquireVariable/Attribute
William F Godoy authoredPassed ctest (MPI and nonMPI) excluding ADIOS1 engine, and Python bindings HDF5, C bindings and C++ tests working Introduced BeginStep EndStep functions Renamed IO GetVariable/Attribute to InquireVariable/Attribute
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
HDF5WriterP.cpp 1.78 KiB
/*
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
* HDF5WriterP.cpp
*
* Created on: March 20, 2017
* Author: Junmin
*/
#include "HDF5WriterP.h"
#include "adios2/ADIOSMPI.h"
#include "adios2/helper/adiosFunctions.h" //CSVToVector
namespace adios2
{
HDF5WriterP::HDF5WriterP(IO &io, const std::string &name, const Mode openMode,
MPI_Comm mpiComm)
: Engine("HDF5Writer", io, name, openMode, mpiComm), m_H5File(io.m_DebugMode)
{
m_EndMessage = ", in call to IO HDF5Writer Open " + m_Name + "\n";
Init();
}
HDF5WriterP::~HDF5WriterP() { Close(); }
void HDF5WriterP::BeginStep() {}
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)
{
throw std::invalid_argument(
"ERROR: HDF5Writer only support OpenMode::Write or "
"OpenMode::Append "
", in call to ADIOS Open or HDF5Writer constructor\n");
}
m_H5File.Init(m_Name, m_MPIComm, true);
}
#define declare_type(T) \
void HDF5WriterP::DoPutSync(Variable<T> &variable, const T *values) \
{ \
DoPutSyncCommon(variable, values); \
}
ADIOS2_FOREACH_TYPE_1ARG(declare_type)
#undef declare_type
template <class T>
void HDF5WriterP::DoPutSyncCommon(Variable<T> &variable, const T *values)
{
variable.SetData(values);
m_WrittenVariables.insert(variable.m_Name);
m_H5File.Write(variable, values);
}
} // end namespace adios2