OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::xsect Namespace Reference

Namespaces

namespace  shape
 The analytic shape formulas — the single definition of each.
 

Classes

struct  LocateLut
 
struct  XsectEval
 The geometry layer itself, parameterized on where its tables live. More...
 
struct  XsectTables
 

Enumerations

enum class  LutId : int {
  Y_Gothic = 0 ,
  Y_Catenary ,
  Y_SemiEllip ,
  Y_SemiCirc ,
  A_HorizEllipse ,
  A_VertEllipse ,
  A_Arch ,
  S_Circ ,
  S_Egg ,
  S_Horseshoe ,
  S_Gothic ,
  S_Catenary ,
  S_SemiEllip ,
  S_BasketHandle ,
  S_SemiCirc ,
  COUNT
}
 Pointers to the shared geometry tables, in whichever memory space the consumer runs in. More...
 

Functions

double getAofY (const XSectParams &xs, double y)
 
double getRofY (const XSectParams &xs, double y)
 
double getWofY (const XSectParams &xs, double y)
 
double getYofA (const XSectParams &xs, double a)
 
double getSofA (const XSectParams &xs, double a)
 
double getRofA (const XSectParams &xs, double a)
 
double getdSdA (const XSectParams &xs, double a)
 
double getAofS (const XSectParams &xs, double s_factor)
 
double getAmax (const XSectParams &xs)
 
double getYcrit (const XSectParams &xs, double q)
 
bool isOpen (int type)
 
int setParams (XSectParams &xs, int type, const double p[], double ucf)
 
double lookup (double x, const double *table, int n_items)
 
double invLookup (double y, const double *table, int n_items, const LocateLut *lut=nullptr)
 
int locate (double y, const double *table, int n)
 
double getYcircular (double alpha)
 
double getScircular (double alpha)
 
const XsectTableshostTables ()
 
const XsectEvalhostEval ()
 
double lookup_exact (double x, const double *t, int n) noexcept
 Bit-exact transliteration of legacy xsect.c:lookup().
 
double lookup_fast (double x, const double *t, int n) noexcept
 Reciprocal-multiply lookup (fast, NOT bit-exact — see §6).
 
double norm_x (double depth, double param) noexcept
 
double norm_lookup (double depth, double param, const double *t, int n) noexcept
 Mode-aware normalize + table lookup (bit-exact by default; §6 fast if opted in).
 
int lut_bucket (const LocateLut &L, double y) noexcept
 Bucket index for a value — the ONE expression used by both build and query.
 
int locate_bisect (double y, const double *table, int jLast) noexcept
 
void build_locate_lut (LocateLut &L, const double *table, int jLast) noexcept
 
int locate_lut (double y, const double *table, int jLast, const LocateLut &L) noexcept
 LUT-accelerated locate() — returns the identical index for every input.
 
int locate_maybe_lut (double y, const double *table, int jLast, const LocateLut *L) noexcept
 Dispatch: use the map when one was built for this exact table extent.
 
void build_invlookup_lut (LocateLut &L, const double *table, int n_items) noexcept
 

Variables

constexpr double TINY = 1.0e-6
 
constexpr double PI = 3.141592654
 
constexpr double GRAVITY = 32.2
 
constexpr double RECT_ALFMAX = 0.97
 
constexpr double RECT_TRIANG_ALFMAX = 0.98
 
constexpr double RECT_ROUND_ALFMAX = 0.98
 

Enumeration Type Documentation

◆ LutId

enum class openswmm::xsect::LutId : int
strong

Pointers to the shared geometry tables, in whichever memory space the consumer runs in.

Plain POD: trivially copyable into a device kernel by value. The member names are deliberately identical to the xsect_tables:: symbols they bind to, so the moved bodies differ from the originals by exactly one token.

The tables invLookup() inverts, and so the ones that carry a LocateLut (plan XSECT_LOOKUP_ACCEL §4 item A1).

Every other shared table is only ever read forward, where the index is a divide-and-truncate and there is no search to accelerate. Keeping the maps in one array indexed by this enum costs XsectTables a single pointer instead of fifteen, and keeps the host binding (XSection.cpp hostTables) and any device binding to one block to copy.

Enumerator
Y_Gothic 
Y_Catenary 
Y_SemiEllip 
Y_SemiCirc 
A_HorizEllipse 
A_VertEllipse 
A_Arch 
S_Circ 
S_Egg 
S_Horseshoe 
S_Gothic 
S_Catenary 
S_SemiEllip 
S_BasketHandle 
S_SemiCirc 
COUNT 

Function Documentation

◆ build_invlookup_lut()

void openswmm::xsect::build_invlookup_lut ( LocateLut & L,
const double * table,
int n_items )
inlinenoexcept

Build the map for the extent invLookup(y, table, n_items) actually searches — including the section-factor tables' two-row top truncation, so the S_* maps bracket the same window locate() is called on. (The truncated top rows are resolved by invLookup's own branch, outside locate, and are unaffected.)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_locate_lut()

void openswmm::xsect::build_locate_lut ( LocateLut & L,
const double * table,
int jLast )
inlinenoexcept

Build the bucket map for table over indices [0, jLast].

