OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
InputReader.hpp File Reference

Top-level SWMM .inp file reader. More...

#include "SectionRegistry.hpp"
#include "../core/SimulationContext.hpp"
#include <string>
#include <vector>
#include <iosfwd>
Include dependency graph for InputReader.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  openswmm::input::InputReader
 Reads and parses a SWMM .inp file into a SimulationContext. More...
 

Namespaces

namespace  openswmm
 
namespace  openswmm::input
 

Detailed Description

Top-level SWMM .inp file reader.

InputReader performs a single-pass read of the .inp file:

  1. Read lines one at a time.
  2. Detect section headers ([SECTIONNAME]).
  3. Accumulate non-blank, comment-stripped lines for the current section.
  4. When the next section header (or EOF) is reached, dispatch the accumulated lines to the SectionRegistry.

The SectionRegistry then calls the appropriate built-in or custom handler, which populates the SimulationContext.

Two-pass vs single-pass

The legacy SWMM uses two passes: one to count objects, one to read data. The new engine does a single pass using dynamic resize: objects are added to name indices as their section is parsed, and NodeData::resize() is called at the end of each section.

Parsing order

SWMM input files may list sections in any order. Cross-references (e.g., a junction referencing a rain gage) are resolved after all sections are parsed in a final resolution step.

See also
Tokenizer.hpp — used for line splitting
SectionRegistry.hpp — dispatches each section
Legacy reference: src/solver/input.c — input_readData()
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License