47 norm /=
mag(norm) + VSMALL;
51 const point& p0 = pointLst[f[0]];
52 for (
label fp1 = 1; fp1 < f.size() - 1; ++fp1)
54 label fp2 = f.fcIndex(fp1);
56 const point& p1 = pointLst[f[fp1]];
57 const point& p2 = pointLst[f[fp2]];
60 os <<
" facet normal " 61 << norm.
x() <<
' ' << norm.y() <<
' ' << norm.z() <<
nl 63 <<
" vertex " << p0.x() <<
' ' << p0.y() <<
' ' << p0.z() <<
nl 64 <<
" vertex " << p1.x() <<
' ' << p1.y() <<
' ' << p1.z() <<
nl 65 <<
" vertex " << p2.x() <<
' ' << p2.y() <<
' ' << p2.z() <<
nl 67 <<
" endfacet" <<
endl;
88 norm /=
mag(norm) + VSMALL;
92 const point& p0 = pointLst[f[0]];
93 for (
label fp1 = 1; fp1 < f.size() - 1; ++fp1)
95 label fp2 = f.fcIndex(fp1);
137 this->storedPoints().transfer(reader.
points());
152 const label startPt = 3*facei;
153 faceLst[facei] =
triFace(startPt, startPt+1, startPt+2);
166 const label startPt = 3*faceMap[facei];
167 faceLst[facei] =
triFace(startPt, startPt+1, startPt+2);
173 this->storedFaces().transfer(faceLst);
177 this->addZones(sizes, names);
181 this->addZones(sizes);
184 this->stitchFaces(SMALL);
201 <<
"Cannot open file for writing " << filename
212 ? surfaceFormatsCore::oneZone(faceLst)
224 os <<
"solid " << zone.
name() <<
nl;
230 const label facei = faceMap[faceIndex++];
231 writeShell(os, pointLst, faceLst[facei]);
238 writeShell(os, pointLst, faceLst[faceIndex++]);
241 os <<
"endsolid " << zone.
name() <<
endl;
253 std::ofstream os(filename.c_str(), std::ios::binary);
257 <<
"Cannot open file for writing " << filename
270 : surfaceFormatsCore::oneZone(faceLst)
276 unsigned int nTris = 0;
279 nTris = faceLst.
size();
286 nTris += faceLst[facei].
size() - 2;
291 STLsurfaceFormatCore::writeHeaderBINARY(os, nTris);
306 faceLst[faceMap[faceIndex++]],
319 faceLst[faceIndex++],
339 <<
"Cannot open file for writing " << filename
344 if (surf.
zoneToc().size() == 1)
349 os <<
"solid " << surf.
zoneToc()[0].name() <<
endl;
352 writeShell(os, pointLst, faceLst[facei]);
354 os <<
"endsolid " << surf.
zoneToc()[0].name() <<
endl;
383 std::ofstream os(filename.c_str(), std::ios::binary);
387 <<
"Cannot open file for writing " << filename
395 unsigned int nTris = 0;
398 nTris = faceLst.
size();
405 nTris += faceLst[facei].
size() - 2;
410 STLsurfaceFormatCore::writeHeaderBINARY(os, nTris);
433 const word ext = filename.
ext();
438 writeBinary(filename, surf);
442 writeAscii(filename, surf);
459 writeBinary(filename, surf);
463 writeAscii(filename, surf);
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
#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.
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const word & name() const
Return name.
const List< label > & faceMap() const
Const access to the faceMap, zero-sized when unused.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
A surface zone on a MeshedSurface.
void size(const label)
Override size to be inconsistent with allocated storage.
const List< Face > & faces() const
Return const access to the faces.
bool good() const
Return true if next operation might succeed.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Field< point > & points() const
Return reference to global points.
Vector< scalar > vector
A scalar version of the templated Vector.
const List< Face > & faces() const
Return const access to the faces.
const List< surfZone > & surfZones() const
Const access to the surface zones.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Various functions to operate on Lists.
const pointField & points() const
Return const access to the points.
bool read(const char *, int32_t &)
vectorField pointField
pointField is a vectorField.
bool useFaceMap() const
Use faceMap?
A class for handling words, derived from string.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
const List< surfZoneIdentifier > & zoneToc() const
Return const access to the zone table-of-contents.
vector point
Point is a vector.
word ext() const
Return file name extension (part after last .)
triangle< point, const point & > triPointRef
dimensioned< scalar > mag(const dimensioned< Type > &)
const List< label > & zoneIds() const
Return const access to the zone ids.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.