![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
O(1) name-to-index lookup for SWMM objects. More...
#include <string>#include <string_view>#include <unordered_map>#include <vector>#include <stdexcept>#include <optional>Go to the source code of this file.
Classes | |
| class | openswmm::NameIndex |
| Bidirectional name↔index registry for SWMM objects. More... | |
Namespaces | |
| namespace | openswmm |
O(1) name-to-index lookup for SWMM objects.
Wraps an unordered_map<string,int> to provide fast lookup of object indices by name. Used by SimulationContext for nodes, links, subcatchments, rain gages, tables, pollutants, and user flags.
The legacy SWMM engine uses project_findObject() in src/solver/project.c, which does a linear scan through the object name table. For models with hundreds of conduits this becomes noticeable during input parsing.
NameIndex replaces that with a hash map so every lookup is O(1).