![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Portable cross-section geometry kernels — one implementation, three consumers (host dynamic wave, host finite volume, device finite volume). More...
Go to the source code of this file.
Classes | |
| struct | openswmm::xsect::XsectTables |
| struct | openswmm::xsect::XsectEval |
| The geometry layer itself, parameterized on where its tables live. More... | |
Namespaces | |
| namespace | openswmm |
| namespace | openswmm::xsect |
| namespace | openswmm::xsect::shape |
| The analytic shape formulas — the single definition of each. | |
Macros | |
| #define | OPENSWMM_KERNEL_FN inline |
Enumerations | |
| enum class | openswmm::xsect::LutId : int { openswmm::xsect::Y_Gothic = 0 , openswmm::xsect::Y_Catenary , openswmm::xsect::Y_SemiEllip , openswmm::xsect::Y_SemiCirc , openswmm::xsect::A_HorizEllipse , openswmm::xsect::A_VertEllipse , openswmm::xsect::A_Arch , openswmm::xsect::S_Circ , openswmm::xsect::S_Egg , openswmm::xsect::S_Horseshoe , openswmm::xsect::S_Gothic , openswmm::xsect::S_Catenary , openswmm::xsect::S_SemiEllip , openswmm::xsect::S_BasketHandle , openswmm::xsect::S_SemiCirc , openswmm::xsect::COUNT } |
| Pointers to the shared geometry tables, in whichever memory space the consumer runs in. More... | |
Functions | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::rectAofY (double y, double w_max) |
| Compute rectangular area as depth times width. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::trapezAofY (double y, double y_bot, double s_bot) |
| Compute trapezoid area as (bottom width+side slope*depth)*depth. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::triangAofY (double y, double s_bot) |
| Compute triangular area from depth and side slope. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::parabAofY (double y, double r_bot) |
| Compute parabolic area using its square-root depth relation. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::powerfuncAofY (double y, double s_bot, double r_bot) |
| Compute power-function section area. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::rectClosedRofA (double a, double w_max, double a_full) |
| Compute closed rectangular hydraulic radius with near-crown perimeter correction. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::rectOpenRofA (double a, double w_max, double s_bot) |
| Compute open rectangular radius excluding selected side banks. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::trapezRofY (double y, double y_bot, double s_bot, double r_bot) |
| Compute trapezoid hydraulic radius from depth. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::triangRofY (double y, double s_bot, double r_bot) |
| Compute triangular hydraulic radius from its side geometry. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::rectClosedWofY (double y_norm, double w_max) |
| Apply the closed rectangular crown top-width convention. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::trapezWofY (double y, double y_bot, double s_bot) |
| Compute trapezoid top width from depth. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::triangWofY (double y, double s_bot) |
| Compute triangular top width from depth. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::parabWofY (double y, double r_bot) |
| Compute parabolic top width from depth. | |
| OPENSWMM_KERNEL_FN double | openswmm::xsect::shape::powerfuncWofY (double y, double s_bot, double r_bot) |
| Compute power-function top width as the area-depth derivative. | |
| const XsectTables & | openswmm::xsect::hostTables () |
| Borrow host pointers, lengths and inverse maps for every built-in geometry table. | |
| const XsectEval & | openswmm::xsect::hostEval () |
| Borrow the immutable host evaluator bound to process-lifetime tables. | |
Variables | |
| constexpr double | openswmm::xsect::TINY = 1.0e-6 |
| constexpr double | openswmm::xsect::PI = 3.141592654 |
| constexpr double | openswmm::xsect::GRAVITY = 32.2 |
| constexpr double | openswmm::xsect::RECT_ALFMAX = 0.97 |
| constexpr double | openswmm::xsect::RECT_TRIANG_ALFMAX = 0.98 |
| constexpr double | openswmm::xsect::RECT_ROUND_ALFMAX = 0.98 |
Portable cross-section geometry kernels — one implementation, three consumers (host dynamic wave, host finite volume, device finite volume).
The cross-section machinery was host-only: the geometry tables are namespace-scope arrays in xsect_tables.hpp, and a device kernel cannot reach a host global. This header removes that barrier without duplicating a single formula — the bodies here were MOVED out of XSection.cpp verbatim, not transcribed, and XSection.cpp's public functions are now one-line forwarders onto them.
The only change to the bodies is where the tables come from. Instead of naming xsect_tables::A_Circ directly they read tbl.A_Circ — a pointer carried in an XsectTables struct. On the host that struct binds straight to the same namespace arrays, so the arithmetic, the operand order and the literals are unchanged and the result is bit-identical by construction rather than by testing. On a device it binds to the device copies of those arrays.
Bit-exactness contract carried over from XSectLookup.hpp: IEEE division rather than a precomputed reciprocal, legacy's exact operation grouping, and no FMA contraction. Device compilers default to aggressive contraction, so a device build MUST pin -ffp-contract=off (or the backend's equivalent) or the tables will diverge in the last ulp.
Transect-backed shapes (IRREGULAR, CUSTOM, STREET_XSECT) read their tables through pointers held in XSectParams itself. A device consumer must rebind those to device memory before use; the shared tables here are the ones that are the same for every model.
| #define OPENSWMM_KERNEL_FN inline |