- //Search for network_element_t
- switch (kind){
- case INSTR_HOST:
- newContainer->netcard = sg_host->pimpl_netpoint;
- xbt_assert(newContainer->netcard, "Element '%s' not found",name);
- break;
- case INSTR_ROUTER:
- newContainer->netcard = simgrid::s4u::Engine::instance()->netcardByNameOrNull(name);
- xbt_assert(newContainer->netcard, "Element '%s' not found",name);
- break;
- case INSTR_AS:
- newContainer->netcard = simgrid::s4u::Engine::instance()->netcardByNameOrNull(name);
- xbt_assert(newContainer->netcard, "Element '%s' not found",name);
- break;
- default:
- newContainer->netcard = nullptr;
- break;
- }
-
- // level depends on level of father
- if (newContainer->father){
- newContainer->level = newContainer->father->level+1;
- XBT_DEBUG("new container %s, child of %s", name, father->name);
- }else{
- newContainer->level = 0;
- }
- // type definition (method depends on kind of this new container)
- newContainer->kind = kind;
- if (newContainer->kind == INSTR_AS){
- //if this container is of an AS, its type name depends on its level
- char as_typename[INSTR_DEFAULT_STR_SIZE];
- snprintf (as_typename, INSTR_DEFAULT_STR_SIZE, "L%d", newContainer->level);
- if (newContainer->father){
- newContainer->type = PJ_type_get_or_null (as_typename, newContainer->father->type);
- if (newContainer->type == nullptr){
- newContainer->type = PJ_type_container_new (as_typename, newContainer->father->type);
- }
- }else{
- newContainer->type = PJ_type_container_new ("0", nullptr);