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

Cross-section geometry — unified batch + per-element API. More...

#include <vector>
#include <cstddef>
#include <cstdint>
#include <cmath>
#include "XSectLookup.hpp"
Include dependency graph for XSectBatch.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  openswmm::XSectParams
 Native cross-section geometry and borrowed optional normalized transect tables. More...
 
struct  openswmm::ShapeGroup
 SoA parameter block for all links of one cross-section shape. More...
 
class  openswmm::XSectGroups
 Shape-grouped cross-section manager for batch computation. More...
 

Namespaces

namespace  openswmm
 
namespace  openswmm::xsect
 
namespace  openswmm::xsect_batch
 

Macros

#define OPENSWMM_RESTRICT   __restrict__
 

Enumerations

enum class  openswmm::XSectShape : int {
  openswmm::DUMMY = 0 ,
  openswmm::CIRCULAR = 1 ,
  openswmm::FILLED_CIRCULAR = 2 ,
  openswmm::RECT_CLOSED = 3 ,
  openswmm::RECT_OPEN = 4 ,
  openswmm::TRAPEZOIDAL = 5 ,
  openswmm::TRIANGULAR = 6 ,
  openswmm::PARABOLIC = 7 ,
  openswmm::POWERFUNC = 8 ,
  openswmm::RECT_TRIANG = 9 ,
  openswmm::RECT_ROUND = 10 ,
  openswmm::MOD_BASKET = 11 ,
  openswmm::HORIZ_ELLIPSE = 12 ,
  openswmm::VERT_ELLIPSE = 13 ,
  openswmm::ARCH = 14 ,
  openswmm::EGGSHAPED = 15 ,
  openswmm::HORSESHOE = 16 ,
  openswmm::GOTHIC = 17 ,
  openswmm::CATENARY = 18 ,
  openswmm::SEMIELLIPTICAL = 19 ,
  openswmm::BASKETHANDLE = 20 ,
  openswmm::SEMICIRCULAR = 21 ,
  openswmm::IRREGULAR = 22 ,
  openswmm::CUSTOM = 23 ,
  openswmm::FORCE_MAIN = 24 ,
  openswmm::STREET_XSECT = 25
}
 

Functions

double openswmm::xsect::getAofY (const XSectParams &xs, double y)
 Query native wetted area from depth through the shared host evaluator.
 
double openswmm::xsect::getRofY (const XSectParams &xs, double y)
 Query native hydraulic radius from depth through the shared host evaluator.
 
double openswmm::xsect::getWofY (const XSectParams &xs, double y)
 Query native top width from depth through the shared host evaluator.
 
double openswmm::xsect::getYofA (const XSectParams &xs, double a)
 Query native depth from area through the shared host evaluator.
 
double openswmm::xsect::getSofA (const XSectParams &xs, double a)
 Query native section factor from area through the shared host evaluator.
 
double openswmm::xsect::getRofA (const XSectParams &xs, double a)
 Query native hydraulic radius from area through the shared host evaluator.
 
double openswmm::xsect::getdSdA (const XSectParams &xs, double a)
 Query native section-factor derivative with respect to area through the shared host evaluator.
 
double openswmm::xsect::getAofS (const XSectParams &xs, double s_factor)
 Query native area from section factor through the shared host evaluator.
 
double openswmm::xsect::getAmax (const XSectParams &xs)
 Read the built-in area-at-maximum-conveyance ratio.
 
double openswmm::xsect::getYcrit (const XSectParams &xs, double q)
 Query native critical depth from discharge through the shared host evaluator.
 
bool openswmm::xsect::isOpen (int type)
 Classify a kernel shape using the legacy open-section set.
 
int openswmm::xsect::setParams (XSectParams &xs, int type, const double p[], double ucf)
 Derive native full-flow geometry from authored shape dimensions.
 
double openswmm::xsect::lookup (double x, const double *table, int n_items)
 Interpolate a borrowed equally spaced normalized geometry table.
 
double openswmm::xsect::invLookup (double y, const double *table, int n_items, const LocateLut *lut=nullptr)
 Invert a borrowed normalized geometry table including the legacy declining top.
 
int openswmm::xsect::locate (double y, const double *table, int n)
 Find a lower bracket in a nondecreasing geometry table.
 
double openswmm::xsect::getYcircular (double alpha)
 Compute normalized circular depth from area ratio.
 
double openswmm::xsect::getScircular (double alpha)
 Compute normalized circular section factor from area ratio.
 
void openswmm::xsect_batch::area_circular (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_full, const double *OPENSWMM_RESTRICT a_full, double *OPENSWMM_RESTRICT area, int count)
 Evaluate circular/force-main normalized area for a contiguous batch.
 
void openswmm::xsect_batch::area_rect (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT w_max, double *OPENSWMM_RESTRICT area, int count)
 Multiply rectangular depths and widths using the shared SIMD routine.
 
void openswmm::xsect_batch::area_trapezoidal (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_bot, const double *OPENSWMM_RESTRICT s_bot, double *OPENSWMM_RESTRICT area, int count)
 Evaluate trapezoid batch area through the shared analytic leaf.
 
void openswmm::xsect_batch::area_triangular (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT s_bot, double *OPENSWMM_RESTRICT area, int count)
 Evaluate triangular batch area through the shared analytic leaf.
 
void openswmm::xsect_batch::area_parabolic (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT r_bot, double *OPENSWMM_RESTRICT area, int count)
 Evaluate parabolic batch area through the shared analytic leaf.
 
