Line data Source code
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 (c) 2016 Cisco Systems, Inc. All rights reserved.
14 : // $COPYRIGHT$
15 : //
16 : // Additional copyrights may follow
17 : //
18 : // $HEADER$
19 : //
20 :
21 : //
22 : // Groups, Contexts, and Communicators
23 : //
24 :
25 : inline int
26 0 : MPI::Group::Get_size() const
27 : {
28 : int size;
29 0 : (void)MPI_Group_size(mpi_group, &size);
30 0 : return size;
31 : }
32 :
33 : inline int
34 0 : MPI::Group::Get_rank() const
35 : {
36 : int myrank;
37 0 : (void)MPI_Group_rank(mpi_group, &myrank);
38 0 : return myrank;
39 : }
40 :
41 : inline void
42 : MPI::Group::Translate_ranks (const MPI::Group& group1, int n,
43 : const int ranks1[],
44 : const MPI::Group& group2, int ranks2[])
45 : {
46 : (void)MPI_Group_translate_ranks(group1, n, const_cast<int *>(ranks1), group2, const_cast<int *>(ranks2));
47 : }
48 :
49 : inline int
50 : MPI::Group::Compare(const MPI::Group& group1, const MPI::Group& group2)
51 : {
52 : int result;
53 : (void)MPI_Group_compare(group1, group2, &result);
54 : return result;
55 : }
56 :
57 : inline MPI::Group
58 : MPI::Group::Union(const MPI::Group &group1, const MPI::Group &group2)
59 : {
60 : MPI_Group newgroup;
61 : (void)MPI_Group_union(group1, group2, &newgroup);
62 : return newgroup;
63 : }
64 :
65 : inline MPI::Group
66 : MPI::Group::Intersect(const MPI::Group &group1, const MPI::Group &group2)
67 : {
68 : MPI_Group newgroup;
69 : (void)MPI_Group_intersection( group1, group2, &newgroup);
70 : return newgroup;
71 : }
72 :
73 : inline MPI::Group
74 : MPI::Group::Difference(const MPI::Group &group1, const MPI::Group &group2)
75 : {
76 : MPI_Group newgroup;
77 : (void)MPI_Group_difference(group1, group2, &newgroup);
78 : return newgroup;
79 : }
80 :
81 : inline MPI::Group
82 0 : MPI::Group::Incl(int n, const int ranks[]) const
83 : {
84 : MPI_Group newgroup;
85 0 : (void)MPI_Group_incl(mpi_group, n, const_cast<int *>(ranks), &newgroup);
86 0 : return newgroup;
87 : }
88 :
89 : inline MPI::Group
90 0 : MPI::Group::Excl(int n, const int ranks[]) const
91 : {
92 : MPI_Group newgroup;
93 0 : (void)MPI_Group_excl(mpi_group, n, const_cast<int *>(ranks), &newgroup);
94 0 : return newgroup;
95 : }
96 :
97 : inline MPI::Group
98 0 : MPI::Group::Range_incl(int n, const int ranges[][3]) const
99 : {
100 : MPI_Group newgroup;
101 0 : (void)MPI_Group_range_incl(mpi_group, n,
102 : #if OMPI_CXX_SUPPORTS_2D_CONST_CAST
103 : const_cast<int(*)[3]>(ranges),
104 : #else
105 : (int(*)[3]) ranges,
106 : #endif
107 : &newgroup);
108 0 : return newgroup;
109 : }
110 :
111 : inline MPI::Group
112 0 : MPI::Group::Range_excl(int n, const int ranges[][3]) const
113 : {
114 : MPI_Group newgroup;
115 0 : (void)MPI_Group_range_excl(mpi_group, n,
116 : #if OMPI_CXX_SUPPORTS_2D_CONST_CAST
117 : const_cast<int(*)[3]>(ranges),
118 : #else
119 : (int(*)[3]) ranges,
120 : #endif
121 : &newgroup);
122 0 : return newgroup;
123 : }
124 :
125 : inline void
126 0 : MPI::Group::Free()
127 : {
128 0 : (void)MPI_Group_free(&mpi_group);
129 0 : }
|