Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 25 Apr 2018 19:11:36 +0000 (21:11 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 25 Apr 2018 19:11:36 +0000 (21:11 +0200)
30 files changed:
examples/s4u/app-bittorrent/s4u-bittorrent.cpp
examples/s4u/app-token-ring/s4u-app-token-ring.cpp
examples/s4u/dht-chord/s4u-dht-chord.cpp
examples/s4u/exec-ptask/s4u-exec-ptask.cpp
examples/s4u/platform-properties/s4u-platform-properties.cpp
include/simgrid/s4u/Engine.hpp
src/instr/instr_paje_containers.cpp
src/instr/instr_platform.cpp
src/kernel/EngineImpl.cpp
src/kernel/EngineImpl.hpp
src/kernel/routing/NetPoint.cpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/VivaldiZone.cpp
src/s4u/s4u_Engine.cpp
src/s4u/s4u_Host.cpp
src/s4u/s4u_Netzone.cpp
src/s4u/s4u_Storage.cpp
src/simdag/sd_dotloader.cpp
src/simdag/sd_global.cpp
src/simgrid/host.cpp
src/smpi/bindings/smpi_pmpi.cpp
src/smpi/internals/smpi_deployment.cpp
src/surf/plugins/host_energy.cpp
src/surf/plugins/link_energy.cpp
src/surf/sg_platf.cpp
src/surf/storage_n11.cpp
src/surf/xml/surfxml_sax_cb.cpp
teshsuite/s4u/storage_client_server/storage_client_server.cpp
teshsuite/simdag/flatifier/flatifier.cpp
teshsuite/simdag/is-router/is-router.cpp

index 2ef35e1..0f45f82 100644 (file)
@@ -21,7 +21,7 @@ int main(int argc, char* argv[])
 
   /* Install our extension on all existing hosts */
   HostBittorrent::EXTENSION_ID = simgrid::s4u::Host::extension_create<HostBittorrent>();
-  std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+  std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
   for (auto const& host : list)
     host->extension_set(new HostBittorrent(host));
 
index 7dfba65..8e76889 100644 (file)
@@ -29,7 +29,7 @@ public:
                                   ia.what());
     }
     my_mailbox = simgrid::s4u::Mailbox::byName(std::to_string(rank));
-    if (rank + 1 == simgrid::s4u::Engine::getInstance()->get_host_count())
+    if (rank + 1 == simgrid::s4u::Engine::get_instance()->get_host_count())
       /* The last process, which sends the token back to rank 0 */
       neighbor_mailbox = simgrid::s4u::Mailbox::byName("0");
     else
index b675aa1..4a465bb 100644 (file)
@@ -43,7 +43,7 @@ int main(int argc, char* argv[])
   XBT_DEBUG("Sets nb_keys to %d", nb_keys);
 
   HostChord::EXTENSION_ID = simgrid::s4u::Host::extension_create<HostChord>();
-  for (auto const& host : simgrid::s4u::Engine::getInstance()->get_all_hosts())
+  for (auto const& host : simgrid::s4u::Engine::get_instance()->get_all_hosts())
     host->extension_set(new HostChord(host));
 
   e.register_actor<Node>("node");
