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);
105 <<
"Cannot read file " << filename
120 if (line[line.size()-1] ==
'\\')
122 line.substr(0, line.size()-1);
134 lineStream >> x >> y >> z;
152 for (
label i = 1; i < dynVertices.
size(); i++)
154 edge edgeRead(dynVertices[i-1], dynVertices[i]);
156 dynUsedPoints[edgeRead[0]] = edgeRead[0];
157 dynUsedPoints[edgeRead[1]] = edgeRead[1];
159 dynEdges.
append(edgeRead);
176 if (dynVertices.
size() == 2)
178 for (
label i = 1; i < dynVertices.
size(); i++)
180 edge edgeRead(dynVertices[i-1], dynVertices[i]);
182 dynUsedPoints[edgeRead[0]] = edgeRead[0];
183 dynUsedPoints[edgeRead[1]] = edgeRead[1];
185 dynEdges.
append(edgeRead);
196 if (dynUsedPoints[pointi] >= 0)
200 dynPoints[nUsed] = dynPoints[pointi];
201 dynUsedPoints[pointi] = nUsed;
213 if (nUsed != dynUsedPoints.
size())
217 edge&
e = dynEdges[edgeI];
219 e[0] = dynUsedPoints[e[0]];
220 e[1] = dynUsedPoints[e[1]];
242 <<
"Cannot open file for writing " << filename
250 <<
"# points : " << pointLst.
size() <<
nl 251 <<
"# lines : " << edgeLst.
size() <<
nl;
254 <<
"# <points count=\"" << pointLst.
size() <<
"\">" <<
nl;
259 const point&
p = pointLst[ptI];
261 os <<
"v " << p.
x() <<
' ' << p.
y() <<
' ' << p.
z() <<
nl;
264 os <<
"# </points>" <<
nl 266 <<
"# <edges count=\"" << edgeLst.
size() <<
"\">" <<
endl;
271 const edge&
e = edgeLst[edgeI];
273 os <<
"l " << (e[0] + 1) <<
" " << (e[1] + 1) <<
nl;
275 os <<
"# </edges>" <<
endl;
#define forAll(list, i)
Loop across all elements in list.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
edgeList & storedEdges()
Non-const access to the edges.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const fileName & name() const
Return the name of the stream.
pointField & storedPoints()
Non-const access to global points.
bool good() const
Return true if next operation might succeed.
Various functions to operate on Lists.
void setSize(const label)
Alter the addressed list size.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling words, derived from string.
static string dateTime()
Return the current wall-clock date/time as a string.
const edgeList & edges() const
Return edges.
word name() const
Return file name (part beyond last /)
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
graph_traits< Graph >::vertices_size_type size_type
const pointField & points() const
Return points.
Points connected by edges.
virtual void clear()
Clear all storage.
vector point
Point is a vector.
Input from memory buffer stream.
fileName lessExt() const
Return file name without extension (part before last .)
const doubleScalar e
Elementary charge.
void clear()
Clear the addressed list, i.e. set the size to zero.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.