#include <RuntimeCoupling.hpp>
|
| RuntimeSource * | find (const std::string &id, int cell) |
| | Find a source prescription by its exact registry key.
|
| |
| const RuntimeSource * | find (const std::string &id, int cell) const |
| | Find a source prescription by its exact registry key.
|
| |
| void | rebuild (int count) |
| | Recreate enabled source-to-cell gather indices.
|
| |
| void | replace (RuntimeSource value) |
| | Upsert a source prescription while preserving accumulated receipts.
|
| |
| void | prune () noexcept |
| | Remove disabled row offsets from every cell gather list.
|
| |
| bool | clear (const std::string &id, int cell=-1) noexcept |
| | Disable one source-cell key or every cell belonging to a source id.
|
| |
| void | syncReceipts (const RuntimeSources &old) |
| | Copy matching accepted receipts into a staged source registry.
|
| |
| bool | active () const |
| | Test whether any retained runtime prescription is enabled.
|
| |
| double | nextTime (double now) const |
| | Find the next enabled prescription expiry strictly after now.
|
| |
| bool | expire (double now) |
| | Disable all enabled prescriptions whose expiry has been reached.
|
| |
|
| std::vector< RuntimeSource > | rows |
| |
| std::vector< std::vector< std::size_t > > | cells |
| |
| std::unordered_map< std::string, std::unordered_map< int, std::size_t > > | index |
| |
◆ active()
| bool openswmm::twoD::RuntimeSources::active |
( |
| ) |
const |
|
inline |
Test whether any retained runtime prescription is enabled.
- Returns
- True if at least one row.enabled is true, otherwise false. Expiry time is not inspected; expire() must run first for time-based status.
- Note
- Read-only, allocation-free; serialize with registry mutations.
◆ clear()
| bool openswmm::twoD::RuntimeSources::clear |
( |
const std::string & | id, |
|
|
int | cell = -1 ) |
|
inlinenoexcept |
Disable one source-cell key or every cell belonging to a source id.
- Parameters
-
| [in] | id | Borrowed exact source identifier. |
| [in] | cell | Nonnegative cell key to clear, or any negative value for all cells under id. |
- Returns
- False for an absent id/cell; true when a matching key exists, even if already disabled.
- Postcondition
- Removes disabled entries from gather lists, preserving rows/index/receipts for later reporting or replacement. Requires exclusive access; no allocation or exceptions.
◆ expire()
| bool openswmm::twoD::RuntimeSources::expire |
( |
double | now | ) |
|
|
inline |
Disable all enabled prescriptions whose expiry has been reached.
- Parameters
-
| [in] | now | Finite elapsed simulation time, seconds; until <= now expires. |
- Postcondition
- Keeps row identity and cumulative receipts; prunes disabled cell gather indices.
- Returns
- True when at least one enabled source was disabled; false otherwise.
- Note
- Requires exclusive registry access. No allocation or exceptions.
◆ find() [1/2]
| RuntimeSource * openswmm::twoD::RuntimeSources::find |
( |
const std::string & | id, |
|
|
int | cell ) |
|
inline |
Find a source prescription by its exact registry key.
- Parameters
-
| [in] | id | Borrowed case-sensitive source identifier. |
| [in] | cell | Zero-based source cell key; may identify a disabled retained row. |
- Returns
- Borrowed pointer into rows, or NULL when the key is absent. Pointer may be invalidated by vector growth, replacement or registry destruction; never free it.
- Precondition
- index matches rows. No allocation or mutation; serialize access with registry edits.
◆ find() [2/2]
| const RuntimeSource * openswmm::twoD::RuntimeSources::find |
( |
const std::string & | id, |
|
|
int | cell ) const |
|
inline |
Find a source prescription by its exact registry key.
- Parameters
-
| [in] | id | Borrowed case-sensitive source identifier. |
| [in] | cell | Zero-based source cell key; may identify a disabled retained row. |
- Returns
- Borrowed pointer into rows, or NULL when the key is absent. Pointer may be invalidated by vector growth, replacement or registry destruction; never free it.
- Precondition
- index matches rows. No allocation or mutation; serialize access with registry edits.
◆ nextTime()
| double openswmm::twoD::RuntimeSources::nextTime |
( |
double | now | ) |
const |
|
inline |
Find the next enabled prescription expiry strictly after now.
- Parameters
-
| [in] | now | Finite elapsed simulation time, seconds. |
- Returns
- Earliest enabled until > now in elapsed seconds, or positive infinity if none exists.
- Note
- Read-only; expired/equal-time rows are skipped without disabling them. No allocation; serialize with edits.
◆ prune()
| void openswmm::twoD::RuntimeSources::prune |
( |
| ) |
|
|
inlinenoexcept |
Remove disabled row offsets from every cell gather list.
- Precondition
- Cell offsets reference valid rows. Requires exclusive registry access.
- Postcondition
- rows, id/cell keys and all receipts remain intact; cell-list iterators may be invalidated. No allocation or exceptions.
◆ rebuild()
| void openswmm::twoD::RuntimeSources::rebuild |
( |
int | count | ) |
|
|
inline |
Recreate enabled source-to-cell gather indices.
- Parameters
-
| [in] | count | Nonnegative mesh cell count, in cells. |
- Precondition
- Every enabled row.cell lies in [0,count); rows/index are otherwise coherent.
- Postcondition
- Replaces cells with count vectors of enabled row offsets. Does not rebuild the id/cell index or clear receipts.
- Exceptions
-
| std::out_of_range | For an enabled cell outside count; partial cells may already be written. |
- Note
- May allocate/throw and invalidates cell-list references. Requires exclusive registry access; no rollback.
◆ replace()
| void openswmm::twoD::RuntimeSources::replace |
( |
RuntimeSource | value | ) |
|
|
inline |
Upsert a source prescription while preserving accumulated receipts.
- Parameters
-
| [in] | value | Owned draft with valid id/cell and transport tuple extent; moved into rows. |
- Postcondition
- Existing keys retain their receipt; new keys receive zeroed species receipt arrays sized to concentrations. Caller must rebuild cell gathers after changing placement/enabling.
- Note
- No validation is performed. Vector/map allocations may throw after index/receipt changes, so this low-level method is not transactional; edit a private draft when rollback is needed. Existing row pointers may be invalidated.
◆ syncReceipts()
| void openswmm::twoD::RuntimeSources::syncReceipts |
( |
const RuntimeSources & | old | ) |
|
|
inline |
Copy matching accepted receipts into a staged source registry.
- Parameters
-
| [in] | old | Borrowed prior registry with coherent index/rows; distinct from this registry when edits are in flight. |
- Postcondition
- Every matching (id,cell) receives the previous receipt, including species vectors; unmatched drafts remain unchanged.
- Note
- Allocations may throw after earlier rows were copied. No topology rebuild or input retention; caller publishes only a fully prepared private draft.
◆ cells
| std::vector<std::vector<std::size_t> > openswmm::twoD::RuntimeSources::cells |
◆ index
| std::unordered_map<std::string, std::unordered_map<int, std::size_t> > openswmm::twoD::RuntimeSources::index |
◆ rows
The documentation for this struct was generated from the following file: