54 const bool mustTriangulate = this->isTri();
61 <<
"Cannot read file " << filename
77 lookup.insert(
"zone0", zoneI);
83 const string line = this->getLineNoComment(is);
93 lineStream >>
x >>
y >> z;
113 zoneI = dynSizes.
size();
129 line.find_first_not_of(
' ', endNum);
131 if (startNum == string::npos)
136 endNum =
line.find(
' ', startNum);
139 if (endNum != string::npos)
141 vertexSpec =
line.substr(startNum, endNum-startNum);
145 vertexSpec =
line.substr(startNum,
line.size() - startNum);
151 if (slashPos != string::npos)
163 dynVertices.
append(vertI - 1);
169 if (mustTriangulate &&
f.size() > 3)
173 for (
label fp1 = 1; fp1 <
f.size() - 1; fp1++)
175 label fp2 =
f.fcIndex(fp1);
193 this->storedPoints().
transfer(dynPoints);
195 this->sortFacesAndStore(move(dynFaces), move(dynZones), sorted);
198 this->addZones(dynSizes, dynNames,
true);
218 ? surfaceFormatsCore::oneZone(faceLst,
"")
228 <<
"Cannot open file for writing " << filename
233 os <<
"# Wavefront OBJ file written " << clock::dateTime().c_str() <<
nl
236 <<
"# points : " << pointLst.
size() <<
nl
237 <<
"# faces : " << faceLst.
size() <<
nl
238 <<
"# zones : " << zones.
size() <<
nl;
243 os <<
"# " << zoneI <<
" " << zones[zoneI].name()
244 <<
" (nFaces: " << zones[zoneI].
size() <<
")" <<
nl;
248 <<
"# <points count=\"" << pointLst.
size() <<
"\">" <<
nl;
253 const point& pt = pointLst[ptI];
255 os <<
"v " << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z() <<
nl;
258 os <<
"# </points>" <<
nl
260 <<
"# <faces count=\"" << faceLst.
size() <<
"\">" <<
endl;
266 const surfZone& zone = zones[zoneI];
268 if (zone.
name().size())
277 const Face&
f = faceLst[
faceMap[faceIndex++]];
282 os <<
' ' <<
f[fp] + 1;
291 const Face&
f = faceLst[faceIndex++];
296 os <<
' ' <<
f[fp] + 1;
302 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 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.
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.
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
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.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.