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

#include <SourceWaterDeliveryBridge.hpp>

Collaboration diagram for openswmm::runoff::SourceWaterDeliveryBridge:

Public Member Functions

std::string initialize (const SourceWaterDriver &source)
 Attach whole-source ownership before any source/receiving advancement.
 
bool ownsSubcatch (int source) const
 Test whether a model subcatchment belongs to a captured source component.
 
const std::vector< int > & sourceGroups () const
 Borrow the original-subcatchment-to-source-group mapping.
 
std::string validateReceiver (const SimulationContext &context) const
 Check receiver node count and exact ordered node-name identity.
 
std::string capture (const SourceWaterDriver &source, double accepted_end)
 Queue newly completed source outlet records at an accepted receiver boundary.
 
std::string stage (double start, double end)
 Offer every pending receipt once over the next contiguous receiving interval.
 
std::string commit ()
 Accept the staged receiving interval and consume its pending source water.
 
void cancel ()
 Drop a receiving trial without consuming any accepted pending receipt. Leaves accepted clocks/totals/last receipts unchanged; safe without a trial. Invalidates receipts() borrows. Caller owns rollback of any private hydraulic trial.
 
const std::vector< SourceNodeDelivery > & receipts () const
 Borrow staged per-node water offers in receiver index order.
 
const std::vector< QueuedSourceDelivery > & pending () const
 Borrow the ordered captured-but-unconsumed delivery suffix.
 
const std::vector< SourceNodeDelivery > & received () const
 Borrow cumulative captured volumes per receiver node.
 
const std::vector< SourceNodeDelivery > & delivered () const
 Borrow cumulative volumes consumed by accepted receiving intervals.
 
const std::vector< SourceNodeDelivery > & lastReceipts () const
 Borrow exact receipts of the preceding accepted receiving interval.
 
double lastStart () const
 Read the previous accepted receiving interval's opening time.
 
double receiverEnd () const
 Read the accepted receiving frontier.
 
uint64_t capturedCount () const
 Read the length of the source delivery prefix captured by this bridge.
 
void checkpoint (detail::CompletedSourceArchive &archive, bool model, const SourceWaterDriver &source)
 Stream private same-platform identity or accepted delivery restart state.
 

Detailed Description

Internal water-only qualification boundary between completed spatial source graphs and hydraulic routing. Ownership covers whole weakly connected graphs. Capture publishes completed outlet volumes after an accepted receiving step; stage offers them once to the next step, at volume / receiving duration. Commit must follow hydraulic acceptance; cancel leaves every receipt pending. The explicit internal engine attachment suppresses duplicate ordinary runoff/LID kernels and pairs the bridge with engine/surface/source restart. This whole-copy bridge does not qualify production scheduling/performance.

Member Function Documentation

◆ cancel()

void openswmm::runoff::SourceWaterDeliveryBridge::cancel ( )
inline

Drop a receiving trial without consuming any accepted pending receipt. Leaves accepted clocks/totals/last receipts unchanged; safe without a trial. Invalidates receipts() borrows. Caller owns rollback of any private hydraulic trial.

◆ capture()

std::string openswmm::runoff::SourceWaterDeliveryBridge::capture ( const SourceWaterDriver & source,
double accepted_end )

Queue newly completed source outlet records at an accepted receiver boundary.

Parameters
sourceCompatible original driver with immutable previously captured prefix, no pending group trials and completed source horizons no later than accepted_end except relative 1e-12 roundoff. All records must carry positive finite ft3 water, valid owned source/node/interval and no pollutant mass.
accepted_endFinite elapsed seconds exactly equal receiverEnd(); a receiving trial must not be staged. Capture publishes availability for the next interval, not consumption in the already accepted step.
Returns
Empty on success, otherwise refusal/caught standard exception retaining bridge state. Copies/validates a candidate, recomputes model identity, complete prefix digest and per-node totals; does not consume pending or change receiver clock/source water. Repeated capture of an unchanged prefix adds no duplicates.
Here is the call graph for this function:

◆ capturedCount()

uint64_t openswmm::runoff::SourceWaterDeliveryBridge::capturedCount ( ) const
inline

Read the length of the source delivery prefix captured by this bridge.

Returns
Original record count, including pending and already consumed records; not volume, node count or number of receiving steps. Does not inspect live source.

◆ checkpoint()

void openswmm::runoff::SourceWaterDeliveryBridge::checkpoint ( detail::CompletedSourceArchive & archive,
bool model,
const SourceWaterDriver & source )

Stream private same-platform identity or accepted delivery restart state.

Parameters
[in,out]archiveMatching native CompletedSourceArchive reader/writer; byte order/schema are not portable interchange. Caller finishes archive validation before publishing restored engine/surface/source/bridge ownership together.
modelTrue writes version-two model identity/mapping only; reading model identity is refused. False streams version-two accepted state into a temporary.
sourceAlready prepared matching source with every completed outlet captured and every source group clock published at the bridge boundary.
Exceptions
std::runtime_errorUninitialized/staged bridge, wrong version/model/prefix, clock/order/shape/water closure or archive error. A failed read retains accepted bridge state; the archive cursor/output bytes can be partially consumed/written. Restore on a private bridge copy, validate the containing archive then publish all paired owners together. No receiving/source water is booked by this method.
Here is the call graph for this function:

◆ commit()

std::string openswmm::runoff::SourceWaterDeliveryBridge::commit ( )

Accept the staged receiving interval and consume its pending source water.

