Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleaning the actor twice seems somewhat overplayed
[simgrid.git] / src / smpi / mpi / smpi_group.cpp
index f3715b1..a6e92a9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -19,23 +19,11 @@ namespace smpi{
 
 using simgrid::s4u::ActorPtr;
 
-Group::Group()
-{
-  size_              = 0;       /* size */
-  refcount_          = 1;       /* refcount_: start > 0 so that this group never gets freed */
-}
-
-Group::Group(int n) : size_(n), rank_to_actor_map_(size_, nullptr), rank_to_index_map_(size_, MPI_UNDEFINED), index_to_rank_map_(size_, MPI_UNDEFINED)
-{
-  refcount_ = 1;
-}
-
-Group::Group(MPI_Group origin)
+Group::Group(Group* origin)
 {
   if (origin != MPI_GROUP_NULL && origin != MPI_GROUP_EMPTY) {
     size_              = origin->size();
-    refcount_          = 1;
-    rank_to_index_map_ = origin->rank_to_index_map_;
+    // 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_;
     rank_to_actor_map_ = origin->rank_to_actor_map_;
     actor_to_rank_map_ = origin->actor_to_rank_map_;
@@ -45,8 +33,7 @@ Group::Group(MPI_Group origin)
 void Group::set_mapping(simgrid::s4u::ActorPtr actor, int rank)
 {
   if (0 <= rank && rank < size_) {
-    int index = actor->getPid();
-    rank_to_index_map_[rank] = index;
+    int index                = actor->get_pid();
     if (index != MPI_UNDEFINED) {
       if ((unsigned)index >= index_to_rank_map_.size())
         index_to_rank_map_.resize(index + 1, MPI_UNDEFINED);
@@ -96,11 +83,6 @@ void Group::unref(Group* group)
   }
 }
 
-int Group::size()
-{
-  return size_;
-}
-
 int Group::compare(MPI_Group group2)
 {
   int result;
@@ -136,7 +118,7 @@ int Group::incl(int n, int* ranks, MPI_Group* newgroup)
   } else {
     *newgroup = new Group(n);
     for (i = 0; i < n; i++) {
-      ActorPtr actor = this->actor(ranks[i]);
+      ActorPtr actor = this->actor(ranks[i]); // ranks[] was passed as a param!
       (*newgroup)->set_mapping(actor, i);
     }
   }