index 37fe2e2..d2ffff9 100644 (file)
@@ -28,7 +28,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_energyptask, "Messages specific for this s4u ex
 static void runner()
 {
   /* Retrieve the list of all hosts as an array of hosts */
-  std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+  std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts();
   int hosts_count = hosts.size();
 
   XBT_INFO("First, build a classical parallel task, with 1 Gflop to execute on each node, "
index a5c6c53..c4d57e0 100644 (file)
@@ -71,7 +71,7 @@ static int david(int argc, char* argv[])
 static int bob(int argc, char* argv[])
 {
   /* this host also tests the properties of the AS*/
-  simgrid::s4u::NetZone* root = simgrid::s4u::Engine::getInstance()->getNetRoot();
+  simgrid::s4u::NetZone* root = simgrid::s4u::Engine::get_instance()->getNetRoot();
   XBT_INFO("== Print the properties of the zone");
   XBT_INFO("   Zone property: filename -> %s", root->getProperty("filename"));
   XBT_INFO("   Zone property: date -> %s", root->getProperty("date"));
index c587b98..c2ac4b0 100644 (file)
@@ -33,6 +33,14 @@ public:
   /** Finalize the default engine and all its dependencies */
   static void shutdown();
 
+  /** @brief Run the simulation */
+  void run();
+
+  /** @brief Retrieve the simulation time */
+  static double get_clock();
+  /** @brief Retrieve the engine singleton */
+  static s4u::Engine* get_instance();
+
   /** @brief Load a platform file describing the environment
    *
    * The environment is either a XML file following the simgrid.dtd formalism, or a lua file.
@@ -98,39 +106,38 @@ public:
   simgrid::s4u::Storage* storage_by_name(std::string name);
   simgrid::s4u::Storage* storage_by_name_or_null(std::string name);
 
-  /** @brief Run the simulation */
-  void run();
-
-  /** @brief Retrieve the simulation time */
-  static double get_clock();
-
-  /** @brief Retrieve the engine singleton */
-  static s4u::Engine* getInstance();
+  std::vector<simgrid::kernel::routing::NetPoint*> get_all_netpoints();
 
   /** @brief Retrieve the root netzone, containing all others */
   simgrid::s4u::NetZone* getNetRoot();
 
-  /** @brief Retrieve the netzone of the given name (or nullptr if not found) */
   simgrid::s4u::NetZone* getNetzoneByNameOrNull(const char* name);
 
   /** @brief Retrieves all netzones of the same type than the subtype of the whereto vector */
   template <class T> void getNetzoneByType(std::vector<T*> * whereto) { netzoneByTypeRecursive(getNetRoot(), whereto); }
+
   /** @brief Retrieve the netcard of the given name (or nullptr if not found) */
   simgrid::kernel::routing::NetPoint* getNetpointByNameOrNull(std::string name);
-  void getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*> * list);
 
   /** Returns whether SimGrid was initialized yet -- mostly for internal use */
-  static bool isInitialized();
-
+  static bool is_initialized();
   /** @brief set a configuration variable
    *
-   * Do --help on any simgrid binary to see the list of currently existing configuration variables (see @ref options).
+   * Do --help on any simgrid binary to see the list of currently existing configuration variables (see also @ref
+   * options).
    *
    * Example:
-   * e->setConfig("host/model","ptask_L07");
+   * e->set_config("host/model:ptask_L07");
    */
-  void setConfig(std::string str);
+  void set_config(std::string str);
 
+  simgrid::kernel::EngineImpl* pimpl;
+
+private:
+  static s4u::Engine* instance_;
+
+  //////////////// Deprecated functions
+public:
   XBT_ATTRIB_DEPRECATED_v323("Please use Engine::load_platform()") void loadPlatform(const char* platf)
   {
     load_platform(platf);
@@ -199,11 +206,17 @@ public:
     return get_all_storages();
   }
   XBT_ATTRIB_DEPRECATED_v323("Please use Engine::get_clock()") static double getClock() { return get_clock(); }
-
-  simgrid::kernel::EngineImpl* pimpl;
-
-private:
-  static s4u::Engine* instance_;
+  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::get_all_netpoints()") void getNetpointList(
+      std::vector<simgrid::kernel::routing::NetPoint*>* list);
+  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::get_instance()") static s4u::Engine* getInstance()
+  {
+    return get_instance();
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::is_initialized()") static bool isInitialized()
+  {
+    return is_initialized();
+  }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::set_config()") void setConfig(std::string str) { set_config(str); }
 };
 
 /** Callback fired when the platform is created (ie, the xml file parsed),
index 8b29f80..2b90134 100644 (file)
@@ -35,7 +35,7 @@ container_t Container::getRoot()
 NetZoneContainer::NetZoneContainer(std::string name, unsigned int level, NetZoneContainer* father)
     : Container::Container(name, "", father)
 {
-  netpoint_ = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
+  netpoint_ = simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(name);
   xbt_assert(netpoint_, "Element '%s' not found", name.c_str());
   if (father_) {
     type_ = father_->type_->getOrCreateContainerType(std::string("L") + std::to_string(level));
@@ -51,7 +51,7 @@ RouterContainer::RouterContainer(std::string name, Container* father) : Containe
 {
   xbt_assert(father, "Only the Root container has no father");
 
-  netpoint_ = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
+  netpoint_ = simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(name);
   xbt_assert(netpoint_, "Element '%s' not found", name.c_str());
 
   trivaNodeTypes.insert(type_->get_name());
index b7b6375..8389127 100644 (file)
@@ -131,7 +131,7 @@ static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t
     }
   }
 
-  xbt_graph_t graph = xbt_graph_new_graph(0, nullptr);
+  xbt_graph_t graph                        = xbt_graph_new_graph(0, nullptr);
   std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
   std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
 
@@ -264,7 +264,7 @@ static void instr_on_platform_created()
   currentContainer.clear();
   std::set<std::string>* filter = new std::set<std::string>;
   XBT_DEBUG("Starting graph extraction.");
-  recursiveGraphExtraction(simgrid::s4u::Engine::getInstance()->getNetRoot(), simgrid::instr::Container::getRoot(),
+  recursiveGraphExtraction(simgrid::s4u::Engine::get_instance()->getNetRoot(), simgrid::instr::Container::getRoot(),
                            filter);
   XBT_DEBUG("Graph extraction finished.");
   delete filter;
@@ -368,10 +368,10 @@ static void recursiveXBTGraphExtraction(xbt_graph_t graph, std::map<std::string,
 
 xbt_graph_t instr_routing_platform_graph()
 {
-  xbt_graph_t ret = xbt_graph_new_graph(0, nullptr);
+  xbt_graph_t ret                          = xbt_graph_new_graph(0, nullptr);
   std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
   std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
-  recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::getInstance()->getNetRoot(),
+  recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::get_instance()->getNetRoot(),
                               simgrid::instr::Container::getRoot());
   delete nodes;
   delete edges;
index 12979fa..dcda57d 100644 (file)
@@ -34,7 +34,7 @@ EngineImpl::~EngineImpl()
     hosts_.at(name)->destroy();
 
   /* Also delete the other data */
-  delete netRoot_;
+  delete netzone_root_;
   for (auto const& kv : netpoints_)
     delete kv.second;
 
index 313ba4e..43f8b67 100644 (file)
@@ -16,7 +16,7 @@ class EngineImpl {
 public:
   EngineImpl();
   virtual ~EngineImpl();
-  kernel::routing::NetZoneImpl* netRoot_ = nullptr;
+  kernel::routing::NetZoneImpl* netzone_root_ = nullptr;
 
 private:
   std::map<std::string, simgrid::s4u::Host*> hosts_;
index e1b0510..9246108 100644 (file)
@@ -22,7 +22,7 @@ NetPoint::NetPoint(std::string name, NetPoint::Type componentType, NetZoneImpl*
     id_ = netzone_p->addComponent(this);
   else
     id_ = static_cast<decltype(id_)>(-1);
-  simgrid::s4u::Engine::getInstance()->netpoint_register(this);
+  simgrid::s4u::Engine::get_instance()->netpoint_register(this);
   simgrid::kernel::routing::NetPoint::onCreation(this);
 }
 }
@@ -35,5 +35,5 @@ NetPoint::NetPoint(std::string name, NetPoint::Type componentType, NetZoneImpl*
  */
 simgrid::kernel::routing::NetPoint* sg_netpoint_by_name_or_null(const char* name)
 {
-  return simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
+  return simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(name);
 }
index 94603ef..8c4f453 100644 (file)
@@ -28,7 +28,7 @@ public:
 
 NetZoneImpl::NetZoneImpl(NetZone* father, std::string name) : NetZone(father, name)
 {
-  xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name.c_str()),
+  xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(name.c_str()),
              "Refusing to create a second NetZone called '%s'.", name.c_str());
 
   netpoint_ = new NetPoint(name, NetPoint::Type::NetZone, static_cast<NetZoneImpl*>(father));
@@ -40,7 +40,7 @@ NetZoneImpl::~NetZoneImpl()
   for (auto const& kv : bypass_routes_)
     delete kv.second;
 
-  simgrid::s4u::Engine::getInstance()->netpoint_unregister(netpoint_);
+  simgrid::s4u::Engine::get_instance()->netpoint_unregister(netpoint_);
 }
 
 simgrid::s4u::Host* NetZoneImpl::create_host(const char* name, std::vector<double>* speedPerPstate, int coreAmount,
index b424a47..3364f03 100644 (file)
@@ -84,8 +84,8 @@ void VivaldiZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg
   if (src->is_netzone()) {
     std::string srcName = "router_" + src->get_name();
     std::string dstName = "router_" + dst->get_name();
-    route->gw_src       = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(srcName.c_str());
-    route->gw_dst       = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(dstName.c_str());
+    route->gw_src       = simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(srcName.c_str());
+    route->gw_dst       = simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(dstName.c_str());
   }
 
   /* Retrieve the private links */
index 4daf853..dc11db8 100644 (file)
@@ -48,7 +48,8 @@ Engine::~Engine()
   s4u::Engine::instance_ = nullptr;
 }
 
