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 const string line = this->getLineNoComment(is);
127 lineStream >>
x >>
y >> z;
145 for (
label i = 1; i < dynVertices.
size(); i++)
147 edge edgeRead(dynVertices[i-1], dynVertices[i]);
149 dynUsedPoints[edgeRead[0]] = edgeRead[0];
150 dynUsedPoints[edgeRead[1]] = edgeRead[1];
152 dynEdges.
append(edgeRead);
169 if (dynVertices.
size() == 2)
171 for (
label i = 1; i < dynVertices.
size(); i++)
173 edge edgeRead(dynVertices[i-1], dynVertices[i]);
175 dynUsedPoints[edgeRead[0]] = edgeRead[0];
176 dynUsedPoints[edgeRead[1]] = edgeRead[1];
178 dynEdges.
append(edgeRead);
189 if (dynUsedPoints[pointi] >= 0)
193 dynPoints[nUsed] = dynPoints[pointi];
194 dynUsedPoints[pointi] = nUsed;
203 storedPoints().transfer(dynPoints);
206 if (nUsed != dynUsedPoints.
size())
210 edge&
e = dynEdges[edgeI];
212 e[0] = dynUsedPoints[
e[0]];
213 e[1] = dynUsedPoints[
e[1]];
235 <<
"Cannot open file for writing " << filename
243 <<
"# points : " << pointLst.
size() <<
nl
244 <<
"# lines : " << edgeLst.
size() <<
nl;
247 <<
"# <points count=\"" << pointLst.
size() <<
"\">" <<
nl;
252 const point&
p = pointLst[ptI];
254 os <<
"v " <<
p.x() <<
' ' <<
p.y() <<
' ' <<
p.z() <<
nl;
257 os <<
"# </points>" <<
nl
259 <<
"# <edges count=\"" << edgeLst.
size() <<
"\">" <<
endl;
264 const edge&
e = edgeLst[edgeI];
266 os <<
"l " << (
e[0] + 1) <<
" " << (
e[1] + 1) <<
nl;
268 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.
bool good() const
Return true if next operation might succeed.
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.
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 .)
virtual const pointField & points() const
Return raw points.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#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.