protected:
friend simgrid::kernel::routing::AsImpl;
- explicit As(const char *name);
+ explicit As(As * father, const char* name);
virtual ~As();
public:
char *name();
As *father();;
xbt_dict_t children(); // Sub AS
- xbt_dynar_t hosts(); // my content
+ xbt_dynar_t hosts(); // my content as a dynar
- As *father_ = nullptr; // FIXME: hide me
public:
/* Add content to the AS, at parsing time. It should be sealed afterward. */
virtual int addComponent(kernel::routing::NetCard *elm); /* A host, a router or an AS, whatever */
void addBypassRoute(sg_platf_route_cbarg_t e_route);
protected:
+ As* father_ = nullptr;
char *name_ = nullptr;
xbt_dict_t children_ = xbt_dict_new_homogeneous(nullptr); // sub-ASes
std::vector<kernel::routing::NetCard*> vertices_; // our content, as known to our graph routing algorithm (maps vertexId -> vertex)
namespace simgrid {
namespace kernel {
namespace routing {
- AsCluster::AsCluster(const char*name)
- : AsImpl(name)
- {}
- AsCluster::~AsCluster()=default;
+AsCluster::AsCluster(As* father, const char* name) : AsImpl(father, name)
+{
+}
+AsCluster::~AsCluster() = default;
void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat)
{
class XBT_PRIVATE AsCluster: public AsImpl {
public:
- explicit AsCluster(const char*name);
+ explicit AsCluster(As* father, const char* name);
~AsCluster() override;
void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override;
namespace kernel {
namespace routing {
-AsClusterDragonfly::AsClusterDragonfly(const char*name)
- : AsCluster(name) {
+AsClusterDragonfly::AsClusterDragonfly(As* father, const char* name) : AsCluster(father, name)
+{
}
AsClusterDragonfly::~AsClusterDragonfly() {
class XBT_PRIVATE AsClusterDragonfly
: public AsCluster {
public:
- explicit AsClusterDragonfly(const char*name);
+ explicit AsClusterDragonfly(As* father, const char* name);
~AsClusterDragonfly() override;
// void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
void getRouteAndLatency(NetCard * src, NetCard * dst, sg_platf_route_cbarg_t into, double *latency) override;
namespace kernel {
namespace routing {
-AsClusterFatTree::AsClusterFatTree(const char*name)
- : AsCluster(name)
+AsClusterFatTree::AsClusterFatTree(As* father, const char* name) : AsCluster(father, name)
{
XBT_DEBUG("Creating a new fat tree.");
}
*/
class XBT_PRIVATE AsClusterFatTree : public AsCluster {
public:
- explicit AsClusterFatTree(const char*name);
+ explicit AsClusterFatTree(As* father, const char* name);
~AsClusterFatTree() override;
void getRouteAndLatency(NetCard *src, NetCard *dst,
sg_platf_route_cbarg_t into,
namespace simgrid {
namespace kernel {
namespace routing {
- AsClusterTorus::AsClusterTorus(const char*name)
- : AsCluster(name) {
+ AsClusterTorus::AsClusterTorus(As* father, const char* name) : AsCluster(father, name)
+ {
}
AsClusterTorus::~AsClusterTorus() {
xbt_dynar_free(&dimensions_);
class XBT_PRIVATE AsClusterTorus : public AsCluster {
public:
- explicit AsClusterTorus(const char*name);
+ explicit AsClusterTorus(As* father, const char* name);
~AsClusterTorus() override;
void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
void getRouteAndLatency(NetCard * src, NetCard * dst, sg_platf_route_cbarg_t into, double *latency) override;
/* Creation routing model functions */
-AsDijkstra::AsDijkstra(const char*name, bool cached)
- : AsRoutedGraph(name)
+AsDijkstra::AsDijkstra(As* father, const char* name, bool cached) : AsRoutedGraph(father, name)
{
if (cached)
routeCache_ = xbt_dict_new_homogeneous(&route_cache_elem_free);
/** Dijkstra routing data: fast initialization, slow lookup, small memory requirements, shortest path routing only */
class XBT_PRIVATE AsDijkstra : public AsRoutedGraph {
public:
- AsDijkstra(const char*name, bool cached);
+ AsDijkstra(As* father, const char* name, bool cached);
void seal() override;
~AsDijkstra() override;
namespace kernel {
namespace routing {
-AsFloyd::AsFloyd(const char*name)
- : AsRoutedGraph(name)
+AsFloyd::AsFloyd(As* father, const char* name) : AsRoutedGraph(father, name)
{
predecessorTable_ = nullptr;
costTable_ = nullptr;
/** Floyd routing data: slow initialization, fast lookup, lesser memory requirements, shortest path routing only */
class XBT_PRIVATE AsFloyd: public AsRoutedGraph {
public:
- explicit AsFloyd(const char *name);
+ explicit AsFloyd(As* father, const char* name);
~AsFloyd() override;
void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override;
namespace simgrid {
namespace kernel {
namespace routing {
- AsFull::AsFull(const char*name)
- : AsRoutedGraph(name)
- {
+AsFull::AsFull(As* father, const char* name) : AsRoutedGraph(father, name)
+{
}
void AsFull::seal() {
/** Full routing: fast, large memory requirements, fully expressive */
class XBT_PRIVATE AsFull: public AsRoutedGraph {
public:
-
- explicit AsFull(const char*name);
+ explicit AsFull(As* father, const char* name);
void seal() override;
~AsFull() override;
namespace kernel {
namespace routing {
- AsImpl::AsImpl(const char *name) : As(name) { }
- AsImpl::~AsImpl() = default;
-
- xbt_dynar_t AsImpl::getOneLinkRoutes() {
- return nullptr;
+ AsImpl::AsImpl(As* father, const char* name) : As(father, name)
+ {
+ }
+ AsImpl::~AsImpl() = default;
+
+ xbt_dynar_t AsImpl::getOneLinkRoutes()
+ {
+ return nullptr;
}
/** @brief Get the common ancestor and its first childs in each line leading to src and dst */
XBT_PUBLIC_CLASS AsImpl : public s4u::As {
friend simgrid::kernel::routing::RoutingPlatf;
protected:
- explicit AsImpl(const char *name);
+ explicit AsImpl(As * father, const char* name);
~AsImpl() override;
public:
namespace kernel {
namespace routing {
-AsNone::AsNone(const char*name)
- : AsImpl(name)
+AsNone::AsNone(As* father, const char* name) : AsImpl(father, name)
{}
AsNone::~AsNone()
/** No specific routing. Mainly useful with the constant network model */
class XBT_PRIVATE AsNone : public AsImpl {
public:
- explicit AsNone(const char*name);
+ explicit AsNone(As* father, const char* name);
~AsNone() override;
void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override;
namespace simgrid {
namespace kernel {
namespace routing {
-
-AsRoutedGraph::AsRoutedGraph(const char*name)
- : AsImpl(name)
+
+AsRoutedGraph::AsRoutedGraph(As* father, const char* name) : AsImpl(father, name)
{
}
class XBT_PRIVATE AsRoutedGraph : public AsImpl {
public:
- explicit AsRoutedGraph(const char*name);
+ explicit AsRoutedGraph(As* father, const char* name);
~AsRoutedGraph() override;
xbt_dynar_t getOneLinkRoutes() override;
return res;
}
- AsVivaldi::AsVivaldi(const char *name)
- : AsCluster(name)
+ AsVivaldi::AsVivaldi(As* father, const char* name) : AsCluster(father, name)
{}
AsVivaldi::~AsVivaldi() {}
/* This derivates from cluster because each host has a private link */
class XBT_PRIVATE AsVivaldi: public AsCluster {
public:
- explicit AsVivaldi(const char *name);
+ explicit AsVivaldi(As* father, const char* name);
~AsVivaldi() override;
xbt_dynar_t getOneLinkRoutes() override {return nullptr;};
namespace simgrid {
namespace s4u {
- As::As(const char *name)
- : name_(xbt_strdup(name))
- {
+ As::As(As* father, const char* name) : father_(father), name_(xbt_strdup(name))
+ {
}
void As::seal()
{
/* search the routing model */
simgrid::kernel::routing::AsImpl *new_as = nullptr;
switch(AS->routing){
- case A_surfxml_AS_routing_Cluster: new_as = new simgrid::kernel::routing::AsCluster(AS->id); break;
- case A_surfxml_AS_routing_ClusterDragonfly: new_as = new simgrid::kernel::routing::AsClusterDragonfly(AS->id); break;
- case A_surfxml_AS_routing_ClusterTorus: new_as = new simgrid::kernel::routing::AsClusterTorus(AS->id); break;
- case A_surfxml_AS_routing_ClusterFatTree: new_as = new simgrid::kernel::routing::AsClusterFatTree(AS->id); break;
- case A_surfxml_AS_routing_Dijkstra: new_as = new simgrid::kernel::routing::AsDijkstra(AS->id, 0); break;
- case A_surfxml_AS_routing_DijkstraCache: new_as = new simgrid::kernel::routing::AsDijkstra(AS->id, 1); break;
- case A_surfxml_AS_routing_Floyd: new_as = new simgrid::kernel::routing::AsFloyd(AS->id); break;
- case A_surfxml_AS_routing_Full: new_as = new simgrid::kernel::routing::AsFull(AS->id); break;
- case A_surfxml_AS_routing_None: new_as = new simgrid::kernel::routing::AsNone(AS->id); break;
- case A_surfxml_AS_routing_Vivaldi: new_as = new simgrid::kernel::routing::AsVivaldi(AS->id); break;
+ case A_surfxml_AS_routing_Cluster:
+ new_as = new simgrid::kernel::routing::AsCluster(current_routing, AS->id);
+ break;
+ case A_surfxml_AS_routing_ClusterDragonfly:
+ new_as = new simgrid::kernel::routing::AsClusterDragonfly(current_routing, AS->id);
+ break;
+ case A_surfxml_AS_routing_ClusterTorus:
+ new_as = new simgrid::kernel::routing::AsClusterTorus(current_routing, AS->id);
+ break;
+ case A_surfxml_AS_routing_ClusterFatTree:
+ new_as = new simgrid::kernel::routing::AsClusterFatTree(current_routing, AS->id);
+ break;
+ case A_surfxml_AS_routing_Dijkstra:
+ new_as = new simgrid::kernel::routing::AsDijkstra(current_routing, AS->id, 0);
+ break;
+ case A_surfxml_AS_routing_DijkstraCache:
+ new_as = new simgrid::kernel::routing::AsDijkstra(current_routing, AS->id, 1);
+ break;
+ case A_surfxml_AS_routing_Floyd:
+ new_as = new simgrid::kernel::routing::AsFloyd(current_routing, AS->id);
+ break;
+ case A_surfxml_AS_routing_Full:
+ new_as = new simgrid::kernel::routing::AsFull(current_routing, AS->id);
+ break;
+ case A_surfxml_AS_routing_None:
+ new_as = new simgrid::kernel::routing::AsNone(current_routing, AS->id);
+ break;
+ case A_surfxml_AS_routing_Vivaldi:
+ new_as = new simgrid::kernel::routing::AsVivaldi(current_routing, AS->id);
+ break;
default: xbt_die("Not a valid model!"); break;
}
routing_platf->root_ = new_as;
} else if (current_routing != nullptr && routing_platf->root_ != nullptr) {
- xbt_assert(!xbt_dict_get_or_null(current_routing->children(), AS->id),
- "The AS \"%s\" already exists", AS->id);
- /* it is a part of the tree */
- new_as->father_ = current_routing;
+ xbt_assert(!xbt_dict_get_or_null(current_routing->children(), AS->id), "The AS '%s' already exists", AS->id);
/* set the father behavior */
if (current_routing->hierarchy_ == simgrid::kernel::routing::AsImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::kernel::routing::AsImpl::RoutingMode::recursive;