- if( container->container_children != NULL ) {
- unsigned int iter;
- jed_simgrid_container_t child_container;
- xbt_dynar_foreach(container->container_children, iter, child_container) {
- jed_free_container(child_container);
+ for (auto host : hosts) {
+ const char *host_name = sg_host_get_name(host);
+ this->name2id.insert({host_name, this->last_id});
+ (this->last_id)++;
+ xbt_dict_set(host2_simgrid_parent_container, host_name, this, nullptr);
+ this->resource_list.push_back(host);
+ }
+}
+
+void Container::createHierarchy(AS_t from_as){
+ xbt_dict_cursor_t cursor = nullptr;
+ char *key;
+ AS_t elem;
+ xbt_dict_t routing_sons = from_as->children();
+
+ if (xbt_dict_is_empty(routing_sons)) {
+ // I am no AS
+ // add hosts to jedule platform
+ xbt_dynar_t table = from_as->hosts();
+ unsigned int dynar_cursor;
+ sg_host_t host;
+
+ std::vector<sg_host_t> hosts;
+
+ xbt_dynar_foreach(table, dynar_cursor, host) {
+ hosts.push_back(host);
+ }
+ this->addResources(hosts);
+ xbt_dynar_free(&table);
+ } else {
+ xbt_dict_foreach(routing_sons, cursor, key, elem) {
+ jed_container_t child_container = new simgrid::jedule::Container(std::string(elem->name()));
+ this->addChild(child_container);
+ child_container->createHierarchy(elem);