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

Builds and applies static rainfall-interpolation weights for the mesh. More...

#include <RainfallInterpolator.hpp>

Collaboration diagram for openswmm::twoD::RainfallInterpolator:

Public Member Functions

void build (const std::vector< double > &cx, const std::vector< double > &cy, const std::vector< double > &gage_x, const std::vector< double > &gage_y, int n_gages, double gage_scale)
 Precompute per-cell interpolation weights.
 
bool ready () const noexcept
 True once build() produced usable weights (≥ 1 located gage).
 
void apply (const std::vector< double > &rain, std::vector< double > &out) const
 Map per-gage values onto per-cell values: out[i] = Σ w·rain[gage].
 

Detailed Description

Builds and applies static rainfall-interpolation weights for the mesh.

Degenerate fallbacks handled by build():

  • 0 located gages → ready()==false (caller uses the SYSTEM mean).
  • 1 located gage → that gage everywhere.
  • 2 located / collinear → inverse-distance weighting everywhere.
  • ≥3 non-collinear → Laplace inside hull, IDW outside.

Member Function Documentation

◆ apply()

void openswmm::twoD::RainfallInterpolator::apply ( const std::vector< double > & rain,
std::vector< double > & out ) const

Map per-gage values onto per-cell values: out[i] = Σ w·rain[gage].

Parameters
rainPer-gage value already in the desired output units (m/s), indexed by global gage index (size ≥ n_gages).
outFilled with one value per cell; resized to n_triangles if its size does not already match.

◆ build()

void openswmm::twoD::RainfallInterpolator::build ( const std::vector< double > & cx,
const std::vector< double > & cy,
const std::vector< double > & gage_x,
const std::vector< double > & gage_y,
int n_gages,
double gage_scale )

Precompute per-cell interpolation weights.

Parameters
cx,cyMesh cell centroids (SI metres), size = n_triangles.
gage_x,gage_yGage coordinates in project map units. An entry of exactly (0,0) marks an un-located gage (no [SYMBOLS] row) and is excluded from the interpolation.
n_gagesNumber of gages (rainfall arrays are indexed 0..n_gages-1; the stored gage indices are these global indices).
gage_scaleFactor applied to the gage coords to bring them into the SI mesh frame — the same FLOW_UNITS ft→m factor initialize() applies to the mesh (1.0 for SI projects).

◆ ready()

bool openswmm::twoD::RainfallInterpolator::ready ( ) const
inlinenoexcept

True once build() produced usable weights (≥ 1 located gage).


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