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 <span>
49#include <string>
50#include <vector>
51
52namespace openswmm::twoD {
53
77std::string parse2DOptionsLine(const std::vector<std::string>& tokens, SolverOptions2D& opts,
78 std::vector<std::string>* warnings = nullptr);
79
97std::string parse2DVertexLine(const std::vector<std::string>& tokens, MeshData& mesh);
98
117std::string parse2DTriangleLine(const std::vector<std::string>& tokens, MeshData& mesh);
118
137std::string parse2DQuadLine(const std::vector<std::string>& tokens, MeshData& mesh);
138
153std::string parse2DInitialVelocityLine(const std::vector<std::string>& tokens, MeshData& mesh);
154
171std::string parse2DVertexNodeMapLine(const std::vector<std::string>& tokens, MeshData& mesh);
172
190std::string parse2DTriangleNodeMapLine(const std::vector<std::string>& tokens, MeshData& mesh);
191
217std::string
218parse2DBoundaryConditionsLine(const std::vector<std::string>& tokens,
219 std::vector<SurfaceRouter2D::PendingBoundaryRow>& pending_rows);
220
242std::string
243parse2DEdgeConveyanceLine(const std::vector<std::string>& tokens,
244 std::vector<SurfaceRouter2D::PendingEdgeConveyanceRow>& pending_rows);
245
262std::string parse2DInfiltrationOptionsLine(const std::vector<std::string>& tokens, Infil2D& infil);
263
287std::string parse2DInfiltrationDefaultsLine(const std::vector<std::string>& tokens, Infil2D& infil);
288
310std::string parse2DInfiltrationLine(const std::vector<std::string>& tokens, Infil2D& infil);
311
325bool is2DOptionKey(const std::string& key);
326
334std::span<const char* const> current2DOptionKeys();
335
349bool is2DRetiredOptionKey(const std::string& key);
350
365const std::vector<std::string>& report2DVarTokens();
375std::string parseReport2DVars(const std::string& text, unsigned& mask);
381std::string formatReport2DVars(unsigned mask);
382
404std::string format2DOptionValue(const SolverOptions2D& opts, const std::string& key);
405
420std::string format2DOptionValueEx(const SolverOptions2D& opts, const Infil2D* infil,
421 const std::string& key);
422
438std::string format2DOptionValueEx(const SolverOptions2D& opts, const Infil2D* infil,
439 const SubsurfaceConfig* aquifer, const std::string& key);
440
471void register2DSections(MeshData& mesh, SolverOptions2D& options,
472 std::vector<SurfaceRouter2D::PendingBoundaryRow>& pending_bc_rows,
473 std::vector<SurfaceRouter2D::PendingEdgeConveyanceRow>& pending_ec_rows,
474 std::vector<SurfaceRouter2D::PendingInitialQualityRow>& pending_iq_rows,
475 std::vector<SurfaceRouter2D::PendingInitialBedQualityRow>& pending_ibq_rows,
476 std::vector<SurfaceRouter2D::PendingBoundaryQualityRow>& pending_bq_rows,
477 input::SectionRegistry& registry);
478
493std::string parse2DInitialQualityLine(const std::vector<std::string>& tokens,
494 std::vector<SurfaceRouter2D::PendingInitialQualityRow>& rows);
495
509std::string
510parse2DInitialBedQualityLine(const std::vector<std::string>& tokens,
511 std::vector<SurfaceRouter2D::PendingInitialBedQualityRow>& rows);
512
526std::string
527parse2DBoundaryQualityLine(const std::vector<std::string>& tokens,
528 std::vector<SurfaceRouter2D::PendingBoundaryQualityRow>& rows);
529
584std::string load2DMeshExternalFile(
585 MeshData& mesh, SolverOptions2D& opts,
586 std::vector<SurfaceRouter2D::PendingBoundaryRow>& pending_bc_rows,
587 std::vector<SurfaceRouter2D::PendingEdgeConveyanceRow>& pending_ec_rows, Infil2D* infil,
588 const std::string& mesh_file, const std::string& inp_base_dir,
589 std::vector<std::string>* warnings = nullptr,
590 std::vector<SurfaceRouter2D::PendingInitialQualityRow>* pending_iq_rows = nullptr,
591 std::vector<SurfaceRouter2D::PendingInitialBedQualityRow>* pending_ibq_rows = nullptr,
592 std::vector<SurfaceRouter2D::PendingBoundaryQualityRow>* pending_bq_rows = nullptr);
593
619void prescan2DUnitsHeader(const std::string& inp_path, SolverOptions2D& opts);
620
621} // namespace openswmm::twoD
622
623#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:175
Definition ExchangeLaw.hpp:60
std::string format2DOptionValue(const SolverOptions2D &opts, const std::string &key)
Format a stored 2D option as a canonical authoring/display token.
Definition SectionHandlers2D.cpp:767
std::string parse2DQuadLine(const std::vector< std::string > &tokens, MeshData &mesh)
Parse a single line from the [2D_QUADS] section.
Definition SectionHandlers2D.cpp:1125
std::string formatReport2DVars(unsigned mask)
Format a report bitmask using canonical presets or ordered keyword list.
Definition SectionHandlers2D.cpp:750
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:1261
std::string parse2DInitialVelocityLine(const std::vector< std::string > &tokens, MeshData &mesh)
Parse a single line from the [2D_INITIAL_VELOCITY] section.
Definition SectionHandlers2D.cpp:1179
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:163
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:1208
std::string parse2DInitialBedQualityLine(const std::vector< std::string > &tokens, std::vector< SurfaceRouter2D::PendingInitialBedQualityRow > &rows)
Parse a finite local-bed native concentration seed without resolving a physical bed.
Definition SectionHandlers2D.cpp:1768
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:1615
bool is2DOptionKey(const std::string &key)
True when key (case-insensitive) is a [2D_OPTIONS] parameter accepted by parse2DOptionsLine.
Definition SectionHandlers2D.cpp:652
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:1644
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::PendingInitialBedQualityRow > *pending_ibq_rows, std::vector< SurfaceRouter2D::PendingBoundaryQualityRow > *pending_bq_rows)
Read a mesh sidecar through a local registry into caller-supplied authoring targets.
Definition SectionHandlers2D.cpp:2035
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:1464
const std::vector< std::string > & report2DVarTokens()
Borrow canonical report-group keyword tokens in defined bit order.
Definition SectionHandlers2D.cpp:730
std::string parse2DBoundaryQualityLine(const std::vector< std::string > &tokens, std::vector< SurfaceRouter2D::PendingBoundaryQualityRow > &rows)
Parse one zero-based surface boundary native concentration row.
Definition SectionHandlers2D.cpp:1822
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:1376
std::string parse2DVertexLine(const std::vector< std::string > &tokens, MeshData &mesh)
Parse a single line from the [2D_VERTICES] section.
Definition SectionHandlers2D.cpp:1007
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:633
std::string parse2DTriangleLine(const std::vector< std::string > &tokens, MeshData &mesh)
Parse a single line from the [2D_TRIANGLES] section.
Definition SectionHandlers2D.cpp:1048
std::string format2DOptionValueEx(const SolverOptions2D &opts, const Infil2D *infil, const std::string &key)
Format stored 2D policy with optional infiltration/aquifer authoring fallback.
Definition SectionHandlers2D.cpp:955
std::string parseReport2DVars(const std::string &text, unsigned &mask)
Parse report-group keyword list/preset through the shared mask grammar.
Definition SectionHandlers2D.cpp:741
std::string parse2DInfiltrationLine(const std::vector< std::string > &tokens, Infil2D &infil)
§5.5 track I — parse a single [2D_INFILTRATION] line.
Definition SectionHandlers2D.cpp:1673
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::PendingInitialBedQualityRow > &pending_ibq_rows, std::vector< SurfaceRouter2D::PendingBoundaryQualityRow > &pending_bq_rows, input::SectionRegistry &registry)
Register mesh/options/native-quality/boundary/infiltration authoring section handlers.
Definition SectionHandlers2D.cpp:1872
std::string parse2DInitialQualityLine(const std::vector< std::string > &tokens, std::vector< SurfaceRouter2D::PendingInitialQualityRow > &rows)
Parse one scoped initial surface native concentration authoring row.
Definition SectionHandlers2D.cpp:1715
std::span< const char *const > current2DOptionKeys()
Every current [2D_OPTIONS] key accepted by is2DOptionKey, in documentation order.
Definition SectionHandlers2D.cpp:663
void prescan2DUnitsHeader(const std::string &inp_path, SolverOptions2D &opts)
Scan an entire UTF-8 input/mesh file for a recognized SI mesh-units comment marker.
Definition SectionHandlers2D.cpp:2185
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
Definition MeshData.hpp:65
Definition SolverOptions2D.hpp:257
Everything the parser fills, before resolution onto cells.
Definition SubsurfaceData.hpp:391