36 bool Foam::triSurface::readOFF(
const fileName& OFFfileName)
38 IFstream OFFfile(OFFfileName);
43 <<
"Cannot read file " << OFFfileName
48 string hdr = getLineNoComment(OFFfile);
52 <<
"OFF file " << OFFfileName
53 <<
" does not start with 'OFF'"
60 string line = getLineNoComment(OFFfile);
62 IStringStream lineStream(line);
72 line = getLineNoComment(OFFfile);
74 IStringStream lineStream(line);
75 lineStream >>
x >>
y >> z;
81 polygonTriangulate triEngine;
84 DynamicList<labelledTri> tris(nElems);
86 for (
label facei = 0; facei < nElems; facei++)
88 line = getLineNoComment(OFFfile);
90 IStringStream lineStream(line);
105 tris.append(labelledTri(
f[0],
f[1],
f[2], 0));
107 else if (nVerts == 4)
109 tris.append(labelledTri(
f[0],
f[1],
f[2], 0));
110 tris.append(labelledTri(
f[2],
f[3],
f[0], 0));
114 triEngine.triangulate(UIndirectList<point>(
points,
f));
116 forAll(triEngine.triPoints(), trii)
118 tris.append(labelledTri(triEngine.triPoints(trii,
f), 0));
#define forAll(list, i)
Loop across all elements in list.
label nEdges() const
Return number of edges in patch.
label nPoints() const
Return number of points supporting patch faces.
const Field< PointType > & points() const
Return reference to global points.
triSurface()
Construct null.
#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.
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.