20#ifndef OPENSWMMVIS_MESH_INPMESHWRITER_H
21#define OPENSWMMVIS_MESH_INPMESHWRITER_H
144 double defaultMannings = 0.035,
215 const QVector<MeshEdgeBC> &bcs);
255 [[nodiscard]]
static bool writeExternal(
const QString &inpPath,
const QString &meshFilePath,
257 double defaultMannings = 0.035,
258 QString *errorOut =
nullptr,
259 const UnitInfo &units = {});
294 [[nodiscard]]
static bool writeExternal(
const QString &inpPath,
const QString &meshFilePath,
295 const MeshResult &
mesh,
const CouplingMap &coupling,
296 const QVector<MeshEdgeBC> &bcs,
double defaultMannings,
297 QString *errorOut =
nullptr,
298 const UnitInfo &units = {});
328 [[nodiscard]]
static bool writeInline(
const QString &inpPath,
const MeshResult &mesh,
329 const CouplingMap &coupling,
330 double defaultMannings = 0.035,
331 QString *errorOut =
nullptr,
const UnitInfo &units = {});
362 [[nodiscard]]
static bool writeInline(
const QString &inpPath,
const MeshResult &mesh,
363 const CouplingMap &coupling,
364 const QVector<MeshEdgeBC> &bcs,
double defaultMannings,
365 QString *errorOut =
nullptr,
const UnitInfo &units = {});
391 [[nodiscard]]
static bool writeMeshFileRef(
const QString &inpPath,
const QString &meshFilePath,
392 QString *errorOut =
nullptr);
418 const QString &logicalFinalMeshPath,
419 const QString &physicalStagedMeshPath,
420 QString *errorOut =
nullptr);
441 QString *errorOut =
nullptr);
477 [[nodiscard]]
static bool replaceMeshSections(
const QString &filePath,
const MeshResult &mesh,
478 const QVector<MeshEdgeBC> &bcs,
479 QString *errorOut =
nullptr,
480 double defaultMannings = 0.035,
508 [[nodiscard]]
static bool patchBCSections(
const QString &filePath,
const MeshResult &mesh,
509 const QVector<MeshEdgeBC> &bcs,
510 QString *errorOut =
nullptr);
549 const MeshResult &mesh,
550 QString *errorOut =
nullptr,
551 double defaultMannings = 0.035,
586 [[nodiscard]]
static bool patchMeshSections(
const QString &filePath,
const MeshResult &mesh,
587 const QVector<MeshEdgeBC> &bcs,
588 QString *errorOut =
nullptr,
589 double defaultMannings = 0.035,
613 [[nodiscard]]
static bool clearMeshFileRef(
const QString &inpPath, QString *errorOut =
nullptr);
641 const QString &meshFilePath,
const MeshResult &mesh,
642 const CouplingMap &coupling,
double defaultMannings = 0.035,
643 QString *errorOut =
nullptr,
const UnitInfo &units = {});
Stateless writer that renders a MeshResult plus CouplingMap as SWMM [2D_*] section text and writes or...
Definition inpmeshwriter.h:71
static QString buildBCSectionText(const QVector< MeshEdgeBC > &bcs)
Render authored cell/local-edge boundary rows with raw variant parameters.
Definition inpmeshwriter.cpp:1289
static bool patchAttributeSections(const QString &filePath, const MeshResult &mesh, QString *errorOut=nullptr, double defaultMannings=0.035, const UnitInfo *units=nullptr)
Rewrite owned geometry attributes/coupling/infiltration after matching row counts.
Definition inpmeshwriter.cpp:1621
static bool patchBCSections(const QString &filePath, const MeshResult &mesh, const QVector< MeshEdgeBC > &bcs, QString *errorOut=nullptr)
Replace only owned boundary/conveyance sections in one file.
Definition inpmeshwriter.cpp:1609
static bool writePreparedMeshFileRef(const QString &inpPath, const QString &logicalFinalMeshPath, const QString &physicalStagedMeshPath, QString *errorOut=nullptr)
Publish an INP reference to a final logical mesh name after checking a physical staged file.
Definition inpmeshwriter.cpp:1162
static bool writeMeshFileRef(const QString &inpPath, const QString &meshFilePath, QString *errorOut=nullptr)
Replace GUI-owned inline mesh sections with a reference to an existing filesystem entry.
Definition inpmeshwriter.cpp:1087
static bool patchMeshSections(const QString &filePath, const MeshResult &mesh, const QVector< MeshEdgeBC > &bcs, QString *errorOut=nullptr, double defaultMannings=0.035, const UnitInfo *units=nullptr)
Patch matched mesh attributes and complete boundary state in one atomic file update.
Definition inpmeshwriter.cpp:1637
static bool replaceMeshSections(const QString &filePath, const MeshResult &mesh, const QVector< MeshEdgeBC > &bcs, QString *errorOut=nullptr, double defaultMannings=0.035, const UnitInfo *units=nullptr)
Replace the complete owned topology and attributes in one checked single-file commit.
Definition inpmeshwriter.cpp:1201
static bool write(MeshOutputMode mode, const QString &inpPath, const QString &meshFilePath, const MeshResult &mesh, const CouplingMap &coupling, double defaultMannings=0.035, QString *errorOut=nullptr, const UnitInfo &units={})
Dispatch to the geometry-only external or inline publication strategy.
Definition inpmeshwriter.cpp:1271
static bool writeInline(const QString &inpPath, const MeshResult &mesh, const CouplingMap &coupling, double defaultMannings=0.035, QString *errorOut=nullptr, const UnitInfo &units={})
Replace GUI-owned mesh sections and any external mesh reference with an inline mesh.
Definition inpmeshwriter.cpp:1002
static bool validateTopologyReplacement(const QString &filePath, QString *errorOut=nullptr)
Read a model and reject recognized unsupported mesh-indexed assignments before replacement.
Definition inpmeshwriter.cpp:1192
static QString buildSectionText(const MeshResult &mesh, const CouplingMap &coupling, double defaultMannings=0.035, const UnitInfo &units={})
Render native geometry, coupling and infiltration sections into an owned text block.
Definition inpmeshwriter.cpp:779
static bool writeExternal(const QString &inpPath, const QString &meshFilePath, const MeshResult &mesh, const CouplingMap &coupling, double defaultMannings=0.035, QString *errorOut=nullptr, const UnitInfo &units={})
Publish a native mesh sidecar, then retarget an existing INP to that sidecar.
Definition inpmeshwriter.cpp:1029
static QString buildConveyanceSectionText(const MeshResult &mesh, const QVector< MeshEdgeBC > &bcs)
Render one nondefault conveyance factor per undirected real mesh edge.
Definition inpmeshwriter.cpp:1356
static bool clearMeshFileRef(const QString &inpPath, QString *errorOut=nullptr)
Strip recognized external-reference blocks while preserving inline mesh and other sections.
Definition inpmeshwriter.cpp:1125
Slice §V.VA — per-edge boundary condition value, stored on the SWMM2DMeshLayer in a SoA QVector index...
value types for the 2D mesh generator.
The Qt-facing MeshKit API (meshkit::core_qt, meshkit::model_qt, meshkit::io_qt): mesh value types and...
MeshOutputMode
Output strategy for the four 2D mesh sections.
Definition inpmeshwriter.h:57
@ Inline
Inline the four sections directly in the .inp.
Definition inpmeshwriter.h:59
@ External
Write .2dm next to the .inp; reference via [2D_MESH_FILE].
Definition inpmeshwriter.h:58
1D↔2D coupling map produced by the meshing dialog.
Definition inpmeshwriter.h:40
QHash< int, QString > triangleToNode
Triangle index (in MeshResult::triangles) → SWMM node ID.
Definition inpmeshwriter.h:44
QHash< int, QString > vertexToNode
Vertex index (in MeshResult::vertices) → SWMM node ID.
Definition inpmeshwriter.h:42
QHash< int, double > triangleMannings
Per-triangle Manning's n.
Definition inpmeshwriter.h:47
Unit & provenance metadata written as ;; header comments.
Definition inpmeshwriter.h:87
QString sourceCrsTag
Goes into ;; SOURCE_CRS: (e.g. "EPSG:2249").
Definition inpmeshwriter.h:90
QString linearUnitName
Goes into ;; UNITS: (e.g. "metre", "US survey foot", "SI (m)").
Definition inpmeshwriter.h:89
UnitInfo()
Construct empty length-unit and source-CRS metadata strings.
Result of MeshGenerator::generate.
Definition meshresult.h:203