X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c897fb0d193bbe081581d7ea7f579f04df1b5b5d..872c04774948d01f31ebadd1c78873840c65d9dd:/src/smpi/mpi/smpi_group.cpp diff --git a/src/smpi/mpi/smpi_group.cpp b/src/smpi/mpi/smpi_group.cpp index bce418b066..a3b3446dc4 100644 --- a/src/smpi/mpi/smpi_group.cpp +++ b/src/smpi/mpi/smpi_group.cpp @@ -39,7 +39,7 @@ Group::Group(MPI_Group origin) rank_to_index_map_[i] = origin->rank_to_index_map_[i]; } - for (auto elm : origin->index_to_rank_map_) { + for (auto const& elm : origin->index_to_rank_map_) { index_to_rank_map_.insert({elm.first, elm.second}); } } @@ -73,11 +73,8 @@ int Group::rank(int index) { if (this == MPI_GROUP_EMPTY) return MPI_UNDEFINED; - try { - return index_to_rank_map_.at(index); - } catch (std::out_of_range& unfound) { - return MPI_UNDEFINED; - } + auto rank = index_to_rank_map_.find(index); + return rank == index_to_rank_map_.end() ? MPI_UNDEFINED : rank->second; } void Group::ref() @@ -130,10 +127,8 @@ int Group::incl(int n, int* ranks, MPI_Group* newgroup) *newgroup = MPI_GROUP_EMPTY; } else if (n == size_) { *newgroup = this; - if(this!= MPI_COMM_WORLD->group() - && this != MPI_COMM_SELF->group() - && this != MPI_GROUP_EMPTY) - this->ref(); + if (this != MPI_COMM_WORLD->group() && this != MPI_COMM_SELF->group() && this != MPI_GROUP_EMPTY) + this->ref(); } else { *newgroup = new Group(n); for (i = 0; i < n; i++) { @@ -355,7 +350,7 @@ MPI_Group Group::f2c(int id) { return MPI_GROUP_EMPTY; } else if(F2C::f2c_lookup() != nullptr && id >= 0) { char key[KEY_SIZE]; - return static_cast(xbt_dict_get_or_null(F2C::f2c_lookup(), get_key(key, id))); + return static_cast(F2C::f2c_lookup()->at(get_key(key, id))); } else { return static_cast(MPI_GROUP_NULL); }