Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Pointer-to-const parameters in smpi::Group.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 17 Apr 2021 08:56:54 +0000 (10:56 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 17 Apr 2021 09:21:45 +0000 (11:21 +0200)
src/smpi/include/smpi_group.hpp
src/smpi/mpi/smpi_group.cpp

index 99be127..1ee962b 100644 (file)
@@ -41,14 +41,14 @@ public:
   void ref();
   static void unref(MPI_Group group);
   int size() const { return static_cast<int>(rank_to_actor_map_.size()); }
-  int compare(MPI_Group group2) const;
+  int compare(const Group* group2) const;
   int incl(int n, const int* ranks, MPI_Group* newgroup) const;
   int excl(int n, const int* ranks, MPI_Group* newgroup) const;
-  int group_union(MPI_Group group2, MPI_Group* newgroup) const;
-  int intersection(MPI_Group group2, MPI_Group* newgroup) const;
-  int difference(MPI_Group group2, MPI_Group* newgroup) const;
-  int range_incl(int n, int ranges[][3], MPI_Group* newgroup) const;
-  int range_excl(int n, int ranges[][3], MPI_Group* newgroup) const;
+  int group_union(const Group* group2, MPI_Group* newgroup) const;
+  int intersection(const Group* group2, MPI_Group* newgroup) const;
+  int difference(const Group* group2, MPI_Group* newgroup) const;
+  int range_incl(int n, const int ranges[][3], MPI_Group* newgroup) const;
+  int range_excl(int n, const int ranges[][3], MPI_Group* newgroup) const;
 
   static Group* f2c(int id);
 };
index 93fef15..f9873bf 100644 (file)
@@ -79,7 +79,7 @@ void Group::unref(Group* group)
   }
 }
 
-int Group::compare(MPI_Group group2) const
+int Group::compare(const Group* group2) const
 {
   int result;
 
@@ -132,7 +132,7 @@ int Group::excl(const std::vector<bool> excl_map, MPI_Group* newgroup) const
   return incl(static_cast<int>(ranks.size()), ranks.data(), newgroup);
 }
 
-int Group::group_union(MPI_Group group2, MPI_Group* newgroup) const
+int Group::group_union(const Group* group2, MPI_Group* newgroup) const
 {
   std::vector<int> ranks2;
   for (int i = 0; i < group2->size(); i++) {
@@ -162,7 +162,7 @@ int Group::group_union(MPI_Group group2, MPI_Group* newgroup) const
   return MPI_SUCCESS;
 }
 
-int Group::intersection(MPI_Group group2, MPI_Group* newgroup) const
+int Group::intersection(const Group* group2, MPI_Group* newgroup) const
 {
   std::vector<int> ranks2;
   for (int i = 0; i < group2->size(); i++) {
@@ -173,7 +173,7 @@ int Group::intersection(MPI_Group group2, MPI_Group* newgroup) const
   return group2->incl(ranks2, newgroup);
 }
 
-int Group::difference(MPI_Group group2, MPI_Group* newgroup) const
+int Group::difference(const Group* group2, MPI_Group* newgroup) const
 {
   std::vector<int> ranks;
   for (int i = 0; i < size(); i++) {
@@ -197,7 +197,7 @@ static bool is_rank_in_range(int rank, int first, int last)
   return (first <= rank && rank <= last) || (first >= rank && rank >= last);
 }
 
-int Group::range_incl(int n, int ranges[][3], MPI_Group* newgroup) const
+int Group::range_incl(int n, const int ranges[][3], MPI_Group* newgroup) const
 {
   std::vector<int> ranks;
   for (int i = 0; i < n; i++) {
@@ -208,7 +208,7 @@ int Group::range_incl(int n, int ranges[][3], MPI_Group* newgroup) const
   return this->incl(ranks, newgroup);
 }
 
-int Group::range_excl(int n, int ranges[][3], MPI_Group* newgroup) const
+int Group::range_excl(int n, const int ranges[][3], MPI_Group* newgroup) const
 {
   std::vector<bool> to_excl(size(), false);
   for (int i = 0; i < n; i++) {