-Engine* Engine::getInstance()
+/** @brief Retrieve the engine singleton */
+Engine* Engine::get_instance()
 {
   if (s4u::Engine::instance_ == nullptr)
     return new Engine(0, nullptr);
@@ -189,16 +190,16 @@ void Engine::run()
 
 s4u::NetZone* Engine::getNetRoot()
 {
-  return pimpl->netRoot_;
+  return pimpl->netzone_root_;
 }
 
-static s4u::NetZone* netzoneByNameRecursive(s4u::NetZone* current, const char* name)
+static s4u::NetZone* netzone_by_name_recursive(s4u::NetZone* current, const char* name)
 {
   if (not strcmp(current->get_cname(), name))
     return current;
 
   for (auto const& elem : *(current->getChildren())) {
-    simgrid::s4u::NetZone* tmp = netzoneByNameRecursive(elem, name);
+    simgrid::s4u::NetZone* tmp = netzone_by_name_recursive(elem, name);
     if (tmp != nullptr) {
       return tmp;
     }
@@ -209,7 +210,7 @@ static s4u::NetZone* netzoneByNameRecursive(s4u::NetZone* current, const char* n
 /** @brief Retrieve the NetZone of the given name (or nullptr if not found) */
 NetZone* Engine::getNetzoneByNameOrNull(const char* name)
 {
-  return netzoneByNameRecursive(getNetRoot(), name);
+  return netzone_by_name_recursive(getNetRoot(), name);
 }
 
 /** @brief Retrieve the netpoint of the given name (or nullptr if not found) */
@@ -225,6 +226,14 @@ void Engine::getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*>* l
   for (auto const& kv : pimpl->netpoints_)
     list->push_back(kv.second);
 }
+std::vector<simgrid::kernel::routing::NetPoint*> Engine::get_all_netpoints()
+{
+  std::vector<simgrid::kernel::routing::NetPoint*> res;
+  for (auto const& kv : pimpl->netpoints_)
+    res.push_back(kv.second);
+  return res;
+}
+
 /** @brief Register a new netpoint to the system */
 void Engine::netpoint_register(simgrid::kernel::routing::NetPoint* point)
 {
@@ -241,11 +250,11 @@ void Engine::netpoint_unregister(simgrid::kernel::routing::NetPoint* point)
   });
 }
 
-bool Engine::isInitialized()
+bool Engine::is_initialized()
 {
   return Engine::instance_ != nullptr;
 }
-void Engine::setConfig(std::string str)
+void Engine::set_config(std::string str)
 {
   simgrid::config::set_parse(std::move(str));
 }
index 8c448a8..efc4cc3 100644 (file)
@@ -30,7 +30,7 @@ simgrid::xbt::signal<void(Host&)> Host::onSpeedChange;
 Host::Host(const char* name) : name_(name)
 {
   xbt_assert(Host::by_name_or_null(name) == nullptr, "Refusing to create a second host named '%s'.", name);
-  Engine::getInstance()->host_register(std::string(name_), this);
+  Engine::get_instance()->host_register(std::string(name_), this);
   new simgrid::surf::HostImpl(this);
 }
 
@@ -40,7 +40,7 @@ Host::~Host()
 
   delete pimpl_;
   if (pimpl_netpoint != nullptr) // not removed yet by a children class
-    simgrid::s4u::Engine::getInstance()->netpoint_unregister(pimpl_netpoint);
+    simgrid::s4u::Engine::get_instance()->netpoint_unregister(pimpl_netpoint);
   delete pimpl_cpu;
   delete mounts;
 }
