From ff2a495ae6f9fa09ff3a8b0bd1bcf1b857623b7e Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 28 May 2026 08:58:56 +0200 Subject: [PATCH] art2dgf: put vertex parsing in separate method --- examples/art2dgf.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/examples/art2dgf.cpp b/examples/art2dgf.cpp index e992f3a9bd..5e8d344ea9 100644 --- a/examples/art2dgf.cpp +++ b/examples/art2dgf.cpp @@ -103,13 +103,7 @@ private: continue; if (curParseMode == ParseMode::Vertex) { - GlobalPosition coord; - std::istringstream iss(curLine); - // parse only the first two numbers as the vertex - // coordinate. the last number is the Z coordinate - // which we ignore (so far) - iss >> coord[0] >> coord[1]; - vertexPos.push_back( std::make_pair( coord, 0 ) ); + vertexPos.emplace_back(parseVertex(curLine), 0); } else if (curParseMode == ParseMode::Edge) { // read an edge and update the fracture mapper @@ -217,6 +211,20 @@ private: write(dgfFile, precision); } + //! \brief Parses a vertex from a string. + //! \param curLine String to parse + static GlobalPosition parseVertex(const std::string& curLine) + { + GlobalPosition coord; + std::istringstream iss(curLine); + // parse only the first two numbers as the vertex + // coordinate. the last number is the Z coordinate + // which we ignore (so far) + iss >> coord[0] >> coord[1]; + + return coord; + } + //! \brief Writes out the data to the output stream. //! \param dgfFile Stream to write to //! \param precision Precision to write at