49,61c49,53
< // Helper functions based on chapter 29 of Cormen et al.
< void extend_shortest_path(Matrix& current_dist, Matrix& latencies,
< Matrix& inter_switches);
< Matrix shortest_path(const Matrix& weights, Matrix& latencies,
< Matrix& inter_switches);
< bool link_is_shortest_path_to_node(SwitchID src, SwitchID next,
< SwitchID final, const Matrix& weights, const Matrix& dist);
< NetDest shortest_path_to_node(SwitchID src, SwitchID next,
< const Matrix& weights, const Matrix& dist);
<
< Topology::Topology(uint32_t num_routers, vector<BasicExtLink *> ext_links,
< vector<BasicIntLink *> int_links)
< : m_number_of_switches(num_routers)
---
> Topology::Topology(uint32_t num_routers,
> const vector<BasicExtLink *> &ext_links,
> const vector<BasicIntLink *> &int_links)
> : m_nodes(ext_links.size()), m_number_of_switches(num_routers),
> m_ext_link_vector(ext_links), m_int_link_vector(int_links)
63,67d54
<
< // initialize component latencies record
< m_component_latencies.resize(0);
< m_component_inter_switches.resize(0);
<
69,70d55
< // Must make sure this is called after the State Machine constructors
< m_nodes = MachineType_base_number(MachineType_NUM);
73,77d57
< if (m_nodes != ext_links.size()) {
< fatal("m_nodes (%d) != ext_links vector length (%d)\n",
< m_nodes, ext_links.size());
< }
<
88,90d67
< // Store the ExtLink pointers for later
< m_ext_link_vector.push_back(ext_link);
<
136d112
< Matrix topology_weights;
138,140c114,119
< topology_weights.resize(num_switches);
< m_component_latencies.resize(num_switches);
< m_component_inter_switches.resize(num_switches);
---
> Matrix topology_weights(num_switches,
> vector<int>(num_switches, INFINITE_LATENCY));
> Matrix component_latencies(num_switches,
> vector<int>(num_switches, -1));
> Matrix component_inter_switches(num_switches,
> vector<int>(num_switches, 0));
142,158d120
< for (int i = 0; i < topology_weights.size(); i++) {
< topology_weights[i].resize(num_switches);
< m_component_latencies[i].resize(num_switches);
< m_component_inter_switches[i].resize(num_switches);
<
< for (int j = 0; j < topology_weights[i].size(); j++) {
< topology_weights[i][j] = INFINITE_LATENCY;
<
< // initialize to invalid values
< m_component_latencies[i][j] = -1;
<
< // initially assume direct connections / no intermediate
< // switches between components
< m_component_inter_switches[i][j] = 0;
< }
< }
<
171c133
< m_component_latencies[src][dst] = link->m_latency;
---
> component_latencies[src][dst] = link->m_latency;
176,177c138,140
< Matrix dist = shortest_path(topology_weights, m_component_latencies,
< m_component_inter_switches);
---
> Matrix dist = shortest_path(topology_weights, component_latencies,
> component_inter_switches);
>
246,247c209,210
< extend_shortest_path(Matrix& current_dist, Matrix& latencies,
< Matrix& inter_switches)
---
> Topology::extend_shortest_path(Matrix &current_dist, Matrix &latencies,
> Matrix &inter_switches)
284c247,248
< shortest_path(const Matrix& weights, Matrix& latencies, Matrix& inter_switches)
---
> Topology::shortest_path(const Matrix &weights, Matrix &latencies,
> Matrix &inter_switches)
292,293c256,258
< link_is_shortest_path_to_node(SwitchID src, SwitchID next, SwitchID final,
< const Matrix& weights, const Matrix& dist)
---
> Topology::link_is_shortest_path_to_node(SwitchID src, SwitchID next,
> SwitchID final, const Matrix &weights,
> const Matrix &dist)
299,300c264,265
< shortest_path_to_node(SwitchID src, SwitchID next, const Matrix& weights,
< const Matrix& dist)
---
> Topology::shortest_path_to_node(SwitchID src, SwitchID next,
> const Matrix &weights, const Matrix &dist)