53 const bool mustTriangulate = this->isTri();
60 <<
"Cannot read file " << filename
65 string hdr = this->getLineNoComment(is);
69 <<
"OFF file " << filename <<
" does not start with 'OFF'" 77 string line = this->getLineNoComment(is);
80 lineStream >> nPoints >> nElems >> nEdges;
88 line = this->getLineNoComment(is);
91 lineStream >> x >> y >> z;
93 pointLst[pointi] =
point(x, y, z);
100 for (
label facei = 0; facei < nElems; ++facei)
102 line = this->getLineNoComment(is);
108 lineStream >> nVerts;
114 lineStream >> verts[vertI];
119 if (mustTriangulate && f.
size() > 3)
123 for (
label fp1 = 1; fp1 < f.
size() - 1; fp1++)
160 <<
"Cannot open file for writing " << filename
166 <<
"# Geomview OFF file written " << clock::dateTime().c_str() <<
nl 168 <<
"# points : " << pointLst.
size() <<
nl 169 <<
"# faces : " << faceLst.
size() <<
nl 170 <<
"# zones : " << zoneLst.
size() <<
nl;
175 os <<
"# " << zoneI <<
" " << zoneLst[zoneI].name()
176 <<
" (nFaces: " << zoneLst[zoneI].
size() <<
")" <<
nl;
180 <<
"# nPoints nFaces nEdges" <<
nl 181 << pointLst.
size() <<
' ' << faceLst.
size() <<
' ' << 0 <<
nl 183 <<
"# <points count=\"" << pointLst.
size() <<
"\">" <<
endl;
188 os << pointLst[ptI].x() <<
' ' 189 << pointLst[ptI].y() <<
' ' 190 << pointLst[ptI].z() <<
" #" << ptI <<
endl;
193 os <<
"# </points>" <<
nl 195 <<
"# <faces count=\"" << faceLst.
size() <<
"\">" <<
endl;
200 os <<
"# <zone name=\"" << zoneLst[zoneI].name() <<
"\">" <<
endl;
204 forAll(zoneLst[zoneI], localFacei)
206 const Face&
f = faceLst[faceMap[faceIndex++]];
215 os <<
' ' << zoneI <<
endl;
220 forAll(zoneLst[zoneI], localFacei)
222 const Face&
f = faceLst[faceIndex++];
231 os <<
' ' << zoneI <<
endl;
234 os <<
"# </zone>" <<
endl;
236 os <<
"# </faces>" <<
endl;
A simple container for copying or transferring objects of type <T>.
#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)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
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.
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)
bool useFaceMap() const
Use faceMap?
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.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container as a plain List.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
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...
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
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.
label size() const
Return the number of elements in the UList.