41#ifndef OPENSWMM_FORCING_DATA_HPP
42#define OPENSWMM_FORCING_DATA_HPP
202 if (
mode.size() == n)
205 value.assign(n, 0.0);
218 double apply(
int i,
double base)
const noexcept {
221 const auto u =
static_cast<std::size_t
>(i);
232 for (std::size_t i = 0; i <
mode.size(); ++i)
278 return (s < 0) ? base :
elem_air_temp[s].apply(e.index, base);
293 return (s < 0) ? base :
elem_humidity[s].apply(e.index, base);
308 return (s < 0) ? base :
elem_wind[s].apply(e.index, base);
351 void resize(
int n_nodes,
int n_links,
int n_subcatches,
int n_gages,
int n_pollutants) {
358 auto un =
static_cast<std::size_t
>(n_nodes);
359 auto ul =
static_cast<std::size_t
>(n_links);
360 auto us =
static_cast<std::size_t
>(n_subcatches);
361 auto ug =
static_cast<std::size_t
>(n_gages);
362 auto unp =
static_cast<std::size_t
>(n_nodes) *
static_cast<std::size_t
>(n_pollutants);
396 auto ulp =
static_cast<std::size_t
>(n_links) *
static_cast<std::size_t
>(n_pollutants);
425 auto set_none = [](
auto& mode_vec) {
426 for (
auto& m : mode_vec)
455 auto clear_resets = [](
auto& mode_vec,
const auto& persist_vec) {
456 for (std::size_t i = 0; i < mode_vec.size(); ++i) {
487 for (
int k = 0; k < 2; ++k) {
542 return gage_rainfall;
549 return gage_rainfall;
582 return gage_snowfall;
589 return gage_snowfall;
611 return broadcast_rate;
618 return broadcast_rate;
Plan PE — per-element radiative and bed attributes.
@ NONE
Definition SimulationContext.hpp:183
Definition ExchangeLaw.hpp:60
ForcingPersist
Definition ForcingData.hpp:61
@ PERSIST
Keep until explicitly cleared.
Definition ForcingData.hpp:63
@ RESET
Auto-clear after each timestep.
Definition ForcingData.hpp:62
HeatElemKind
What kind of element a flux is being evaluated for (D-PE1).
Definition HeatOverrideData.hpp:75
@ NODE
Definition HeatOverrideData.hpp:76
@ LINK
Definition HeatOverrideData.hpp:77
ForcingMode
Definition ForcingData.hpp:55
@ OVERRIDE
Replace computed value with user value.
Definition ForcingData.hpp:57
@ ADD
Add user value to computed value.
Definition ForcingData.hpp:58
@ NONE
Use model-computed value (no forcing)
Definition ForcingData.hpp:56
Definition ForcingData.hpp:188
void resetPerStep()
Disable only channel entries marked RESET.
Definition ForcingData.hpp:231
std::vector< ForcingPersist > persist
Definition ForcingData.hpp:191
double apply(int i, double base) const noexcept
Resolve an element override/addition against a supplied baseline.
Definition ForcingData.hpp:218
std::vector< ForcingMode > mode
Definition ForcingData.hpp:189
void clear()
Release all owned element-climate channel arrays.
Definition ForcingData.hpp:241
std::vector< double > value
Definition ForcingData.hpp:190
void ensure(std::size_t n)
Allocate a channel shape or preserve an already matching shape.
Definition ForcingData.hpp:201
Definition ForcingData.hpp:70
std::vector< ForcingPersist > link_seepage_persist
Definition ForcingData.hpp:118
ElemClimateChannel elem_air_temp[2]
deg F
Definition ForcingData.hpp:246
void clear_reset_entries()
Clear only RESET-persistence entries (called at end of each step).
Definition ForcingData.hpp:454
std::vector< double > subcatch_rainfall_value
user units (in/hr or mm/hr)
Definition ForcingData.hpp:127
std::vector< ForcingMode > node_lat_inflow_mode
Definition ForcingData.hpp:74
double effective_wind(double broadcast) const noexcept
Resolve the effective wind speed (mph internal).
Definition ForcingData.hpp:518
std::vector< double > node_temperature_value
Definition ForcingData.hpp:93
ForcingMode climate_evap_mode
Definition ForcingData.hpp:158
void resize(int n_nodes, int n_links, int n_subcatches, int n_gages, int n_pollutants)
Replace object-channel arrays with NONE/zero/RESET defaults.
Definition ForcingData.hpp:351
double climate_evap_value
ft/sec (internal; converted from in/day or mm/day at the C API boundary)
Definition ForcingData.hpp:159
std::vector< double > link_setting_value
0.0–1.0 for pump/orifice/weir
Definition ForcingData.hpp:107
std::vector< ForcingMode > gage_rainfall_mode
Definition ForcingData.hpp:142
int n_pollutants_
Definition ForcingData.hpp:332
std::vector< ForcingMode > link_seepage_mode
Definition ForcingData.hpp:116
std::vector< ForcingPersist > subcatch_evap_persist
Definition ForcingData.hpp:133
std::vector< ForcingMode > link_quality_mode
flattened link × pollutant
Definition ForcingData.hpp:120
void clear_all()
Disable object and global-climate forcing modes.
Definition ForcingData.hpp:424
std::vector< ForcingMode > subcatch_snowfall_mode
Definition ForcingData.hpp:135
int n_links_
Definition ForcingData.hpp:329
std::vector< double > link_seepage_value
Definition ForcingData.hpp:117
std::vector< double > node_age_value
Definition ForcingData.hpp:97
ForcingMode climate_wind_mode
Definition ForcingData.hpp:153
std::vector< double > node_lat_inflow_value
Definition ForcingData.hpp:75
std::vector< ForcingMode > subcatch_rainfall_mode
Definition ForcingData.hpp:126
std::vector< double > link_quality_value
OVERRIDE: concentration; ADD: mass rate (mass/sec)
Definition ForcingData.hpp:121
std::vector< double > subcatch_evap_value
prescribed PET rate, ft/sec (internal units; converted from in/day or mm/day at the C API boundary)
Definition ForcingData.hpp:132
int n_subcatches_
Definition ForcingData.hpp:330
double climate_temperature_value
deg F (internal; converted from deg C at the C API boundary for SI)
Definition ForcingData.hpp:149
double effective_temperature(double broadcast) const noexcept
Resolve the effective air temperature (deg F internal).
Definition ForcingData.hpp:501
ElemClimateChannel elem_wind[2]
mph
Definition ForcingData.hpp:248
static int elemSlot(HeatElemKind k) noexcept
Map a heat element category to the per-element climate slot.
Definition ForcingData.hpp:257
std::vector< ForcingMode > link_setting_mode
Definition ForcingData.hpp:106
double effective_snowfall(std::size_t ui, double gage_snowfall) const noexcept
Resolve the effective snowfall for a subcatchment (ft/sec).
Definition ForcingData.hpp:580
std::vector< ForcingMode > node_quality_mode
Definition ForcingData.hpp:83
double elementShortwave(const HeatElement &e, double base) const noexcept
Resolve incoming-shortwave forcing for one heat element.
Definition ForcingData.hpp:321
std::vector< ForcingPersist > subcatch_snowfall_persist
Definition ForcingData.hpp:138
ElemClimateChannel elem_humidity[2]
%
Definition ForcingData.hpp:247
double climate_wind_value
mph (internal; converted from km/hr at the C API boundary for SI)
Definition ForcingData.hpp:154
std::vector< double > subcatch_snowfall_value
ft/sec (internal; converted from in/hr or mm/hr at the C API boundary)
Definition ForcingData.hpp:137
std::vector< double > gage_rainfall_value
user units (in/hr or mm/hr)
Definition ForcingData.hpp:143
std::vector< ForcingPersist > gage_rainfall_persist
Definition ForcingData.hpp:144
double elementWindMph(const HeatElement &e, double base) const noexcept
Resolve wind-speed forcing for one heat element.
Definition ForcingData.hpp:306
double effective_rainfall(std::size_t ui, double gage_rainfall) const noexcept
Resolve the effective rainfall for a subcatchment.
Definition ForcingData.hpp:540
ElemClimateChannel elem_shortwave[2]
W/m2.
Definition ForcingData.hpp:249
std::vector< ForcingPersist > link_quality_persist
Definition ForcingData.hpp:122
std::vector< ForcingPersist > link_flow_persist
Definition ForcingData.hpp:104
ForcingPersist climate_wind_persist
Definition ForcingData.hpp:156
ForcingMode climate_temperature_mode
Definition ForcingData.hpp:148
std::vector< double > link_flow_value
Definition ForcingData.hpp:103
std::vector< ForcingPersist > node_lat_inflow_persist
Definition ForcingData.hpp:76
double effective_climate_evap(double broadcast) const noexcept
Resolve the effective system-wide evaporation rate (ft/sec).
Definition ForcingData.hpp:559
std::vector< ForcingMode > link_flow_mode
Definition ForcingData.hpp:102
ForcingPersist climate_temperature_persist
Definition ForcingData.hpp:151
std::vector< ForcingMode > node_head_boundary_mode
Definition ForcingData.hpp:78
std::vector< ForcingPersist > node_age_persist
Definition ForcingData.hpp:98
std::vector< ForcingPersist > node_quality_persist
Definition ForcingData.hpp:85
std::vector< ForcingMode > node_temperature_mode
Definition ForcingData.hpp:92
std::vector< ForcingPersist > subcatch_rainfall_persist
Definition ForcingData.hpp:128
double effective_evap_rate(std::size_t ui, double broadcast_rate) const noexcept
Resolve the effective evaporation rate for a subcatchment.
Definition ForcingData.hpp:606
std::vector< ForcingPersist > node_head_boundary_persist
Definition ForcingData.hpp:80
ForcingPersist climate_evap_persist
Definition ForcingData.hpp:161
std::vector< ForcingPersist > link_setting_persist
Definition ForcingData.hpp:108
double elementAirTempF(const HeatElement &e, double base) const noexcept
Resolve air-temperature forcing for one heat element.
Definition ForcingData.hpp:276
std::vector< double > node_head_boundary_value
Definition ForcingData.hpp:79
int n_gages_
Definition ForcingData.hpp:331
std::vector< ForcingMode > subcatch_evap_mode
Definition ForcingData.hpp:130
double elementHumidity(const HeatElement &e, double base) const noexcept
Resolve humidity forcing for one heat element.
Definition ForcingData.hpp:291
std::vector< ForcingMode > node_age_mode
Definition ForcingData.hpp:96
std::vector< ForcingPersist > node_temperature_persist
Definition ForcingData.hpp:94
int n_nodes_
Definition ForcingData.hpp:328
std::vector< double > node_quality_value
mass rate (mass/sec)
Definition ForcingData.hpp:84
Which element a flux evaluator is being called for.
Definition HeatOverrideData.hpp:95