44#ifndef OPENSWMM_ENGINE_2D_RAINFALL_INTERPOLATOR_HPP
45#define OPENSWMM_ENGINE_2D_RAINFALL_INTERPOLATOR_HPP
106 void build(
const std::vector<double>& cx,
const std::vector<double>& cy,
107 const std::vector<double>& gage_x,
const std::vector<double>& gage_y,
int n_gages,
116 bool ready() const noexcept {
return ready_; }
133 void apply(
const std::vector<double>& rain, std::vector<double>& out)
const;
154 void cellWeights(
int i, std::vector<int>& gages, std::vector<double>& weights)
const;
157 Diagnostics diagnostics_;
158 std::vector<CellMethod> cell_method_;
165 std::vector<int> w_ptr_;
166 std::vector<int> w_gage_;
167 std::vector<double> w_val_;
Builds and applies static rainfall-interpolation weights for the mesh.
Definition RainfallInterpolator.hpp:60
Method
Definition RainfallInterpolator.hpp:62
@ NaturalNeighbour
Definition RainfallInterpolator.hpp:62
@ NearestNeighbour
Definition RainfallInterpolator.hpp:62
CellMethod cellMethod(int i) const
Per-cell diagnostic: the method used and the contributing (global gage index, weight) pairs of cell i...
Definition RainfallInterpolator.hpp:143
bool ready() const noexcept
True once build() produced usable weights (≥ 1 located gage).
Definition RainfallInterpolator.hpp:116
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, Method method=Method::NaturalNeighbour)
Precompute per-cell interpolation weights.
Definition RainfallInterpolator.cpp:341
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].
Definition RainfallInterpolator.cpp:468
CellMethod
How build() weighted one cell (values match swmm_2d_get_rainfall_weights).
Definition RainfallInterpolator.hpp:64
@ InverseDistance
IDW: outside the hull, 2 sites, or degenerate.
Definition RainfallInterpolator.hpp:66
@ Nearest
One gage, weight 1 (nearest mode or 1 site).
Definition RainfallInterpolator.hpp:67
const Diagnostics & diagnostics() const noexcept
Borrow diagnostics from the most recent interpolation build.
Definition RainfallInterpolator.hpp:80
void cellWeights(int i, std::vector< int > &gages, std::vector< double > &weights) const
Copy one built cell's interpolation contributors.
Definition RainfallInterpolator.cpp:482
Definition ExchangeLaw.hpp:60
Definition RainfallInterpolator.hpp:69
int invalid
Definition RainfallInterpolator.hpp:71
int idwCells
Definition RainfallInterpolator.hpp:73
int unlocated
Definition RainfallInterpolator.hpp:70
int duplicates
Definition RainfallInterpolator.hpp:72