OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm::XSectGroups Class Reference

Shape-grouped cross-section manager for batch computation. More...

#include <XSectBatch.hpp>

Collaboration diagram for openswmm::XSectGroups:

Public Member Functions

void build (const SimulationContext &ctx)
 Build shape groups from SimulationContext link data.
 
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 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 ShapeGroupgroup (int i) const
 Access a specific shape group.
 
const ShapeGroupfindGroup (XSectShape shape) const
 Find the group for a given shape (returns nullptr if no links have that shape).
 

Detailed Description

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.

Member Function Documentation

◆ build() [1/2]

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.

Parameters
ctxSimulationContext (must have links populated).
Here is the caller graph for this function:

◆ build() [2/2]

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.

Parameters
paramsArray of per-link XSectParams.
n_linksNumber of links.

◆ computeAreas()

void openswmm::XSectGroups::computeAreas ( const double *  depths,
double *  areas,
int  n_links 
) const

Compute area for every link, reading depth from depths[link].

Parameters
depths[in] Global depth array (indexed by link).
areas[out] Global area array (indexed by link).
n_linksTotal number of links.
Here is the call graph for this function:

◆ computeDepthsFromArea()

void openswmm::XSectGroups::computeDepthsFromArea ( const double *  areas,
double *  depths,
int  n_links 
) const

Compute depth from area for every link (inverse).

Parameters
areas[in] Global area array.
depths[out] Global depth array.
n_linksTotal number of links.
Here is the call graph for this function:

◆ computeHydRad()

void openswmm::XSectGroups::computeHydRad ( const double *  depths,
double *  hydrad,
int  n_links 
) const

Compute hydraulic radius for every link.

Parameters
depths[in] Global depth array.
hydrad[out] Global hydraulic radius array.
n_linksTotal number of links.
Here is the call graph for this function:

◆ computeSectionFactors()

void openswmm::XSectGroups::computeSectionFactors ( const double *  areas,
double *  sfact,
int  n_links 
) const

Compute section factor for every link (from area, not depth).

Parameters
areas[in] Global area array.
sfact[out] Global section factor array.
n_linksTotal number of links.
Here is the call graph for this function:

◆ computeWidths()

void openswmm::XSectGroups::computeWidths ( const double *  depths,
double *  widths,
int  n_links 
) const

Compute top width for every link.

Parameters
depths[in] Global depth array.
widths[out] Global top width array.
n_linksTotal number of links.
Here is the call graph for this function:

◆ findGroup()

const ShapeGroup * openswmm::XSectGroups::findGroup ( XSectShape  shape) const

Find the group for a given shape (returns nullptr if no links have that shape).

◆ group()

const ShapeGroup & openswmm::XSectGroups::group ( int  i) const
inline

Access a specific shape group.

◆ numGroups()

int openswmm::XSectGroups::numGroups ( ) const
inline

Number of non-empty shape groups.


The documentation for this class was generated from the following files: