communicatorenvironment.hh 1.7 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
/*
 * @file:   communicatorenvironment.hh
 * @author: Jordan P. Lefebvre, lefebvrejp@ornl.gov
 *
 * Created on August 30, 2013, 12:41 PM
 */

#ifndef RADIX_RADIXPARA_COMMUNICATORENVIRONMENT_HH_
#define RADIX_RADIXPARA_COMMUNICATORENVIRONMENT_HH_

11
#include "radixcore/visibility.hh"
12

13
14
15
16
namespace radix
{
namespace Private
{
17
#ifdef USE_MPI
18
19
20
/**
 * MPIEnviroment implementation
 */
21
22
class RADIX_PUBLIC MPIEnvironment
{
23
24
25
 public:
  MPIEnvironment(int &argc, char **&argv);
  virtual ~MPIEnvironment();
26

27
28
29
30
31
32
33
34
35
36
37
38
  /**
   * About all processes
   * Aborts all processes and returns to the environment. This call will not
   * return
   * @param error_code <b>int</b> error code to be returned to environment
   */
  static void abort(int error_code);
  static bool initialized();
  static bool finalized();

 private:
  bool owner;
39
};
40
#else
41
42
43
/**
 * SerialEnviroment implementation
 */
44
45
class RADIX_PUBLIC SerialEnvironment
{
46
47
48
49
50
51
52
53
 public:
  SerialEnvironment(int &argc, char **&argv);
  virtual ~SerialEnvironment();
  static void abort(int error_code);
  static bool initialized();
  static bool finalized();

 private:
54
};
55
#endif
56
}  // namespace Private
57

58
#ifdef USE_MPI
59
template <class CommImpl = Private::MPIEnvironment>
60
#else
61
template <class CommImpl = Private::SerialEnvironment>
62
#endif
63
64
class RADIX_PUBLIC CommunicatorEnvironmentImpl : public CommImpl
{
65
66
67
68
69
 public:
  CommunicatorEnvironmentImpl(int &argc, char **&argv);
  virtual ~CommunicatorEnvironmentImpl();

 private:
70
71
72
73
74
};
/**
 * CommunicatorEnvironment default Implement
 */
typedef CommunicatorEnvironmentImpl<> CommunicatorEnvironment;
75
}  // namespace radix
76
77
78
79
80

//
// Include implementation file
//
#include "radixpara/communicatorenvironment.i.hh"
81
#endif /* RADIX_RADIXPARA_COMMUNICATORENVIRONMENT_HH_ */