xbt_dynar_t route = xbt_dynar_new(sizeof(NetCard*), NULL);
- XBT_IN("(%s,%s,%g,%g)", src->getName(), dst->getName(), size, rate);
+ XBT_IN("(%s,%s,%g,%g)", src->name(), dst->name(), size, rate);
routing_platf->getRouteAndLatency(src, dst, &route, &latency);
xbt_assert(!xbt_dynar_is_empty(route) || latency,
"You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
- src->getName(), dst->getName());
+ src->name(), dst->name());
xbt_dynar_foreach(route, i, _link) {
link = static_cast<NetworkCm02Link*>(_link);
link = *static_cast<NetworkCm02Link **>(xbt_dynar_get_ptr(route, 0));
gapAppend(size, link, action);
XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)",
- action, src->getName(), dst->getName(), action->m_senderGap,
+ action, src->name(), dst->name(), action->m_senderGap,
action->m_latency);
}
Action *NetworkConstantModel::communicate(NetCard *src, NetCard *dst,
double size, double rate)
{
- char *src_name = src->getName();
- char *dst_name = dst->getName();
+ char *src_name = src->name();
+ char *dst_name = dst->name();
XBT_IN("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
NetworkConstantAction *action = new NetworkConstantAction(this, size, sg_latency_factor);
if(((NetworkIBModel*)surf_network_model)->active_nodes==NULL)
xbt_die("IB comm added, without any node connected !");
- IBNode* act_src= (IBNode*) xbt_dict_get_or_null(((NetworkIBModel*)surf_network_model)->active_nodes, src->getName());
+ IBNode* act_src= (IBNode*) xbt_dict_get_or_null(((NetworkIBModel*)surf_network_model)->active_nodes, src->name());
if(act_src==NULL)
xbt_die("could not find src node active comms !");
//act_src->rate=rate;
- IBNode* act_dst= (IBNode*) xbt_dict_get_or_null(((NetworkIBModel*)surf_network_model)->active_nodes, dst->getName());
+ IBNode* act_dst= (IBNode*) xbt_dict_get_or_null(((NetworkIBModel*)surf_network_model)->active_nodes, dst->name());
if(act_dst==NULL)
xbt_die("could not find dst node active comms !");
// act_dst->rate=rate;
static void simgrid_ns3_add_router(simgrid::surf::NetCard* router)
{
- const char* router_id = router->getName();
+ const char* router_id = router->name();
XBT_DEBUG("NS3_ADD_ROUTER '%s'",router_id);
xbt_lib_set(as_router_lib,
router_id,
simgrid::surf::Onelink *onelink;
unsigned int iter;
xbt_dynar_foreach(onelink_routes, iter, onelink) {
- char *src = onelink->p_src->getName();
- char *dst = onelink->p_dst->getName();
+ char *src = onelink->p_src->name();
+ char *dst = onelink->p_dst->name();
simgrid::surf::NetworkNS3Link *link =
static_cast<simgrid::surf::NetworkNS3Link *>(onelink->p_link);
Action *NetworkNS3Model::communicate(NetCard *src, NetCard *dst,
double size, double rate)
{
- XBT_DEBUG("Communicate from %s to %s", src->getName(), dst->getName());
+ XBT_DEBUG("Communicate from %s to %s", src->name(), dst->name());
NetworkNS3Action *action = new NetworkNS3Action(this, size, 0);
- ns3_create_flow(src->getName(), dst->getName(), surf_get_clock(), size, action);
+ ns3_create_flow(src->name(), dst->name(), surf_get_clock(), size, action);
action->m_lastSent = 0;
action->p_srcElm = src;
double *bytes_amount = xbt_new0(double, 4);
Action *res = NULL;
- host_list[0] = sg_host_by_name(src->getName());
- host_list[1] = sg_host_by_name(dst->getName());
+ host_list[0] = sg_host_by_name(src->name());
+ host_list[1] = sg_host_by_name(dst->name());
bytes_amount[1] = size;
res = p_hostModel->executeParallelTask(2, host_list, flops_amount, bytes_amount, rate);
simgrid::surf::NetCard *info = new simgrid::surf::NetCardImpl(router->id, SURF_NETWORK_ELEMENT_ROUTER, current_routing);
info->setId(current_routing->addComponent(info));
xbt_lib_set(as_router_lib, router->id, ROUTING_ASR_LEVEL, (void *) info);
- XBT_DEBUG("Having set name '%s' id '%d'", router->id, info->getId());
+ XBT_DEBUG("Having set name '%s' id '%d'", router->id, info->id());
simgrid::surf::netcardCreatedCallbacks(info);
if (router->coord && strcmp(router->coord, "")) {
int As::addComponent(NetCard *elm) {
- XBT_DEBUG("Load component \"%s\"", elm->getName());
+ XBT_DEBUG("Load component \"%s\"", elm->name());
xbt_dynar_push_as(vertices_, NetCard*, elm);
return xbt_dynar_length(vertices_)-1;
}
xbt_assert(link_up_down.link_down, "Link '%s' not found!",netcard_arg->link_down);
// If dynar is is greater than netcard id and if the host_link is already defined
- if((int)xbt_dynar_length(current_routing->upDownLinks) > netcard->getId() &&
- xbt_dynar_get_as(current_routing->upDownLinks, netcard->getId(), void*))
+ if((int)xbt_dynar_length(current_routing->upDownLinks) > netcard->id() &&
+ xbt_dynar_get_as(current_routing->upDownLinks, netcard->id(), void*))
surf_parse_error("Host_link for '%s' is already defined!",netcard_arg->id);
- XBT_DEBUG("Push Host_link for host '%s' to position %d", netcard->getName(), netcard->getId());
- xbt_dynar_set_as(current_routing->upDownLinks, netcard->getId(), s_surf_parsing_link_up_down_t, link_up_down);
+ XBT_DEBUG("Push Host_link for host '%s' to position %d", netcard->name(), netcard->id());
+ xbt_dynar_set_as(current_routing->upDownLinks, netcard->id(), s_surf_parsing_link_up_down_t, link_up_down);
}
void sg_platf_new_trace(sg_platf_trace_cbarg_t trace)
THROWF(arg_error, 0, "All defined components must belong to a AS");
}
- xbt_lib_set(as_router_lib, netcard->getName(), ROUTING_ASR_LEVEL,
+ xbt_lib_set(as_router_lib, netcard->name(), ROUTING_ASR_LEVEL,
(void *) netcard);
- XBT_DEBUG("Having set name '%s' id '%d'", new_as->name_, netcard->getId());
+ XBT_DEBUG("Having set name '%s' id '%d'", new_as->name_, netcard->id());
/* set the new current component of the tree */
current_routing = new_as;
/* (1) find the as where the src and dst are located */
sg_netcard_t src_data = src;
sg_netcard_t dst_data = dst;
- src_as = src_data->getRcComponent();
- dst_as = dst_data->getRcComponent();
+ src_as = src_data->containingAS();
+ dst_as = dst_data->containingAS();
#ifndef NDEBUG
- char* src_name = src_data->getName();
- char* dst_name = dst_data->getName();
+ char* src_name = src_data->name();
+ char* dst_name = dst_data->name();
#endif
xbt_assert(src_as && dst_as,
memset(&route,0,sizeof(route));
xbt_assert(src && dst, "bad parameters for \"_get_route_latency\" method");
- XBT_DEBUG("Solve route/latency \"%s\" to \"%s\"", src->getName(), dst->getName());
+ XBT_DEBUG("Solve route/latency \"%s\" to \"%s\"", src->name(), dst->name());
/* Find how src and dst are interconnected */
simgrid::surf::As *common_father, *src_father, *dst_father;
&route, latency);
xbt_assert((route.gw_src != NULL) && (route.gw_dst != NULL),
- "bad gateways for route from \"%s\" to \"%s\"", src->getName(), dst->getName());
+ "bad gateways for route from \"%s\" to \"%s\"", src->name(), dst->name());
sg_netcard_t src_gateway_net_elm = route.gw_src;
sg_netcard_t dst_gateway_net_elm = route.gw_dst;
*/
void RoutingPlatf::getRouteAndLatency(NetCard *src, NetCard *dst, xbt_dynar_t* route, double *latency)
{
- XBT_DEBUG("getRouteAndLatency from %s to %s", src->getName(), dst->getName());
+ XBT_DEBUG("getRouteAndLatency from %s to %s", src->name(), dst->name());
if (NULL == *route) {
xbt_dynar_reset(routing_platf->p_lastRoute);
*route = routing_platf->p_lastRoute;
_get_route_and_latency(src, dst, route, latency);
xbt_assert(!latency || *latency >= 0.0,
- "negative latency on route between \"%s\" and \"%s\"", src->getName(), dst->getName());
+ "negative latency on route between \"%s\" and \"%s\"", src->name(), dst->name());
}
xbt_dynar_t RoutingPlatf::getOneLinkRoutes(){
for (int index = 0; index < count; index++) {
sg_netcard_t relm =
xbt_dynar_get_as(elms, index, simgrid::surf::NetCard*);
- sg_host_t delm = simgrid::s4u::Host::by_name_or_null(relm->getName());
+ sg_host_t delm = simgrid::s4u::Host::by_name_or_null(relm->name());
if (delm!=NULL) {
xbt_dynar_push(res, &delm);
}
class NetCard {
public:
virtual ~NetCard(){};
- virtual int getId()=0; // Our rank in the vertices_ array of our container AS.
+ virtual int id()=0; // Our rank in the vertices_ array of our containing AS.
virtual int *getIdPtr()=0;
virtual void setId(int id)=0;
- virtual char *getName()=0;
- virtual As *getRcComponent()=0;
+ virtual char *name()=0;
+ virtual As *containingAS()=0; // This is the AS in which I am
virtual e_surf_network_element_type_t getRcType()=0;
};
struct XBT_PRIVATE NetCardImpl : public NetCard {
public:
- NetCardImpl(const char *name, e_surf_network_element_type_t componentType, As *component)
- : component_(component),
+ NetCardImpl(const char *name, e_surf_network_element_type_t componentType, As *as)
+ : name_(xbt_strdup(name)),
componentType_(componentType),
- name_(xbt_strdup(name))
+ containingAS_(as)
{}
~NetCardImpl() { xbt_free(name_);};
- int getId() {return id_;}
+ int id() {return id_;}
int *getIdPtr() {return &id_;}
void setId(int id) {id_ = id;}
- char *getName() {return name_;}
- As *getRcComponent() {return component_;}
+ char *name() {return name_;}
+ As *containingAS() {return containingAS_;}
e_surf_network_element_type_t getRcType() {return componentType_;}
private:
- As *component_;
- e_surf_network_element_type_t componentType_;
int id_ = -1;
char *name_;
+ e_surf_network_element_type_t componentType_;
+ As *containingAS_;
};
/** @ingroup SURF_routing_interface
{
s_surf_parsing_link_up_down_t info;
XBT_VERB("cluster_get_route_and_latency from '%s'[%d] to '%s'[%d]",
- src->getName(), src->getId(), dst->getName(), dst->getId());
+ src->name(), src->id(), dst->name(), dst->id());
if (src->getRcType() != SURF_NETWORK_ELEMENT_ROUTER) { // No specific link for router
- if((src->getId() == dst->getId()) && p_has_loopback ){
- info = xbt_dynar_get_as(upDownLinks, src->getId() * p_nb_links_per_node, s_surf_parsing_link_up_down_t);
+ if((src->id() == dst->id()) && p_has_loopback ){
+ info = xbt_dynar_get_as(upDownLinks, src->id() * p_nb_links_per_node, s_surf_parsing_link_up_down_t);
xbt_dynar_push_as(route->link_list, void *, info.link_up);
if (lat)
*lat += static_cast<Link*>(info.link_up)->getLatency();
if (p_has_limiter){ // limiter for sender
- info = xbt_dynar_get_as(upDownLinks, src->getId() * p_nb_links_per_node + p_has_loopback, s_surf_parsing_link_up_down_t);
+ info = xbt_dynar_get_as(upDownLinks, src->id() * p_nb_links_per_node + p_has_loopback, s_surf_parsing_link_up_down_t);
xbt_dynar_push_as(route->link_list, void *, info.link_up);
}
- info = xbt_dynar_get_as(upDownLinks, src->getId() * p_nb_links_per_node + p_has_loopback + p_has_limiter, s_surf_parsing_link_up_down_t);
+ info = xbt_dynar_get_as(upDownLinks, src->id() * p_nb_links_per_node + p_has_loopback + p_has_limiter, s_surf_parsing_link_up_down_t);
if (info.link_up) { // link up
xbt_dynar_push_as(route->link_list, void *, info.link_up);
if (lat)
}
if (dst->getRcType() != SURF_NETWORK_ELEMENT_ROUTER) { // No specific link for router
- info = xbt_dynar_get_as(upDownLinks, dst->getId() * p_nb_links_per_node + p_has_loopback + p_has_limiter, s_surf_parsing_link_up_down_t);
+ info = xbt_dynar_get_as(upDownLinks, dst->id() * p_nb_links_per_node + p_has_loopback + p_has_limiter, s_surf_parsing_link_up_down_t);
if (info.link_down) { // link down
xbt_dynar_push_as(route->link_list, void *, info.link_down);
*lat += static_cast<Link*>(info.link_down)->getLatency();
}
if (p_has_limiter){ // limiter for receiver
- info = xbt_dynar_get_as(upDownLinks, dst->getId() * p_nb_links_per_node + p_has_loopback, s_surf_parsing_link_up_down_t);
+ info = xbt_dynar_get_as(upDownLinks, dst->id() * p_nb_links_per_node + p_has_loopback, s_surf_parsing_link_up_down_t);
xbt_dynar_push_as(route->link_list, void *, info.link_up);
}
}
xbt_assert(p_router,"Malformed cluster. This may be because your platform file is a hypergraph while it must be a graph.");
/* create the router */
- char *link_name = p_router->getName();
+ char *link_name = p_router->name();
routerNode = new_xbt_graph_node(graph, link_name, nodes);
if(p_backbone) {
src = xbt_dynar_get_as(vertices_, isrc, NetCard*);
if (src->getRcType() != SURF_NETWORK_ELEMENT_ROUTER) {
- previous = new_xbt_graph_node(graph, src->getName(), nodes);
+ previous = new_xbt_graph_node(graph, src->name(), nodes);
- info = xbt_dynar_get_as(upDownLinks, src->getId(), s_surf_parsing_link_up_down_t);
+ info = xbt_dynar_get_as(upDownLinks, src->id(), s_surf_parsing_link_up_down_t);
if (info.link_up) { // link up
if (dst->getRcType() == SURF_NETWORK_ELEMENT_ROUTER || src->getRcType() == SURF_NETWORK_ELEMENT_ROUTER) return;
/* Let's find the source and the destination in our internal structure */
- tempIter = this->computeNodes.find(src->getId());
+ tempIter = this->computeNodes.find(src->id());
// xbt_die -> assert
if (tempIter == this->computeNodes.end()) {
- xbt_die("Could not find the source %s [%d] in the fat tree", src->getName(),
- src->getId());
+ xbt_die("Could not find the source %s [%d] in the fat tree", src->name(),
+ src->id());
}
source = tempIter->second;
- tempIter = this->computeNodes.find(dst->getId());
+ tempIter = this->computeNodes.find(dst->id());
if (tempIter == this->computeNodes.end()) {
xbt_die("Could not find the destination %s [%d] in the fat tree",
- dst->getName(), dst->getId());
+ dst->name(), dst->id());
}
destination = tempIter->second;
XBT_VERB("Get route and latency from '%s' [%d] to '%s' [%d] in a fat tree",
- src->getName(), src->getId(), dst->getName(), dst->getId());
+ src->name(), src->id(), dst->name(), dst->id());
/* In case destination is the source, and there is a loopback, let's get
through it instead of going up to a switch*/
void AsClusterTorus::getRouteAndLatency(NetCard * src, NetCard * dst, sg_platf_route_cbarg_t route, double *lat) {
XBT_VERB("torus_get_route_and_latency from '%s'[%d] to '%s'[%d]",
- src->getName(), src->getId(), dst->getName(), dst->getId());
+ src->name(), src->id(), dst->name(), dst->id());
if (dst->getRcType() == SURF_NETWORK_ELEMENT_ROUTER || src->getRcType() == SURF_NETWORK_ELEMENT_ROUTER)
return;
- if ((src->getId() == dst->getId()) && p_has_loopback) {
+ if ((src->id() == dst->id()) && p_has_loopback) {
s_surf_parsing_link_up_down_t info =
- xbt_dynar_get_as(upDownLinks, src->getId() * p_nb_links_per_node, s_surf_parsing_link_up_down_t);
+ xbt_dynar_get_as(upDownLinks, src->id() * p_nb_links_per_node, s_surf_parsing_link_up_down_t);
xbt_dynar_push_as(route->link_list, void *, info.link_up);
if (lat)
* TODO Change to dynamic assignment
*/
unsigned int j, cur_dim, dim_product = 1;
- int current_node = src->getId();
+ int current_node = src->id();
int unsigned next_node = 0;
/**
* Arrays that hold the coordinates of the current node and
* into this dimension or not.
*/
unsigned int *myCoords, *targetCoords;
- myCoords = rankId_to_coords(src->getId(), p_dimensions);
- targetCoords = rankId_to_coords(dst->getId(), p_dimensions);
+ myCoords = rankId_to_coords(src->id(), p_dimensions);
+ targetCoords = rankId_to_coords(dst->id(), p_dimensions);
/**
* linkOffset describes the offset where the link
* we want to use is stored
* which can only be the case if src->m_id == dst->m_id -- see above
* for this special case)
*/
- int nodeOffset = (xbt_dynar_length(p_dimensions) + 1) * src->getId();
+ int nodeOffset = (xbt_dynar_length(p_dimensions) + 1) * src->id();
int linkOffset = nodeOffset;
bool use_lnk_up = false; // Is this link of the form "cur -> next" or "next -> cur"?
// false means: next -> cur
- while (current_node != dst->getId()) {
+ while (current_node != dst->id()) {
dim_product = 1; // First, we will route in x-dimension
for (j = 0; j < xbt_dynar_length(p_dimensions); j++) {
cur_dim = xbt_dynar_get_as(p_dimensions, j, int);
// current_node/dim_product = position in current dimension
- if ((current_node / dim_product) % cur_dim != (dst->getId() / dim_product) % cur_dim) {
+ if ((current_node / dim_product) % cur_dim != (dst->id() / dim_product) % cur_dim) {
if ((targetCoords[j] > myCoords[j] && targetCoords[j] <= myCoords[j] + cur_dim / 2) // Is the target node on the right, without the wrap-around?
|| (myCoords[j] > cur_dim / 2 && (myCoords[j] + cur_dim / 2) % cur_dim >= targetCoords[j])) { // Or do we need to use the wrap around to reach it?
int *dst_id = dst->getIdPtr();
if (!src_id || !dst_id)
- THROWF(arg_error,0,"No route from '%s' to '%s'",src->getName(),dst->getName());
+ THROWF(arg_error,0,"No route from '%s' to '%s'",src->name(),dst->name());
int *pred_arr = NULL;
int src_node_id = 0;
xbt_edge_t edge = xbt_graph_get_edge(p_routeGraph, node_s_v, node_e_v);
if (edge == NULL)
- THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getName(), dst->getName());
+ THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name(), dst->name());
e_route = (sg_platf_route_cbarg_t) xbt_graph_edge_get_data(edge);
if (m_cached) {
/*check if there is a cached predecessor list avail */
elm = (route_cache_element_t)
- xbt_dict_get_or_null_ext(p_routeCache, (char *) (&src_id),
- sizeof(int));
+ xbt_dict_get_or_null_ext(p_routeCache, (char *) (&src_id), sizeof(int));
}
if (elm) { /* cached mode and cache hit */
xbt_graph_get_edge(p_routeGraph, node_pred_v, node_v);
if (edge == NULL)
- THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getName(), dst->getName());
+ THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name(), dst->name());
prev_gw_src = gw_src;
first_gw = gw_dst;
if (hierarchy_ == SURF_ROUTING_RECURSIVE && v != dst_node_id
- && strcmp(gw_dst->getName(), prev_gw_src->getName())) {
+ && strcmp(gw_dst->name(), prev_gw_src->name())) {
xbt_dynar_t e_route_as_to_as=NULL;
routing_platf->getRouteAndLatency(gw_dst_net_elm, prev_gw_src_net_elm, &e_route_as_to_as, NULL);
if (edge == NULL)
- THROWF(arg_error,0,"No route from '%s' to '%s'", src->getName(), dst->getName());
+ THROWF(arg_error,0,"No route from '%s' to '%s'", src->name(), dst->name());
links = e_route_as_to_as;
int pos = 0;
xbt_dynar_foreach(links, cpt, link) {
elm = xbt_new0(struct route_cache_element, 1);
elm->pred_arr = pred_arr;
elm->size = size;
- xbt_dict_set_ext(p_routeCache, (char *) (&src_id), sizeof(int),
- (xbt_dictelm_t) elm, NULL);
+ xbt_dict_set_ext(p_routeCache, (char *) (&src_id), sizeof(int), (xbt_dictelm_t) elm, NULL);
}
if (!m_cached)
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
else{
XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
- route->gw_src->getName(), dst, route->gw_dst->getName());
+ route->gw_src->name(), dst, route->gw_dst->name());
as_route = 1;
if(route->gw_dst->getRcType() == SURF_NETWORK_ELEMENT_NULL)
- surf_parse_error("The gw_dst '%s' does not exist!",route->gw_dst->getName());
+ surf_parse_error("The gw_dst '%s' does not exist!",route->gw_dst->name());
if(route->gw_src->getRcType() == SURF_NETWORK_ELEMENT_NULL)
- surf_parse_error("The gw_src '%s' does not exist!",route->gw_src->getName());
+ surf_parse_error("The gw_src '%s' does not exist!",route->gw_src->name());
}
NetCard *src_net_elm, *dst_net_elm;
p_routeCache = xbt_dict_new_homogeneous(&route_cache_elem_free);
sg_platf_route_cbarg_t e_route = newExtendedRoute(hierarchy_, route, 1);
- newRoute(src_net_elm->getId(), dst_net_elm->getId(), e_route);
+ newRoute(src_net_elm->id(), dst_net_elm->id(), e_route);
// Symmetrical YES
if ( (route->symmetrical == TRUE && as_route == 0)
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
else
XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
- route->gw_dst->getName(), src, route->gw_src->getName());
+ route->gw_dst->name(), src, route->gw_src->name());
xbt_dynar_t nodes = xbt_graph_get_nodes(p_routeGraph);
- xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src_net_elm->getId(), xbt_node_t);
- xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst_net_elm->getId(), xbt_node_t);
+ xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src_net_elm->id(), xbt_node_t);
+ xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst_net_elm->id(), xbt_node_t);
xbt_edge_t edge =
xbt_graph_get_edge(p_routeGraph, node_e_v, node_s_v);
route->gw_dst = gw_tmp;
}
sg_platf_route_cbarg_t link_route_back = newExtendedRoute(hierarchy_, route, 0);
- newRoute(dst_net_elm->getId(), src_net_elm->getId(), link_route_back);
+ newRoute(dst_net_elm->id(), src_net_elm->id(), link_route_back);
}
xbt_dynar_free(&route->link_list);
}
/* create a result route */
xbt_dynar_t route_stack = xbt_dynar_new(sizeof(sg_platf_route_cbarg_t), NULL);
int pred;
- int cur = dst->getId();
+ int cur = dst->id();
do {
- pred = TO_FLOYD_PRED(src->getId(), cur);
+ pred = TO_FLOYD_PRED(src->id(), cur);
if (pred == -1)
- THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getName(), dst->getName());
+ THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name(), dst->name());
xbt_dynar_push_as(route_stack, sg_platf_route_cbarg_t, TO_FLOYD_LINK(pred, cur));
cur = pred;
- } while (cur != src->getId());
+ } while (cur != src->id());
if (hierarchy_ == SURF_ROUTING_RECURSIVE) {
res->gw_src = xbt_dynar_getlast_as(route_stack, sg_platf_route_cbarg_t)->gw_src;
unsigned int cpt;
if (hierarchy_ == SURF_ROUTING_RECURSIVE && prev_dst_gw != NULL
- && strcmp(prev_dst_gw->getName(), e_route->gw_src->getName())) {
+ && strcmp(prev_dst_gw->name(), e_route->gw_src->name())) {
routing_platf->getRouteAndLatency(prev_dst_gw, e_route->gw_src,
&res->link_list, lat);
}
else{
as_route = 1;
XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
- route->gw_src->getName(), dst, route->gw_dst->getName());
+ route->gw_src->name(), dst, route->gw_dst->name());
if(route->gw_dst->getRcType() == SURF_NETWORK_ELEMENT_NULL)
- surf_parse_error("The dst_gateway '%s' does not exist!",route->gw_dst->getName());
+ surf_parse_error("The dst_gateway '%s' does not exist!",route->gw_dst->name());
if(route->gw_src->getRcType() == SURF_NETWORK_ELEMENT_NULL)
- surf_parse_error("The src_gateway '%s' does not exist!",route->gw_src->getName());
+ surf_parse_error("The src_gateway '%s' does not exist!",route->gw_src->name());
}
- if(TO_FLOYD_LINK(src_net_elm->getId(), dst_net_elm->getId()))
+ if(TO_FLOYD_LINK(src_net_elm->id(), dst_net_elm->id()))
{
char * link_name;
xbt_dynar_push(link_route_to_test,&link);
}
xbt_assert(!xbt_dynar_compare(
- TO_FLOYD_LINK(src_net_elm->getId(), dst_net_elm->getId())->link_list,
+ TO_FLOYD_LINK(src_net_elm->id(), dst_net_elm->id())->link_list,
link_route_to_test,
(int_f_cpvoid_cpvoid_t) floyd_pointer_resource_cmp),
"The route between \"%s\" and \"%s\" already exists", src,dst);
}
else
{
- TO_FLOYD_LINK(src_net_elm->getId(), dst_net_elm->getId()) =
+ TO_FLOYD_LINK(src_net_elm->id(), dst_net_elm->id()) =
newExtendedRoute(hierarchy_, route, 1);
- TO_FLOYD_PRED(src_net_elm->getId(), dst_net_elm->getId()) = src_net_elm->getId();
- TO_FLOYD_COST(src_net_elm->getId(), dst_net_elm->getId()) =
- ((TO_FLOYD_LINK(src_net_elm->getId(), dst_net_elm->getId()))->link_list)->used; /* count of links, old model assume 1 */
+ TO_FLOYD_PRED(src_net_elm->id(), dst_net_elm->id()) = src_net_elm->id();
+ TO_FLOYD_COST(src_net_elm->id(), dst_net_elm->id()) =
+ ((TO_FLOYD_LINK(src_net_elm->id(), dst_net_elm->id()))->link_list)->used; /* count of links, old model assume 1 */
}
if ( (route->symmetrical == TRUE && as_route == 0)
|| (route->symmetrical == TRUE && as_route == 1)
)
{
- if(TO_FLOYD_LINK(dst_net_elm->getId(), src_net_elm->getId()))
+ if(TO_FLOYD_LINK(dst_net_elm->id(), src_net_elm->id()))
{
if(!route->gw_dst && !route->gw_src)
XBT_DEBUG("See Route from \"%s\" to \"%s\"", dst, src);
else
XBT_DEBUG("See ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
- route->gw_src->getName(), src, route->gw_dst->getName());
+ route->gw_src->name(), src, route->gw_dst->name());
char * link_name;
unsigned int i;
xbt_dynar_t link_route_to_test = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
xbt_dynar_push(link_route_to_test,&link);
}
xbt_assert(!xbt_dynar_compare(
- TO_FLOYD_LINK(dst_net_elm->getId(), src_net_elm->getId())->link_list,
+ TO_FLOYD_LINK(dst_net_elm->id(), src_net_elm->id())->link_list,
link_route_to_test,
(int_f_cpvoid_cpvoid_t) floyd_pointer_resource_cmp),
"The route between \"%s\" and \"%s\" already exists", src,dst);
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
else
XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
- route->gw_src->getName(), src, route->gw_dst->getName());
+ route->gw_src->name(), src, route->gw_dst->name());
- TO_FLOYD_LINK(dst_net_elm->getId(), src_net_elm->getId()) =
+ TO_FLOYD_LINK(dst_net_elm->id(), src_net_elm->id()) =
newExtendedRoute(hierarchy_, route, 0);
- TO_FLOYD_PRED(dst_net_elm->getId(), src_net_elm->getId()) = dst_net_elm->getId();
- TO_FLOYD_COST(dst_net_elm->getId(), src_net_elm->getId()) =
- ((TO_FLOYD_LINK(dst_net_elm->getId(), src_net_elm->getId()))->link_list)->used; /* count of links, old model assume 1 */
+ TO_FLOYD_PRED(dst_net_elm->id(), src_net_elm->id()) = dst_net_elm->id();
+ TO_FLOYD_COST(dst_net_elm->id(), src_net_elm->id()) =
+ ((TO_FLOYD_LINK(dst_net_elm->id(), src_net_elm->id()))->link_list)->used; /* count of links, old model assume 1 */
}
}
xbt_dynar_free(&route->link_list);
void AsFull::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t res, double *lat)
{
XBT_DEBUG("full_get_route_and_latency from %s[%d] to %s[%d]",
- src->getName(),
- src->getId(),
- dst->getName(),
- dst->getId());
+ src->name(),
+ src->id(),
+ dst->name(),
+ dst->id());
/* set utils vars */
size_t table_size = xbt_dynar_length(vertices_);
void *link;
unsigned int cpt = 0;
- e_route = TO_ROUTE_FULL(src->getId(), dst->getId());
+ e_route = TO_ROUTE_FULL(src->id(), dst->id());
if (e_route) {
res->gw_src = e_route->gw_src;
if (!p_routingTable)
p_routingTable = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);
- if (TO_ROUTE_FULL(src_net_elm->getId(), dst_net_elm->getId())) {
+ if (TO_ROUTE_FULL(src_net_elm->id(), dst_net_elm->id())) {
char *link_name;
unsigned int i;
xbt_dynar_t link_route_to_test =
xbt_assert(link, "Link : '%s' doesn't exists.", link_name);
xbt_dynar_push(link_route_to_test, &link);
}
- if (xbt_dynar_compare(TO_ROUTE_FULL(src_net_elm->getId(), dst_net_elm->getId())->link_list,
+ if (xbt_dynar_compare(TO_ROUTE_FULL(src_net_elm->id(), dst_net_elm->id())->link_list,
link_route_to_test, full_pointer_resource_cmp)) {
surf_parse_error("A route between \"%s\" and \"%s\" already exists "
"with a different content. "
if (!route->gw_src ||
route->gw_src->getRcType() == SURF_NETWORK_ELEMENT_NULL)
surf_parse_error("The src_gateway \"%s\" does not exist!",
- route->gw_src ? route->gw_src->getName() : "(null)");
+ route->gw_src ? route->gw_src->name() : "(null)");
if (!route->gw_dst ||
route->gw_dst->getRcType() == SURF_NETWORK_ELEMENT_NULL)
surf_parse_error("The dst_gateway \"%s\" does not exist!",
- route->gw_dst ? route->gw_dst->getName() : "(null)");
+ route->gw_dst ? route->gw_dst->name() : "(null)");
XBT_DEBUG("ASroute goes from \"%s\" to \"%s\"",
- route->gw_src->getName(), route->gw_dst->getName());
+ route->gw_src->name(), route->gw_dst->name());
}
- TO_ROUTE_FULL(src_net_elm->getId(), dst_net_elm->getId()) = newExtendedRoute(hierarchy_, route, 1);
- xbt_dynar_shrink(TO_ROUTE_FULL(src_net_elm->getId(), dst_net_elm->getId())->link_list, 0);
+ TO_ROUTE_FULL(src_net_elm->id(), dst_net_elm->id()) = newExtendedRoute(hierarchy_, route, 1);
+ xbt_dynar_shrink(TO_ROUTE_FULL(src_net_elm->id(), dst_net_elm->id())->link_list, 0);
}
if ( (route->symmetrical == TRUE && as_route == 0)
route->gw_src = route->gw_dst;
route->gw_dst = gw_tmp;
}
- if (TO_ROUTE_FULL(dst_net_elm->getId(), src_net_elm->getId())) {
+ if (TO_ROUTE_FULL(dst_net_elm->id(), src_net_elm->id())) {
char *link_name;
unsigned int i;
xbt_dynar_t link_route_to_test =
xbt_assert(link, "Link : '%s' doesn't exists.", link_name);
xbt_dynar_push(link_route_to_test, &link);
}
- xbt_assert(!xbt_dynar_compare(TO_ROUTE_FULL(dst_net_elm->getId(), src_net_elm->getId())->link_list,
+ xbt_assert(!xbt_dynar_compare(TO_ROUTE_FULL(dst_net_elm->id(), src_net_elm->id())->link_list,
link_route_to_test,
full_pointer_resource_cmp),
"The route between \"%s\" and \"%s\" already exists", src,
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
else
XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"",
- dst, route->gw_src->getName(), src, route->gw_dst->getName());
- TO_ROUTE_FULL(dst_net_elm->getId(), src_net_elm->getId()) = newExtendedRoute(hierarchy_, route, 0);
- xbt_dynar_shrink(TO_ROUTE_FULL(dst_net_elm->getId(), src_net_elm->getId())->link_list, 0);
+ dst, route->gw_src->name(), src, route->gw_dst->name());
+ TO_ROUTE_FULL(dst_net_elm->id(), src_net_elm->id()) = newExtendedRoute(hierarchy_, route, 0);
+ xbt_dynar_shrink(TO_ROUTE_FULL(dst_net_elm->id(), src_net_elm->id())->link_list, 0);
}
}
xbt_dynar_free(&route->link_list);
src, dst);
xbt_assert(!xbt_dict_get_or_null(dict_bypassRoutes, route_name),
"The bypass route between \"%s\"(\"%s\") and \"%s\"(\"%s\") already exists",
- src, e_route->gw_src->getName(), dst, e_route->gw_dst->getName());
+ src, e_route->gw_src->name(), dst, e_route->gw_dst->name());
sg_platf_route_cbarg_t new_e_route = NULL;
if(e_route->gw_dst)
getRouteAndLatency(my_src, my_dst, route, NULL);
- XBT_DEBUG ("get_route_and_latency %s -> %s", my_src->getName(), my_dst->getName());
+ XBT_DEBUG ("get_route_and_latency %s -> %s", my_src->name(), my_dst->name());
unsigned int cpt;
void *link;
const char *previous_name, *current_name;
if (route->gw_src) {
- previous = new_xbt_graph_node(graph, route->gw_src->getName(), nodes);
- previous_name = route->gw_src->getName();
+ previous = new_xbt_graph_node(graph, route->gw_src->name(), nodes);
+ previous_name = route->gw_src->name();
} else {
- previous = new_xbt_graph_node(graph, my_src->getName(), nodes);
- previous_name = my_src->getName();
+ previous = new_xbt_graph_node(graph, my_src->name(), nodes);
+ previous_name = my_src->name();
}
xbt_dynar_foreach(route->link_list, cpt, link) {
}
if (route->gw_dst) {
- current = new_xbt_graph_node(graph, route->gw_dst->getName(), nodes);
- current_name = route->gw_dst->getName();
+ current = new_xbt_graph_node(graph, route->gw_dst->name(), nodes);
+ current_name = route->gw_dst->name();
} else {
- current = new_xbt_graph_node(graph, my_dst->getName(), nodes);
- current_name = my_dst->getName();
+ current = new_xbt_graph_node(graph, my_dst->name(), nodes);
+ current_name = my_dst->name();
}
new_xbt_graph_edge(graph, previous, current, edges);
XBT_DEBUG (" %s -> %s", previous_name, current_name);
double *lat)
{
// If never set a bypass route return NULL without any further computations
- XBT_DEBUG("generic_get_bypassroute from %s to %s", src->getName(), dst->getName());
+ XBT_DEBUG("generic_get_bypassroute from %s to %s", src->name(), dst->name());
if (no_bypassroute_declared)
return NULL;
sg_platf_route_cbarg_t e_route_bypass = NULL;
xbt_dict_t dict_bypassRoutes = bypassRoutes_;
- if(dst->getRcComponent() == this && src->getRcComponent() == this ){
- char *route_name = bprintf("%s#%s", src->getName(), dst->getName());
+ if(dst->containingAS() == this && src->containingAS() == this ){
+ char *route_name = bprintf("%s#%s", src->name(), dst->name());
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
if(e_route_bypass)
XBT_DEBUG("Find bypass route with %ld links",xbt_dynar_length(e_route_bypass->link_list));
if (src == NULL || dst == NULL)
xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
- src ? src->getName() : "(null)",
- dst ? dst->getName() : "(null)", name_);
+ src ? src->name() : "(null)",
+ dst ? dst->name() : "(null)", name_);
- src_as = src->getRcComponent();
- dst_as = dst->getRcComponent();
+ src_as = src->containingAS();
+ dst_as = dst->containingAS();
/* (2) find the path to the root routing component */
path_src = xbt_dynar_new(sizeof(As*), NULL);
{
if (src == NULL || dst == NULL)
xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
- src ? src->getName() : "(null)",
- dst ? dst->getName() : "(null)",
+ src ? src->name() : "(null)",
+ dst ? dst->name() : "(null)",
name_);
- As *src_as = src->getRcComponent();
- As *dst_as = dst->getRcComponent();
+ As *src_as = src->containingAS();
+ As *dst_as = dst->containingAS();
if (src_as != dst_as)
- xbt_die("The src(%s in %s) and dst(%s in %s) are in differents AS",
- src->getName(), src_as->name_,
- dst->getName(), dst_as->name_);
+ xbt_die("The src(%s in %s) and dst(%s in %s) are not in the same AS",
+ src->name(), src_as->name_, dst->name(), dst_as->name_);
if (this != dst_as)
- xbt_die
- ("The routing component of src'%s' and dst'%s' is not the same as the network elements belong (%s?=%s?=%s)",
- src->getName(),
- dst->getName(),
- src_as->name_,
- dst_as->name_,
- name_);
+ xbt_die("The routing component of src'%s' and dst'%s' is not the same as the network elements belong (%s?=%s?=%s)",
+ src->name(), dst->name(), src_as->name_, dst_as->name_, name_);
}
}
s_surf_parsing_link_up_down_t info;
XBT_DEBUG("vivaldi_get_route_and_latency from '%s'[%d] '%s'[%d]",
- src->getName(), src->getId(), dst->getName(), dst->getId());
+ src->name(), src->id(), dst->name(), dst->id());
if(src->getRcType() == SURF_NETWORK_ELEMENT_AS) {
- char *src_name = ROUTER_PEER(src->getName());
- char *dst_name = ROUTER_PEER(dst->getName());
+ char *src_name = ROUTER_PEER(src->name());
+ char *dst_name = ROUTER_PEER(dst->name());
route->gw_src = (sg_netcard_t) xbt_lib_get_or_null(as_router_lib, src_name, ROUTING_ASR_LEVEL);
route->gw_dst = (sg_netcard_t) xbt_lib_get_or_null(as_router_lib, dst_name, ROUTING_ASR_LEVEL);
xbt_free(src_name);
char *tmp_src_name, *tmp_dst_name;
if(src->getRcType() == SURF_NETWORK_ELEMENT_HOST){
- tmp_src_name = HOST_PEER(src->getName());
+ tmp_src_name = HOST_PEER(src->name());
- if ((int)xbt_dynar_length(upDownLinks)>src->getId()) {
- info = xbt_dynar_get_as(upDownLinks, src->getId(), s_surf_parsing_link_up_down_t);
+ if ((int)xbt_dynar_length(upDownLinks)>src->id()) {
+ info = xbt_dynar_get_as(upDownLinks, src->id(), s_surf_parsing_link_up_down_t);
if(info.link_up) { // link up
xbt_dynar_push_as(route->link_list, void*, info.link_up);
if (lat)
}
src_ctn = (xbt_dynar_t) simgrid::s4u::Host::by_name_or_create(tmp_src_name)->extension(COORD_HOST_LEVEL);
if (src_ctn == nullptr)
- src_ctn = (xbt_dynar_t) simgrid::s4u::Host::by_name_or_create(src->getName())->extension(COORD_HOST_LEVEL);
+ src_ctn = (xbt_dynar_t) simgrid::s4u::Host::by_name_or_create(src->name())->extension(COORD_HOST_LEVEL);
}
else if(src->getRcType() == SURF_NETWORK_ELEMENT_ROUTER || src->getRcType() == SURF_NETWORK_ELEMENT_AS){
- tmp_src_name = ROUTER_PEER(src->getName());
+ tmp_src_name = ROUTER_PEER(src->name());
src_ctn = (xbt_dynar_t) xbt_lib_get_or_null(as_router_lib, tmp_src_name, COORD_ASR_LEVEL);
}
else{
}
if(dst->getRcType() == SURF_NETWORK_ELEMENT_HOST){
- tmp_dst_name = HOST_PEER(dst->getName());
+ tmp_dst_name = HOST_PEER(dst->name());
- if ((int)xbt_dynar_length(upDownLinks)>dst->getId()) {
- info = xbt_dynar_get_as(upDownLinks, dst->getId(), s_surf_parsing_link_up_down_t);
+ if ((int)xbt_dynar_length(upDownLinks)>dst->id()) {
+ info = xbt_dynar_get_as(upDownLinks, dst->id(), s_surf_parsing_link_up_down_t);
if(info.link_down) { // link down
xbt_dynar_push_as(route->link_list,void*,info.link_down);
if (lat)
dst_ctn = (xbt_dynar_t) simgrid::s4u::Host::by_name_or_create(tmp_dst_name)
->extension(COORD_HOST_LEVEL);
if (dst_ctn == nullptr)
- dst_ctn = (xbt_dynar_t) simgrid::s4u::Host::by_name_or_create(dst->getName())
+ dst_ctn = (xbt_dynar_t) simgrid::s4u::Host::by_name_or_create(dst->name())
->extension(COORD_HOST_LEVEL);
}
else if(dst->getRcType() == SURF_NETWORK_ELEMENT_ROUTER || dst->getRcType() == SURF_NETWORK_ELEMENT_AS){
- tmp_dst_name = ROUTER_PEER(dst->getName());
+ tmp_dst_name = ROUTER_PEER(dst->name());
dst_ctn = (xbt_dynar_t) xbt_lib_get_or_null(as_router_lib, tmp_dst_name, COORD_ASR_LEVEL);
}
else{