![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
Time series and rating curve data with bidirectional cursor. More...
#include <string>#include <vector>#include <cstdint>#include <cassert>#include <algorithm>Go to the source code of this file.
Classes | |
| struct | openswmm::TableCursor |
| Bidirectional cursor tracking the last accessed index in a Table. More... | |
| struct | openswmm::Table |
| A single time series or rating curve. More... | |
| struct | openswmm::TableData |
| SoA collection of all time series and curves in the model. More... | |
Namespaces | |
| namespace | openswmm |
Enumerations | |
| enum class | openswmm::TableType : int { openswmm::TIMESERIES = 0 , openswmm::CURVE_STORAGE = 1 , openswmm::CURVE_DIVERSION = 2 , openswmm::CURVE_RATING = 3 , openswmm::CURVE_SHAPE = 4 , openswmm::CURVE_CONTROL = 5 , openswmm::CURVE_TIDAL = 6 , openswmm::CURVE_PUMP1 = 7 , openswmm::CURVE_PUMP2 = 8 , openswmm::CURVE_PUMP3 = 9 , openswmm::CURVE_PUMP4 = 10 } |
| Type of data stored in a Table. More... | |
Functions | |
| double | openswmm::table_lookup_cursor (Table &tbl, double x_query) noexcept |
| Look up a value in a Table using the bidirectional cursor. | |
| double | openswmm::table_step_cursor (Table &tbl, double x_query) noexcept |
| Piecewise-constant (step function) table lookup with cursor. | |
Time series and rating curve data with bidirectional cursor.
Provides the Table struct (a single time series or curve) and TableData (the SoA collection of all tables in the model), plus the cursor-optimized lookup function.
The legacy SWMM table_lookup() in src/solver/table.c performs a linear scan from index 0 on every call. For a simulation with many output steps and long time series, this becomes O(N*T) total work where N is the number of table entries and T is the number of timesteps.
The new engine uses a bidirectional cursor that remembers where the last lookup landed. For monotonically advancing simulation time (the common case), each lookup costs O(1) — the cursor simply advances one or a few positions. For backward seeks (e.g., restart scenarios), the cursor retreats.