Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill redundant F2C::f2c_lookup.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 27 Oct 2020 22:00:37 +0000 (23:00 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 27 Oct 2020 22:43:08 +0000 (23:43 +0100)
src/smpi/include/smpi_f2c.hpp
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_errhandler.cpp
src/smpi/mpi/smpi_group.cpp
src/smpi/mpi/smpi_request.cpp

index 69c309d..116d3d5 100644 (file)
@@ -23,7 +23,6 @@ private:
   int my_f2c_id_ = -1;
 
 protected:
-  static std::unordered_map<int, F2C*>* f2c_lookup() { return f2c_lookup_; }
   static void set_f2c_lookup(std::unordered_map<int, F2C*>* map) { f2c_lookup_ = map; }
   static int f2c_id() { return f2c_id_; }
   static void f2c_id_increment() { f2c_id_++; }
index 0d7b5c7..73d4f84 100644 (file)
@@ -508,8 +508,8 @@ MPI_Comm Comm::f2c(int id) {
     return MPI_COMM_SELF;
   } else if(id==0){
     return MPI_COMM_WORLD;
-  } else if(F2C::f2c_lookup() != nullptr && id >= 0) {
-    const auto& lookup = F2C::f2c_lookup();
+  } else if (F2C::lookup() != nullptr && id >= 0) {
+    const auto& lookup = F2C::lookup();
     auto comm          = lookup->find(id);
     return comm == lookup->end() ? MPI_COMM_NULL : static_cast<MPI_Comm>(comm->second);
   } else {
@@ -518,7 +518,7 @@ MPI_Comm Comm::f2c(int id) {
 }
 
 void Comm::free_f(int id) {
-  F2C::f2c_lookup()->erase(id);
+  F2C::lookup()->erase(id);
 }
 
 void Comm::add_rma_win(MPI_Win win){
index 14997b2..bb19ffc 100644 (file)
@@ -17,8 +17,8 @@ namespace simgrid{
 namespace smpi{
 
 MPI_Errhandler Errhandler::f2c(int id) {
-  if(F2C::f2c_lookup() != nullptr && id >= 0) {
-    return static_cast<MPI_Errhandler>(F2C::f2c_lookup()->at(id));
+  if (F2C::lookup() != nullptr && id >= 0) {
+    return static_cast<MPI_Errhandler>(F2C::lookup()->at(id));
   } else {
     return MPI_ERRHANDLER_NULL;
   }
index 4ad8e2c..8d2d653 100644 (file)
@@ -318,8 +318,8 @@ int Group::range_excl(int n, int ranges[][3], MPI_Group * newgroup){
 MPI_Group Group::f2c(int id) {
   if(id == -2) {
     return MPI_GROUP_EMPTY;
-  } else if(F2C::f2c_lookup() != nullptr && id >= 0) {
-    return static_cast<MPI_Group>(F2C::f2c_lookup()->at(id));
+  } else if (F2C::lookup() != nullptr && id >= 0) {
+    return static_cast<MPI_Group>(F2C::lookup()->at(id));
   } else {
     return MPI_GROUP_NULL;
   }
index 193f8ad..31fe56f 100644 (file)
@@ -1119,13 +1119,13 @@ MPI_Request Request::f2c(int id)
 {
   if(id==MPI_FORTRAN_REQUEST_NULL)
     return MPI_REQUEST_NULL;
-  return static_cast<MPI_Request>(F2C::f2c_lookup()->at(id));
+  return static_cast<MPI_Request>(F2C::lookup()->at(id));
 }
 
 void Request::free_f(int id)
 {
   if (id != MPI_FORTRAN_REQUEST_NULL) {
-    F2C::f2c_lookup()->erase(id);
+    F2C::lookup()->erase(id);
   }
 }