From bb086c95fc3a655941c28595a1568ed454b0e347 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Sat, 17 Apr 2021 10:56:54 +0200 Subject: [PATCH] Pointer-to-const parameters in smpi::Group. --- src/smpi/include/smpi_group.hpp | 12 ++++++------ src/smpi/mpi/smpi_group.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/smpi/include/smpi_group.hpp b/src/smpi/include/smpi_group.hpp index 99be12735a..1ee962bfb0 100644 --- a/src/smpi/include/smpi_group.hpp +++ b/src/smpi/include/smpi_group.hpp @@ -41,14 +41,14 @@ public: void ref(); static void unref(MPI_Group group); int size() const { return static_cast(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); }; diff --git a/src/smpi/mpi/smpi_group.cpp b/src/smpi/mpi/smpi_group.cpp index 93fef15478..f9873bf744 100644 --- a/src/smpi/mpi/smpi_group.cpp +++ b/src/smpi/mpi/smpi_group.cpp @@ -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 excl_map, MPI_Group* newgroup) const return incl(static_cast(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 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 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 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 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 to_excl(size(), false); for (int i = 0; i < n; i++) { -- 2.20.1