![]() |
OpenSWMM Engine
6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
|
Namespaces | |
| namespace | detail |
Classes | |
| struct | DisplayUnits |
Enumerations | |
| enum | Quantity { RAINFALL = 0 , RAINDEPTH = 1 , EVAPRATE = 2 , LENGTH = 3 , LANDAREA = 4 , VOLUME = 5 , WINDSPEED = 6 , TEMPERATURE = 7 , MASS = 8 , GWFLOW = 9 , FLOW = 10 } |
Functions | |
| int | getUnitSystem (int flow_units) |
| Determine unit system (0=US, 1=SI) from flow units. | |
| double | UCF (int quantity, const SimulationOptions &opts) |
| Get unit conversion factor for a quantity. | |
| double | UCF_inv (int quantity, const SimulationOptions &opts) |
| Reciprocal of UCF — multiply display by this to get internal units. | |
Variables | |
| constexpr std::array< std::array< double, 2 >, 10 > | Ucf_inv = detail::makeUcfInv() |
| Reciprocal of Ucf[quantity][unit_system] — multiply display by this → internal. | |
| constexpr std::array< double, 6 > | Qcf_inv = detail::makeQcfInv() |
| Reciprocal of Qcf[flow_units] — multiply display flow by this → cfs. | |
| constexpr const char * | FlowUnitWords [6] |
| Legacy FlowUnitWords — index by FlowUnits enum (CFS,GPM,MGD,CMS,LPS,MLD). | |
| int openswmm::ucf::getUnitSystem | ( | int | flow_units | ) |
Determine unit system (0=US, 1=SI) from flow units.
CFS/GPM/MGD → US (0). CMS/LPS/MLD → SI (1).
| flow_units | FlowUnits enum value. |
| double openswmm::ucf::UCF | ( | int | quantity, |
| const SimulationOptions & | opts ) |
Get unit conversion factor for a quantity.
For non-flow quantities, returns Ucf[quantity][unit_system]. For FLOW, returns Qcf[flow_units].
To convert FROM project/display units TO internal units: internal = display / UCF(quantity, opts)
To convert FROM internal units TO project/display units: display = internal * UCF(quantity, opts)
| quantity | Quantity code (RAINFALL, LENGTH, FLOW, etc.) |
| opts | Simulation options (for unit system and flow units). |
| double openswmm::ucf::UCF_inv | ( | int | quantity, |
| const SimulationOptions & | opts ) |
Reciprocal of UCF — multiply display by this to get internal units.
internal = display * UCF_inv(quantity, opts). Equivalent to 1.0 / UCF(quantity, opts) but uses the precomputed reciprocal tables (no runtime division). For hot loops, prefer hoisting the factor (e.g. Ucf_inv[LENGTH][us]) out of the loop directly.
| quantity | Quantity code (RAINFALL, LENGTH, FLOW, etc.) |
| opts | Simulation options (for unit system and flow units). |
|
inlineconstexpr |
Legacy FlowUnitWords — index by FlowUnits enum (CFS,GPM,MGD,CMS,LPS,MLD).
|
inlineconstexpr |
Reciprocal of Qcf[flow_units] — multiply display flow by this → cfs.
|
inlineconstexpr |
Reciprocal of Ucf[quantity][unit_system] — multiply display by this → internal.