OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
ActiveSetData.hpp
Go to the documentation of this file.
1
30
31#ifndef OPENSWMM_ENGINE_2D_ACTIVE_SET_DATA_HPP
32#define OPENSWMM_ENGINE_2D_ACTIVE_SET_DATA_HPP
33
34#include <cstdint>
35#include <vector>
36
37namespace openswmm::twoD {
38
40 bool enabled = false;
41 int halo_rings = 2;
42 double wet_depth_eps = 0.0;
43
46 static constexpr uint8_t kInactive = 255;
47 std::vector<uint8_t> cell_ring;
49 std::vector<uint8_t> cell_active;
51 std::vector<uint8_t> vert_active;
52
53 // Compact ascending index lists rebuilt each advance (cache-friendly
54 // iteration; OpenMP schedules over these instead of branch-per-cell).
55 std::vector<int> active_cells;
56 std::vector<int> active_verts;
59 std::vector<int> outer_ring_cells;
60
61 // Diagnostics (cumulative over the run).
62 long rebuild_count = 0;
63 long halo_trip_count = 0;
64 int n_seed = 0;
65
66 int n_active() const noexcept { return static_cast<int>(active_cells.size()); }
67
69 void resize(int nt, int nv) {
70 cell_ring.assign(static_cast<std::size_t>(nt), kInactive);
71 cell_active.assign(static_cast<std::size_t>(nt), 0);
72 vert_active.assign(static_cast<std::size_t>(nv), 0);
73 active_cells.clear();
74 active_verts.clear();
75 outer_ring_cells.clear();
76 }
77};
78
79} // namespace openswmm::twoD
80
81#endif // OPENSWMM_ENGINE_2D_ACTIVE_SET_DATA_HPP
Definition NodeCoupling.cpp:15
Definition ActiveSetData.hpp:39
std::vector< int > active_cells
Definition ActiveSetData.hpp:55
double wet_depth_eps
wet threshold (m); cell is a seed if V > eps·A
Definition ActiveSetData.hpp:42
std::vector< uint8_t > vert_active
Vertex touched by ≥1 active cell. Sized n_vertices.
Definition ActiveSetData.hpp:51
long halo_trip_count
breach-redo occurrences
Definition ActiveSetData.hpp:63
std::vector< uint8_t > cell_active
1 = active (compute), 0 = frozen. Sized n_triangles.
Definition ActiveSetData.hpp:49
int n_seed
wet ∪ sourced cells at the last rebuild
Definition ActiveSetData.hpp:64
long rebuild_count
Definition ActiveSetData.hpp:62
std::vector< uint8_t > cell_ring
Definition ActiveSetData.hpp:47
std::vector< int > outer_ring_cells
Definition ActiveSetData.hpp:59
static constexpr uint8_t kInactive
Definition ActiveSetData.hpp:46
int halo_rings
current halo width (auto-widened on breach)
Definition ActiveSetData.hpp:41
std::vector< int > active_verts
Definition ActiveSetData.hpp:56
int n_active() const noexcept
Definition ActiveSetData.hpp:66
bool enabled
resolved: option ∧ CVODE ∧ DW momentum
Definition ActiveSetData.hpp:40
void resize(int nt, int nv)
Allocate the flag arrays (idempotent) and clear the lists.
Definition ActiveSetData.hpp:69