- xbt_assert(sg_host_by_name(host->id) == nullptr, "Refusing to create a second host named '%s'.", host->id);
-
- simgrid::routing::AsImpl* current_routing = routing_get_current();
- if (current_routing->hierarchy_ == simgrid::routing::AsImpl::RoutingMode::unset)
- current_routing->hierarchy_ = simgrid::routing::AsImpl::RoutingMode::base;
-
- simgrid::routing::NetCard *netcard =
- new simgrid::routing::NetCardImpl(host->id, simgrid::routing::NetCard::Type::Host, current_routing);
-
- sg_host_t h = simgrid::s4u::Host::by_name_or_create(host->id);
- h->pimpl_netcard = netcard;
-
- if(mount_list) {
- xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list);
- mount_list = nullptr;
- }
-
- if (host->coord && strcmp(host->coord, "")) {
- unsigned int cursor;
- char*str;
-
- xbt_assert(COORD_HOST_LEVEL, "To use host coordinates, please add --cfg=network/coordinates:yes to your command line");
- /* Pre-parse the host coordinates -- FIXME factorize with routers by overloading the routing->parse_PU function*/
- xbt_dynar_t ctn_str = xbt_str_split_str(host->coord, " ");
- xbt_assert(xbt_dynar_length(ctn_str)==3,"Coordinates of %s must have 3 dimensions", host->id);
-
- xbt_dynar_t ctn = xbt_dynar_new(sizeof(double),nullptr);
- xbt_dynar_foreach(ctn_str,cursor, str) {
- double val = xbt_str_parse_double(str, "Invalid coordinate: %s");
- xbt_dynar_push(ctn,&val);
- }
- xbt_dynar_free(&ctn_str);
- xbt_dynar_shrink(ctn, 0);
- h->extension_set(COORD_HOST_LEVEL, (void *) ctn);
- }
-
- simgrid::surf::Cpu *cpu = surf_cpu_model_pm->createCpu( h, host->speed_per_pstate, host->core_amount);
- if (host->state_trace)
- cpu->setStateTrace(host->state_trace);
- if (host->speed_trace)
- cpu->setSpeedTrace(host->speed_trace);
- surf_host_model->createHost(host->id, netcard, cpu)->attach(h);
-
- if (host->properties) {