const std::string& get_name() const { return name_; }
const char* get_cname() const { return name_.c_str(); }
/** @brief the NetZone in which this NetPoint is included */
- NetZoneImpl* netzone() { return netzone_; }
+ NetZoneImpl* get_englobing_zone() { return englobing_zone_; }
- bool isNetZone() { return component_type_ == Type::NetZone; }
- bool isHost() { return component_type_ == Type::Host; }
- bool isRouter() { return component_type_ == Type::Router; }
+ bool is_netzone() { return component_type_ == Type::NetZone; }
+ bool is_host() { return component_type_ == Type::Host; }
+ bool is_router() { return component_type_ == Type::Router; }
static simgrid::xbt::signal<void(NetPoint*)> onCreation;
unsigned int id_;
std::string name_;
NetPoint::Type component_type_;
- NetZoneImpl* netzone_;
+ NetZoneImpl* englobing_zone_;
};
} // namespace routing
} // namespace kernel
"Cluster routing: no links attached to the source node - did you use host_link tag?");
if ((src->id() == dst->id()) && has_loopback_) {
- xbt_assert(not src->isRouter(), "Routing from a cluster private router to itself is meaningless");
+ xbt_assert(not src->is_router(), "Routing from a cluster private router to itself is meaningless");
std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePosition(src->id()));
route->link_list.push_back(info.first);
return;
}
- if (not src->isRouter()) { // No private link for the private router
+ if (not src->is_router()) { // No private link for the private router
if (has_limiter_) { // limiter for sender
std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLoopback(src->id()));
route->link_list.push_back(info.first);
*lat += backbone_->latency();
}
- if (not dst->isRouter()) { // No specific link for router
+ if (not dst->is_router()) { // No specific link for router
std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLimiter(dst->id()));
if (info.second) { // link down
}
for (auto const& src : getVertices()) {
- if (not src->isRouter()) {
+ if (not src->is_router()) {
xbt_node_t previous = new_xbt_graph_node(graph, src->get_cname(), nodes);
std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(src->id());
// Minimal routing version.
// TODO : non-minimal random one, and adaptive ?
- if (dst->isRouter() || src->isRouter())
+ if (dst->is_router() || src->is_router())
return;
XBT_VERB("dragonfly getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(),
void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency)
{
- if (dst->isRouter() || src->isRouter())
+ if (dst->is_router() || src->is_router())
return;
/* Let's find the source and the destination in our internal structure */
simgrid::xbt::signal<void(NetPoint*)> NetPoint::onCreation;
NetPoint::NetPoint(std::string name, NetPoint::Type componentType, NetZoneImpl* netzone_p)
- : name_(name), component_type_(componentType), netzone_(netzone_p)
+ : name_(name), component_type_(componentType), englobing_zone_(netzone_p)
{
if (netzone_p != nullptr)
id_ = netzone_p->addComponent(this);
NetZoneImpl** dst_ancestor)
{
/* Deal with the easy base case */
- if (src->netzone() == dst->netzone()) {
- *common_ancestor = src->netzone();
+ if (src->get_englobing_zone() == dst->get_englobing_zone()) {
+ *common_ancestor = src->get_englobing_zone();
*src_ancestor = *common_ancestor;
*dst_ancestor = *common_ancestor;
return;
/* engage the full recursive search */
/* (1) find the path to root of src and dst*/
- NetZoneImpl* src_as = src->netzone();
- NetZoneImpl* dst_as = dst->netzone();
+ NetZoneImpl* src_as = src->get_englobing_zone();
+ NetZoneImpl* dst_as = dst->get_englobing_zone();
xbt_assert(src_as, "Host %s must be in a netzone", src->get_cname());
xbt_assert(dst_as, "Host %s must be in a netzone", dst->get_cname());
/* (2) find the path to the root routing component */
std::vector<NetZoneImpl*> path_src;
- NetZoneImpl* current = src->netzone();
+ NetZoneImpl* current = src->get_englobing_zone();
while (current != nullptr) {
path_src.push_back(current);
current = static_cast<NetZoneImpl*>(current->getFather());
}
std::vector<NetZoneImpl*> path_dst;
- current = dst->netzone();
+ current = dst->get_englobing_zone();
while (current != nullptr) {
path_dst.push_back(current);
current = static_cast<NetZoneImpl*>(current->getFather());
return false;
/* Base case, no recursion is needed */
- if (dst->netzone() == this && src->netzone() == this) {
+ if (dst->get_englobing_zone() == this && src->get_englobing_zone() == this) {
if (bypass_routes_.find({src, dst}) != bypass_routes_.end()) {
BypassRoute* bypassedRoute = bypass_routes_.at({src, dst});
for (surf::LinkImpl* const& link : bypassedRoute->links) {
/* (1) find the path to the root routing component */
std::vector<NetZoneImpl*> path_src;
- NetZone* current = src->netzone();
+ NetZone* current = src->get_englobing_zone();
while (current != nullptr) {
path_src.push_back(static_cast<NetZoneImpl*>(current));
current = current->father_;
}
std::vector<NetZoneImpl*> path_dst;
- current = dst->netzone();
+ current = dst->get_englobing_zone();
while (current != nullptr) {
path_dst.push_back(static_cast<NetZoneImpl*>(current));
current = current->father_;
xbt_assert(src, "Cannot find a route from nullptr to %s", dst->get_cname());
xbt_assert(dst, "Cannot find a route from %s to nullptr", src->get_cname());
- NetZone* src_as = src->netzone();
- NetZone* dst_as = dst->netzone();
+ NetZone* src_as = src->get_englobing_zone();
+ NetZone* dst_as = dst->get_englobing_zone();
xbt_assert(src_as == dst_as,
"Internal error: %s@%s and %s@%s are not in the same netzone as expected. Please report that bug.",
xbt_assert(src, "Cannot add a route from %s to %s: %s does not exist.", srcName, dstName, srcName);
xbt_assert(dst, "Cannot add a route from %s to %s: %s does not exist.", srcName, dstName, dstName);
xbt_assert(not link_list.empty(), "Empty route (between %s and %s) forbidden.", srcName, dstName);
- xbt_assert(not src->isNetZone(),
+ xbt_assert(not src->is_netzone(),
"When defining a route, src cannot be a netzone such as '%s'. Did you meant to have an NetzoneRoute?",
srcName);
- xbt_assert(not dst->isNetZone(),
+ xbt_assert(not dst->is_netzone(),
"When defining a route, dst cannot be a netzone such as '%s'. Did you meant to have an NetzoneRoute?",
dstName);
} else {
XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", srcName, gw_src->get_cname(), dstName, gw_dst->get_cname());
- xbt_assert(src->isNetZone(), "When defining a NetzoneRoute, src must be a netzone but '%s' is not", srcName);
- xbt_assert(dst->isNetZone(), "When defining a NetzoneRoute, dst must be a netzone but '%s' is not", dstName);
+ xbt_assert(src->is_netzone(), "When defining a NetzoneRoute, src must be a netzone but '%s' is not", srcName);
+ xbt_assert(dst->is_netzone(), "When defining a NetzoneRoute, dst must be a netzone but '%s' is not", dstName);
- xbt_assert(gw_src->isHost() || gw_src->isRouter(),
+ xbt_assert(gw_src->is_host() || gw_src->is_router(),
"When defining a NetzoneRoute, gw_src must be an host or a router but '%s' is not.", srcName);
- xbt_assert(gw_dst->isHost() || gw_dst->isRouter(),
+ xbt_assert(gw_dst->is_host() || gw_dst->is_router(),
"When defining a NetzoneRoute, gw_dst must be an host or a router but '%s' is not.", dstName);
xbt_assert(gw_src != gw_dst, "Cannot define an NetzoneRoute from '%s' to itself", gw_src->get_cname());
XBT_VERB("torus getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
- if (dst->isRouter() || src->isRouter())
+ if (dst->is_router() || src->is_router())
return;
if (src->id() == dst->id() && has_loopback_) {
{
simgrid::kernel::routing::vivaldi::Coords* coords = np->extension<simgrid::kernel::routing::vivaldi::Coords>();
xbt_assert(coords, "Please specify the Vivaldi coordinates of %s %s (%p)",
- (np->isNetZone() ? "Netzone" : (np->isHost() ? "Host" : "Router")), np->get_cname(), np);
+ (np->is_netzone() ? "Netzone" : (np->is_host() ? "Host" : "Router")), np->get_cname(), np);
return &coords->coords;
}
void VivaldiZone::setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, std::string coord)
{
- xbt_assert(netpoint->netzone() == this, "Cannot add a peer link to a netpoint that is not in this netzone");
+ xbt_assert(netpoint->get_englobing_zone() == this,
+ "Cannot add a peer link to a netpoint that is not in this netzone");
new simgrid::kernel::routing::vivaldi::Coords(netpoint, coord);
{
XBT_DEBUG("vivaldi getLocalRoute from '%s'[%u] '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
- if (src->isNetZone()) {
+ 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());
std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->getAllHosts();
for (auto const& host : list) {
- if (host && host->pimpl_netpoint && host->pimpl_netpoint->isHost())
+ if (host && host->pimpl_netpoint && host->pimpl_netpoint->is_host())
xbt_dynar_push(res, &host);
}
xbt_dynar_sort(res, hostcmp_voidp);
static void sg_instr_new_router(simgrid::kernel::routing::NetPoint * netpoint)
{
- if (netpoint->isRouter() && TRACE_is_enabled() && TRACE_needs_platform())
+ if (netpoint->is_router() && TRACE_is_enabled() && TRACE_needs_platform())
new simgrid::instr::RouterContainer(netpoint->get_cname(), currentContainer.back());
}
});
bool first = true;
for (auto const& np : list) {
- if (np->isNetZone())
+ if (np->is_netzone())
continue;
if (not first)
});
for (auto const& srcCard : netcardList)
- if (srcCard->isRouter())
+ if (srcCard->is_router())
std::printf(" <router id=\"%s\"/>\n", srcCard->get_cname());
}
}
for (auto const& netcardDst : netcardList) { // to router
- if (netcardDst->isRouter()) {
+ if (netcardDst->is_router()) {
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->get_cname(), netcardDst->get_cname());
std::vector<simgrid::surf::LinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, route, nullptr);
}
for (auto const& value1 : netcardList) { // Routes from router
- if (value1->isRouter()) {
+ if (value1->is_router()) {
for (auto const& value2 : netcardList) { // to router
- if (value2->isRouter()) {
+ if (value2->is_router()) {
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->get_cname(), value2->get_cname());
std::vector<simgrid::surf::LinkImpl*> route;
simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, value2, route, nullptr);
xbt_dynar_foreach(hosts, it, host) {
simgrid::kernel::routing::NetPoint* nc = host->pimpl_netpoint;
const char *type = "buggy";
- if (nc->isRouter())
+ if (nc->is_router())
type = "router";
- if (nc->isNetZone())
+ if (nc->is_netzone())
type = "netzone";
- if (nc->isHost())
+ if (nc->is_host())
type = "host";
std::printf(" - Seen: \"%s\". Type: %s\n", host->get_cname(), type);
}
std::printf("NetCards count: %zu\n", netcardList.size());
for (auto const& nc : netcardList)
std::printf(" - Seen: \"%s\". Type: %s\n", nc->get_cname(),
- nc->isRouter() ? "router" : (nc->isNetZone() ? "netzone" : (nc->isHost() ? "host" : "buggy")));
+ nc->is_router() ? "router" : (nc->is_netzone() ? "netzone" : (nc->is_host() ? "host" : "buggy")));
return 0;
}