Newer
Older
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
Podhorszki, Norbert
committed
* ADIOS1Reader.cpp
*
* Created on: Feb 27, 2017
* Author: wfg
*/
#include "core/Support.h"
#include "core/adiosFunctions.h" // CSVToVector
#include "transport/file/FStream.h" // uses C++ fstream
#include "transport/file/FileDescriptor.h" // uses POSIX
#include "transport/file/FilePointer.h" // uses C FILE*
#include "ADIOS1Reader.h"
ADIOS1Reader::ADIOS1Reader(ADIOS &adios, const std::string &name,
const std::string accessMode, MPI_Comm mpiComm,
const Method &method)
Podhorszki, Norbert
committed
: Engine(adios, "ADIOS1Reader", name, accessMode, mpiComm, method,
" ADIOS1Reader constructor (or call to ADIOS Open).\n")
Podhorszki, Norbert
committed
adios_read_init_method(read_method, mpiComm, "");
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariable(const std::string &variableName,
const bool readIn) // not yet implemented
{
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableChar(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<char>(variableName, readIn);
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableUChar(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<unsigned char>(variableName, readIn);
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableShort(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<short>(variableName, readIn);
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableUShort(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<unsigned short>(variableName, readIn);
Podhorszki, Norbert
committed
Variable<int> *ADIOS1Reader::InquireVariableInt(const std::string &variableName,
return InquireVariableCommon<int>(variableName, readIn);
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableUInt(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<unsigned int>(variableName, readIn);
Variable<long int> *
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableLInt(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<long int>(variableName, readIn);
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableULInt(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<unsigned long int>(variableName, readIn);
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableLLInt(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<long long int>(variableName, readIn);
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableULLInt(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<unsigned long long int>(variableName, readIn);
Variable<float> *
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableFloat(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<float>(variableName, readIn);
Variable<double> *
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableDouble(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<double>(variableName, readIn);
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableLDouble(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<long double>(variableName, readIn);
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableCFloat(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<std::complex<float>>(variableName, readIn);
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableCDouble(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<std::complex<double>>(variableName, readIn);
}
Variable<std::complex<long double>> *
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableCLDouble(const std::string &variableName,
const bool readIn)
return InquireVariableCommon<std::complex<long double>>(variableName,
readIn);
VariableCompound *
Podhorszki, Norbert
committed
ADIOS1Reader::InquireVariableCompound(const std::string &variableName,
const bool readIn)
Podhorszki, Norbert
committed
void ADIOS1Reader::Close(const int transportIndex) {}
Podhorszki, Norbert
committed
void ADIOS1Reader::Init()
if (m_DebugMode == true)
{
if (m_AccessMode != "r" && m_AccessMode != "read")
throw std::invalid_argument(
Podhorszki, Norbert
committed
"ERROR: ADIOS1Reader doesn't support access mode " +
Podhorszki, Norbert
committed
", in call to ADIOS Open or ADIOS1Reader constructor\n");
Podhorszki, Norbert
committed
InitParameters();
Podhorszki, Norbert
committed
void ADIOS1Reader::InitParameters() {}
void ADIOS1Reader::InitTransports()
Podhorszki, Norbert
committed
if (TransportNamesUniqueness() == false)
{
throw std::invalid_argument(
"ERROR: two transports of the same kind (e.g file IO) "
"can't have the same name, modify with name= in Method "
"AddTransport\n");
}
for (const auto ¶meters : m_Method.m_TransportParameters)
auto itTransport = parameters.find("transport");
Podhorszki, Norbert
committed
if (itTransport->second == "file" || itTransport->second == "File" ||
itTransport->second == "bp" || itTransport->second == "BP")
Podhorszki, Norbert
committed
read_method = ADIOS_READ_METHOD_BP;
}
else
{
if (m_DebugMode == true)
throw std::invalid_argument(
"ERROR: transport " + itTransport->second +
" (you mean File?) not supported, in " + m_Name +
m_EndMessage);
}