communicatorgroup.hh 1.97 KB
Newer Older
1
2
3
4
5
6
7
8
/*
 * @file:   communicatorgroup.hh
 * @uthor: Jordan P. Lefebvre, lefebvrejp@ornl.gov
 *
 * Created on July 3, 2013, 12:48 PM
 */

#ifndef RADIX_RADIXPARA_COMMUNICATORGROUP_HH_
9
#define RADIX_RADIXPARA_COMMUNICATORGROUP_HH_
10
11
#include <memory>

12
#include "radixcore/visibility.hh"
13

14
15
16
17
#ifdef USE_MPI
#include <mpi.h>
#endif

18
19
20
21
namespace radix
{
namespace Private
{
22
23
#ifdef USE_MPI

24
25
26
27
/**
 * @class MPICommGroup
 * @brief MPI implementation of CommunicatorGroup
 */
28
29
class RADIX_PUBLIC MPICommGroup
{
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 public:
  MPICommGroup();
  MPICommGroup(MPI_Group group);
  virtual ~MPICommGroup();
  /**
   * @brief rank of group
   * @return <b>int</b>
   */
  virtual int rank() const;
  /**
   * @brief size of group
   * @return <b>int</b>
   */
  virtual int size() const;
44

45
46
47
48
 private:
  MPI_Group group;

};     // class MPICommGroup
49
50
#endif /** ifdef USE_MPI **/

51
52
53
54
55
/**
 * @class SerialCommGroup
 * @brief Serial implementation of CommGroup
 */

56
57
class RADIX_PUBLIC SerialCommGroup
{
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 public:
  SerialCommGroup();
  virtual ~SerialCommGroup();
  /**
   * @brief rank of group
   * @return <b>int</b>
   */
  virtual int rank() const;
  /**
   * @brief size of group
   * @return <b>int</b>
   */
  virtual int size() const;

 private:
};  // class SerialCommGroup
}  // namespace Private
75
76
77
78
/**
 * @class CommunicatorGroup
 * @brief Simply pure interface to describe communicator group
 */
79
#ifdef USE_MPI
80
template <class GroupImpl = Private::MPICommGroup>
81
#else
82
template <class GroupImpl = Private::SerialCommGroup>
83
#endif
84
85
class RADIX_PUBLIC CommunicatorGroupImpl : public GroupImpl
{
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
 public:
  /**
   * Default constructor
   */
  CommunicatorGroupImpl();
  /**
   * Copy constructor
   */
  CommunicatorGroupImpl(const GroupImpl &orig);
  /**
   * Default destructor
   */
  virtual ~CommunicatorGroupImpl();

 private:
101
};
102

103
typedef CommunicatorGroupImpl<> CommunicatorGroup;
104
}  // namespace radix
105
106
107
108
109

//
// Include template implementations
//
#include "radixpara/communicatorgroup.i.hh"
110
#endif /* RADIX_RADIXPARA_COMMUNICATORGROUP_HH_ */