* under the terms of the license (GNU LGPL) which comes with this package. */
#include "surf_routing_dijkstra.hpp"
-#include "network.hpp"
+#include "network_interface.hpp"
/* Global vars */
extern routing_platf_t routing_platf;
-extern "C" {
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf -- dijkstra routing logic");
-}
/* Free functions */
int src,dst;
RoutingEdgePtr src_elm, dst_elm;
- size_t table_size = xbt_dynar_length(p_indexNetworkElm);
+ int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
for(src=0; src < table_size; src++) {
for(dst=0; dst< table_size; dst++) {
xbt_dynar_reset(route->link_list);
xbt_dynar_foreach(links, cpt, link) {
xbt_dynar_unshift(route->link_list, &link);
if (lat)
- *lat += dynamic_cast<NetworkCm02LinkPtr>(static_cast<ResourcePtr>(link))->getLatency();
+ *lat += static_cast<NetworkLinkPtr>(link)->getLatency();
}
}
xbt_dynar_foreach(links, cpt, link) {
xbt_dynar_insert_at(route->link_list, pos, &link);
if (lat)
- *lat += dynamic_cast<NetworkCm02LinkPtr>(static_cast<ResourcePtr>(link))->getLatency();
+ *lat += static_cast<NetworkLinkPtr>(link)->getLatency();
pos++;
}
}
xbt_dynar_foreach(links, cpt, link) {
xbt_dynar_unshift(route->link_list, &link);
if (lat)
- *lat += dynamic_cast<NetworkCm02LinkPtr>(static_cast<ResourcePtr>(link))->getLatency();
+ *lat += static_cast<NetworkLinkPtr>(link)->getLatency();
}
size++;
}
/* Creation routing model functions */
-AsDijkstra::AsDijkstra() : AsGeneric(), m_cached(0) {}
+AsDijkstra::AsDijkstra() : AsGeneric(), m_cached(0) {
+ p_routeGraph = NULL;
+ p_graphNodeMap = NULL;
+ p_routeCache = NULL;
+}
AsDijkstra::AsDijkstra(int cached) : AsGeneric(), m_cached(cached)
{
+ p_routeGraph = NULL;
+ p_graphNodeMap = NULL;
+ p_routeCache = NULL;
/*new_component->generic_routing.parse_route = model_dijkstra_both_parse_route;
new_component->generic_routing.parse_ASroute = model_dijkstra_both_parse_route;
new_component->generic_routing.get_route_and_latency = dijkstra_get_route_and_latency;
if(!p_graphNodeMap)
p_graphNodeMap = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
- if (m_cached && p_routeCache)
+ if (m_cached && !p_routeCache)
p_routeCache = xbt_dict_new_homogeneous(&route_cache_elem_free);
/* Add the loopback if needed */