X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9de2143df74699fb6e21a9eb8f37e38db0c00357..4e73c03c087fd07184d9ed45224f7fbad24e686e:/src/smpi/include/smpi_group.hpp diff --git a/src/smpi/include/smpi_group.hpp b/src/smpi/include/smpi_group.hpp index 4637dea46f..1a008533a1 100644 --- a/src/smpi/include/smpi_group.hpp +++ b/src/smpi/include/smpi_group.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, 2013-2017. The SimGrid Team. +/* Copyright (c) 2010-2019. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -9,6 +9,8 @@ #include "smpi_f2c.hpp" #include +#include +#include namespace simgrid{ namespace smpi{ @@ -16,18 +18,24 @@ namespace smpi{ class Group : public F2C{ private: int size_; - int *rank_to_index_map_; - std::unordered_map index_to_rank_map_; + /* This is actually a map from int to int. We could use + * std::map here, but looking up a value there costs O(log(n)). + * For a vector, this costs O(1). We hence go with the vector. + */ + std::vector rank_to_actor_map_; + std::map actor_to_rank_map_; + std::vector index_to_rank_map_; + int refcount_; public: explicit Group(); explicit Group(int size); explicit Group(Group* origin); - ~Group(); - void set_mapping(int index, int rank); - int index(int rank); + void set_mapping(simgrid::s4u::ActorPtr actor, int rank); int rank(int index); + simgrid::s4u::ActorPtr actor(int rank); + int rank(const simgrid::s4u::ActorPtr process); void ref(); static void unref(MPI_Group group); int size();