![]() |
OpenSWMM Engine
6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
|
Storage-shape raw parameters ⇄ area-relation coefficients, and the INP/GeoPackage keywords for each shape. More...
Go to the source code of this file.
Namespaces | |
| namespace | openswmm |
Functions | |
| constexpr bool | openswmm::storage_shape_is_geometric (StorageShape s) noexcept |
True when s is one of the four geometric shapes (i.e. its a/b/c are the quadratic coefficients, not TABULAR/FUNCTIONAL). | |
| bool | openswmm::storage_shape_params_valid (StorageShape s, double p1, double p2, double p3) noexcept |
| Validate raw shape parameters. | |
| bool | openswmm::storage_shape_coeffs (StorageShape s, double p1, double p2, double p3, double &a, double &b, double &c) noexcept |
| Derive the area-relation coefficients for a geometric shape. | |
| const char * | openswmm::storage_shape_keyword (StorageShape s) noexcept |
| Canonical INP/GeoPackage keyword for a shape. | |
| bool | openswmm::storage_shape_from_keyword (std::string_view kw, StorageShape &out) noexcept |
| Parse a shape keyword (caller upper-cases first). | |
| constexpr bool | openswmm::storage_shape_is_valid_code (int v) noexcept |
True when v is a valid StorageShape ordinal (C API boundary check). | |
Variables | |
| constexpr double | openswmm::kStoragePi = 3.141592653589793 |
| π to the precision legacy uses (src/legacy/engine/consts.h). | |
Storage-shape raw parameters ⇄ area-relation coefficients, and the INP/GeoPackage keywords for each shape.
Single source of truth for the shape math. Three call sites must never disagree about it — the INP parser (NodesHandler), the C API (openswmm_nodes_impl) and the GeoPackage reader — so the conversion lives here rather than being open-coded at each.
Users supply three raw parameters (p1, p2, p3 — lengths/slope); the solver evaluates the quadratic area relation A(d) = c + a*d + b*d². Legacy storage_readParams() (src/legacy/engine/node.c:713-752) derives a/b/c at parse time and then discards p1/p2/p3, which is why a legacy model cannot round-trip its own shape parameters. We keep the raw values in StorageData so .inp/.gpkg writes are lossless, and derive a/b/c here with the identical formulas.
Coefficient slots map to legacy names as: a ≡ a1, b ≡ a2, c ≡ a0.