Skip to content

Commit 3e16890

Browse files
committed
Fix
1 parent 7c22984 commit 3e16890

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

examples/slow_charge_rb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ int main(int argc, char** argv) {
124124
Unit n{0};
125125
{
126126
std::vector<Unit> destinationNodes;
127-
for (auto nodeId{0}; nodeId < graph.nNodes(); ++nodeId) {
127+
for (auto nodeId{0}; nodeId < dynamics.graph().nNodes(); ++nodeId) {
128128
if (degreeVector[nodeId] < 4) {
129129
destinationNodes.push_back(nodeId);
130130
++n;

examples/slow_charge_tl.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ int main(int argc, char** argv) {
9696
graph.importCoordinates(IN_COORDS);
9797
std::cout << "Setting street parameters..." << '\n';
9898
graph.buildAdj();
99-
const auto dv = graph.adjMatrix().getOutDegreeVector();
10099

101100
// graph.addStreet(Street(100002, std::make_pair(0, 108)));
102101
// graph.addStreet(Street(100003, std::make_pair(108, 0)));
@@ -162,8 +161,7 @@ int main(int argc, char** argv) {
162161
std::cerr << "Street " << id << " is not a spire.\n";
163162
}
164163
}
165-
const auto& adj = graph.adjMatrix();
166-
const auto& degreeVector = adj.getOutDegreeVector();
164+
auto const degreeVector = graph.adjMatrix().getOutDegreeVector();
167165
// create gaussian random number generator
168166
std::random_device rd;
169167
std::mt19937 gen(rd());
@@ -180,13 +178,11 @@ int main(int argc, char** argv) {
180178
while (value < 0.) {
181179
value = random();
182180
}
183-
const auto& col = adj.getCol(nodeId);
181+
const auto& col = graph.adjMatrix().getCol(nodeId);
184182
std::set<Unit> streets;
185-
const auto& refLat =
186-
node->coords().value().first;
183+
const auto& refLat = node->coords().value().first;
187184
for (const auto& id : col) {
188-
const auto& lat =
189-
graph.node(id)->coords().value().first;
185+
const auto& lat = graph.node(id)->coords().value().first;
190186
// std::cout << "Lat: " << lat << " RefLat: " << refLat << '\n';
191187
if (lat == refLat) {
192188
streets.emplace(id * graph.nNodes() + nodeId);
@@ -212,6 +208,7 @@ int main(int argc, char** argv) {
212208
std::cout << "Creating dynamics...\n";
213209

214210
Dynamics dynamics{graph, true, SEED, 0.6};
211+
auto const& adj{dynamics.graph().adjMatrix()};
215212
Unit n{0};
216213
{
217214
std::vector<Unit> destinationNodes;

0 commit comments

Comments
 (0)