Go to the documentation of this file.
26 #include "triSurface.H"
27 #include "STLtriangle.H"
28 #include "primitivePatch.H"
48 os <<
"solid " << patch.
name() <<
endl;
53 patchFaceI < patch.
size();
61 os <<
" facet normal "
62 <<
n.x() <<
' ' <<
n.y() <<
' ' <<
n.z() <<
nl
63 <<
" outer loop" <<
endl;
71 << pa.
x() <<
' ' << pa.
y() <<
' ' << pa.
z() <<
nl
73 << pb.
x() <<
' ' << pb.
y() <<
' ' << pb.
z() <<
nl
75 << pc.
x() <<
' ' << pc.
y() <<
' ' << pc.
z() <<
nl
77 <<
" endfacet" <<
endl;
80 os <<
"endsolid " << patch.
name() <<
endl;
89 label faceI = myPatches[patchI].start();
91 forAll(myPatches[patchI], i)
93 patchIDs[
faceMap[faceI++]] = patchI;
97 label currentPatchI = -1;
101 if (currentPatchI != patchIDs[faceI])
103 if (currentPatchI != -1)
106 os <<
"endsolid " << myPatches[currentPatchI].name()
109 currentPatchI = patchIDs[faceI];
110 os <<
"solid " << myPatches[currentPatchI].name() <<
nl;
115 os <<
" facet normal "
116 <<
n.x() <<
' ' <<
n.y() <<
' ' <<
n.z() <<
nl
117 <<
" outer loop" <<
endl;
125 << pa.
x() <<
' ' << pa.
y() <<
' ' << pa.
z() <<
nl
127 << pb.
x() <<
' ' << pb.
y() <<
' ' << pb.
z() <<
nl
129 << pc.
x() <<
' ' << pc.
y() <<
' ' << pc.
z() <<
nl
131 <<
" endfacet" <<
endl;
134 if (currentPatchI != -1)
136 os <<
"endsolid " << myPatches[currentPatchI].name()
146 string header(
"Foam binary STL", STLheaderSize);
147 os.write(header.c_str(), STLheaderSize);
149 label nTris = size();
150 os.write(
reinterpret_cast<char*
>(&nTris),
sizeof(
unsigned int));
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
label size() const
Return size of this patch in the polyMesh face list.
const Field< point > & points() const
Return reference to global points.
#define forAll(list, i)
Loop across all elements in list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void writeSTLASCII(Ostream &) const
Write to Ostream in ASCII STL format.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
'Patch' on surface as subset of triSurface.
label size() const
Return the number of elements in the UList.
surfacePatchList calcPatches(labelList &faceMap) const
Sort faces according to region. Returns patch list.
A triangle representation for STL files.
const Field< point > & faceNormals() const
Return face normals for patch.
A vertex point representation for STL files.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Triangle with additional region number.
void writeSTLBINARY(std::ostream &) const
Write to std::ostream in BINARY STL format.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const word & name() const
Return name.