Go to the documentation of this file.
26 #include "triSurface.H"
27 #include "STLtriangle.H"
38 bool compressed =
false;
40 autoPtr<istream> STLfilePtr
42 new ifstream(STLfileName.c_str(), std::ios::binary)
46 if (!STLfilePtr->good() &&
isFile(STLfileName +
".gz",
false))
49 STLfilePtr.reset(
new igzstream((STLfileName +
".gz").c_str()));
51 istream& STLfile = STLfilePtr();
56 <<
"Cannot read file " << STLfileName
57 <<
" or file " << STLfileName +
".gz"
74 STLfile.read(
reinterpret_cast<char*
>(&nTris),
sizeof(
unsigned int));
78 if (!STLfile || nTris < 0)
89 if (nTris < dataFileSize/50 || nTris > dataFileSize/25)
103 for (
label i = 0; i < nTris; i++)
106 STLtriangle stlTri(STLfile);
109 STLpoints[pointI++] = stlTri.a();
110 STLpoints[pointI++] = stlTri.b();
111 STLpoints[pointI++] = stlTri.c();
112 operator[](i).region() = stlTri.attrib();
127 sp.setSize(nUniquePoints);
131 sp[pointMap[pointI]] =
vector
143 operator[](i)[0] = pointMap[pointI++];
144 operator[](i)[1] = pointMap[pointI++];
145 operator[](i)[2] = pointMap[pointI++];
vectorField pointField
pointField is a vectorField.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
bool readSTLBINARY(const fileName &)
List< label > labelList
A List of labels.
static const int STLheaderSize
The number of bytes in the STL header.
#define forAll(list, i)
Loop across all elements in list.
Vector< float > floatVector
A float version of vector.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
pointField & storedPoints()
Non-const access to global points.
bool isFile(const fileName &, const bool checkGzip=true)
Does the name exist as a FILE in the file system?
Vector< scalar > vector
A scalar version of the templated Vector.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void setSize(const label)
Reset size of List.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label mergePoints(const UList< Type > &points, const scalar mergeTol, const bool verbose, labelList &pointMap, const Type &origin=Type::zero)
Sorts and merges points. All points closer than/equal mergeTol get merged.
off_t fileSize(const fileName &)
Return size of file.