![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Classes | |
| struct | InpWriteOptions |
| Write profile: which engine the file is written for. More... | |
Functions | |
| std::string | groundwaterSections (const SimulationContext &ctx) |
| Render the authored groundwater chemistry/aquifer reactor sections as text. | |
| int | writeInpFile (const SimulationContext &ctx, const std::string &path, std::vector< std::string > *warnings=nullptr) |
| Write the full model to a SWMM .inp file. | |
| int | writeInpFile (const SimulationContext &ctx_internal, const std::string &path, std::vector< std::string > *warnings, const InpWriteOptions &opts) |
| Write a complete model with explicit native or SWMM5 export options. | |
| std::string | modelText (const SimulationContext &ctx, const std::string &anchor, bool internal_units) |
| std::string openswmm::inp_writer::groundwaterSections | ( | const SimulationContext & | ctx | ) |
Render the authored groundwater chemistry/aquifer reactor sections as text.
Uses a temporary FILE to reuse emitGwTransportSections; runtime_error on temporary-file/write/read failure. Does not install output, advance state or rebase the retained FILE reference; allocation can throw.
| [in] | ctx | Borrowed model with live optional twod_io groundwater attachment and coherent authored rows. |
| std::string openswmm::inp_writer::modelText | ( | const SimulationContext & | ctx, |
| const std::string & | anchor, | ||
| bool | internal_units ) |
| int openswmm::inp_writer::writeInpFile | ( | const SimulationContext & | ctx, |
| const std::string & | path, | ||
| std::vector< std::string > * | warnings = nullptr ) |
Write the full model to a SWMM .inp file.
Sections written (in order): [TITLE], [OPTIONS], [EVAPORATION], [TEMPERATURE], [SNOWPACKS], [ADJUSTMENTS], [RAINGAGES], [SUBCATCHMENTS], [SUBAREAS], [INFILTRATION], [JUNCTIONS], [OUTFALLS], [STORAGE], [DIVIDERS], [CONDUITS], [PUMPS], [ORIFICES], [WEIRS], [OUTLETS], [XSECTIONS], [TRANSECTS], [LOSSES], [CONTROLS], [REPORT], [INFLOWS], [DWF], [RDII], [POLLUTANTS], [LANDUSES], [BUILDUP], [WASHOFF], [TREATMENT], [TIMESERIES], [CURVES], [PATTERNS], [USER_FLAGS], [PLUGINS], [MAP], [COORDINATES], [VERTICES], [Polygons], [SYMBOLS]
Slice IO-4: every external-file path slot ([FILES], [RAINGAGES] FILE, [TIMESERIES] FILE, [TEMPERATURE] FILE, etc.) is emitted relative to the destination directory by default. Set ctx.options.write_absolute_paths = true to disable rebasing. Slots that cannot be expressed relatively (cross-volume on Windows, UNC roots, beyond the depth cap) fall back to absolute form and append a human-readable explanation to warnings when that vector is non-null.
| ctx | Simulation context with all model data. |
| path | Output file path. |
| warnings | Optional sink for non-fatal portability warnings (cross-volume slots, etc.). Pass nullptr to discard. |
Main INP, engine-owned mesh and written component configs use adjacent temporary files, checked write/flush/sync/close, and individual atomic replacement. Errors are returned and described in warnings when supplied. This is not a multi-file transaction: a later main-file failure does not roll back an already-published mesh or component configuration. Output redirection/recovery remain caller concerns.
| int openswmm::inp_writer::writeInpFile | ( | const SimulationContext & | ctx_internal, |
| const std::string & | path, | ||
| std::vector< std::string > * | warnings, | ||
| const InpWriteOptions & | opts ) |
Write a complete model with explicit native or SWMM5 export options.
Converts a local context copy back to display/authored representation as needed, leaving the live model unchanged. Writes main/mesh/component files via individual AtomicOutputFile commits; a later failure does not roll back earlier sidecar publication. Maps legacy-incompatible features according to profile; rejects UEB/mesh snow rather than silently replacing physics. Allocation, callback and serializer exceptions can propagate.
| [in] | ctx_internal | Borrowed coherent model in its current authored/resolved unit/orientation state; valid flow_units and aligned names/arrays required. |
| [in] | path | UTF-8 final INP destination, also the path-rebasing anchor. |
| [in,out] | warnings | Optional append-only portability, profile-substitution and IO diagnostics; NULL discards them. |
| [in] | opts | Export profile and optional physical staging callback; caller owns mapped staging cleanup/publication. |