54 const bool mustTriangulate = this->isTri();
62 "fileFormats::OBJsurfaceFormat::read(const fileName&)" 64 <<
"Cannot read file " << filename
80 lookup.
insert(
"zone0", zoneI);
86 string line = this->getLineNoComment(is);
89 if (line[line.size()-1] ==
'\\')
91 line.substr(0, line.size()-1);
92 line += this->getLineNoComment(is);
103 lineStream >> x >> y >> z;
112 if (fnd != lookup.
end())
123 zoneI = dynSizes.
size();
124 lookup.
insert(name, zoneI);
139 line.find_first_not_of(
' ', endNum);
141 if (startNum == string::npos)
146 endNum = line.find(
' ', startNum);
149 if (endNum != string::npos)
151 vertexSpec = line.substr(startNum, endNum-startNum);
155 vertexSpec = line.substr(startNum, line.size() - startNum);
161 if (slashPos != string::npos)
173 dynVertices.
append(vertI - 1);
179 if (mustTriangulate && f.
size() > 3)
183 for (
label fp1 = 1; fp1 < f.
size() - 1; fp1++)
203 this->storedPoints().
transfer(dynPoints);
205 this->sortFacesAndStore(dynFaces.
xfer(), dynZones.
xfer(), sorted);
208 this->addZones(dynSizes, dynNames,
true);
228 ? surfaceFormatsCore::oneZone(faceLst,
"")
239 "fileFormats::OBJsurfaceFormat::write" 240 "(const fileName&, const MeshedSurfaceProxy<Face>&)" 242 <<
"Cannot open file for writing " << filename
247 os <<
"# Wavefront OBJ file written " << clock::dateTime().c_str() <<
nl 250 <<
"# points : " << pointLst.
size() <<
nl 251 <<
"# faces : " << faceLst.
size() <<
nl 252 <<
"# zones : " << zones.
size() <<
nl;
257 os <<
"# " << zoneI <<
" " << zones[zoneI].name()
258 <<
" (nFaces: " << zones[zoneI].
size() <<
")" <<
nl;
262 <<
"# <points count=\"" << pointLst.
size() <<
"\">" <<
nl;
267 const point& pt = pointLst[ptI];
269 os <<
"v " << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z() <<
nl;
272 os <<
"# </points>" <<
nl 274 <<
"# <faces count=\"" << faceLst.
size() <<
"\">" <<
endl;
282 if (zone.
name().size())
291 const Face&
f = faceLst[faceMap[faceIndex++]];
296 os <<
' ' << f[fp] + 1;
305 const Face&
f = faceLst[faceIndex++];
310 os <<
' ' << f[fp] + 1;
316 os <<
"# </faces>" <<
endl;
Input from memory buffer stream.
void transfer(List< T > &)
Transfer contents of the argument List into this.
word name() const
Return file name (part beyond last /)
vector point
Point is a vector.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
bool useFaceMap() const
Use faceMap?
word name(const complex &)
Return a string representation of a complex.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
Various functions to operate on Lists.
const pointField & points() const
Return const access to the points.
const List< Face > & faces() const
Return const access to the faces.
graph_traits< Graph >::vertices_size_type size_type
Ostream & endl(Ostream &os)
Add newline and flush stream.
stressControl lookup("compactNormalStress") >> compactNormalStress
const List< surfZone > & surfZones() const
Const access to the surface zones.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container as a plain List.
const fileName & name() const
Return the name of the stream.
bool good() const
Return true if next operation might succeed.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
label size() const
Return the number of elements in the UList.
A surface zone on a MeshedSurface.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
const word & name() const
Return name.
Provide a means of reading/writing Alias/Wavefront OBJ format.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
A class for handling file names.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
virtual bool read(const fileName &)
Read from file.
const List< label > & faceMap() const
Const access to the faceMap, zero-sized when unused.
fileName lessExt() const
Return file name without extension (part before last .)
bool read(const char *, int32_t &)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
static void write(const fileName &, const MeshedSurfaceProxy< Face > &)
Write surface mesh components by proxy.