Newer
Older
/*
* DataManReader.h
*
* Created on: Feb 21, 2017
* Author: wfg
*/
#ifndef DATAMANREADER_H_
#define DATAMANREADER_H_
#include <iostream> //std::cout << Needs to go
#include "core/Engine.h"
#include "format/BP1Writer.h"
namespace adios
{
class DataManReader : public Engine
{
public:
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
* Constructor for dataman engine Reader for WAN communications
* @param adios
* @param name
* @param accessMode
* @param mpiComm
* @param method
* @param debugMode
* @param nthreads
*/
DataManReader(ADIOS &adios, const std::string name,
const std::string accessMode, MPI_Comm mpiComm,
const Method &method, const IOMode iomode,
const float timeout_sec, const bool debugMode = false,
const unsigned int nthreads = 1);
~DataManReader();
/**
* Set callback function from user application
* @param callback function (get) provided by the user to be applied in
* DataMan
*/
void SetCallBack(std::function<void(const void *, std::string, std::string,
std::string, Dims)>
callback);
Variable<void> *InquireVariable(const std::string name,
const bool readIn = true);
Variable<char> *InquireVariableChar(const std::string name,
const bool readIn = true);
Variable<unsigned char> *InquireVariableUChar(const std::string name,
const bool readIn = true);
Variable<short> *InquireVariableShort(const std::string name,
const bool readIn = true);
Variable<unsigned short> *InquireVariableUShort(const std::string name,
const bool readIn = true);
Variable<int> *InquireVariableInt(const std::string name,
const bool readIn = true);
Variable<unsigned int> *InquireVariableUInt(const std::string name,
const bool readIn = true);
Variable<long int> *InquireVariableLInt(const std::string name,
const bool readIn = true);
Variable<unsigned long int> *InquireVariableULInt(const std::string name,
const bool readIn = true);
Variable<long long int> *InquireVariableLLInt(const std::string name,
const bool readIn = true);
Variable<unsigned long long int> *
InquireVariableULLInt(const std::string name, const bool readIn = true);
Variable<float> *InquireVariableFloat(const std::string name,
const bool readIn = true);
Variable<double> *InquireVariableDouble(const std::string name,
const bool readIn = true);
Variable<long double> *InquireVariableLDouble(const std::string name,
const bool readIn = true);
Variable<std::complex<float>> *
InquireVariableCFloat(const std::string name, const bool readIn = true);
Variable<std::complex<double>> *
InquireVariableCDouble(const std::string name, const bool readIn = true);
Variable<std::complex<long double>> *
InquireVariableCLDouble(const std::string name, const bool readIn = true);
/**
* Not implemented
* @param name
* @param readIn
* @return
*/
VariableCompound *InquireVariableCompound(const std::string name,
const bool readIn = true);
void Close(const int transportIndex = -1);
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
capsule::STLVector
m_Buffer; ///< heap capsule, contains data and metadata buffers
format::BP1Writer m_BP1Writer; ///< format object will provide the required BP
///functionality to be applied on m_Buffer and
///m_Transports
bool m_DoRealTime = false;
DataManager m_Man;
std::function<void(const void *, std::string, std::string, std::string, Dims)>
m_CallBack; ///< call back function
void Init(); ///< calls InitCapsules and InitTransports based on Method,
///called from constructor
void InitCapsules();
void InitTransports(); ///< from Transports
std::string
GetMdtmParameter(const std::string parameter,
const std::map<std::string, std::string> &mdtmParameters);
template <class T>
Variable<T> *InquireVariableCommon(const std::string name, const bool readIn)
{
std::cout << "I am hooked to the DataMan library\n";
std::cout << "Hello DatamanReader from rank " << m_RankMPI << "\n";
std::cout << "Trying to read variable " << name
<< " from one of the variables coming from a WAN transport\n";
// here read variable metadata (dimensions, type, etc.)...then create a
// Variable like below:
// Variable<T>& variable = m_ADIOS.DefineVariable<T>( m_Name + "/" + name, )
// return &variable; //return address if success
return nullptr; // on failure
}