SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
profilebuilder.cpp File Reference
#include "plot/profilebuilder.h"
#include <algorithm>
#include <cmath>
#include <limits>
Include dependency graph for profilebuilder.cpp:

Namespaces

namespace  ProfileBuilder
 

Functions

QVector< doubleProfileBuilder::computeChainage (const QVector< LinkStatic > &links)
 Computes cumulative chainage from the first node. chainage[0] = 0.0, chainage[i] = chainage[i-1] + links[i-1].length. Returns the populated array — does not mutate path.
 
double ProfileBuilder::groundElev (const NodeStatic &n)
 Returns the ground elevation at node i along the path. Equivalent to nodes[i].invertElev + nodes[i].maxDepth.
 
double ProfileBuilder::conduitInvertUpstream (const PathStatic &path, int linkIdx)
 Returns the conduit-invert elevation at the upstream end of link i along the path: nodes[i].invertElev + links[i].offset1.
 
double ProfileBuilder::conduitInvertDownstream (const PathStatic &path, int linkIdx)
 Symmetric to conduitInvertUpstream for the downstream end: nodes[i+1].invertElev + links[i].offset2.
 
double ProfileBuilder::velocityHead (const PathStatic &path, const SourceSeries &src, int nodeIdx, int period, double gravity)
 Velocity-head at node nodeIdx for the given source at period p, using the path-direction convention: head node uses downstream velocity only, tail node uses upstream only, interior nodes average the two incident links. Returns 0.0 if velocity data is missing or the period is out of range. Uses |v|.
 
double ProfileBuilder::eglAtPeriod (const PathStatic &path, const SourceSeries &src, int nodeIdx, int period, double gravity)
 Convenience: EGL at node nodeIdx, period p = HGL(nodeIdx, p) + velocityHead(nodeIdx, p, g).
 
Diagnostic ProfileBuilder::validate (const PathStatic &path, const SourceSeries &src)
 Sanity-checks a PathStatic + SourceSeries pair before compute(). Catches: empty path (< 2 nodes), links-count mismatch (must be nodes-1), mismatched series array sizes vs path size, zero report step on a non-empty series, etc.
 
SourceDerived ProfileBuilder::compute (const PathStatic &path, const SourceSeries &src, double gravity)
 Builds per-node HGL/EGL time-series and per-node envelope min/max for a single source. Assumes the input has passed validate(). Returns an empty SourceDerived on validation failure.
 
void ProfileBuilder::accumulatePeriod (const PathStatic &path, const SourceSeries &src, int p, double gravity, SourceDerived &out)
 The per-period kernel shared by compute() and appendPeriods(): fills period p's rows of out (which must already be sized and NaN-filled for p) and folds the values into the envelopes.
 
bool ProfileBuilder::appendPeriods (const PathStatic &path, const SourceSeries &src, double gravity, SourceDerived &derived)
 Live results: extend a SourceDerived built over the first derived.hglByPeriod.size() periods of src with the periods src has gained since. src must be the full (grown) series. Appends one period-major row per new period and updates the running envelopes; the result is identical to compute() over the whole series (both use accumulatePeriod). Returns false and leaves derived untouched when src does not validate, has fewer periods than derived, or derived is not a compute() of this path. A no-op success when nothing was appended.
 

Detailed Description