![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Owned mixed degree-day/UEB snow on remaining mesh weather footprints. Geometry area is horizontal m2; cell slope/aspect are degrees. Water accounts are m3, energy kJ, point energy kJ/m2 and rates m/s. One owner serializes all mutation, borrowing and checkpoint/contact calls. Trial advance protects this snow owner, while shared context weather cursors/diagnostics can still change. Physical ground heat, cover-geometry energy and prescribed energy stay distinct. More...
#include <MeshSnow.hpp>
Public Member Functions | |
| std::string | initialize (SimulationContext &context, const std::vector< MeshSnowGeometry > &geometry) |
| Build a candidate mixed mesh snow owner from resolved authored assignment scopes. | |
| std::string | advance (SimulationContext &context, double start, double end, const std::vector< double > &precipitation_ms, const std::vector< double > &snow_catch) |
| Trial a contiguous interval, publishing internal snow state only after success. | |
| std::string | setGroundContactMask (const std::vector< unsigned char > &mask) |
| Install reciprocal ground-contact ownership for assigned UEB cells. | |
| std::string | applyGroundContactEnergy (int cell, double soil_j) |
| Apply an accepted reciprocal soil energy receipt to one covered-point owner. | |
| std::string | saveCheckpoint () const |
| Copy this owner and encode a native version-four accepted/predicted snapshot. | |
| std::string | restoreCheckpoint (const std::string &bytes, bool seed=false) |
| Validate a native mesh-snow archive into a private candidate then publish it. | |
| bool | active () const |
| Test whether any nonzero assigned snow weather footprint is owned. | |
| bool | hasUeb () const |
| Scan active cells for at least one UEB model owner. | |
| bool | owns (int cell) const |
| Test resolved snowpack ownership for one indexed mesh cell. | |
| double | completedEnd () const |
| Read the accepted snow-source frontier. | |
| double | lastSeconds () const |
| Read the latest ordinary accepted advance duration. | |
| SnowKind | kind (int cell) const |
| Read stored model kind for one allocated cell row. | |
| const std::array< double, 10 > & | depletionCurve () const |
| Borrow owned snow metadata/state without copying it. | |
| const std::vector< double > & | liquidRates () const |
| Borrow owned snow metadata/state without copying it. | |
| const std::vector< double > & | exposedFractions () const |
| Borrow owned snow metadata/state without copying it. | |
| void | useAcceptedExposure () |
| Replace ET exposure for active cells by one minus accepted endpoint cover. Does not advance snow or alter output cover/water/predictions. Used during split source operators where the previously stored interval-average exposure is unsuitable; inactive/unowned rows remain unchanged. Serialize with source/thermal evaluation. | |
| void | reanchorCompletedEnd (double end) |
| Adopt only an ulp-sized driver endpoint change without advancing physics. | |
| const std::string & | configurationIdentity () const |
| Borrow owned snow metadata/state without copying it. | |
| const std::vector< MeshSnowGeometry > & | geometry () const |
| Borrow owned snow metadata/state without copying it. | |
| const std::vector< SnowOutputs > & | outputs () const |
| Borrow owned snow metadata/state without copying it. | |
| const std::vector< MeshSnowLedger > & | ledgers () const |
| Borrow owned snow metadata/state without copying it. | |
| bool | groundContactEnabled (int cell) const |
| Test the stored per-cell reciprocal contact bit. | |
| double | groundContactFraction (int cell) const |
| Read accepted endpoint cover for the next reciprocal thermal interval. | |
| double | groundContactSurfaceTemperature (int cell) const |
| Read the latest stored cell snow surface temperature. | |
| const std::vector< unsigned char > & | groundContactMask () const |
| Borrow owned snow metadata/state without copying it. | |
| const std::vector< ueb::HeldState > & | columns () const |
| Borrow owned snow metadata/state without copying it. | |
Friends | |
| class | openswmm::twoD::CommonSourceStage |
Owned mixed degree-day/UEB snow on remaining mesh weather footprints. Geometry area is horizontal m2; cell slope/aspect are degrees. Water accounts are m3, energy kJ, point energy kJ/m2 and rates m/s. One owner serializes all mutation, borrowing and checkpoint/contact calls. Trial advance protects this snow owner, while shared context weather cursors/diagnostics can still change. Physical ground heat, cover-geometry energy and prescribed energy stay distinct.
|
inline |
Test whether any nonzero assigned snow weather footprint is owned.
| std::string openswmm::surface::MeshSnow::advance | ( | SimulationContext & | context, |
| double | start, | ||
| double | end, | ||
| const std::vector< double > & | precipitation_ms, | ||
| const std::vector< double > & | snow_catch ) |
Trial a contiguous interval, publishing internal snow state only after success.
| [in,out] | context | Matching initialized weather/configuration/forcing; shared lookup cursors and climate_state.radiation may change even if snow trial fails. Does not update global simulation time or book external mesh water/thermal stores. |
| start | Finite elapsed seconds exactly equal completedEnd(). | |
| end | Finite elapsed endpoint strictly after start, within weather/simulation coverage. | |
| precipitation_ms | One finite nonnegative held raw precipitation m/s per mesh cell; active entries checked. Snow catch/UEB drift can change effective volume. | |
| snow_catch | Same-sized finite nonnegative catch factors; active entries checked. |
| std::string openswmm::surface::MeshSnow::applyGroundContactEnergy | ( | int | cell, |
| double | soil_j ) |
Apply an accepted reciprocal soil energy receipt to one covered-point owner.
| cell | Valid assigned UEB cell with enabled ground-contact mask; checked here. |
| soil_j | Finite signed joules into soil; snow receives -soil_j. Zero is a no-op after owner validation. Uses horizontal area times accepted cover (one if snow-free) to convert to point kJ/m2; no water/cover change. |
|
inline |
Borrow owned snow metadata/state without copying it.
|
inline |
Read the accepted snow-source frontier.
|
inline |
Borrow owned snow metadata/state without copying it.
|
inline |
Borrow owned snow metadata/state without copying it.
|
inline |
Borrow owned snow metadata/state without copying it.
|
inline |
Borrow owned snow metadata/state without copying it.
|
inline |
Test the stored per-cell reciprocal contact bit.
| cell | Zero-based row; invalid returns false. |
|
inline |
Read accepted endpoint cover for the next reciprocal thermal interval.
| cell | Cell index; disabled/invalid contact returns zero before output lookup. |
|
inline |
Borrow owned snow metadata/state without copying it.
|
inline |
Read the latest stored cell snow surface temperature.
| cell | Zero-based allocated output index, checked by vector::at(). |
| std::out_of_range | Invalid index. |
|
inline |
Scan active cells for at least one UEB model owner.
| std::string openswmm::surface::MeshSnow::initialize | ( | SimulationContext & | context, |
| const std::vector< MeshSnowGeometry > & | geometry ) |
Build a candidate mixed mesh snow owner from resolved authored assignment scopes.
| context | Compatible initialized global/mesh snow, named pack/pervious rows, weather identity and valid project units; read here without advancing climate time. |
| geometry | One indexed horizontal weather footprint m2 per mesh cell, with tag and slope/aspect degrees. Count/products must fit int. Assigned nonzero-area cells require finite positive area, slope[0,90) and aspect[0,360]; skipped/unassigned cells are not fully geometry-qualified. Tag/default/cell rows can override slope/aspect. |
|
inline |
Read stored model kind for one allocated cell row.
| cell | Zero-based row, checked through vector::at(). |
| std::out_of_range | Invalid row. No pack/water/contact validation. |
|
inline |
Read the latest ordinary accepted advance duration.
|
inline |
Borrow owned snow metadata/state without copying it.
|
inline |
Borrow owned snow metadata/state without copying it.
|
inline |
Borrow owned snow metadata/state without copying it.
|
inline |
Test resolved snowpack ownership for one indexed mesh cell.
| cell | Zero-based index; invalid returns false. |
| void openswmm::surface::MeshSnow::reanchorCompletedEnd | ( | double | end | ) |
Adopt only an ulp-sized driver endpoint change without advancing physics.
| end | Finite nonnegative elapsed seconds within8*epsilon*max(1,abs(end),abs(old)). |
| std::invalid_argument | Larger/incompatible landing. On success changes only completed_, retaining lastSeconds, histories, held predictions, outputs and ledgers. |
| std::string openswmm::surface::MeshSnow::restoreCheckpoint | ( | const std::string & | bytes, |
| bool | seed = false ) |
Validate a native mesh-snow archive into a private candidate then publish it.
| bytes | Matching native version4/3/2 archive. Identity/model/geometry must match; old legacy identity is allowed only with all-one depletion curve. Version3/4 contact mask must match, and version2 cannot restore an enabled contact owner. Empty bytes clear owned inventory using the existing assignments and force seeding. |
| seed | True preserves restored water/thermal state but clears ledgers to new initial inventory, zeroes clocks/last flux/rates, closes future predictions and resets cached rain/catch. False restores exact clocks and pending held predictions. |
| std::string openswmm::surface::MeshSnow::saveCheckpoint | ( | ) | const |
Copy this owner and encode a native version-four accepted/predicted snapshot.
| std::string openswmm::surface::MeshSnow::setGroundContactMask | ( | const std::vector< unsigned char > & | mask | ) |
Install reciprocal ground-contact ownership for assigned UEB cells.
| mask | One byte per mesh cell, each zero/one; one requires owns(cell) and UEB. |
| void openswmm::surface::MeshSnow::useAcceptedExposure | ( | ) |
Replace ET exposure for active cells by one minus accepted endpoint cover. Does not advance snow or alter output cover/water/predictions. Used during split source operators where the previously stored interval-average exposure is unsuitable; inactive/unowned rows remain unchanged. Serialize with source/thermal evaluation.
|
friend |