![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
Shape-grouped cross-section manager for batch computation. More...
#include <XSectBatch.hpp>
Public Member Functions | |
| void | build (const SimulationContext &ctx) |
| Build shape groups from SimulationContext link data. | |
| void | attachTransectTables (const SimulationContext &ctx) |
| Attach transect tables to the IRREGULAR shape group. | |
| void | build (const XSectParams *params, int n_links) |
| Build shape groups from an array of XSectParams. | |
| void | computeAreas (const double *depths, double *areas, int n_links) const |
Compute area for every link, reading depth from depths[link]. | |
| void | computeHydRad (const double *depths, double *hydrad, int n_links) const |
| Compute hydraulic radius for every link. | |
| void | computeWidths (const double *depths, double *widths, int n_links) const |
| Compute top width for every link. | |
| void | computeAreaAndHydRad (const double *depths, double *areas, double *hydrad, int n_links) const |
| Fused area + hydraulic radius computation (single gather/scatter). | |
| void | computeAreaHydRadTriple (const double *d1, const double *d2, const double *dm, double *a1, double *a2, double *am, double *hrad1, double *hrad_mid, int n_links) const |
| Fused triple: d1→(a1,hrad1), d2→a2, dm→(am,hrad_mid) in one pass over shape groups. Replaces three separate compute calls in STEP B / STEP D of computeLinkGeometry. | |
| void | computeWidthsTriple (const double *d1, const double *d2, const double *dm, double *w1, double *w2, double *wm, int n_links) const |
| Fused triple: d1→w1, d2→w2, dm→wm in one pass over shape groups. | |
| void | computeSectionFactors (const double *areas, double *sfact, int n_links) const |
| Compute section factor for every link (from area, not depth). | |
| void | computeDepthsFromArea (const double *areas, double *depths, int n_links) const |
| Compute depth from area for every link (inverse). | |
| int | numGroups () const |
| Number of non-empty shape groups. | |
| const ShapeGroup & | group (int i) const |
| Access a specific shape group. | |
| const ShapeGroup * | findGroup (XSectShape shape) const |
| Find the group for a given shape (returns nullptr if no links have that shape). | |
Shape-grouped cross-section manager for batch computation.
Call build() once after the model is loaded/built. This sorts links by shape type and builds contiguous SoA parameter blocks. Then use computeAreas(), computeHydRad(), computeWidths() in the routing hot loop — each iterates over shape groups and calls the shape-specific vectorised kernel.
Results are written directly into the caller's global arrays (indexed by link) using the scatter index link_idx.
| void openswmm::XSectGroups::attachTransectTables | ( | const SimulationContext & | ctx | ) |
Attach transect tables to the IRREGULAR shape group.
Must be called after build() when IRREGULAR shapes exist. Populates per-link area/hrad/width table pointers from the precomputed transect tables in the context.
| ctx | SimulationContext with transect_tables populated. |
| void openswmm::XSectGroups::build | ( | const SimulationContext & | ctx | ) |
Build shape groups from SimulationContext link data.
Scans all links, groups them by xsect shape, and copies the geometry parameters into contiguous SoA arrays. Only shapes that have at least one link get a group.
| ctx | SimulationContext (must have links populated). |
| void openswmm::XSectGroups::build | ( | const XSectParams * | params, |
| int | n_links | ||
| ) |
Build shape groups from an array of XSectParams.
Alternative to build(ctx) — useful for testing.
| params | Array of per-link XSectParams. |
| n_links | Number of links. |
| void openswmm::XSectGroups::computeAreaAndHydRad | ( | const double * | depths, |
| double * | areas, | ||
| double * | hydrad, | ||
| int | n_links | ||
| ) | const |
Fused area + hydraulic radius computation (single gather/scatter).
| depths | [in] Global depth array. |
| areas | [out] Global area array. |
| hydrad | [out] Global hydraulic radius array. |
| n_links | Total number of links. |
| void openswmm::XSectGroups::computeAreaHydRadTriple | ( | const double * | d1, |
| const double * | d2, | ||
| const double * | dm, | ||
| double * | a1, | ||
| double * | a2, | ||
| double * | am, | ||
| double * | hrad1, | ||
| double * | hrad_mid, | ||
| int | n_links | ||
| ) | const |
Fused triple: d1→(a1,hrad1), d2→a2, dm→(am,hrad_mid) in one pass over shape groups. Replaces three separate compute calls in STEP B / STEP D of computeLinkGeometry.
| void openswmm::XSectGroups::computeAreas | ( | const double * | depths, |
| double * | areas, | ||
| int | n_links | ||
| ) | const |
Compute area for every link, reading depth from depths[link].
| depths | [in] Global depth array (indexed by link). |
| areas | [out] Global area array (indexed by link). |
| n_links | Total number of links. |
| void openswmm::XSectGroups::computeDepthsFromArea | ( | const double * | areas, |
| double * | depths, | ||
| int | n_links | ||
| ) | const |
Compute depth from area for every link (inverse).
| areas | [in] Global area array. |
| depths | [out] Global depth array. |
| n_links | Total number of links. |
| void openswmm::XSectGroups::computeHydRad | ( | const double * | depths, |
| double * | hydrad, | ||
| int | n_links | ||
| ) | const |
Compute hydraulic radius for every link.
| depths | [in] Global depth array. |
| hydrad | [out] Global hydraulic radius array. |
| n_links | Total number of links. |
| void openswmm::XSectGroups::computeSectionFactors | ( | const double * | areas, |
| double * | sfact, | ||
| int | n_links | ||
| ) | const |
Compute section factor for every link (from area, not depth).
| areas | [in] Global area array. |
| sfact | [out] Global section factor array. |
| n_links | Total number of links. |
| void openswmm::XSectGroups::computeWidths | ( | const double * | depths, |
| double * | widths, | ||
| int | n_links | ||
| ) | const |
Compute top width for every link.
| depths | [in] Global depth array. |
| widths | [out] Global top width array. |
| n_links | Total number of links. |
| void openswmm::XSectGroups::computeWidthsTriple | ( | const double * | d1, |
| const double * | d2, | ||
| const double * | dm, | ||
| double * | w1, | ||
| double * | w2, | ||
| double * | wm, | ||
| int | n_links | ||
| ) | const |
Fused triple: d1→w1, d2→w2, dm→wm in one pass over shape groups.
| const ShapeGroup * openswmm::XSectGroups::findGroup | ( | XSectShape | shape | ) | const |
Find the group for a given shape (returns nullptr if no links have that shape).
|
inline |
Access a specific shape group.
|
inline |
Number of non-empty shape groups.