OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
SubsurfaceSections.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
85
86#ifndef OPENSWMM_ENGINE_2D_SUBSURFACE_SECTIONS_HPP
87#define OPENSWMM_ENGINE_2D_SUBSURFACE_SECTIONS_HPP
88
89#include "SubsurfaceData.hpp"
91
92#include <string>
93#include <functional>
94#include <limits>
95#include <vector>
96
97namespace openswmm {
99}
100
101namespace openswmm::twoD {
102
103struct MeshData;
104
120std::string parseAquiferOptionsLine(const std::vector<std::string>& tokens, GwOptions& opts);
121
139std::string parseAquiferLine(const std::vector<std::string>& tokens,
140 std::vector<GwAquiferRow>& rows);
141
158std::string parseAquiferNodeLine(const std::vector<std::string>& tokens,
159 std::vector<GwNodeBed>& beds, std::vector<std::string>& names);
160
176std::string parseAquiferLinkLine(const std::vector<std::string>& tokens,
177 std::vector<GwLinkRow>& rows, std::vector<std::string>& names);
178
193std::string parseAquiferBoundaryLine(const std::vector<std::string>& tokens,
194 std::vector<GwBoundaryRow>& rows);
195
210void registerSubsurfaceSections(SubsurfaceConfig& cfg, std::vector<std::string>& node_names,
211 std::vector<std::string>& link_names,
212 input::SectionRegistry& registry);
213
223GwUnitFactors gwUnitFactors(const SimulationContext& ctx) noexcept;
224
254std::vector<std::string> resolveSubsurface(SimulationContext& ctx, const MeshData& mesh,
255 SubsurfaceConfig& cfg, std::vector<std::string>& names,
256 double node_xy_to_mesh);
257
259 int cell = -1;
260 double begin = 0, end = 0;
261 double share = 1;
262};
264 std::string error;
265 double length = 0, covered_length = 0;
266 bool cancelled = false;
267 std::size_t interval_count = 0, contact_cells = 0;
268 std::vector<MeshPolylineInterval> intervals;
269};
270
303mapMeshPolyline(const MeshData&, const std::vector<double>& x, const std::vector<double>& y,
304 const std::function<bool(int)>& progress = {}, std::size_t first_interval = 0,
305 std::size_t max_intervals = std::numeric_limits<std::size_t>::max(),
306 bool count_contact_cells = false);
307
340std::vector<GwLinkShare> resolveLinkSeepage(SimulationContext& ctx, const MeshData& mesh,
341 SubsurfaceConfig& cfg,
342 std::vector<std::string>& link_names,
343 double node_xy_to_mesh, int& n_conduits);
344
366std::vector<GwSubcatchShare> resolveSubcatchInfiltration(const SimulationContext& ctx,
367 const MeshData& mesh,
368 double node_xy_to_mesh, int& n_subcatch);
369
388void writeSubsurfaceSections(const SubsurfaceConfig& cfg,
389 const std::vector<std::string>& node_names,
390 const std::vector<std::string>& link_names, std::string& out,
391 bool full_precision = false);
392
393} // namespace openswmm::twoD
394
395#endif // OPENSWMM_ENGINE_2D_SUBSURFACE_SECTIONS_HPP
Registry that maps SWMM section tags to handler functions.
G-step 1 — state, parameters and options for the two-zone groundwater kernel (TWO_ZONE_GROUNDWATER_EX...
Definition ExchangeLaw.hpp:60
std::string parseAquiferNodeLine(const std::vector< std::string > &tokens, std::vector< GwNodeBed > &beds, std::vector< std::string > &names)
Parse one named native-node aquifer bed with explicit cell or deferred location.
Definition SubsurfaceSections.cpp:429
MeshPolylineMapping mapMeshPolyline(const MeshData &mesh, const std::vector< double > &x, const std::vector< double > &y, const std::function< bool(int)> &progress, std::size_t first_interval, std::size_t max_intervals, bool count_contact_cells)
Clip a polyline into exact convex-cell chainage intervals with local shared-edge ownership.
Definition SubsurfaceSections.cpp:1014
std::vector< GwSubcatchShare > resolveSubcatchInfiltration(const SimulationContext &ctx, const MeshData &mesh, double node_xy_to_mesh, int &n_subcatch)
Compute normalized polygon-area shares from every subcatchment footprint to mesh cells.
Definition SubsurfaceSections.cpp:1472
std::vector< GwLinkShare > resolveLinkSeepage(SimulationContext &ctx, const MeshData &mesh, SubsurfaceConfig &cfg, std::vector< std::string > &link_names, double node_xy_to_mesh, int &n_conduits)
Resolve conduit polylines into normalized aquifer cell shares and vertical contact reaches.
Definition SubsurfaceSections.cpp:1294
std::string parseAquiferBoundaryLine(const std::vector< std::string > &t, std::vector< GwBoundaryRow > &rows)
Parse a unique hydraulic aquifer exterior-edge prescription.
Definition SubsurfaceSections.cpp:531
std::vector< std::string > resolveSubsurface(SimulationContext &ctx, const MeshData &mesh, SubsurfaceConfig &cfg, std::vector< std::string > &names, double node_xy_to_mesh)
Resolve native-node bed identity/location and optional coordinate-based automatic enrollment.
Definition SubsurfaceSections.cpp:1159
std::string parseAquiferLinkLine(const std::vector< std::string > &tokens, std::vector< GwLinkRow > &rows, std::vector< std::string > &names)
Parse named conduit bed coefficient/path and exchange opt-out authoring row.
Definition SubsurfaceSections.cpp:488
std::string parseAquiferLine(const std::vector< std::string > &tokens, std::vector< GwAquiferRow > &rows)
Parse a scoped aquifer hydraulic authoring row into a local candidate.
Definition SubsurfaceSections.cpp:312
GwUnitFactors gwUnitFactors(const SimulationContext &ctx) noexcept
Resolve authored aquifer units into SI kernel conversion factors.
Definition SubsurfaceSections.cpp:642
void registerSubsurfaceSections(SubsurfaceConfig &cfg, std::vector< std::string > &node_names, std::vector< std::string > &link_names, input::SectionRegistry &registry)
Register aquifer option/cell/node/link/boundary and surface-ownership authoring callbacks.
Definition SubsurfaceSections.cpp:578
std::string parseAquiferOptionsLine(const std::vector< std::string > &tokens, GwOptions &opts)
Apply one aquifer authoring option without initializing a physical column.
Definition SubsurfaceSections.cpp:181
void writeSubsurfaceSections(const SubsurfaceConfig &cfg, const std::vector< std::string > &node_names, const std::vector< std::string > &link_names, std::string &out, bool full_precision)
Append retained aquifer/ownership/boundary authoring sections in project units.
Definition SubsurfaceSections.cpp:1905
Definition ExchangeLaw.hpp:60
double * y
Definition odesolve.c:37
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
[2D_AQUIFER_OPTIONS]. Defaults are the plan's starred values.
Definition SubsurfaceData.hpp:142
Project-unit → SI multipliers for the four kinds of aquifer number.
Definition SubsurfaceData.hpp:374
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
Definition MeshData.hpp:65
Definition SubsurfaceSections.hpp:258
double share
coincident shared-edge ownership, never added length.
Definition SubsurfaceSections.hpp:261
int cell
Definition SubsurfaceSections.hpp:259
double begin
Definition SubsurfaceSections.hpp:260
double end
SI chainage along the complete polyline, m.
Definition SubsurfaceSections.hpp:260
Definition SubsurfaceSections.hpp:263
std::size_t interval_count
Definition SubsurfaceSections.hpp:267
std::string error
Definition SubsurfaceSections.hpp:264
std::size_t contact_cells
Definition SubsurfaceSections.hpp:267
bool cancelled
Definition SubsurfaceSections.hpp:266
double length
Definition SubsurfaceSections.hpp:265
std::vector< MeshPolylineInterval > intervals
Definition SubsurfaceSections.hpp:268
double covered_length
Definition SubsurfaceSections.hpp:265
Everything the parser fills, before resolution onto cells.
Definition SubsurfaceData.hpp:391