NetCDF4 C++ API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NcMPI.references.h
Go to the documentation of this file.
1 
13 #if !defined(INC_netCDF_NcMPI) && defined(USE_PARALLEL)
14 #define INC_netCDF_NcMPI
15 
16 #ifndef USE_PARALLEL
17  #error For parallel netCDF, use #define USE_PARALLEL during library compilation.
18 #endif
19 
20 #include "mpi.h"
21 #include "NcException.h"
22 
23 namespace netcdf {
24 
25 
26  class NcMPI
27  {
28  public:
29 
30  MPI::Comm & comm;
31  MPI::Info & info;
32 
34  MPI::Comm & mpiComm,
35  MPI::Info & mpiInfo)
36  : comm (mpiComm), info (mpiInfo)
37  {
38  if ( !MPI::Is_initialized() )
39  NcEXCEPTION( "MPI has not been initialized." );
40  }
41 
42  NcMPI ( NcMPI const & rhs )
43  : comm (rhs.comm), info (rhs.info)
44  {
45  }
46 
47  MPI::Comm & Comm () { return comm; }
48  MPI::Info & Info () { return info; }
49 
50  static bool IsInitialized () { return MPI::Is_initialized(); }
51 
52  private:
53 
54  // not used
55  NcMPI operator= ( NcMPI const & rhs );
56 
57  };
58 
59 
60 } // namespace netcdf
61 
62 #endif // INC_netCDF_NcMPI
MPI::Info & Info()
Definition: NcMPI.references.h:48
NcMPI(MPI::Comm &mpiComm, MPI::Info &mpiInfo)
Definition: NcMPI.references.h:33
static bool IsInitialized()
Definition: NcMPI.references.h:50
NcMPI(NcMPI const &rhs)
Definition: NcMPI.references.h:42
MPI::Comm & comm
Definition: NcMPI.references.h:30
Manages data related to the MPI implementation.
Definition: NcMPI.h:29
#define NcEXCEPTION(a_)
Definition: NcException.h:67
MPI::Comm & Comm()
Definition: NcMPI.references.h:47
MPI::Info & info
Definition: NcMPI.references.h:31