-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2009-2018. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include "src/kernel/routing/FloydZone.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/FloydZone.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
#include "src/surf/network_interface.hpp"
#include "xbt/log.h"
+#include "src/surf/xml/platf_private.hpp"
#include <cfloat>
#include <limits>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf");
-#define TO_FLOYD_COST(i, j) (costTable_)[(i) + (j)*table_size]
-#define TO_FLOYD_PRED(i, j) (predecessorTable_)[(i) + (j)*table_size]
-#define TO_FLOYD_LINK(i, j) (linkTable_)[(i) + (j)*table_size]
+#define TO_FLOYD_COST(i, j) (cost_table_)[(i) + (j)*table_size]
+#define TO_FLOYD_PRED(i, j) (predecessor_table_)[(i) + (j)*table_size]
+#define TO_FLOYD_LINK(i, j) (link_table_)[(i) + (j)*table_size]
namespace simgrid {
namespace kernel {
FloydZone::FloydZone(NetZone* father, std::string name) : RoutedZone(father, name)
{
- predecessorTable_ = nullptr;
- costTable_ = nullptr;
- linkTable_ = nullptr;
+ predecessor_table_ = nullptr;
+ cost_table_ = nullptr;
+ link_table_ = nullptr;
}
FloydZone::~FloydZone()
{
- if (linkTable_ == nullptr) // Dealing with a parse error in the file?
+ if (link_table_ == nullptr) // Dealing with a parse error in the file?
return;
unsigned int table_size = getTableSize();
/* Delete link_table */
for (unsigned int i = 0; i < table_size; i++)
for (unsigned int j = 0; j < table_size; j++)
delete TO_FLOYD_LINK(i, j);
- delete[] linkTable_;
+ delete[] link_table_;
- delete[] predecessorTable_;
- delete[] costTable_;
+ delete[] predecessor_table_;
+ delete[] cost_table_;
}
-void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
+void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
unsigned int table_size = getTableSize();
getRouteCheckParams(src, dst);
/* create a result route */
- std::vector<sg_platf_route_cbarg_t> route_stack;
+ std::vector<RouteCreationArgs*> route_stack;
unsigned int cur = dst->id();
do {
int pred = TO_FLOYD_PRED(src->id(), cur);
sg_netpoint_t prev_dst_gw = nullptr;
while (not route_stack.empty()) {
- sg_platf_route_cbarg_t e_route = route_stack.back();
+ RouteCreationArgs* e_route = route_stack.back();
route_stack.pop_back();
if (hierarchy_ == RoutingMode::recursive && prev_dst_gw != nullptr &&
prev_dst_gw->getCname() != e_route->gw_src->getCname()) {
addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
- if (not linkTable_) {
+ if (not link_table_) {
/* Create Cost, Predecessor and Link tables */
- costTable_ = new double[table_size * table_size]; /* link cost from host to host */
- predecessorTable_ = new int[table_size * table_size]; /* predecessor host numbers */
- linkTable_ = new sg_platf_route_cbarg_t[table_size * table_size]; /* actual link between src and dst */
+ cost_table_ = new double[table_size * table_size]; /* link cost from host to host */
+ predecessor_table_ = new int[table_size * table_size]; /* predecessor host numbers */
+ link_table_ = new RouteCreationArgs*[table_size * table_size]; /* actual link between src and dst */
/* Initialize costs and predecessors */
for (unsigned int i = 0; i < table_size; i++)
/* set the size of table routing */
unsigned int table_size = getTableSize();
- if (not linkTable_) {
+ if (not link_table_) {
/* Create Cost, Predecessor and Link tables */
- costTable_ = new double[table_size * table_size]; /* link cost from host to host */
- predecessorTable_ = new int[table_size * table_size]; /* predecessor host numbers */
- linkTable_ = new sg_platf_route_cbarg_t[table_size * table_size]; /* actual link between src and dst */
+ cost_table_ = new double[table_size * table_size]; /* link cost from host to host */
+ predecessor_table_ = new int[table_size * table_size]; /* predecessor host numbers */
+ link_table_ = new RouteCreationArgs*[table_size * table_size]; /* actual link between src and dst */
/* Initialize costs and predecessors */
for (unsigned int i = 0; i < table_size; i++)
/* Add the loopback if needed */
if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
for (unsigned int i = 0; i < table_size; i++) {
- sg_platf_route_cbarg_t e_route = TO_FLOYD_LINK(i, i);
+ RouteCreationArgs* e_route = TO_FLOYD_LINK(i, i);
if (not e_route) {
- e_route = new s_sg_platf_route_cbarg_t;
- e_route->gw_src = nullptr;
- e_route->gw_dst = nullptr;
+ e_route = new RouteCreationArgs();
e_route->link_list.push_back(surf_network_model->loopback_);
TO_FLOYD_LINK(i, i) = e_route;
TO_FLOYD_PRED(i, i) = i;