Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Adding integration tests of async-waitall and waitany
[simgrid.git] / src / smpi / mpi / smpi_group.cpp
index bce418b..580d0d6 100644 (file)
@@ -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()
@@ -355,7 +352,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<MPI_Group>(xbt_dict_get_or_null(F2C::f2c_lookup(), get_key(key, id)));
+    return static_cast<MPI_Group>(F2C::f2c_lookup()->at(get_key(key, id)));
   } else {
     return static_cast<MPI_Group>(MPI_GROUP_NULL);
   }