Go to the documentation of this file.
28 #include "triSurface.H"
43 bool compressed =
false;
47 new ifstream(STLfileName.c_str(), std::ios::binary)
51 if (!STLfilePtr->good() &&
isFile(STLfileName +
".gz",
false))
54 STLfilePtr.
reset(
new igzstream((STLfileName +
".gz").c_str()));
56 istream& STLfile = STLfilePtr();
60 FatalErrorIn(
"triSurface::readSTLBINARY(const fileName&)")
61 <<
"Cannot read file " << STLfileName
62 <<
" or file " << STLfileName +
".gz"
79 STLfile.read(
reinterpret_cast<char*
>(&nTris),
sizeof(
unsigned int));
83 if (!STLfile || nTris < 0)
94 if (nTris < dataFileSize/50 || nTris > dataFileSize/25)
118 rawPoints[rawPointI] = stlTri.
a();
119 operator[](i)[0] = rawPointI++;
121 rawPoints[rawPointI] = stlTri.
b();
122 operator[](i)[1] = rawPointI++;
124 rawPoints[rawPointI] = stlTri.
c();
125 operator[](i)[2] = rawPointI++;
127 operator[](i).region() = stlTri.
region();
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A class for handling file names.
bool readSTLBINARY(const fileName &)
static const int STLheaderSize
The number of bytes in the STL header.
#define forAll(list, i)
Loop across all elements in list.
unsigned short region() const
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.
bool isFile(const fileName &, const bool checkGzip=true)
Does the name exist as a FILE in the file system?
errorManipArg< error, int > exit(error &err, const int errNo=1)
void setSize(const label)
Reset size of List.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
const STLpoint & b() const
const STLpoint & c() const
A triangle representation for STL files.
bool stitchTriangles(const pointField &rawPoints, const scalar tol=SMALL, const bool verbose=false)
Function to stitch the triangles by removing duplicate points.
void reset(T *=0)
If object pointer already set, delete object and set to given.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
off_t fileSize(const fileName &)
Return size of file.
const STLpoint & a() const