OpenMPI  0.1.1
group_inln.h
1 // -*- c++ -*-
2 //
3 // Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4 // University Research and Technology
5 // Corporation. All rights reserved.
6 // Copyright (c) 2004-2005 The University of Tennessee and The University
7 // of Tennessee Research Foundation. All rights
8 // reserved.
9 // Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10 // University of Stuttgart. All rights reserved.
11 // Copyright (c) 2004-2005 The Regents of the University of California.
12 // All rights reserved.
13 // $COPYRIGHT$
14 //
15 // Additional copyrights may follow
16 //
17 // $HEADER$
18 //
19 
20 //
21 // Groups, Contexts, and Communicators
22 //
23 
24 inline int
25 MPI::Group::Get_size() const
26 {
27  int size;
28  (void)MPI_Group_size(mpi_group, &size);
29  return size;
30 }
31 
32 inline int
33 MPI::Group::Get_rank() const
34 {
35  int rank;
36  (void)MPI_Group_rank(mpi_group, &rank);
37  return rank;
38 }
39 
40 inline void
41 MPI::Group::Translate_ranks (const MPI::Group& group1, int n,
42  const int ranks1[],
43  const MPI::Group& group2, int ranks2[])
44 {
45  (void)MPI_Group_translate_ranks(group1, n, const_cast<int *>(ranks1), group2, const_cast<int *>(ranks2));
46 }
47 
48 inline int
49 MPI::Group::Compare(const MPI::Group& group1, const MPI::Group& group2)
50 {
51  int result;
52  (void)MPI_Group_compare(group1, group2, &result);
53  return result;
54 }
55 
56 inline MPI::Group
57 MPI::Group::Union(const MPI::Group &group1, const MPI::Group &group2)
58 {
59  MPI_Group newgroup;
60  (void)MPI_Group_union(group1, group2, &newgroup);
61  return newgroup;
62 }
63 
64 inline MPI::Group
65 MPI::Group::Intersect(const MPI::Group &group1, const MPI::Group &group2)
66 {
67  MPI_Group newgroup;
68  (void)MPI_Group_intersection( group1, group2, &newgroup);
69  return newgroup;
70 }
71 
72 inline MPI::Group
73 MPI::Group::Difference(const MPI::Group &group1, const MPI::Group &group2)
74 {
75  MPI_Group newgroup;
76  (void)MPI_Group_difference(group1, group2, &newgroup);
77  return newgroup;
78 }
79 
80 inline MPI::Group
81 MPI::Group::Incl(int n, const int ranks[]) const
82 {
83  MPI_Group newgroup;
84  (void)MPI_Group_incl(mpi_group, n, const_cast<int *>(ranks), &newgroup);
85  return newgroup;
86 }
87 
88 inline MPI::Group
89 MPI::Group::Excl(int n, const int ranks[]) const
90 {
91  MPI_Group newgroup;
92  (void)MPI_Group_excl(mpi_group, n, const_cast<int *>(ranks), &newgroup);
93  return newgroup;
94 }
95 
96 inline MPI::Group
97 MPI::Group::Range_incl(int n, const int ranges[][3]) const
98 {
99  MPI_Group newgroup;
100  (void)MPI_Group_range_incl(mpi_group, n,
101 #if OMPI_CXX_SUPPORTS_2D_CONST_CAST
102  const_cast<int(*)[3]>(ranges),
103 #else
104  (int(*)[3]) ranges,
105 #endif
106  &newgroup);
107  return newgroup;
108 }
109 
110 inline MPI::Group
111 MPI::Group::Range_excl(int n, const int ranges[][3]) const
112 {
113  MPI_Group newgroup;
114  (void)MPI_Group_range_excl(mpi_group, n,
115 #if OMPI_CXX_SUPPORTS_2D_CONST_CAST
116  const_cast<int(*)[3]>(ranges),
117 #else
118  (int(*)[3]) ranges,
119 #endif
120  &newgroup);
121  return newgroup;
122 }
123 
124 inline void
125 MPI::Group::Free()
126 {
127  (void)MPI_Group_free(&mpi_group);
128 }
Group structure Currently we have four formats for storing the process pointers that are members of t...
Definition: group.h:79