void openswmm::xsect_batch::area_powerfunc (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT s_bot, const double *OPENSWMM_RESTRICT r_bot, double *OPENSWMM_RESTRICT area, int count)
 Evaluate power-function batch area through the shared analytic leaf.
 
void openswmm::xsect_batch::area_tabulated (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_full, const double *OPENSWMM_RESTRICT a_full, const double *table, int table_size, double *OPENSWMM_RESTRICT area, int count)
 Scale one shared normalized area table for a batch.
 
void openswmm::xsect_batch::perlink_tabulated (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT nrm, const double *OPENSWMM_RESTRICT scale, const double *const *tables, int table_size, double *OPENSWMM_RESTRICT result, int count)
 Per-link tabulated lookup (for IRREGULAR shapes where each link has its own table).
 
void openswmm::xsect_batch::perlink_tabulated_pair (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT nrm, const double *OPENSWMM_RESTRICT scale_a, const double *OPENSWMM_RESTRICT scale_b, const double *const *tables_a, const double *const *tables_b, int table_size, double *OPENSWMM_RESTRICT out_a, double *OPENSWMM_RESTRICT out_b, int count)
 Fuse two per-element profile lookups on one normalized depth grid.
 
void openswmm::xsect_batch::area_inv_tabulated (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_full, const double *OPENSWMM_RESTRICT a_full, const double *table, int table_size, const xsect::LocateLut *lut, double *OPENSWMM_RESTRICT area, int count)
 Invert one shared normalized depth-versus-area table for batch areas.
 
void openswmm::xsect_batch::hydrad_circular (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_full, const double *OPENSWMM_RESTRICT r_full, double *OPENSWMM_RESTRICT hydrad, int count)
 Evaluate circular/force-main batch hydraulic radii from the built-in table.
 
void openswmm::xsect_batch::area_hydrad_circular (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_full, const double *OPENSWMM_RESTRICT a_full, const double *OPENSWMM_RESTRICT r_full, double *OPENSWMM_RESTRICT area, double *OPENSWMM_RESTRICT hydrad, int count)
 Fuse circular batch area and hydraulic-radius table interpolation.
 
void openswmm::xsect_batch::hydrad_trapezoidal (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_bot, const double *OPENSWMM_RESTRICT s_bot, const double *OPENSWMM_RESTRICT r_bot, double *OPENSWMM_RESTRICT hydrad, int count)
 Evaluate trapezoid batch hydraulic radius through the shared leaf.
 
void openswmm::xsect_batch::hydrad_triangular (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT s_bot, const double *OPENSWMM_RESTRICT r_bot, double *OPENSWMM_RESTRICT hydrad, int count)
 Evaluate triangular batch hydraulic radius through the shared leaf.
 
void openswmm::xsect_batch::hydrad_rect (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT w_max, double *OPENSWMM_RESTRICT hydrad, int count)
 Evaluate the simple two-bank rectangular batch radius formula.
 
void openswmm::xsect_batch::hydrad_tabulated (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_full, const double *OPENSWMM_RESTRICT r_full, const double *table, int table_size, double *OPENSWMM_RESTRICT hydrad, int count)
 Scale one shared normalized hydraulic-radius table for a batch.
 
void openswmm::xsect_batch::width_circular (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_full, const double *OPENSWMM_RESTRICT w_max, double *OPENSWMM_RESTRICT width, int count)
 Evaluate circular batch top widths from the built-in width table.
 
void openswmm::xsect_batch::width_trapezoidal (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_bot, const double *OPENSWMM_RESTRICT s_bot, double *OPENSWMM_RESTRICT width, int count)
 Evaluate trapezoid batch top widths through the shared leaf.
 
void openswmm::xsect_batch::width_triangular (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT s_bot, double *OPENSWMM_RESTRICT width, int count)
 Evaluate triangular batch top widths through the shared leaf.
 
void openswmm::xsect_batch::width_rect (const double *OPENSWMM_RESTRICT w_max, double *OPENSWMM_RESTRICT width, int count)
 Copy constant rectangular widths to the batch output.
 
void openswmm::xsect_batch::width_tabulated (const double *OPENSWMM_RESTRICT depth, const double *OPENSWMM_RESTRICT y_full, const double *OPENSWMM_RESTRICT w_max, const double *table, int table_size, double *OPENSWMM_RESTRICT width, int count)
 Scale one shared normalized width table for a batch.
 

Detailed Description

Cross-section geometry — unified batch + per-element API.

This is the SINGLE cross-section header for the new engine. It provides:

  1. Shape enum + XSectParams struct — data types for cross-sections
  2. Per-element functions (xsect:: namespace) — used by C API, hot start, KW/DW solvers for single-conduit queries
  3. Batch API (XSectGroups, xsect_batch::) — shape-grouped SoA for the routing hot loop; groups links by shape, computes over contiguous arrays with no branching

Routing hot loop (batch):

XSectGroups groups;
groups.build(params, n_links); // params holds resolved per-link geometry
groups.computeAreas(link_depths, link_areas);
groups.computeHydRad(link_depths, link_hydrad);
groups.computeWidths(link_depths, link_widths);
See also
SIMD.hpp — SIMD abstraction layer
xsect_tables.hpp — lookup table data (internal)
Note
Legacy reference: src/legacy/engine/xsect.c
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License
Apache-2.0

Macro Definition Documentation

◆ OPENSWMM_RESTRICT

#define OPENSWMM_RESTRICT   __restrict__