36 Foam::fileFormats::OBJedgeFormat::OBJedgeFormat
47 void Foam::fileFormats::OBJedgeFormat::readVertices
58 line.find_first_not_of(
' ', endNum);
60 if (startNum == string::npos)
65 endNum = line.find(
' ', startNum);
68 if (endNum != string::npos)
70 vertexSpec = line.substr(startNum, endNum-startNum);
74 vertexSpec = line.substr(startNum, line.size() - startNum);
80 if (slashPos != string::npos)
92 dynVertices.
append(vertI - 1);
106 "fileFormats::OBJedgeFormat::read(const fileName&)" 108 <<
"Cannot read file " << filename
123 if (line[line.size()-1] ==
'\\')
125 line.substr(0, line.size()-1);
137 lineStream >> x >> y >> z;
155 for (
label i = 1; i < dynVertices.
size(); i++)
157 edge edgeRead(dynVertices[i-1], dynVertices[i]);
159 dynUsedPoints[edgeRead[0]] = edgeRead[0];
160 dynUsedPoints[edgeRead[1]] = edgeRead[1];
162 dynEdges.
append(edgeRead);
179 if (dynVertices.
size() == 2)
181 for (
label i = 1; i < dynVertices.
size(); i++)
183 edge edgeRead(dynVertices[i-1], dynVertices[i]);
185 dynUsedPoints[edgeRead[0]] = edgeRead[0];
186 dynUsedPoints[edgeRead[1]] = edgeRead[1];
188 dynEdges.
append(edgeRead);
199 if (dynUsedPoints[pointI] >= 0)
203 dynPoints[nUsed] = dynPoints[pointI];
204 dynUsedPoints[pointI] = nUsed;
216 if (nUsed != dynUsedPoints.
size())
220 edge&
e = dynEdges[edgeI];
222 e[0] = dynUsedPoints[e[0]];
223 e[1] = dynUsedPoints[e[1]];
246 "fileFormats::OBJedgeFormat::write" 247 "(const fileName&, const edgeMesh&)" 249 <<
"Cannot open file for writing " << filename
257 <<
"# points : " << pointLst.
size() <<
nl 258 <<
"# lines : " << edgeLst.
size() <<
nl;
261 <<
"# <points count=\"" << pointLst.
size() <<
"\">" <<
nl;
266 const point&
p = pointLst[ptI];
268 os <<
"v " << p.
x() <<
' ' << p.
y() <<
' ' << p.
z() <<
nl;
271 os <<
"# </points>" <<
nl 273 <<
"# <edges count=\"" << edgeLst.
size() <<
"\">" <<
endl;
278 const edge&
e = edgeLst[edgeI];
280 os <<
"l " << (e[0] + 1) <<
" " << (e[1] + 1) <<
nl;
282 os <<
"# </edges>" <<
endl;
Input from memory buffer stream.
word name() const
Return file name (part beyond last /)
edgeList & storedEdges()
Non-const access to the edges.
vector point
Point is a vector.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void clear()
Clear the addressed list, i.e. set the size to zero.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const pointField & points() const
Return points.
void size(const label)
Override size to be inconsistent with allocated storage.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static string getLineNoComment(IFstream &)
Read non-comment line.
Various functions to operate on Lists.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
static string dateTime()
Return the current wall-clock date/time as a string.
graph_traits< Graph >::vertices_size_type size_type
virtual void clear()
Clear all storage.
const double e
Elementary charge.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const fileName & name() const
Return the name of the stream.
bool good() const
Return true if next operation might succeed.
void setSize(const label)
Alter the addressed list size.
static void write(const fileName &, const edgeMesh &)
Write surface mesh components by proxy.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Points connected by edges.
virtual bool read(const fileName &)
Read from file.
A class for handling file names.
fileName lessExt() const
Return file name without extension (part before last .)
bool read(const char *, int32_t &)
pointField & storedPoints()
Non-const access to global points.
const edgeList & edges() const
Return edges.