OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
XSectKernels.hpp File Reference

Portable cross-section geometry kernels — one implementation, three consumers (host dynamic wave, host finite volume, device finite volume). More...

#include <algorithm>
#include <cmath>
#include "XSectLookup.hpp"
#include "../data/LinkData.hpp"
Include dependency graph for XSectKernels.hpp:
This graph shows which files directly or indirectly include this file:

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)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::trapezAofY (double y, double y_bot, double s_bot)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::triangAofY (double y, double s_bot)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::parabAofY (double y, double r_bot)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::powerfuncAofY (double y, double s_bot, double r_bot)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::rectClosedRofA (double a, double w_max, double a_full)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::rectOpenRofA (double a, double w_max, double s_bot)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::trapezRofY (double y, double y_bot, double s_bot, double r_bot)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::triangRofY (double y, double s_bot, double r_bot)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::rectClosedWofY (double y_norm, double w_max)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::trapezWofY (double y, double y_bot, double s_bot)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::triangWofY (double y, double s_bot)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::parabWofY (double y, double r_bot)
 
OPENSWMM_KERNEL_FN double openswmm::xsect::shape::powerfuncWofY (double y, double s_bot, double r_bot)
 
const XsectTablesopenswmm::xsect::hostTables ()
 
const XsectEvalopenswmm::xsect::hostEval ()
 

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
 

Detailed Description

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.

See also
plans/EXPLICIT_FV_KOKKOS_1D_SOLVER_PLAN.md §5.1
Note
INTERNAL HEADER — not installed.
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n Apache-2.0

Macro Definition Documentation

◆ OPENSWMM_KERNEL_FN

#define OPENSWMM_KERNEL_FN   inline