Leaves the map disabled (scale == 0) for a degenerate or non-monotone table, or one too long to index with a byte — the caller then bisects as before.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAmax()

double openswmm::xsect::getAmax ( const XSectParams & xs)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAofS()

double openswmm::xsect::getAofS ( const XSectParams & xs,
double s_factor )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAofY()

double openswmm::xsect::getAofY ( const XSectParams & xs,
double y )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getdSdA()

double openswmm::xsect::getdSdA ( const XSectParams & xs,
double a )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRofA()

double openswmm::xsect::getRofA ( const XSectParams & xs,
double a )
Here is the call graph for this function:

◆ getRofY()

double openswmm::xsect::getRofY ( const XSectParams & xs,
double y )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getScircular()

double openswmm::xsect::getScircular ( double alpha)
Here is the call graph for this function:

◆ getSofA()

double openswmm::xsect::getSofA ( const XSectParams & xs,
double a )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getWofY()

double openswmm::xsect::getWofY ( const XSectParams & xs,
double y )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getYcircular()

double openswmm::xsect::getYcircular ( double alpha)
Here is the call graph for this function:

◆ getYcrit()

double openswmm::xsect::getYcrit ( const XSectParams & xs,
double q )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getYofA()

double openswmm::xsect::getYofA ( const XSectParams & xs,
double a )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hostEval()

const XsectEval & openswmm::xsect::hostEval ( )

One host-bound evaluator, constructed once. Holding it in a function-local static keeps the forwarders free of any per-call setup, and lets the finite-volume geometry hold a pointer to it instead of a copy.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hostTables()

const XsectTables & openswmm::xsect::hostTables ( )

The host-bound table set and evaluator: hostTables() binds every pointer straight back to the xsect_tables:: arrays, so hostEval() reproduces the pre-extraction code exactly. A device consumer builds its own pair over device copies of the same arrays.

Here is the caller graph for this function:

◆ invLookup()

double openswmm::xsect::invLookup ( double y,
const double * table,
int n_items,
const LocateLut * lut = nullptr )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isOpen()

bool openswmm::xsect::isOpen ( int type)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ locate()

int openswmm::xsect::locate ( double y,
const double * table,
int n )
Here is the call graph for this function:

◆ locate_bisect()

int openswmm::xsect::locate_bisect ( double y,
const double * table,
int jLast )
inlinenoexcept

Plain bisection — the shipped locate() body, kept here so the LUT builder and the fallback path share one definition with XsectEval::locate.

Here is the caller graph for this function:

◆ locate_lut()

int openswmm::xsect::locate_lut ( double y,
const double * table,
int jLast,
const LocateLut & L )
inlinenoexcept

LUT-accelerated locate() — returns the identical index for every input.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ locate_maybe_lut()

int openswmm::xsect::locate_maybe_lut ( double y,
const double * table,
int jLast,
const LocateLut * L )
inlinenoexcept

Dispatch: use the map when one was built for this exact table extent.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lookup()

double openswmm::xsect::lookup ( double x,
const double * table,
int n_items )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lookup_exact()

double openswmm::xsect::lookup_exact ( double x,
const double * t,
int n )
inlinenoexcept

Bit-exact transliteration of legacy xsect.c:lookup().

Parameters
xNormalized independent variable (depth/y_full or area/a_full), finite and in [0, 1] (see file-level preconditions).
tGeometry table (n equally spaced entries on [0, 1]).
nLogical entry count (== legacy nItems).
Returns
Interpolated dependent value; ULP==0 vs legacy lookup().
Here is the caller graph for this function:

◆ lookup_fast()

double openswmm::xsect::lookup_fast ( double x,
const double * t,
int n )
inlinenoexcept

Reciprocal-multiply lookup (fast, NOT bit-exact — see §6).

Here is the caller graph for this function:

◆ lut_bucket()

int openswmm::xsect::lut_bucket ( const LocateLut & L,
double y )
inlinenoexcept

Bucket index for a value — the ONE expression used by both build and query.

Here is the caller graph for this function:

◆ norm_lookup()

double openswmm::xsect::norm_lookup ( double depth,
double param,
const double * t,
int n )
inlinenoexcept

Mode-aware normalize + table lookup (bit-exact by default; §6 fast if opted in).

Here is the call graph for this function:

◆ norm_x()

double openswmm::xsect::norm_x ( double depth,
double param )
inlinenoexcept
Here is the caller graph for this function:

◆ setParams()

int openswmm::xsect::setParams ( XSectParams & xs,
int type,
const double p[],
double ucf )
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ GRAVITY

double openswmm::xsect::GRAVITY = 32.2
inlineconstexpr

◆ PI

double openswmm::xsect::PI = 3.141592654
inlineconstexpr

◆ RECT_ALFMAX

double openswmm::xsect::RECT_ALFMAX = 0.97
inlineconstexpr

◆ RECT_ROUND_ALFMAX

double openswmm::xsect::RECT_ROUND_ALFMAX = 0.98
inlineconstexpr

◆ RECT_TRIANG_ALFMAX

double openswmm::xsect::RECT_TRIANG_ALFMAX = 0.98
inlineconstexpr

◆ TINY

double openswmm::xsect::TINY = 1.0e-6
inlineconstexpr