54 for (
const auto& tok : tokens)
63 std::string vrtSpec(tok.str());
67 const auto slash = vrtSpec.find(
'/');
68 slash != std::string::npos
107 <<
"Cannot read file " << filename
118 string line = this->getLineNoComment(is);
121 while (
line.removeEnd(
'\\'))
123 line += this->getLineNoComment(is);
129 if (tokens.size() < 2)
145 readScalar(tokens[1]),
146 readScalar(tokens[2]),
147 readScalar(tokens[3])
162 for (label i = 1; i < dynVerts.
size(); i++)
164 const edge
e(dynVerts[i-1], dynVerts[i]);
167 dynUsedPoints[
e[0]] =
e[0];
168 dynUsedPoints[
e[1]] =
e[1];
181 for (label i = 1; i < dynVerts.
size(); i++)
183 const edge
e(dynVerts[i-1], dynVerts[i]);
186 dynUsedPoints[
e[0]] =
e[0];
187 dynUsedPoints[
e[1]] =
e[1];
197 if (dynUsedPoints[pointi] >= 0)
201 dynPoints[nUsed] = std::move(dynPoints[pointi]);
202 dynUsedPoints[pointi] = nUsed;
211 storedPoints().transfer(dynPoints);
214 if (nUsed != dynUsedPoints.
size())
216 for (edge&
e : dynEdges)
218 e = edge(dynUsedPoints,
e);
221 storedEdges().transfer(dynEdges);
245 <<
"Cannot write file " << filename <<
nl
251 <<
"o " <<
os.name().stem() <<
nl
253 <<
"# points : " << pointLst.
size() <<
nl
254 <<
"# lines : " << edgeLst.
size() <<
nl;
257 <<
"# <points count=\"" << pointLst.
size() <<
"\">" <<
nl;
260 for (
const point&
p : pointLst)
262 os <<
"v " <<
p.x() <<
' ' <<
p.y() <<
' ' <<
p.z() <<
nl;
265 os <<
"# </points>" <<
nl
267 <<
"# <edges count=\"" << edgeLst.
size() <<
"\">" <<
endl;
270 for (
const edge&
e : edgeLst)
272 os <<
"l " << (
e[0] + 1) <<
" " << (
e[1] + 1) <<
nl;
274 os <<
"# </edges>" <<
endl;
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void setSize(const label n)
Alias for resize().
void append(const T &val)
Copy append an element to the end of this list.
void push_back(const T &val)
Copy append an element to the end of this list.
Input from file stream as an ISstream, normally using std::ifstream for the actual input.
A simple container for options an IOstream can normally have.
streamFormat format() const noexcept
Get the current stream format.
@ ASCII
"ascii" (normal default)
bool good() const noexcept
True if next operation might succeed.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
Sub-ranges of a string with a structure similar to std::match_results, but without the underlying reg...
void size(const label n)
Older name for setAddressableSize.
static std::string dateTime()
The current wall-clock date/time (in local time) as a string in ISO-8601 format (yyyy-mm-ddThh:mm:ss)...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Area discretisation.
pointField & storedPoints() noexcept
Non-const access to global points.
edgeMesh(const faMesh &mesh)
Construct finite-area edge mesh faMesh reference.
edgeList & storedEdges() noexcept
Non-const access to the edges.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A class for handling file names.
A class for handling words, derived from Foam::string.
static word validate(const std::string &s, const bool prefix=false)
Construct validated word (no invalid characters).
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
Foam::SubStrings splitSpace(const std::string &str, std::string::size_type pos=0)
Split string into sub-strings at whitespace (TAB, NL, VT, FF, CR, SPC).
List< edge > edgeList
List of edge.
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
Ostream & endl(Ostream &os)
Add newline and flush stream.
vector point
Point is a vector.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
static label readObjVertices(const SubStrings &tokens, DynamicList< label > &verts)
#define forAll(list, i)
Loop across all elements in list.