OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
SpatialFrame.hpp
Go to the documentation of this file.
1
27#ifndef OPENSWMM_ENGINE_SPATIAL_FRAME_HPP
28#define OPENSWMM_ENGINE_SPATIAL_FRAME_HPP
29
30#include <string>
31#include <vector>
32#include <cstdint>
33
34namespace openswmm {
35
36// ============================================================================
37// Forward declarations for 2D coupling (R30)
38// ============================================================================
39
50public:
51 virtual ~ICouplingPoint() = default;
52
54 virtual int object_index() const noexcept = 0;
55
57 virtual const char* object_type() const noexcept = 0;
58
60 virtual void exchange_to_2d(double value) = 0;
61
63 virtual double receive_from_2d() const = 0;
64};
65
66// ============================================================================
67// SpatialFrame
68// ============================================================================
69
83 // -----------------------------------------------------------------------
84 // Coordinate reference system
85 // -----------------------------------------------------------------------
86
100 std::string crs;
101
106 bool is_geographic = false;
107
108 // -----------------------------------------------------------------------
109 // Node coordinates (indexed parallel to NodeData)
110 // -----------------------------------------------------------------------
111
113 std::vector<double> node_x;
114
116 std::vector<double> node_y;
117
118 // -----------------------------------------------------------------------
119 // Link coordinates (one point per link — nominal centroid or from-node)
120 // -----------------------------------------------------------------------
121
123 std::vector<double> link_x;
124
126 std::vector<double> link_y;
127
128 // -----------------------------------------------------------------------
129 // Subcatchment centroid coordinates
130 // -----------------------------------------------------------------------
131
133 std::vector<double> subcatch_x;
134
136 std::vector<double> subcatch_y;
137
138 // -----------------------------------------------------------------------
139 // Link vertices (polyline points between from-node and to-node)
140 // -----------------------------------------------------------------------
141
143 std::vector<std::vector<double>> link_vertices_x;
144
146 std::vector<std::vector<double>> link_vertices_y;
147
148 // -----------------------------------------------------------------------
149 // Subcatchment polygon vertices
150 // -----------------------------------------------------------------------
151
153 std::vector<std::vector<double>> subcatch_polygon_x;
154
156 std::vector<std::vector<double>> subcatch_polygon_y;
157
158 // -----------------------------------------------------------------------
159 // Gage coordinates
160 // -----------------------------------------------------------------------
161
163 std::vector<double> gage_x;
164
166 std::vector<double> gage_y;
167
168 // -----------------------------------------------------------------------
169 // 2D coupling interface (R30)
170 // -----------------------------------------------------------------------
171
182 std::vector<ICouplingPoint*> coupling_points;
183
189 if (point) coupling_points.push_back(point);
190 }
191
195 bool has_2d_coupling() const noexcept {
196 return !coupling_points.empty();
197 }
198};
199
200} /* namespace openswmm */
201
202#endif /* OPENSWMM_ENGINE_SPATIAL_FRAME_HPP */
Abstract coupling point between a 1D SWMM object and a 2D mesh cell.
Definition SpatialFrame.hpp:49
virtual ~ICouplingPoint()=default
virtual void exchange_to_2d(double value)=0
Exchange 1D state to the 2D component at this point.
virtual int object_index() const noexcept=0
Index of the 1D SWMM object (node, link, or subcatch index).
virtual double receive_from_2d() const =0
Receive 2D state from the 2D component at this point.
virtual const char * object_type() const noexcept=0
Type: "NODE", "LINK", or "SUBCATCH".
Definition Controls.cpp:24
Spatial frame containing CRS and georeferenced coordinates.
Definition SpatialFrame.hpp:82
std::vector< double > link_x
Link centroid X coordinates.
Definition SpatialFrame.hpp:123
void register_coupling_point(ICouplingPoint *point)
Register a 2D coupling point.
Definition SpatialFrame.hpp:188
std::vector< double > subcatch_x
Subcatchment centroid X.
Definition SpatialFrame.hpp:133
std::vector< double > node_x
Node X coordinates (easting or longitude).
Definition SpatialFrame.hpp:113
std::vector< double > gage_x
Gage X coordinates.
Definition SpatialFrame.hpp:163
std::vector< double > gage_y
Gage Y coordinates.
Definition SpatialFrame.hpp:166
std::string crs
CRS specification string.
Definition SpatialFrame.hpp:100
std::vector< std::vector< double > > subcatch_polygon_y
Per-subcatchment polygon Y vertices.
Definition SpatialFrame.hpp:156
bool has_2d_coupling() const noexcept
Returns true if any 2D coupling points are registered.
Definition SpatialFrame.hpp:195
std::vector< std::vector< double > > link_vertices_x
Per-link X vertices. link_vertices_x[link_idx] is a vector of X coords.
Definition SpatialFrame.hpp:143
std::vector< double > link_y
Link centroid Y coordinates.
Definition SpatialFrame.hpp:126
std::vector< std::vector< double > > subcatch_polygon_x
Per-subcatchment polygon X vertices.
Definition SpatialFrame.hpp:153
std::vector< double > node_y
Node Y coordinates (northing or latitude).
Definition SpatialFrame.hpp:116
std::vector< double > subcatch_y
Subcatchment centroid Y.
Definition SpatialFrame.hpp:136
std::vector< std::vector< double > > link_vertices_y
Per-link Y vertices. link_vertices_y[link_idx] is a vector of Y coords.
Definition SpatialFrame.hpp:146
std::vector< ICouplingPoint * > coupling_points
Registered 2D coupling points.
Definition SpatialFrame.hpp:182