@@ -58,26 +58,26 @@ void Host::destroy()
   if (not currentlyDestroying_) {
     currentlyDestroying_ = true;
     onDestruction(*this);
-    Engine::getInstance()->host_unregister(std::string(name_));
+    Engine::get_instance()->host_unregister(std::string(name_));
     delete this;
   }
 }
 
 Host* Host::by_name(std::string name)
 {
-  return Engine::getInstance()->host_by_name(name);
+  return Engine::get_instance()->host_by_name(name);
 }
 Host* Host::by_name(const char* name)
 {
-  return Engine::getInstance()->host_by_name(std::string(name));
+  return Engine::get_instance()->host_by_name(std::string(name));
 }
 Host* Host::by_name_or_null(const char* name)
 {
-  return Engine::getInstance()->host_by_name_or_null(std::string(name));
+  return Engine::get_instance()->host_by_name_or_null(std::string(name));
 }
 Host* Host::by_name_or_null(std::string name)
 {
-  return Engine::getInstance()->host_by_name_or_null(name);
+  return Engine::get_instance()->host_by_name_or_null(name);
 }
 
 Host* Host::current()
index e62b0af..d805c8c 100644 (file)
@@ -111,7 +111,7 @@ void NetZone::add_route(kernel::routing::NetPoint* /*src*/, kernel::routing::Net
 
 sg_netzone_t sg_zone_get_root()
 {
-  return simgrid::s4u::Engine::getInstance()->getNetRoot();
+  return simgrid::s4u::Engine::get_instance()->getNetRoot();
 }
 
 const char* sg_zone_get_name(sg_netzone_t netzone)
@@ -121,7 +121,7 @@ const char* sg_zone_get_name(sg_netzone_t netzone)
 
 sg_netzone_t sg_zone_get_by_name(const char* name)
 {
-  return simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(name);
+  return simgrid::s4u::Engine::get_instance()->getNetzoneByNameOrNull(name);
 }
 
 void sg_zone_get_sons(sg_netzone_t netzone, xbt_dict_t whereto)
index 8a870df..6080b06 100644 (file)
@@ -21,18 +21,18 @@ namespace s4u {
 
 void getStorageList(std::map<std::string, Storage*>* whereTo)
 {
-  for (auto const& s : simgrid::s4u::Engine::getInstance()->get_all_storages())
+  for (auto const& s : simgrid::s4u::Engine::get_instance()->get_all_storages())
     whereTo->insert({s->get_name(), s});
 }
 
 Storage::Storage(std::string name, surf::StorageImpl* pimpl) : pimpl_(pimpl), name_(name)
 {
-  simgrid::s4u::Engine::getInstance()->storage_register(name, this);
+  simgrid::s4u::Engine::get_instance()->storage_register(name, this);
 }
 
 Storage* Storage::byName(std::string name)
 {
-  return Engine::getInstance()->storage_by_name_or_null(name);
+  return Engine::get_instance()->storage_by_name_or_null(name);
 }
 
 const std::string& Storage::get_name() const
@@ -170,7 +170,7 @@ sg_storage_t sg_storage_get_by_name(const char* name)
  */
 xbt_dynar_t sg_storages_as_dynar()
 {
-  std::vector<simgrid::s4u::Storage*> storage_list = simgrid::s4u::Engine::getInstance()->get_all_storages();
+  std::vector<simgrid::s4u::Storage*> storage_list = simgrid::s4u::Engine::get_instance()->get_all_storages();
   xbt_dynar_t res                                  = xbt_dynar_new(sizeof(sg_storage_t), nullptr);
   for (auto const& s : storage_list)
     xbt_dynar_push(res, &s);
index ddea1a7..29c5294 100644 (file)
@@ -213,7 +213,7 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
 
   if(schedule){
     if (schedule_success) {
-      std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+      std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts();
 
       for (auto const& elm : computers) {
         SD_task_t previous_task = nullptr;
index 35f4fd9..a5fc843 100644 (file)
@@ -200,7 +200,7 @@ void SD_config(const char *key, const char *value){
  */
 void SD_create_environment(const char *platform_file)
 {
-  simgrid::s4u::Engine::getInstance()->load_platform(platform_file);
+  simgrid::s4u::Engine::get_instance()->load_platform(platform_file);
 
   XBT_DEBUG("Host number: %zu, link number: %d", sg_host_count(), sg_link_count());
 #if SIMGRID_HAVE_JEDULE
index ad422c6..c4e6ee1 100644 (file)
@@ -21,7 +21,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_host, sd, "Logging specific to sg_hosts");
 
 size_t sg_host_count()
 {
-  return simgrid::s4u::Engine::getInstance()->get_host_count();
+  return simgrid::s4u::Engine::get_instance()->get_host_count();
 }
 /** @brief Returns the host list
  *
@@ -35,7 +35,7 @@ size_t sg_host_count()
  */
 sg_host_t *sg_host_list() {
   xbt_assert(sg_host_count() > 0, "There is no host!");
-  std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+  std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts();
 
   sg_host_t* res = (sg_host_t*)malloc(sizeof(sg_host_t) * hosts.size());
   memcpy(res, hosts.data(), sizeof(sg_host_t) * hosts.size());
@@ -73,7 +73,7 @@ xbt_dynar_t sg_hosts_as_dynar()
 {
   xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t),nullptr);
 
-  std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+  std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
 
   for (auto const& host : list) {
     if (host && host->pimpl_netpoint && host->pimpl_netpoint->is_host())
index 1409885..9028c78 100644 (file)
@@ -28,7 +28,7 @@ void TRACE_smpi_set_category(const char *category)
 
 int PMPI_Init(int *argc, char ***argv)
 {
-  xbt_assert(simgrid::s4u::Engine::isInitialized(),
+  xbt_assert(simgrid::s4u::Engine::is_initialized(),
              "Your MPI program was not properly initialized. The easiest is to use smpirun to start it.");
   // PMPI_Init is called only once per SMPI process
   int already_init;
index a3dbcef..4d800c3 100644 (file)
@@ -58,7 +58,7 @@ void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_
   static int already_called = 0;
   if (not already_called) {
     already_called = 1;
-    std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+    std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
     for (auto const& host : list) {
       host->extension_set(new simgrid::smpi::SmpiHost(host));
     }
index 7bf554e..b35157c 100644 (file)
@@ -424,7 +424,7 @@ static void onHostDestruction(simgrid::s4u::Host& host)
 
 static void onSimulationEnd()
 {
-  std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+  std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts();
 
   double total_energy      = 0.0; // Total energy consumption (whole platform)
   double used_hosts_energy = 0.0; // Energy consumed by hosts that computed something
@@ -474,7 +474,7 @@ void sg_host_energy_plugin_init()
 void sg_host_energy_update_all()
 {
   simgrid::simix::kernelImmediate([]() {
-    std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+    std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
     for (auto const& host : list)
       if (dynamic_cast<simgrid::s4u::VirtualMachine*>(host) == nullptr) // Ignore virtual machines
         host->extension<HostEnergy>()->update();
index dd39c53..e7eb0c6 100644 (file)
@@ -162,7 +162,7 @@ static void onCommunicate(simgrid::kernel::resource::NetworkAction* action, simg
 
 static void onSimulationEnd()
 {
-  std::vector<simgrid::s4u::Link*> links = simgrid::s4u::Engine::getInstance()->get_all_links();
+  std::vector<simgrid::s4u::Link*> links = simgrid::s4u::Engine::get_instance()->get_all_links();
 
   double total_energy = 0.0; // Total dissipated energy (whole platform)
   for (const auto link : links) {
index 2577e4f..9814e4a 100644 (file)
@@ -98,7 +98,7 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(std::string name, const
 
   if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
     current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::base;
-  xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name),
+  xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(name),
              "Refusing to create a router named '%s': this name already describes a node.", name.c_str());
 
   simgrid::kernel::routing::NetPoint* netpoint =
@@ -394,7 +394,7 @@ void sg_platf_new_mount(simgrid::kernel::routing::MountCreationArgs* mount)
 
   if (mount_list.empty())
     XBT_DEBUG("Create a Mount list for %s", A_surfxml_host_id);
-  mount_list.insert({mount->name, simgrid::s4u::Engine::getInstance()->storage_by_name(mount->storageId)->getImpl()});
+  mount_list.insert({mount->name, simgrid::s4u::Engine::get_instance()->storage_by_name(mount->storageId)->getImpl()});
 }
 
 void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route)
@@ -417,7 +417,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor)
     std::string msg = std::string("Cannot create actor '") + actor->function + "': host '" + actor->host +
                       "' does not exist\nExisting hosts: '";
 
-    std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->get_all_hosts();
+    std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
 
     for (auto const& host : list) {
       msg += host->get_name();
@@ -599,9 +599,9 @@ simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCre
   }
 
   if (current_routing == nullptr) { /* it is the first one */
-    xbt_assert(simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ == nullptr,
+    xbt_assert(simgrid::s4u::Engine::get_instance()->pimpl->netzone_root_ == nullptr,
                "All defined components must belong to a networking zone.");
-    simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ = new_zone;
+    simgrid::s4u::Engine::get_instance()->pimpl->netzone_root_ = new_zone;
 
   } else {
     /* set the father behavior */
index 6d71df7..e1a0cd2 100644 (file)
@@ -19,7 +19,7 @@ extern std::map<std::string, simgrid::surf::StorageType*> storage_types;
 
 void check_disk_attachment()
 {
-  for (auto const& s : simgrid::s4u::Engine::getInstance()->get_all_storages()) {
+  for (auto const& s : simgrid::s4u::Engine::get_instance()->get_all_storages()) {
     simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(s->getImpl()->getHost().c_str());
     if (not host_elm)
       surf_parse_error(std::string("Unable to attach storage ") + s->get_cname() + ": host " +
index b0b5dcb..43c3b3b 100644 (file)
@@ -59,13 +59,14 @@ void surf_parse_assert_netpoint(std::string hostname, std::string pre, std::stri
 
   std::string msg = pre + hostname + post + " Existing netpoints: \n";
 
-  std::vector<simgrid::kernel::routing::NetPoint*> list;
-  simgrid::s4u::Engine::getInstance()->getNetpointList(&list);
-  std::sort(list.begin(), list.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
-    return a->get_name() < b->get_name();
-  });
+  std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
+      simgrid::s4u::Engine::get_instance()->get_all_netpoints();
+  std::sort(netpoints.begin(), netpoints.end(),
+            [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
+              return a->get_name() < b->get_name();
+            });
   bool first = true;
-  for (auto const& np : list) {
+  for (auto const& np : netpoints) {
     if (np->is_netzone())
       continue;
 
@@ -406,7 +407,7 @@ void STag_surfxml_prop()
 {
   if (ZONE_TAG) { // We need to retrieve the most recently opened zone
     XBT_DEBUG("Set zone property %s -> %s", A_surfxml_prop_id, A_surfxml_prop_value);
-    simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(A_surfxml_zone_id);
+    simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::get_instance()->getNetzoneByNameOrNull(A_surfxml_zone_id);
 
     netzone->setProperty(A_surfxml_prop_id, A_surfxml_prop_value);
   } else {
@@ -944,7 +945,9 @@ void ETag_surfxml_prop(){/* Nothing to do */}
 void STag_surfxml_random(){/* Nothing to do */}
 void ETag_surfxml_random(){/* Nothing to do */}
 void ETag_surfxml_trace___connect(){/* Nothing to do */}
-void STag_surfxml_trace(){/* Nothing to do */}
+void STag_surfxml_trace()
+{ /* Nothing to do */
+}
 void ETag_surfxml_router(){/*Nothing to do*/}
 void ETag_surfxml_host___link(){/* Nothing to do */}
 void ETag_surfxml_cabinet(){/* Nothing to do */}
index d02157f..166d134 100644 (file)
@@ -91,7 +91,7 @@ static void get_set_storage_data(const std::string& storage_name)
 
 static void dump_platform_storages()
 {
-  std::vector<simgrid::s4u::Storage*> storages = simgrid::s4u::Engine::getInstance()->get_all_storages();
+  std::vector<simgrid::s4u::Storage*> storages = simgrid::s4u::Engine::get_instance()->get_all_storages();
 
   for (auto const& s : storages) {
     XBT_INFO("Storage %s is attached to %s", s->get_cname(), s->getHost()->get_cname());
index d21cf4d..11e6ce7 100644 (file)
@@ -97,16 +97,16 @@ static void dump_links()
 
 static void dump_routers()
 {
-  std::vector<simgrid::kernel::routing::NetPoint*> netcardList;
-  simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList);
-  std::sort(netcardList.begin(), netcardList.end(),
+  std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
+      simgrid::s4u::Engine::get_instance()->get_all_netpoints();
+  std::sort(netpoints.begin(), netpoints.end(),
             [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
               return a->get_name() < b->get_name();
             });
 
-  for (auto const& srcCard : netcardList)
-    if (srcCard->is_router())
-      std::printf("  <router id=\"%s\"/>\n", srcCard->get_cname());
+  for (auto const& src : netpoints)
+    if (src->is_router())
+      std::printf("  <router id=\"%s\"/>\n", src->get_cname());
 }
 
 static void dump_routes()
@@ -115,21 +115,21 @@ static void dump_routes()
   sg_host_t* hosts        = sg_host_list();
   std::sort(hosts, hosts + totalHosts,
             [](sg_host_t a, sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; });
-  std::vector<simgrid::kernel::routing::NetPoint*> netcardList;
-  simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList);
-  std::sort(netcardList.begin(), netcardList.end(),
+  std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
+      simgrid::s4u::Engine::get_instance()->get_all_netpoints();
+  std::sort(netpoints.begin(), netpoints.end(),
             [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
               return a->get_name() < b->get_name();
             });
 
   for (unsigned int it_src = 0; it_src < totalHosts; it_src++) { // Routes from host
-    simgrid::s4u::Host* host1                      = hosts[it_src];
-    simgrid::kernel::routing::NetPoint* netcardSrc = host1->pimpl_netpoint;
+    simgrid::s4u::Host* host1               = hosts[it_src];
+    simgrid::kernel::routing::NetPoint* src = host1->pimpl_netpoint;
     for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
       simgrid::s4u::Host* host2 = hosts[it_dst];
       std::vector<simgrid::kernel::resource::LinkImpl*> route;
-      simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
-      simgrid::kernel::routing::NetZoneImpl::get_global_route(netcardSrc, netcardDst, route, nullptr);
+      simgrid::kernel::routing::NetPoint* dst = host2->pimpl_netpoint;
+      simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
       if (not route.empty()) {
         std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", host1->get_cname(), host2->get_cname());
         for (auto const& link : route)
@@ -138,11 +138,11 @@ static void dump_routes()
       }
     }
 
-    for (auto const& netcardDst : netcardList) { // to router
-      if (netcardDst->is_router()) {
-        std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", host1->get_cname(), netcardDst->get_cname());
+    for (auto const& dst : netpoints) { // to router
+      if (dst->is_router()) {
+        std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", host1->get_cname(), dst->get_cname());
         std::vector<simgrid::kernel::resource::LinkImpl*> route;
-        simgrid::kernel::routing::NetZoneImpl::get_global_route(netcardSrc, netcardDst, route, nullptr);
+        simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
         for (auto const& link : route)
           std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
         std::printf("\n  </route>\n");
@@ -150,9 +150,9 @@ static void dump_routes()
     }
   }
 
-  for (auto const& value1 : netcardList) { // Routes from router
+  for (auto const& value1 : netpoints) { // Routes from router
     if (value1->is_router()) {
-      for (auto const& value2 : netcardList) { // to router
+      for (auto const& value2 : netpoints) { // to router
         if (value2->is_router()) {
           std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", value1->get_cname(), value2->get_cname());
           std::vector<simgrid::kernel::resource::LinkImpl*> route;
index fbfd1dc..8666fe7 100644 (file)
@@ -19,9 +19,9 @@ int main(int argc, char **argv)
   xbt_dynar_t hosts = sg_hosts_as_dynar();
   std::printf("Host count: %zu, link number: %d\n", sg_host_count(), sg_link_count());
 
-  std::vector<simgrid::kernel::routing::NetPoint*> netcardList;
-  simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList);
-  std::sort(netcardList.begin(), netcardList.end(),
+  std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
+      simgrid::s4u::Engine::get_instance()->get_all_netpoints();
+  std::sort(netpoints.begin(), netpoints.end(),
             [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
               return a->get_name() < b->get_name();
             });
@@ -41,8 +41,8 @@ int main(int argc, char **argv)
   }
   xbt_dynar_free(&hosts);
 
-  std::printf("NetCards count: %zu\n", netcardList.size());
-  for (auto const& nc : netcardList)
+  std::printf("NetCards count: %zu\n", netpoints.size());
+  for (auto const& nc : netpoints)
     std::printf("   - Seen: \"%s\". Type: %s\n", nc->get_cname(),
                 nc->is_router() ? "router" : (nc->is_netzone() ? "netzone" : (nc->is_host() ? "host" : "buggy")));