35 bool Foam::triSurface::readOFF(
const fileName& OFFfileName)
37 IFstream OFFfile(OFFfileName);
42 <<
"Cannot read file " << OFFfileName
47 string hdr = getLineNoComment(OFFfile);
51 <<
"OFF file " << OFFfileName
52 <<
" does not start with 'OFF'" 59 string line = getLineNoComment(OFFfile);
61 IStringStream lineStream(line);
62 lineStream >> nPoints >> nElems >>
nEdges;
71 line = getLineNoComment(OFFfile);
73 IStringStream lineStream(line);
74 lineStream >> x >> y >> z;
80 DynamicList<labelledTri> tris(nElems);
82 for (
label facei = 0; facei < nElems; facei++)
84 line = getLineNoComment(OFFfile);
86 IStringStream lineStream(line);
101 tris.append(labelledTri(
f[0],
f[1],
f[2], 0));
103 else if (nVerts == 4)
105 tris.append(labelledTri(
f[0],
f[1],
f[2], 0));
106 tris.append(labelledTri(
f[2],
f[3],
f[0], 0));
114 f.triangles(
points, nTri, triFaces);
116 forAll(triFaces, triFacei)
118 const face&
f = triFaces[triFacei];
120 tris.append(labelledTri(f[0], f[1], f[2], 0));
label nPoints() const
Return number of points supporting patch faces.
#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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
vectorField pointField
pointField is a vectorField.
const Field< point > & points() const
Return reference to global points.
label nEdges() const
Return number of edges in patch.
triSurface()
Construct null.
vector point
Point is a vector.