54 const bool mustTriangulate = this->isTri();
61 <<
"Cannot read file " << filename
77 lookup.
insert(
"zone0", zoneI);
83 string line = this->getLineNoComment(is);
89 line += this->getLineNoComment(is);
100 lineStream >>
x >>
y >> z;
109 if (fnd != lookup.
end())
120 zoneI = dynSizes.
size();
136 line.find_first_not_of(
' ', endNum);
138 if (startNum == string::npos)
143 endNum =
line.find(
' ', startNum);
146 if (endNum != string::npos)
148 vertexSpec =
line.substr(startNum, endNum-startNum);
152 vertexSpec =
line.substr(startNum,
line.size() - startNum);
158 if (slashPos != string::npos)
170 dynVertices.
append(vertI - 1);
176 if (mustTriangulate &&
f.size() > 3)
180 for (
label fp1 = 1; fp1 <
f.size() - 1; fp1++)
182 label fp2 =
f.fcIndex(fp1);
200 this->storedPoints().
transfer(dynPoints);
202 this->sortFacesAndStore(move(dynFaces), move(dynZones), sorted);
205 this->addZones(dynSizes, dynNames,
true);
225 ? surfaceFormatsCore::oneZone(faceLst,
"")
235 <<
"Cannot open file for writing " << filename
240 os <<
"# Wavefront OBJ file written " << clock::dateTime().c_str() <<
nl
243 <<
"# points : " << pointLst.
size() <<
nl
244 <<
"# faces : " << faceLst.
size() <<
nl
245 <<
"# zones : " << zones.
size() <<
nl;
250 os <<
"# " << zoneI <<
" " << zones[zoneI].name()
251 <<
" (nFaces: " << zones[zoneI].
size() <<
")" <<
nl;
255 <<
"# <points count=\"" << pointLst.
size() <<
"\">" <<
nl;
260 const point& pt = pointLst[ptI];
262 os <<
"v " << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z() <<
nl;
265 os <<
"# </points>" <<
nl
267 <<
"# <faces count=\"" << faceLst.
size() <<
"\">" <<
endl;
273 const surfZone& zone = zones[zoneI];
275 if (zone.
name().size())
284 const Face&
f = faceLst[
faceMap[faceIndex++]];
289 os <<
' ' <<
f[fp] + 1;
298 const Face&
f = faceLst[faceIndex++];
303 os <<
' ' <<
f[fp] + 1;
309 os <<
"# </faces>" <<
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.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
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.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
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.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
const List< surfZone > & surfZones() const
Const access to the surface zones.
const List< Face > & faces() const
Return const access to the faces.
bool useFaceMap() const
Use faceMap?
const List< label > & faceMap() const
Const access to the faceMap, zero-sized when unused.
const pointField & points() const
Return const access to the points.
const fileName & name() const
Return the name of the stream.
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 .)
const word & name() const
Return name.
A surface zone on a MeshedSurface.
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.
word name(const bool)
Return a word representation of a bool.
vector point
Point is a vector.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable