static simgrid::xbt::signal<void(NetZone&)> onSeal;
protected:
- std::vector<kernel::routing::NetPoint*>
- vertices_; // our content, as known to our graph routing algorithm (maps vertexId -> vertex)
+ unsigned int getTableSize() { return vertices_.size(); }
+ std::vector<kernel::routing::NetPoint*> getVertices() { return vertices_; }
private:
+ // our content, as known to our graph routing algorithm (maps vertexId -> vertex)
+ std::vector<kernel::routing::NetPoint*> vertices_;
+
std::unordered_map<std::string, std::string> properties_;
NetZone* father_ = nullptr;
char* name_ = nullptr;
new_xbt_graph_edge(graph, routerNode, backboneNode, edges);
}
- for (auto src : vertices_) {
+ for (auto src : getVertices()) {
if (not src->isRouter()) {
xbt_node_t previous = new_xbt_graph_node(graph, src->cname(), nodes);
{
if (linkTable_ == nullptr) // Dealing with a parse error in the file?
return;
- int table_size = vertices_.size();
+ unsigned int table_size = getTableSize();
/* Delete link_table */
- for (int i = 0; i < table_size; i++)
- for (int j = 0; j < table_size; j++)
+ for (unsigned int i = 0; i < table_size; i++)
+ for (unsigned int j = 0; j < table_size; j++)
routing_route_free(TO_FLOYD_LINK(i, j));
xbt_free(linkTable_);
void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
{
- size_t table_size = vertices_.size();
+ unsigned int table_size = getTableSize();
getRouteCheckParams(src, dst);
void FloydZone::addRoute(sg_platf_route_cbarg_t route)
{
/* set the size of table routing */
- int table_size = static_cast<int>(vertices_.size());
+ unsigned int table_size = getTableSize();
addRouteCheckParams(route);
linkTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size); /* actual link between src and dst */
/* Initialize costs and predecessors */
- for (int i = 0; i < table_size; i++)
- for (int j = 0; j < table_size; j++) {
+ for (unsigned int i = 0; i < table_size; i++)
+ for (unsigned int j = 0; j < table_size; j++) {
TO_FLOYD_COST(i, j) = DBL_MAX;
TO_FLOYD_PRED(i, j) = -1;
TO_FLOYD_LINK(i, j) = nullptr;
void FloydZone::seal()
{
/* set the size of table routing */
- size_t table_size = vertices_.size();
+ unsigned int table_size = getTableSize();
if (not linkTable_) {
/* Create Cost, Predecessor and Link tables */
void FullZone::seal()
{
- int table_size = static_cast<int>(vertices_.size());
+ unsigned int table_size = getTableSize();
/* Create table if needed */
if (not routingTable_)
/* Add the loopback if needed */
if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
- for (int i = 0; i < table_size; i++) {
+ for (unsigned int i = 0; i < table_size; i++) {
sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(i, i);
if (not e_route) {
e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
FullZone::~FullZone()
{
if (routingTable_) {
- int table_size = static_cast<int>(vertices_.size());
+ unsigned int table_size = getTableSize();
/* Delete routing table */
- for (int i = 0; i < table_size; i++)
- for (int j = 0; j < table_size; j++) {
+ for (unsigned int i = 0; i < table_size; i++)
+ for (unsigned int j = 0; j < table_size; j++) {
if (TO_ROUTE_FULL(i, j)) {
delete TO_ROUTE_FULL(i, j)->link_list;
xbt_free(TO_ROUTE_FULL(i, j));
{
XBT_DEBUG("full getLocalRoute from %s[%d] to %s[%d]", src->cname(), src->id(), dst->cname(), dst->id());
- size_t table_size = vertices_.size();
+ unsigned int table_size = getTableSize();
sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(src->id(), dst->id());
if (e_route != nullptr) {
NetPoint* dst = route->dst;
addRouteCheckParams(route);
- size_t table_size = vertices_.size();
+ unsigned int table_size = getTableSize();
if (not routingTable_)
routingTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);
void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
{
- for (auto my_src : vertices_) {
- for (auto my_dst : vertices_) {
+ std::vector<kernel::routing::NetPoint*> vertices = getVertices();
+
+ for (auto my_src : vertices) {
+ for (auto my_dst : vertices) {
if (my_src == my_dst)
continue;