OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
PollutantData.hpp
Go to the documentation of this file.
1
19#ifndef OPENSWMM_ENGINE_POLLUTANT_DATA_HPP
20#define OPENSWMM_ENGINE_POLLUTANT_DATA_HPP
21
22#include <vector>
23#include <string>
24#include <cstdint>
25
26namespace openswmm {
27
28// ============================================================================
29// Concentration units
30// ============================================================================
31
36enum class MassUnits : int8_t {
37 MG_PER_L = 0,
38 UG_PER_L = 1,
39 COUNTS_PER_L = 2
40};
41
42// ============================================================================
43// PollutantData — pollutant definitions
44// ============================================================================
45
56
57 // -----------------------------------------------------------------------
58 // Pollutant definition arrays (indexed by pollutant index)
59 // -----------------------------------------------------------------------
60
65 std::vector<MassUnits> units;
66
71 std::vector<double> mwt;
72
77 std::vector<double> k_decay;
78
83 std::vector<double> c_rain;
84
89 std::vector<double> c_gw;
90
95 std::vector<double> c_rdii;
96
101 std::vector<double> init_conc;
102
108 std::vector<int> co_pollut;
109
114 std::vector<double> co_frac;
115
120 std::vector<bool> snow_only;
121
127 std::vector<std::string> comments;
128
129 // -----------------------------------------------------------------------
130 // Capacity management
131 // -----------------------------------------------------------------------
132
133 int n_pollutants() const noexcept { return static_cast<int>(units.size()); }
134
136 void resize_pollutants(int n) {
137 const auto un = static_cast<std::size_t>(n);
138 units.assign(un, MassUnits::MG_PER_L);
139 mwt.assign(un, 1.0);
140 k_decay.assign(un, 0.0);
141 c_rain.assign(un, 0.0);
142 c_gw.assign(un, 0.0);
143 c_rdii.assign(un, 0.0);
144 init_conc.assign(un, 0.0);
145 co_pollut.assign(un, -1);
146 co_frac.assign(un, 0.0);
147 snow_only.assign(un, false);
148 comments.assign(un, std::string{});
149 }
150
153 units.shrink_to_fit();
154 mwt.shrink_to_fit();
155 k_decay.shrink_to_fit();
156 c_rain.shrink_to_fit();
157 c_gw.shrink_to_fit();
158 c_rdii.shrink_to_fit();
159 init_conc.shrink_to_fit();
160 co_pollut.shrink_to_fit();
161 co_frac.shrink_to_fit();
162 snow_only.shrink_to_fit();
163 comments.shrink_to_fit();
164 }
165};
166
167} /* namespace openswmm */
168
169#endif /* OPENSWMM_ENGINE_POLLUTANT_DATA_HPP */
Definition NodeCoupling.cpp:15
MassUnits
Pollutant concentration units.
Definition PollutantData.hpp:36
@ MG_PER_L
Milligrams per liter.
@ UG_PER_L
Micrograms per liter.
@ COUNTS_PER_L
Counts per liter (bacteria)
Static properties for each pollutant species.
Definition PollutantData.hpp:55
std::vector< double > init_conc
Initial concentration everywhere in the network.
Definition PollutantData.hpp:101
int n_pollutants() const noexcept
Definition PollutantData.hpp:133
void shrink_to_fit()
Release excess vector capacity.
Definition PollutantData.hpp:152
void resize_pollutants(int n)
Resize pollutant definition arrays to hold n pollutants.
Definition PollutantData.hpp:136
std::vector< double > c_gw
Groundwater concentration.
Definition PollutantData.hpp:89
std::vector< int > co_pollut
Co-pollutant index (-1 if none).
Definition PollutantData.hpp:108
std::vector< double > c_rain
Rain concentration (project mass/volume units).
Definition PollutantData.hpp:83
std::vector< std::string > comments
Object comment from the INP file (';'-prefixed lines immediately above this pollutant's data row),...
Definition PollutantData.hpp:127
std::vector< double > mwt
Molecular weight (g/mol). Used for unit conversions.
Definition PollutantData.hpp:71
std::vector< double > k_decay
First-order decay coefficient (1/day).
Definition PollutantData.hpp:77
std::vector< bool > snow_only
True if the pollutant should be printed in output.
Definition PollutantData.hpp:120
std::vector< double > c_rdii
RDII concentration.
Definition PollutantData.hpp:95
std::vector< MassUnits > units
Concentration units for each pollutant.
Definition PollutantData.hpp:65
std::vector< double > co_frac
Co-fraction (fraction of co-pollutant concentration).
Definition PollutantData.hpp:114