OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
SectionHandlers2D.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2//
3// Copyright 2026 Caleb Buahin
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
38
39#ifndef OPENSWMM_ENGINE_2D_SECTION_HANDLERS_HPP
40#define OPENSWMM_ENGINE_2D_SECTION_HANDLERS_HPP
41
42#include "../data/MeshData.hpp"
44#include "../infil/Infil2D.hpp"
47
48#include <string>
49#include <vector>
50
51namespace openswmm::twoD {
52
65std::string parse2DOptionsLine(const std::vector<std::string>& tokens,
66 SolverOptions2D& opts,
67 std::vector<std::string>* warnings = nullptr);
68
78std::string parse2DVertexLine(const std::vector<std::string>& tokens,
79 MeshData& mesh);
80
90std::string parse2DTriangleLine(const std::vector<std::string>& tokens,
91 MeshData& mesh);
92
99std::string parse2DQuadLine(const std::vector<std::string>& tokens,
100 MeshData& mesh);
101
111std::string parse2DInitialVelocityLine(const std::vector<std::string>& tokens,
112 MeshData& mesh);
113
123std::string parse2DVertexNodeMapLine(const std::vector<std::string>& tokens,
124 MeshData& mesh);
125
135std::string parse2DTriangleNodeMapLine(const std::vector<std::string>& tokens,
136 MeshData& mesh);
137
154 const std::vector<std::string>& tokens,
155 std::vector<SurfaceRouter2D::PendingBoundaryRow>& pending_rows);
156
170std::string parse2DEdgeConveyanceLine(
171 const std::vector<std::string>& tokens,
172 std::vector<SurfaceRouter2D::PendingEdgeConveyanceRow>& pending_rows);
173
183 const std::vector<std::string>& tokens, Infil2D& infil);
184
203 const std::vector<std::string>& tokens, Infil2D& infil);
204
217std::string parse2DInfiltrationLine(
218 const std::vector<std::string>& tokens, Infil2D& infil);
219
230bool is2DOptionKey(const std::string& key);
231
242bool is2DRetiredOptionKey(const std::string& key);
243
264const std::vector<std::string>& report2DVarTokens();
265std::string parseReport2DVars(const std::string& text, unsigned& mask);
266std::string formatReport2DVars(unsigned mask);
267
268std::string format2DOptionValue(const SolverOptions2D& opts,
269 const std::string& key);
270
277std::string format2DOptionValueEx(const SolverOptions2D& opts,
278 const Infil2D* infil,
279 const std::string& key);
280
287std::string format2DOptionValueEx(const SolverOptions2D& opts,
288 const Infil2D* infil,
289 const SubsurfaceConfig* aquifer,
290 const std::string& key);
291
303 SolverOptions2D& options,
304 std::vector<SurfaceRouter2D::PendingBoundaryRow>& pending_bc_rows,
305 std::vector<SurfaceRouter2D::PendingEdgeConveyanceRow>& pending_ec_rows,
306 std::vector<SurfaceRouter2D::PendingInitialQualityRow>& pending_iq_rows,
307 std::vector<SurfaceRouter2D::PendingBoundaryQualityRow>& pending_bq_rows,
308 input::SectionRegistry& registry);
309
311std::string parse2DInitialQualityLine(
312 const std::vector<std::string>& tokens,
313 std::vector<SurfaceRouter2D::PendingInitialQualityRow>& rows);
314
317 const std::vector<std::string>& tokens,
318 std::vector<SurfaceRouter2D::PendingBoundaryQualityRow>& rows);
319
348std::string load2DMeshExternalFile(MeshData& mesh,
349 SolverOptions2D& opts,
350 std::vector<SurfaceRouter2D::PendingBoundaryRow>& pending_bc_rows,
351 std::vector<SurfaceRouter2D::PendingEdgeConveyanceRow>& pending_ec_rows,
352 Infil2D* infil,
353 const std::string& mesh_file,
354 const std::string& inp_base_dir,
355 std::vector<std::string>* warnings = nullptr,
356 std::vector<SurfaceRouter2D::PendingInitialQualityRow>* pending_iq_rows = nullptr,
357 std::vector<SurfaceRouter2D::PendingBoundaryQualityRow>* pending_bq_rows = nullptr);
358
374void prescan2DUnitsHeader(const std::string& inp_path, SolverOptions2D& opts);
375
376} // namespace openswmm::twoD
377
378#endif // OPENSWMM_ENGINE_2D_SECTION_HANDLERS_HPP
Per-cell infiltration for the 2D overland-flow mesh (track I).
Structure-of-Arrays (SoA) storage for 2D triangular mesh geometry.
Registry that maps SWMM section tags to handler functions.
Configuration options for the 2D surface routing solver.
Top-level orchestrator for the optional 2D surface routing module.
Owns per-cell infiltration parameters, kernel state and held rates.
Definition Infil2D.hpp:181
Definition NodeCoupling.cpp:16
std::string format2DOptionValue(const SolverOptions2D &opts, const std::string &key)
Definition SectionHandlers2D.cpp:440
std::string parse2DQuadLine(const std::vector< std::string > &tokens, MeshData &mesh)
Parse a single line from the [2D_QUADS] section.
Definition SectionHandlers2D.cpp:661
std::string formatReport2DVars(unsigned mask)
Definition SectionHandlers2D.cpp:437
std::string parse2DTriangleNodeMapLine(const std::vector< std::string > &tokens, MeshData &mesh)
Parse a single line from the [2D_TRIANGLE_NODE_MAP] section.
Definition SectionHandlers2D.cpp:768
std::string parse2DInitialVelocityLine(const std::vector< std::string > &tokens, MeshData &mesh)
Parse a single line from the [2D_INITIAL_VELOCITY] section.
Definition SectionHandlers2D.cpp:707
std::string parse2DOptionsLine(const std::vector< std::string > &tokens, SolverOptions2D &opts, std::vector< std::string > *warnings)
Parse a single line from the [2D_OPTIONS] section.
Definition SectionHandlers2D.cpp:101
std::string load2DMeshExternalFile(MeshData &mesh, SolverOptions2D &opts, std::vector< SurfaceRouter2D::PendingBoundaryRow > &pending_bc_rows, std::vector< SurfaceRouter2D::PendingEdgeConveyanceRow > &pending_ec_rows, Infil2D *infil, const std::string &mesh_file, const std::string &inp_base_dir, std::vector< std::string > *warnings, std::vector< SurfaceRouter2D::PendingInitialQualityRow > *pending_iq_rows, std::vector< SurfaceRouter2D::PendingBoundaryQualityRow > *pending_bq_rows)
Load 2D mesh sections from an external file.
Definition SectionHandlers2D.cpp:1326
std::string parse2DVertexNodeMapLine(const std::vector< std::string > &tokens, MeshData &mesh)
Parse a single line from the [2D_VERTEX_NODE_MAP] section.
Definition SectionHandlers2D.cpp:727
std::string parse2DInfiltrationOptionsLine(const std::vector< std::string > &tokens, Infil2D &infil)
§5.5 track I — parse a single [2D_INFILTRATION_OPTIONS] line.
Definition SectionHandlers2D.cpp:1052
bool is2DOptionKey(const std::string &key)
True when key (case-insensitive) is a [2D_OPTIONS] parameter accepted by parse2DOptionsLine.
Definition SectionHandlers2D.cpp:406
std::string parse2DInfiltrationDefaultsLine(const std::vector< std::string > &tokens, Infil2D &infil)
§5.5 track I — parse a single [2D_INFILTRATION_DEFAULTS] line.
Definition SectionHandlers2D.cpp:1073
void register2DSections(MeshData &mesh, SolverOptions2D &options, std::vector< SurfaceRouter2D::PendingBoundaryRow > &pending_bc_rows, std::vector< SurfaceRouter2D::PendingEdgeConveyanceRow > &pending_ec_rows, std::vector< SurfaceRouter2D::PendingInitialQualityRow > &pending_iq_rows, std::vector< SurfaceRouter2D::PendingBoundaryQualityRow > &pending_bq_rows, input::SectionRegistry &registry)
Register all 2D input section handlers with the section registry.
Definition SectionHandlers2D.cpp:1202
std::string parse2DEdgeConveyanceLine(const std::vector< std::string > &tokens, std::vector< SurfaceRouter2D::PendingEdgeConveyanceRow > &pending_rows)
§11A — parse a single [2D_EDGE_CONVEYANCE] line.
Definition SectionHandlers2D.cpp:925
const std::vector< std::string > & report2DVarTokens()
Format the current value of a [2D_OPTIONS] parameter as the string token parse2DOptionsLine accepts (...
Definition SectionHandlers2D.cpp:431
std::string parse2DBoundaryQualityLine(const std::vector< std::string > &tokens, std::vector< SurfaceRouter2D::PendingBoundaryQualityRow > &rows)
S2 — one [2D_BOUNDARY_QUALITY] line (TRI EDGE SPECIES CONC). Empty = OK.
Definition SectionHandlers2D.cpp:1172
std::string parse2DBoundaryConditionsLine(const std::vector< std::string > &tokens, std::vector< SurfaceRouter2D::PendingBoundaryRow > &pending_rows)
V-E3 — parse a single line from the [2D_BOUNDARY_CONDITIONS] section into a SurfaceRouter2D::PendingB...
Definition SectionHandlers2D.cpp:860
std::string parse2DVertexLine(const std::vector< std::string > &tokens, MeshData &mesh)
Parse a single line from the [2D_VERTICES] section.
Definition SectionHandlers2D.cpp:573
bool is2DRetiredOptionKey(const std::string &key)
True when key (case-insensitive) is a [2D_OPTIONS] parameter retired with the CVODE/ARKODE stack (D2,...
Definition SectionHandlers2D.cpp:392
std::string parse2DTriangleLine(const std::vector< std::string > &tokens, MeshData &mesh)
Parse a single line from the [2D_TRIANGLES] section.
Definition SectionHandlers2D.cpp:601
std::string format2DOptionValueEx(const SolverOptions2D &opts, const Infil2D *infil, const std::string &key)
format2DOptionValue with the E2 infiltration keys resolved against the model's [2D_INFILTRATION*] row...
Definition SectionHandlers2D.cpp:537
std::string parseReport2DVars(const std::string &text, unsigned &mask)
Definition SectionHandlers2D.cpp:433
std::string parse2DInfiltrationLine(const std::vector< std::string > &tokens, Infil2D &infil)
§5.5 track I — parse a single [2D_INFILTRATION] line.
Definition SectionHandlers2D.cpp:1092
std::string parse2DInitialQualityLine(const std::vector< std::string > &tokens, std::vector< SurfaceRouter2D::PendingInitialQualityRow > &rows)
S1/S2 — one [2D_INITIAL_QUALITY] line. Empty string = OK.
Definition SectionHandlers2D.cpp:1123
void prescan2DUnitsHeader(const std::string &inp_path, SolverOptions2D &opts)
Scan inp_path for a ;; UNITS: <value> comment header and set opts.mesh_units_si to true when the valu...
Definition SectionHandlers2D.cpp:1449
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
Definition MeshData.hpp:67
Configuration for the 2D surface routing solver.
Definition SolverOptions2D.hpp:208
Everything the parser fills, before resolution onto cells.
Definition SubsurfaceData.hpp:234