59#ifndef OPENSWMM_ENGINE_2D_SURFACE_TRANSPORT_STATE_HPP
60#define OPENSWMM_ENGINE_2D_SURFACE_TRANSPORT_STATE_HPP
105 int rowIndex(std::string_view name)
const noexcept {
106 for (std::size_t i = 0; i <
row_names.size(); ++i)
108 return static_cast<int>(i);
225 void resize(
int n_spec,
int n_tri,
int n_coupling_points) {
227 n_cells = (n_tri > 0) ? n_tri : 0;
234 const auto ns =
static_cast<std::size_t
>(
n_species);
243 ns *
static_cast<std::size_t
>(n_coupling_points > 0 ? n_coupling_points : 0), 0.0);
244 exch_spill.assign(
static_cast<std::size_t
>(n_coupling_points > 0 ? n_coupling_points : 0),
274 std::size_t
idx(
int s,
int c)
const noexcept {
275 return static_cast<std::size_t
>(s) *
static_cast<std::size_t
>(
n_cells) +
276 static_cast<std::size_t
>(c);
293 double concentration(
int s,
int c,
double volume_m3,
double dry_volume_m3)
const noexcept {
294 if (!(volume_m3 > dry_volume_m3))
315 const auto base =
static_cast<std::size_t
>(s) *
static_cast<std::size_t
>(
n_cells);
316 for (
int c = 0; c <
n_cells; ++c)
317 m +=
cell_mass[base +
static_cast<std::size_t
>(c)];
318 const auto us =
static_cast<std::size_t
>(s);
Definition ExchangeLaw.hpp:60
Definition SurfaceTransportState.hpp:153
double conc
Definition SurfaceTransportState.hpp:156
int slot
Definition SurfaceTransportState.hpp:154
int species
Definition SurfaceTransportState.hpp:155
Definition SurfaceTransportState.hpp:70
std::vector< double > cell_mass
Definition SurfaceTransportState.hpp:115
std::vector< double > gained_washoff
Definition SurfaceTransportState.hpp:183
std::vector< double > gained_exfiltration
Definition SurfaceTransportState.hpp:177
std::vector< double > lost_boundary
left through an open edge
Definition SurfaceTransportState.hpp:121
std::vector< double > exch_mass
Definition SurfaceTransportState.hpp:129
std::vector< double > rain_conc
Definition SurfaceTransportState.hpp:144
int rowIndex(std::string_view name) const noexcept
Resolve an exact species name in the current transport layout.
Definition SurfaceTransportState.hpp:105
std::vector< double > generated_age
Definition SurfaceTransportState.hpp:179
bool active() const noexcept
Test whether cell transport arrays have a nonempty layout.
Definition SurfaceTransportState.hpp:211
std::vector< double > cell_runoff_vol
Definition SurfaceTransportState.hpp:194
std::vector< double > lost_infiltration
left through the bed
Definition SurfaceTransportState.hpp:120
std::map< int, std::vector< double > > runtime_bc_conc
Definition SurfaceTransportState.hpp:150
void clear()
Replace the complete surface transport state with empty defaults.
Definition SurfaceTransportState.hpp:265
bool signedRow(int s) const noexcept
The temperature row is SIGNED (°C below zero is a state, not an error): every "mass≥ 0" guard in the ...
Definition SurfaceTransportState.hpp:98
int age_row
Definition SurfaceTransportState.hpp:82
std::vector< double > gained_rainfall
Definition SurfaceTransportState.hpp:170
long dispersion_limiter_binds
Definition SurfaceTransportState.hpp:166
std::size_t idx(int s, int c) const noexcept
Map a species/cell pair into species-major storage.
Definition SurfaceTransportState.hpp:274
double totalIncludingLedgers(int s) const noexcept
Total mass of one species over the surface + every ledger — the quantity the S1 conservation gate ass...
Definition SurfaceTransportState.hpp:313
std::vector< double > gained_external
Definition SurfaceTransportState.hpp:122
std::vector< double > coupling_src
Definition SurfaceTransportState.hpp:204
int n_cells
Definition SurfaceTransportState.hpp:72
std::vector< double > gained_coupling
Definition SurfaceTransportState.hpp:174
int n_msx
Definition SurfaceTransportState.hpp:81
std::vector< double > bc_conc
Definition SurfaceTransportState.hpp:149
std::vector< double > gained_boundary
Definition SurfaceTransportState.hpp:171
void resize(int n_spec, int n_tri, int n_coupling_points)
Reset core transport inventory and ledgers to a new tuple/cell layout.
Definition SurfaceTransportState.hpp:225
std::vector< double > lost_coupling
Definition SurfaceTransportState.hpp:125
std::vector< std::string > row_names
Definition SurfaceTransportState.hpp:87
int n_pollut
Definition SurfaceTransportState.hpp:80
double concentration(int s, int c, double volume_m3, double dry_volume_m3) const noexcept
Reported concentration — derived, never stored. dry_volume_m3 is the hydraulics' own dry threshold ex...
Definition SurfaceTransportState.hpp:293
std::vector< double > exch_spill
Definition SurfaceTransportState.hpp:139
std::vector< double > gained_bed
signed finite-bed -> surface exchange; empty in compatibility mode
Definition SurfaceTransportState.hpp:124
int temp_row
Definition SurfaceTransportState.hpp:83
int n_species
rows carried; 0 ⇒ transport is off everywhere
Definition SurfaceTransportState.hpp:71
std::vector< BoundaryQualityRow > bc_quality_rows
Definition SurfaceTransportState.hpp:158
std::vector< double > lost_external
Definition SurfaceTransportState.hpp:122