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)
82 IStringStream intStream(vertexSpec.substr(0, slashPos));
88 IStringStream intStream(vertexSpec);
92 dynVertices.
append(vertI - 1);
105 <<
"Cannot read file " << filename
117 string line = this->getLineNoComment(is);
123 line += this->getLineNoComment(is);
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;
210 storedPoints().transfer(dynPoints);
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;
Various functions to operate on Lists.
graph_traits< Graph >::vertices_size_type size_type
#define forAll(list, i)
Loop across all elements in list.
void transfer(List< T > &)
Transfer contents of the argument List into this.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void clear()
Clear the addressed list, i.e. set the size to zero.
void setSize(const label)
Alter the addressed list size.
bool good() const
Return true if next operation might succeed.
Input from memory buffer stream.
void size(const label)
Override size to be inconsistent with allocated storage.
const fileName & name() const
Return the name of the stream.
static string dateTime()
Return the current wall-clock date/time as a string.
Points connected by edges.
const edgeList & edges() const
Return edges.
const pointField & points() const
Return points.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling file names.
word name() const
Return file name (part beyond last /)
fileName lessExt() const
Return file name without extension (part before last .)
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
vector point
Point is a vector.