X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/367c3e351de1918df33865e9eec68c3f0ca93a39..f9d94fd3daa5f6293cf12b7f2837263c274c84b2:/src/smpi/mpi/smpi_group.cpp diff --git a/src/smpi/mpi/smpi_group.cpp b/src/smpi/mpi/smpi_group.cpp index 3e324086c6..029df2c3fa 100644 --- a/src/smpi/mpi/smpi_group.cpp +++ b/src/smpi/mpi/smpi_group.cpp @@ -17,7 +17,7 @@ Group::Group(const Group* origin) { if (origin != MPI_GROUP_NULL && origin != MPI_GROUP_EMPTY) { // FIXME: cheinrich: There is no such thing as an index any more; the two maps should be removed - index_to_rank_map_ = origin->index_to_rank_map_; + pid_to_rank_map_ = origin->pid_to_rank_map_; rank_to_actor_map_ = origin->rank_to_actor_map_; actor_to_rank_map_ = origin->actor_to_rank_map_; } @@ -26,24 +26,18 @@ Group::Group(const Group* origin) void Group::set_mapping(s4u::Actor* actor, int rank) { if (0 <= rank && rank < size()) { - int index = actor->get_pid(); - if ((unsigned)index >= index_to_rank_map_.size()) - index_to_rank_map_.resize(index + 1, MPI_UNDEFINED); - index_to_rank_map_[index] = rank; + aid_t pid = actor->get_pid(); + if (static_cast(pid) >= pid_to_rank_map_.size()) + pid_to_rank_map_.resize(pid + 1, MPI_UNDEFINED); + pid_to_rank_map_[pid] = rank; rank_to_actor_map_[rank] = actor; actor_to_rank_map_.insert({actor, rank}); } } -int Group::rank(int index) const +int Group::rank(aid_t pid) const { - int rank; - if (0 <= index && (unsigned)index < index_to_rank_map_.size()) - rank = index_to_rank_map_[index]; - else - rank = MPI_UNDEFINED; - - return rank; + return static_cast(pid) < pid_to_rank_map_.size() ? pid_to_rank_map_[pid] : MPI_UNDEFINED; } s4u::Actor* Group::actor(int rank) const