10 #include "../stdafx.h"
13 #include "../safeguards.h"
21 for (NodeID node_id = 0; node_id < job.
Size(); ++node_id) {
22 Node &prev_node = job[node_id];
23 StationID prev = prev_node.base.
station;
24 for (
const Path *path : prev_node.paths) {
28 StationID via = node.base.
station;
29 StationID origin = job[path->
GetOrigin()].base.station;
30 assert(prev != via && via != origin);
32 node.flows.AddFlow(origin, via, flow);
36 prev_node.flows.PassOnFlow(origin, via, flow);
39 prev_node.flows.AddFlow(origin, via, flow);
44 for (NodeID node_id = 0; node_id < job.
Size(); ++node_id) {
46 Node &node = job[node_id];
54 for (
auto &it : flows) {
55 it.second.ScaleToMonthly(runtime.base());
59 for (
Path *i : node.paths)
delete i;
void Run(LinkGraphJob &job) const override
Map the paths generated by the MCF solver into flows associated with nodes.
const bool scale
Whether the flow mapper should scale all flows to monthly values.
Flow descriptions by origin stations.
void FinalizeLocalConsumption(StationID self)
Subtract invalid flows from locally consumed flow.
Class for calculation jobs to be run on link graphs.
const LinkGraphSettings & Settings() const
Get the link graph settings for this component.
TimerGameEconomy::Date JoinDate() const
Get the date when the job should be finished.
TimerGameEconomy::Date LastCompression() const
Get the date when the underlying link graph was last compressed.
NodeID Size() const
Get the size of the underlying link graph.
A leg of a path in the link graph.
NodeID GetOrigin() const
Get the overall origin of the path.
uint GetFlow() const
Get the flow on this leg.
NodeID GetNode() const
Get the node this leg passes.
static constexpr int SECONDS_PER_DAY
approximate seconds per day, not for precise calculations
Declaration of flow mapper; maps paths into flows at nodes.
uint16_t recalc_time
time (in days) for recalculating each link graph component.
StationID station
Station ID.