Loading...
Searching...
No Matches
mesh::Sms2dmReader Class Reference

Stateless reader that turns an SMS 2DM mesh (file or text) into a MeshResult. More...

#include <mesh/sms2dmreader.h>

Collaboration diagram for mesh::Sms2dmReader:

Static Public Member Functions

static MeshResult read (const QString &path, bool splitQuads=false, QStringList *warnings=nullptr)
 Stream a bounded two-pass SMS file through meshkit::io.
 
static MeshResult parse (const QString &text, bool splitQuads=false)
 Decode case-sensitive ND/E3T/E4Q cards into owned vertices and engine-ordered cells.
 
static bool looksLikeSms2dm (const QString &path)
 Perform an early-card format sniff on at most 200 nonblank file lines.
 

Detailed Description

Stateless reader that turns an SMS 2DM mesh (file or text) into a MeshResult.

All members are static and hold no state, so concurrent calls are independent. Results carry vertices, cells (triangles before quads) and, for read(), node strings as boundaryEdges; ok/errorMsg report failure. No unit or CRS conversion is applied.

Member Function Documentation

◆ looksLikeSms2dm()

bool mesh::Sms2dmReader::looksLikeSms2dm ( const QString & path)
staticnodiscard

Perform an early-card format sniff on at most 200 nonblank file lines.

Parameters
[in]pathBorrowed input pathname, unchanged; opened read-only/text, no result retained.
Returns
False on open failure, first encountered '[' section header before a recognized card, or no recognized card within budget. Returns true immediately for case-insensitive MESH2D/ND/E3T/E4Q/ E2L/E6T/E8Q/E9Q first space-delimited token, including cards the geometry parser does not support. Does not inspect later lines after a match or validate syntax. Leading/trailing whitespace trimmed, but embedded tab separators are not normalized here; ';;' comment lines consume the nonblank budget then skip. File extension ignored, no geometry allocations or file/project mutation.

Cheap format sniff: true when the first non-blank lines of the file carry SMS cards (MESH2D, ND, E3T, E4Q) and no SWMMVis [2D_*] section header. Both formats share the .2dm extension.

◆ parse()

MeshResult mesh::Sms2dmReader::parse ( const QString & text,
bool splitQuads = false )
staticnodiscard

Decode case-sensitive ND/E3T/E4Q cards into owned vertices and engine-ordered cells.

Parameters
[in]textBorrowed whole text, unchanged; whitespace simplified per line, no inline-comment grammar. Other card names are ignored; geometry card names must be uppercase despite case-insensitive sniffing.
[in]splitQuadsTrue emits two adjacent triangle halves for each quad using cellGeom()'s z-selected storage fan; false emits v3>=0 quads after all triangles.
Returns
Owned result with ok=true only for nonempty vertices/cells and successful syntax/reference resolution. Node IDs may be sparse/out-of-order and any convertible int (including nonpositive); duplicates fail, references resolve after reading all nodes. Element IDs are ignored/unvalidated, optional material text becomes mat-prefixed tag, other attributes stay defaults/unset. Numeric coordinates retain file units and are not explicitly finite-checked; repeated corners, winding, convexity/topology and unit metadata are not validated. Checked failure returns ok=false with one-based source line and may include partial geometry. Allocates whole-line/element/map/output storage, no source/engine mutation or ownership retention.

Same as read, on already-loaded text.

Here is the call graph for this function:

◆ read()

MeshResult mesh::Sms2dmReader::read ( const QString & path,
bool splitQuads = false,
QStringList * warnings = nullptr )
staticnodiscard

Stream a bounded two-pass SMS file through meshkit::io.

Sparse identifiers and forward references are resolved before returning geometry. Cells are finite, convex and counterclockwise; clockwise input is reoriented. Failure returns no partial mesh. NS node strings become tagged constraint edges. The GUI compatibility mode retains optional/text material tags; unsupported cards and winding changes are reported through warnings when supplied. Coordinates stay in file units. The legacy parse(text) helper remains below.

Here is the call graph for this function:

The documentation for this class was generated from the following files: