#pragma once #include "Types.h" #include namespace diag { class NetworkModel; struct FlowResult { bool ok = false; QString message; QHash edgeFlow; // signed; positive flows from -> to }; // Mock flow-distribution calculation. Treats each relation network as a // resistor-style network: edge conductance derives from pipe diameter and // length, node injections from "supply"/"demand" properties. Solves nodal // balance (Kirchhoff) per connected component with dense Gaussian // elimination, so flow is conserved at every junction. class FlowSolver { public: static FlowResult solve(const NetworkModel& model, const QString& relationId); // Writes flows into the model (setEdgeFlow); edges of other relations keep theirs. static void apply(NetworkModel& model, const FlowResult& result); }; } // namespace diag