54 const bool mustTriangulate = this->isTri();
61 <<
"Cannot read file " << filename
77 lookup.
insert(
"zone0", zoneI);
83 string line = this->getLineNoComment(is);
86 if (line[line.size()-1] ==
'\\')
88 line.substr(0, line.size()-1);
89 line += this->getLineNoComment(is);
100 lineStream >> x >> y >> z;
109 if (fnd != lookup.
end())
120 zoneI = dynSizes.
size();
121 lookup.
insert(name, zoneI);
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++)
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;
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;
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const word & name() const
Return name.
A surface zone on a MeshedSurface.
void size(const label)
Override size to be inconsistent with allocated storage.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
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.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Various functions to operate on Lists.
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 useFaceMap() const
Use faceMap?
stressControl lookup("compactNormalStress") >> compactNormalStress
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
const List< Face > & faces() const
Return const access to the faces.
A class for handling words, derived from string.
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 List< surfZone > & surfZones() const
Const access to the surface zones.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
word name(const complex &)
Return a string representation of a complex.
vector point
Point is a vector.
const pointField & points() const
Return const access to the points.
const List< label > & faceMap() const
Const access to the faceMap, zero-sized when unused.
Input from memory buffer stream.
fileName lessExt() const
Return file name without extension (part before last .)
label size() const
Return the number of elements in the UList.
void transfer(List< T > &)
Transfer contents of the argument List into this.