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++)
125 label fp2 =
f.fcIndex(fp1);
138 this->reset(move(pointLst), move(dynFaces), NullObjectMove<surfZoneList>());
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;
#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.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
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.
A class for handling file names.
#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.
vector point
Point is a vector.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)