A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
NetCardImpl: automatic and ignorable field renamings
[simgrid.git]
/
src
/
surf
/
surf_routing_dijkstra.cpp
diff --git
a/src/surf/surf_routing_dijkstra.cpp
b/src/surf/surf_routing_dijkstra.cpp
index
31d603f
..
ccdeaad
100644
(file)
--- a/
src/surf/surf_routing_dijkstra.cpp
+++ b/
src/surf/surf_routing_dijkstra.cpp
@@
-4,8
+4,9
@@
/* 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. */
/* 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 "surf_routing_dijkstra.hpp"
-#include "network_interface.hpp"
+#include "src/surf/surf_routing_private.hpp"
+#include "src/surf/surf_routing_dijkstra.hpp"
+#include "src/surf/network_interface.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf -- dijkstra routing logic");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf -- dijkstra routing logic");
@@
-43,41
+44,36
@@
AS_t model_dijkstracache_create(void){
return new simgrid::surf::AsDijkstra(1);
}
return new simgrid::surf::AsDijkstra(1);
}
-void model_dijkstra_both_end(AS_t as)
-{
- simgrid::surf::AsDijkstra *THIS_AS
- = static_cast<simgrid::surf::AsDijkstra*>(as);
- xbt_node_t node = NULL;
- unsigned int cursor2;
- xbt_dynar_t nodes = NULL;
+/* Utility functions */
+namespace simgrid {
+namespace surf {
+void AsDijkstra::Seal()
+{
/* Create the topology graph */
/* Create the topology graph */
- if(!
THIS_AS->
p_routeGraph)
-
THIS_AS->
p_routeGraph = xbt_graph_new_graph(1, NULL);
- if(!
THIS_AS->
p_graphNodeMap)
-
THIS_AS->
p_graphNodeMap = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
+ if(!p_routeGraph)
+ p_routeGraph = xbt_graph_new_graph(1, NULL);
+ if(!p_graphNodeMap)
+ p_graphNodeMap = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
- if (
THIS_AS->m_cached && !THIS_AS->
p_routeCache)
-
THIS_AS->
p_routeCache = xbt_dict_new_homogeneous(&route_cache_elem_free);
+ if (
m_cached && !
p_routeCache)
+ p_routeCache = xbt_dict_new_homogeneous(&route_cache_elem_free);
/* Add the loopback if needed */
/* Add the loopback if needed */
- if (routing_platf->p_loopback &&
as->
p_hierarchy == SURF_ROUTING_BASE)
-
THIS_AS->
addLoopback();
+ if (routing_platf->p_loopback && p_hierarchy == SURF_ROUTING_BASE)
+ addLoopback();
/* initialize graph indexes in nodes after graph has been built */
/* initialize graph indexes in nodes after graph has been built */
-
nodes = xbt_graph_get_nodes(THIS_AS->
p_routeGraph);
+
xbt_dynar_t nodes = xbt_graph_get_nodes(
p_routeGraph);
+ xbt_node_t node = NULL;
+ unsigned int cursor2;
xbt_dynar_foreach(nodes, cursor2, node) {
graph_node_data_t data = (graph_node_data_t) xbt_graph_node_get_data(node);
data->graph_id = cursor2;
}
}
xbt_dynar_foreach(nodes, cursor2, node) {
graph_node_data_t data = (graph_node_data_t) xbt_graph_node_get_data(node);
data->graph_id = cursor2;
}
}
-/* Utility functions */
-
-namespace simgrid {
-namespace surf {
-
xbt_node_t AsDijkstra::routeGraphNewNode(int id, int graph_id)
{
xbt_node_t node = NULL;
xbt_node_t AsDijkstra::routeGraphNewNode(int id, int graph_id)
{
xbt_node_t node = NULL;
@@
-92,7
+88,7
@@
xbt_node_t AsDijkstra::routeGraphNewNode(int id, int graph_id)
elm = xbt_new0(struct graph_node_map_element, 1);
elm->node = node;
xbt_dict_set_ext(p_graphNodeMap, (char *) (&id), sizeof(int),
elm = xbt_new0(struct graph_node_map_element, 1);
elm->node = node;
xbt_dict_set_ext(p_graphNodeMap, (char *) (&id), sizeof(int),
- (xbt_
set_
elm_t) elm, NULL);
+ (xbt_
dict
elm_t) elm, NULL);
return node;
}
return node;
}
@@
-175,7
+171,7
@@
void AsDijkstra::addLoopback() {
}
}
}
}
-xbt_dynar_t AsDijkstra::getOne
l
inkRoutes()
+xbt_dynar_t AsDijkstra::getOne
L
inkRoutes()
{
xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
{
xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
@@
-390,7
+386,7
@@
void AsDijkstra::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_c
elm->pred_arr = pred_arr;
elm->size = size;
xbt_dict_set_ext(p_routeCache, (char *) (&src_id), sizeof(int),
elm->pred_arr = pred_arr;
elm->size = size;
xbt_dict_set_ext(p_routeCache, (char *) (&src_id), sizeof(int),
- (xbt_
set_
elm_t) elm, NULL);
+ (xbt_
dict
elm_t) elm, NULL);
}
if (!m_cached)
}
if (!m_cached)
@@
-408,13
+404,10
@@
AsDijkstra::~AsDijkstra()
/* Creation routing model functions */
/* Creation routing model functions */
-AsDijkstra::AsDijkstra() : AsGeneric(), m_cached(0) {
- p_routeGraph = NULL;
- p_graphNodeMap = NULL;
- p_routeCache = NULL;
+AsDijkstra::AsDijkstra() : AsGeneric() {
}
}
-AsDijkstra::AsDijkstra(
int
cached) : AsGeneric(), m_cached(cached)
+AsDijkstra::AsDijkstra(
bool
cached) : AsGeneric(), m_cached(cached)
{
p_routeGraph = NULL;
p_graphNodeMap = NULL;
{
p_routeGraph = NULL;
p_graphNodeMap = NULL;
@@
-437,7
+430,7
@@
void AsDijkstra::end()
/* Create the topology graph */
if(!p_routeGraph)
/* Create the topology graph */
if(!p_routeGraph)
-
p_routeGraph = xbt_graph_new_graph(1, NULL);
+ p_routeGraph = xbt_graph_new_graph(1, NULL);
if(!p_graphNodeMap)
p_graphNodeMap = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
if(!p_graphNodeMap)
p_graphNodeMap = xbt_dict_new_homogeneous(&graph_node_map_elem_free);