-
Notifications
You must be signed in to change notification settings - Fork 4
Partially parallelize evolve function
#273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #273 +/- ##
==========================================
- Coverage 90.66% 90.57% -0.09%
==========================================
Files 36 36
Lines 5086 5084 -2
Branches 460 459 -1
==========================================
- Hits 4611 4605 -6
- Misses 475 479 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/dsm/headers/RoadDynamics.hpp
Outdated
|
|
||
| protected: | ||
| std::vector<std::pair<double, double>> m_travelDTs; | ||
| tbb::concurrent_vector<std::pair<double, double>> m_travelDTs; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
src/dsm/headers/RoadDynamics.hpp
Outdated
| continue; | ||
| return; | ||
| } | ||
| assert(srcNode->id() == nextStreet->nodePair().first); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.5 rule Note
src/dsm/headers/RoadDynamics.hpp
Outdated
| const auto& pNode = nodes.at(i); | ||
| for (auto const& sourceId : | ||
| this->m_graph.adjacencyMatrix().getCol(pNode->id())) { | ||
| auto const streetId = sourceId * N + pNode->id(); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
| auto const streetId = sourceId * N + pNode->id(); | ||
| auto const& pStreet = this->m_graph.edge(streetId); | ||
|
|
||
| if (bUpdateData) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
| auto const streetId = sourceId * N + pNode->id(); | ||
| auto const& pStreet = this->m_graph.edge(streetId); | ||
|
|
||
| if (bUpdateData) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 13.1 rule Note
| // Evolve the node based on its transport capacity. | ||
| for (auto j = 0; j < pNode->transportCapacity(); ++j) { | ||
| this->m_evolveNode(pNode); | ||
| } |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
| for (auto j = 0; j < pNode->transportCapacity(); ++j) { | ||
| this->m_evolveNode(pNode); | ||
| } | ||
|
|
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 13.1 rule Note
src/dsm/headers/RoadDynamics.hpp
Outdated
| } | ||
| std::discrete_distribution<size_t> laneDist{weights.begin(), | ||
| weights.end()}; | ||
| street->enqueue(agentId, laneDist(this->m_generator)); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.1 rule Note
src/dsm/headers/RoadDynamics.hpp
Outdated
| street->enqueue(agentId, nLanes - 1); // Always the last lane | ||
| } | ||
| } else { // U turn | ||
| // Normalize the weights |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.5 rule Note
| auto& roundabout = dynamic_cast<Roundabout&>(*srcNode); | ||
| roundabout.enqueue(agentId); | ||
| } | ||
| pAgent->setNextStreetId(nextStreet->id()); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
| pAgent->setSpeed(0.); | ||
| } | ||
| pAgent->incrementTime(); | ||
| } |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
| requires(is_numeric_v<delay_t>) | ||
| void RoadDynamics<delay_t>::evolve(bool reinsert_agents) { | ||
| // move the first agent of each street queue, if possible, putting it in the next node | ||
| bool const bUpdateData = |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
src/dsm/headers/RoadDynamics.hpp
Outdated
| bool const bUpdateData = | ||
| m_dataUpdatePeriod.has_value() && this->m_time % m_dataUpdatePeriod.value() == 0; | ||
| auto const N{this->m_graph.nNodes()}; | ||
| std::for_each(this->m_graph.nodes().cbegin(), |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
No description provided.