Newer
Older
Podhorszki, Norbert
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
* ADIOS1Writer.h
* Class to write files using old adios 1.x library.
* It requires adios 1.x installed
*
* Created on: Mar 27, 2017
* Author: pnb
*/
#ifndef ADIOS1WRITER_H_
#define ADIOS1WRITER_H_
#include "core/Engine.h"
namespace adios
{
#ifdef ADIOS_NOMPI
# define _NOMPI 1
#endif
#include "adios.h" // this is adios 1.x header file
class ADIOS1Writer : public Engine
{
public:
/**
* Constructor for Writer writes in ADIOS 1.x BP format
* @param name unique name given to the engine
* @param accessMode
* @param mpiComm
* @param method
* @param debugMode
*/
ADIOS1Writer( 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 );
~ADIOS1Writer( );
void Write( Variable<char>& variable, const char* values );
void Write( Variable<unsigned char>& variable, const unsigned char* values );
void Write( Variable<short>& variable, const short* values );
void Write( Variable<unsigned short>& variable, const unsigned short* values );
void Write( Variable<int>& variable, const int* values );
void Write( Variable<unsigned int>& variable, const unsigned int* values );
void Write( Variable<long int>& variable, const long int* values );
void Write( Variable<unsigned long int>& variable, const unsigned long int* values );
void Write( Variable<long long int>& variable, const long long int* values );
void Write( Variable<unsigned long long int>& variable, const unsigned long long int* values );
void Write( Variable<float>& variable, const float* values );
void Write( Variable<double>& variable, const double* values );
void Write( Variable<long double>& variable, const long double* values );
void Write( Variable<std::complex<float>>& variable, const std::complex<float>* values );
void Write( Variable<std::complex<double>>& variable, const std::complex<double>* values );
void Write( Variable<std::complex<long double>>& variable, const std::complex<long double>* values );
void Write( VariableCompound& variable, const void* values );
void Write( const std::string variableName, const char* values );
void Write( const std::string variableName, const unsigned char* values );
void Write( const std::string variableName, const short* values );
void Write( const std::string variableName, const unsigned short* values );
void Write( const std::string variableName, const int* values );
void Write( const std::string variableName, const unsigned int* values );
void Write( const std::string variableName, const long int* values );
void Write( const std::string variableName, const unsigned long int* values );
void Write( const std::string variableName, const long long int* values );
void Write( const std::string variableName, const unsigned long long int* values );
void Write( const std::string variableName, const float* values );
void Write( const std::string variableName, const double* values );
void Write( const std::string variableName, const long double* values );
void Write( const std::string variableName, const std::complex<float>* values );
void Write( const std::string variableName, const std::complex<double>* values );
void Write( const std::string variableName, const std::complex<long double>* values );
void Write( const std::string variableName, const void* values );
void Advance( );
/**
* Closes a single transport or all transports
* @param transportIndex, if -1 (default) closes all transports, otherwise it closes a transport in m_Transport[transportIndex]. In debug mode the latter is bounds-checked.
*/
void Close( const int transportIndex = -1 );
private:
const char * m_groupname; ///< ADIOS1 group name created from the method's name. Must be a unique group name.
const char * m_filename; ///< Save file name from constructor for Advance() when we re-open in ADIOS1
MPI_Comm m_comm; ///< Save MPI communicator from constructor for Advance() when we re-open in ADIOS1
bool m_initialized = false; ///< set to true after calling adios_init()
int64_t m_adios_file = 0; ///< ADIOS1 file handler returned by adios_open()
int64_t m_adios_group = 0; ///< ADIOS1 group pointer that holds the ADIOS1 variable definitions
bool m_IsFileOpen = false;
void Init( );
// these are unused yet, keeping here to see if we need them
void InitParameters( );
void InitTransports( );
void InitProcessGroup( );
bool ReOpenAsNeeded( ); // return true if file is open or reopened
void DefineVariable( std::string name, bool isScalar, enum ADIOS_DATATYPES vartype,
std::string ldims, std::string gdims, std::string offs );
void WriteVariable( std::string name, bool isScalar, enum ADIOS_DATATYPES vartype,
std::string ldims, std::string gdims, std::string offs, const void * values );
};
} //end namespace adios
#endif /* ADIOS1WRITER_H_ */