1 /* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "smpi_f2c.hpp"
8 #include "src/smpi/include/smpi_actor.hpp"
14 int mpi_status_ignore_;
15 int mpi_statuses_ignore_;
20 std::unordered_map<std::string, F2C*>* F2C::f2c_lookup_ = nullptr;
23 // Keep it non trivially-constructible, or it will break MC+smpi on FreeBSD with Clang (don't ask why)
26 std::unordered_map<std::string, F2C*>* F2C::f2c_lookup()
31 void F2C::set_f2c_lookup(std::unordered_map<std::string, F2C*>* map)
36 void F2C::f2c_id_increment(){
44 char* F2C::get_my_key(char* key) {
45 std::snprintf(key, KEY_SIZE, "%d", my_f2c_id_);
49 char* F2C::get_key(char* key, int id) {
50 std::snprintf(key, KEY_SIZE, "%d", id);
54 void F2C::delete_lookup(){
58 std::unordered_map<std::string, F2C*>* F2C::lookup()
63 void F2C::free_f(int id)
66 f2c_lookup_->erase(get_key(key,id));
71 if (f2c_lookup_ == nullptr)
72 f2c_lookup_ = new std::unordered_map<std::string, F2C*>();
76 (*f2c_lookup_)[get_my_key(key)] = this;
83 if (f2c_lookup_ == nullptr) {
84 f2c_lookup_ = new std::unordered_map<std::string, F2C*>();
88 /* this function wasn't found, add it */
96 if (f2c_lookup_ == nullptr)
97 f2c_lookup_ = new std::unordered_map<std::string, F2C*>();
101 auto comm = f2c_lookup_->find(get_key(key,id));
102 return comm == f2c_lookup_->end() ? nullptr : comm->second;