X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/96f6f8fa81bf92c5367ca3a4cc7761c445379d6e..9740a26f7f05adb6289f0db8c01007ee1394fb5e:/src/surf/surf_routing_cluster_fat_tree.hpp?ds=sidebyside diff --git a/src/surf/surf_routing_cluster_fat_tree.hpp b/src/surf/surf_routing_cluster_fat_tree.hpp index 1c8a865f71..1c39826b4b 100644 --- a/src/surf/surf_routing_cluster_fat_tree.hpp +++ b/src/surf/surf_routing_cluster_fat_tree.hpp @@ -17,9 +17,10 @@ * should certainly be checked for) */ + class FatTreeNode { public: - int id; // ID as given by the user + int id; // ID as given by the user, should be unique int level; // The 0th level represents the leafs of the PGFT int position; // Position in the level @@ -36,22 +37,30 @@ public: class FatTreeLink { public: unsigned int ports; - std::vector linksUp; // From source to destination - std::vector linksDown; // From destination to source - FatTreeNode source; - FatTreeNode destination; - FatTreeLink(int source, int destination, unsigned int ports = 0); + std::vector linksUp; // From source to destination + std::vector linksDown; // From destination to source + /* As it is symetric, it might as well be first / second instead + * of source / destination + */ + FatTreeNode *source; + FatTreeNode *destination; + //FatTreeLink(FatTreeNode *source, FatTreeNode *destination, unsigned int ports = 0); }; class AsClusterFatTree : public AsCluster { public: AsClusterFatTree(); ~AsClusterFatTree(); - virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency) const; + virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, + sg_platf_route_cbarg_t into, + double *latency) const; + // virtual void getRouteAndLatency(const int src, const int dst, + // std::vector *route, + // double *latency) const; virtual void create_links(sg_platf_cluster_cbarg_t cluster); void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster); void addNodes(std::vector const& id); - void generateDotFile(string filename = "fatTree.dot"); + void generateDotFile(const string& filename = "fatTree.dot") const; protected: //description of a PGFT (TODO : better doc) @@ -62,9 +71,9 @@ protected: std::vector nodes; std::map, FatTreeLink*> links; - -}; + std::vector nodesByLevel; - - + void addLink(FatTreeNode *parent, FatTreeNode *child); + void getLevelPosition(const int level, int &position, int &size); +}; #endif