OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
RainfallInterpolator.hpp
Go to the documentation of this file.
1
27
28#ifndef OPENSWMM_ENGINE_2D_RAINFALL_INTERPOLATOR_HPP
29#define OPENSWMM_ENGINE_2D_RAINFALL_INTERPOLATOR_HPP
30
31#include <vector>
32
33namespace openswmm::twoD {
34
45public:
59 void build(const std::vector<double>& cx, const std::vector<double>& cy,
60 const std::vector<double>& gage_x, const std::vector<double>& gage_y,
61 int n_gages, double gage_scale);
62
64 bool ready() const noexcept { return ready_; }
65
74 void apply(const std::vector<double>& rain, std::vector<double>& out) const;
75
76private:
77 bool ready_ = false;
78 int nt_ = 0;
79
80 // CSR weight store: cell i owns weights [w_ptr_[i], w_ptr_[i+1]); each slot
81 // pairs a global gage index (w_gage_) with a normalized weight (w_val_,
82 // sums to 1 per cell).
83 std::vector<int> w_ptr_;
84 std::vector<int> w_gage_;
85 std::vector<double> w_val_;
86};
87
88} // namespace openswmm::twoD
89
90#endif // OPENSWMM_ENGINE_2D_RAINFALL_INTERPOLATOR_HPP
Builds and applies static rainfall-interpolation weights for the mesh.
Definition RainfallInterpolator.hpp:44
bool ready() const noexcept
True once build() produced usable weights (≥ 1 located gage).
Definition RainfallInterpolator.hpp:64
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.
Definition RainfallInterpolator.cpp:224
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:295
Definition NodeCoupling.cpp:15