Returns
Empty after moving trial receipts into last, advancing receiverEnd and cumulative delivered totals, clearing pending/trial; refusal without an active trial. Does not verify hydraulic acceptance or book receiver water itself; caller must settle the corresponding hydraulic interval first. Invalidates trial and pending element borrows. No source advancement/capture is performed here.

◆ delivered()

const std::vector< SourceNodeDelivery > & openswmm::runoff::SourceWaterDeliveryBridge::delivered ( ) const
inline

Borrow cumulative volumes consumed by accepted receiving intervals.

Returns
Per-node runoff/drain ft3 totals with rate zero. Excludes staged offers until commit. Commit/checkpoint/replacement may invalidate element references.

◆ initialize()

std::string openswmm::runoff::SourceWaterDeliveryBridge::initialize ( const SourceWaterDriver & source)

Attach whole-source ownership before any source/receiving advancement.

Parameters
sourceCompatible initialized source driver with zero completed group clocks, no pending source trial or delivery history, named hydraulic nodes and resolved outlets for selected components. This bridge rejects pollutant-bearing sources; other source qualification remains the driver's responsibility.
Returns
Empty after publishing a prepared owned snapshot, otherwise refusal or caught standard-exception text, retaining the prior bridge. Reattachment is refused. Copies model-archive identity, node names, ownership and zero ledgers; retains no source pointer. Source identity/order must remain compatible later. Whole copies/hash validation are intentional qualification costs, not a claim of production scheduling performance. Serialize all bridge/source operations.
Here is the call graph for this function:

◆ lastReceipts()

const std::vector< SourceNodeDelivery > & openswmm::runoff::SourceWaterDeliveryBridge::lastReceipts ( ) const
inline

Borrow exact receipts of the preceding accepted receiving interval.

Returns
Per-node runoff/drain ft3 and held total cfs over [lastStart(),receiverEnd()]. Initially zero rows after initialization. Commit/checkpoint/replacement invalidates old elements; caller uses these for accepted held-rate continuity/report integration.

◆ lastStart()

double openswmm::runoff::SourceWaterDeliveryBridge::lastStart ( ) const
inline

Read the previous accepted receiving interval's opening time.

Returns
Elapsed seconds, zero initially. Meaningful with lastReceipts/receiverEnd; staging/cancel alone do not change it.

◆ ownsSubcatch()

bool openswmm::runoff::SourceWaterDeliveryBridge::ownsSubcatch ( int source) const

Test whether a model subcatchment belongs to a captured source component.

Parameters
sourceZero-based original subcatchment index.
Returns
True only when initialized and the stored mapping is nonnegative; false for invalid/unselected indices. Does not inspect current source water or clocks.

◆ pending()

const std::vector< QueuedSourceDelivery > & openswmm::runoff::SourceWaterDeliveryBridge::pending ( ) const
inline

Borrow the ordered captured-but-unconsumed delivery suffix.

Returns
Owned queue with original source interval/ft3, ordinal and availability seconds. Capture/commit/checkpoint/replacement can invalidate elements. Empty before initial capture or after successful consumption; read requires serialization.

◆ receipts()

const std::vector< SourceNodeDelivery > & openswmm::runoff::SourceWaterDeliveryBridge::receipts ( ) const

Borrow staged per-node water offers in receiver index order.

Returns
Trial vector of separate runoff/drain ft3 and total cfs, valid until cancel/commit/stage replacement/destruction. Never modify/free; copy as needed.
Exceptions
std::logic_errorNo active receiving trial. Does not consume/commit water.

◆ received()

const std::vector< SourceNodeDelivery > & openswmm::runoff::SourceWaterDeliveryBridge::received ( ) const
inline

Borrow cumulative captured volumes per receiver node.

Returns
Runoff/drain ft3 totals, rate fields zero. Capture/checkpoint/replacement can change storage; not staged/accepted hydraulic rates. Copy for a stable snapshot.

◆ receiverEnd()

double openswmm::runoff::SourceWaterDeliveryBridge::receiverEnd ( ) const
inline

Read the accepted receiving frontier.

Returns
Elapsed seconds, zero initially and advanced only by commit/restoration. A staged end is not exposed as accepted by this accessor.

◆ sourceGroups()

const std::vector< int > & openswmm::runoff::SourceWaterDeliveryBridge::sourceGroups ( ) const
inline

Borrow the original-subcatchment-to-source-group mapping.

Returns
Owned vector, -1 for unowned rows; empty before initialization. Valid until destruction; initialization/replacement invalidates elements. Caller keeps source model indices compatible and serializes access with state replacement.

◆ stage()

std::string openswmm::runoff::SourceWaterDeliveryBridge::stage ( double start,
double end )

Offer every pending receipt once over the next contiguous receiving interval.

Parameters
startFinite elapsed seconds exactly equal accepted receiverEnd().
endFinite later elapsed seconds with representable finite difference.
Returns
Empty after installing private per-node trial receipts and projected delivered totals, otherwise refusal/caught standard exception retaining accepted state. Rejects an existing trial. Runoff/drain remain separate ft3 volumes; total rate is volume/(end-start) in cfs. Does not mutate receiving hydraulics or consume pending. Caller applies these held rates, commits only after acceptance, or cancels.

◆ validateReceiver()

std::string openswmm::runoff::SourceWaterDeliveryBridge::validateReceiver ( const SimulationContext & context) const

Check receiver node count and exact ordered node-name identity.

Parameters
contextBorrowed initialized receiving context; node-name table matches count.
Returns
Empty on exact compatibility, otherwise diagnostic. Does not validate hydraulic geometry, physical state, flow/quality options or source ownership; no receiver/bridge mutation occurs.
Here is the call graph for this function:

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