OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::Router Class Reference

Top-level routing orchestrator. More...

#include <Routing.hpp>

Collaboration diagram for openswmm::Router:

Public Member Functions

void init (SimulationContext &ctx, RouteModel model)
 Initialise the router for the given model.
 
int step (SimulationContext &ctx, double dt, double evap_rate=0.0, dynwave::DWSolver::NonConduitFlowFunc non_conduit_fn=nullptr)
 Execute one routing timestep.
 
double getAdaptiveStep (SimulationContext &ctx, double fixed_step, double courant)
 Compute adaptive timestep (DW only).
 
const XSectGroupsxsectGroups () const
 Access the shape-grouped xsect manager.
 
bool hasCycle () const
 
void setDWNumThreads (int n, std::vector< std::string > *warnings=nullptr)
 Set the DWSolver OpenMP thread count (delegates to DWSolver::setNumThreads).
 
dynwave::DWSolverdwSolver ()
 Access the DW solver (for non-conduit node state scatter).
 
void setStructureSolver (hydstruct::StructureSolver *s)
 
bool lastStepConverged () const
 
const fv::INetworkSolverfvSolver () const
 
const fv::NetworkMeshDatafvMesh () const
 The FV mesh built at init (empty unless FLOW_ROUTING FV).
 
const std::string & fvBackend () const
 Backend label chosen by the FV factory ("cpu (...)", "omp (...)", ...).
 
const std::vector< std::string > & fvWarnings () const
 
const std::vector< std::string > & fvErrors () const
 

Detailed Description

Top-level routing orchestrator.

Owns the XSectGroups (shape-grouped batch xsect), KWSolver, and DWSolver. Initialised once after the model is built; then step() is called each routing timestep.

Member Function Documentation

◆ dwSolver()

dynwave::DWSolver & openswmm::Router::dwSolver ( )
inline

Access the DW solver (for non-conduit node state scatter).

◆ fvBackend()

const std::string & openswmm::Router::fvBackend ( ) const
inline

Backend label chosen by the FV factory ("cpu (...)", "omp (...)", ...).

◆ fvErrors()

const std::vector< std::string > & openswmm::Router::fvErrors ( ) const
inline

◆ fvMesh()

const fv::NetworkMeshData & openswmm::Router::fvMesh ( ) const
inline

The FV mesh built at init (empty unless FLOW_ROUTING FV).

◆ fvSolver()

const fv::INetworkSolver * openswmm::Router::fvSolver ( ) const
inline

Access the FV solver (null unless FLOW_ROUTING FV). Used by the report plugin for the "FV Solver Statistics" block and by the tests.

◆ fvWarnings()

const std::vector< std::string > & openswmm::Router::fvWarnings ( ) const
inline

Diagnostics accumulated while building the FV mesh; the caller surfaces them through ctx.warnings / ctx.errors.

◆ getAdaptiveStep()

double openswmm::Router::getAdaptiveStep ( SimulationContext & ctx,
double fixed_step,
double courant )

Compute adaptive timestep (DW only).

Parameters
ctxSimulation context.
fixed_stepUser-specified routing step.
courantCourant factor target (0 = use fixed).
Returns
Adaptive timestep (seconds).
Here is the call graph for this function:

◆ hasCycle()

bool openswmm::Router::hasCycle ( ) const
inline

Gap #44: true if a routing cycle was detected during the last init(). For KW/STEADY routing only (DW does not toposort).

◆ init()

void openswmm::Router::init ( SimulationContext & ctx,
RouteModel model )

Initialise the router for the given model.

Builds XSectGroups from the link cross-sections, initialises the KW and/or DW solver working arrays.

Parameters
ctxSimulation context (must have links/nodes populated).
modelRouting model selection.
Here is the call graph for this function:

◆ lastStepConverged()

bool openswmm::Router::lastStepConverged ( ) const
inline

Whether the most recent step() converged. DYNWAVE returns the solver's real final Picard flag; other models always converge (legacy only tracks dynwave non-convergence). FV has no convergence loop at all — that is a property of the scheme, not an omission. Feeds the "% of Steps Not Converging" stat.

◆ setDWNumThreads()

void openswmm::Router::setDWNumThreads ( int n,
std::vector< std::string > * warnings = nullptr )
inline

Set the DWSolver OpenMP thread count (delegates to DWSolver::setNumThreads).

◆ setStructureSolver()

void openswmm::Router::setStructureSolver ( hydstruct::StructureSolver * s)
inline

Supply the structure solver used to evaluate pump/orifice/weir/outlet discharge. DYNWAVE/FV get theirs through the non_conduit_fn callback, but KINWAVE/STEADY evaluate structures inline (legacy getLinkInflow), so they need the solver itself. Must be set before the first step().

◆ step()

int openswmm::Router::step ( SimulationContext & ctx,
double dt,
double evap_rate = 0.0,
dynwave::DWSolver::NonConduitFlowFunc non_conduit_fn = nullptr )

Execute one routing timestep.

Parameters
ctxSimulation context (modified in place).
dtRouting timestep (seconds).
evap_rateCurrent evaporation rate (ft/sec), from climate module.
Returns
Number of solver iterations used.
Here is the call graph for this function:

◆ xsectGroups()

const XSectGroups & openswmm::Router::xsectGroups ( ) const
inline

Access the shape-grouped xsect manager.


The documentation for this class was generated from the following files: