62 <<
"Cannot read file " << filename <<
nl 67 string hdr = this->getLineNoComment(is);
71 <<
"OFF file " << filename <<
" does not start with 'OFF'" 79 string line = this->getLineNoComment(is);
81 IStringStream lineStream(line);
82 lineStream >>
nPoints >> nElems >> nEdges;
87 for (
point& pt : pointLst)
91 line = this->getLineNoComment(is);
93 IStringStream lineStream(line);
94 lineStream >>
x >>
y >> z;
102 DynamicList<Face> dynFaces(nElems);
104 for (label facei = 0; facei < nElems; ++facei)
106 line = this->getLineNoComment(is);
109 IStringStream lineStream(line);
112 lineStream >> nVerts;
114 List<label> verts(nVerts);
118 lineStream >> verts[vertI];
123 if (faceTraits<Face>::isTri() &&
f.size() > 3)
127 for (label fp1 = 1; fp1 <
f.size() - 1; fp1++)
129 label fp2 =
f.fcIndex(fp1);
131 dynFaces.append(Face{
f[0],
f[fp1],
f[fp2]});
136 dynFaces.append(Face(
f));
142 MeshedSurface<Face> surf(std::move(pointLst), std::move(dynFaces));
160 streamOpt.
format(IOstreamOption::ASCII);
173 <<
"Cannot write file " << filename <<
nl 179 <<
"# Geomview OFF file written " << clock::dateTime().c_str() <<
nl 181 <<
"# points : " << pointLst.
size() <<
nl 182 <<
"# faces : " << faceLst.
size() <<
nl 183 <<
"# zones : " << zoneLst.
size() <<
nl;
188 os <<
"# " << zoneI <<
" " << zoneLst[zoneI].name()
189 <<
" (nFaces: " << zoneLst[zoneI].
size() <<
")" <<
nl;
193 <<
"# nPoints nFaces nEdges" <<
nl 194 << pointLst.
size() <<
' ' << faceLst.
size() <<
' ' << 0 <<
nl 196 <<
"# <points count=\"" << pointLst.
size() <<
"\">" <<
nl;
201 os << pointLst[ptI].x() <<
' ' 202 << pointLst[ptI].y() <<
' ' 203 << pointLst[ptI].z() <<
" #" << ptI <<
nl;
206 os <<
"# </points>" <<
nl 208 <<
"# <faces count=\"" << faceLst.
size() <<
"\">" <<
nl;
213 for (
const surfZone& zone : zoneLst)
215 os <<
"# <zone name=\"" << zone.name() <<
"\">" <<
nl;
217 for (label nLocal = zone.size(); nLocal--; ++faceIndex)
220 (useFaceMap ?
faceMap[faceIndex] : faceIndex);
222 const Face&
f = faceLst[facei];
225 for (
const label verti :
f)
231 os <<
' ' << zoneIndex <<
nl;
234 os <<
"# </zone>" <<
nl;
238 os <<
"# </faces>" <<
nl;
void size(const label n)
Older name for setAddressableSize.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Input/output from string buffers.
Output to file stream as an OSstream, normally using std::ofstream for the actual output...
constexpr char nl
The newline '\n' character (0x0a)
A simple container for options an IOstream can normally have.
const pointField & points() const noexcept
Return const access to the points.
const labelUList & faceMap() const noexcept
Const access to the faceMap, zero-sized when unused.
UList< label > labelUList
A UList of labels.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
#define forAll(list, i)
Loop across all elements in list.
vectorField pointField
pointField is a vectorField.
bool useFaceMap() const noexcept
Can/should use faceMap?
const UList< surfZone > & surfZones() const noexcept
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...
OBJstream os(runTime.globalPath()/outputName)
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
Input from file stream as an ISstream, normally using std::ifstream for the actual input...
vector point
Point is a vector.
bool good() const noexcept
True if next operation might succeed.
const UList< Face > & surfFaces() const noexcept
Return const access to the faces.
streamFormat format() const noexcept
Get the current stream format.