Newer
Older
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
/*
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
* ADIOS.h : ADIOS library starting point, factory class for IO and
* (polymorphic) Engines
* Created on: Oct 3, 2016
* Author: William F Godoy godoywf@ornl.gov
*/
#ifndef ADIOS2_CORE_ADIOS_H_
#define ADIOS2_CORE_ADIOS_H_
/// \cond EXCLUDE_FROM_DOXYGEN
#include <map>
#include <memory> //std::shared_ptr
#include <string>
#include <vector>
/// \endcond
#include "adios2/ADIOSConfig.h"
#include "adios2/ADIOSMPICommOnly.h"
#include "adios2/core/IO.h"
#include "adios2/core/Transform.h"
namespace adios
{
/** @brief Point of entry class for an application.
* Serves as factory of IO class objects and Transforms */
class ADIOS
{
public:
/** Passed from parallel constructor, MPI_Comm is a pointer itself. */
MPI_Comm m_MPIComm = MPI_COMM_SELF;
std::string m_HostLanguage = "C++"; ///< changed by language bindings
/** @brief ADIOS no-MPI default empty constructor
* @param debugMode true: extra exception checks (recommended)
*/
ADIOS(const bool debugMode = false);
/**
* @brief Constructor for non-MPI applications WITH a XML config file
* @param configFile XML format (maybe support different formats in the
* future?)
* @param debugMode true: extra exception checks (recommended)
*/
ADIOS(const std::string configFile, const bool debugMode = false);
/**
* @brief Constructor for MPI applications WITH a XML config file
* @param configFile XML format (maybe support different formats in the
* future?)
* @param mpiComm MPI communicator from application
* @param debugMode true: extra exception checks (recommended)
*/
ADIOS(const std::string configFile, MPI_Comm mpiComm,
const bool debugMode = false);
/**
* @brief Constructor for MPI apps WITHOUT a XML config file
* @param mpiComm MPI communicator from application
* @param debugMode true: extra exception checks (recommended)
*/
ADIOS(MPI_Comm mpiComm, const bool debugMode = false);
~ADIOS() = default;
/**
* Declares a new IO class object. If IO object is defined in the user
* config file, by name, it will be already created during the processing
* the config file. So this function returns a reference to that object.
* Otherwise it will create and return a new IO object with default
* settings.
* Use function InConfigFile() to distinguish between the two cases.
* @param ioName must be unique
* @return reference to existing (or newly created) method inside ADIOS
*/
IO &DeclareIO(const std::string ioName);
protected: // no const member to allow default empty and copy constructors
/** XML File to be read containing configuration information */
std::string m_ConfigFile;
/** if true will do more checks, exceptions, warnings, expect slower code */
bool m_DebugMode = false;
/** transforms associated with ADIOS run */
std::vector<std::shared_ptr<Transform>> m_Transforms;
/**
* @brief List of IO class objects defined from either ADIOS
* configuration file (XML) or the DeclareIO function explicitly.
* Using map (binary tree) to preserve references returned by DeclareIO.
* <pre>
* Key: unique method name
* Value: IO class object
* </pre>
*/
std::map<std::string, IO> m_IOs;
/** throws exception if m_MPIComm = MPI_COMM_NULL */
void CheckMPI() const;
};
} // end namespace adios
#endif /* ADIOS2_ADIOS_H_ */