55 && std::toupper(header[
pos+0]) ==
'S' 56 && std::toupper(header[
pos+1]) ==
'O' 57 && std::toupper(header[
pos+2]) ==
'L' 58 && std::toupper(header[
pos+3]) ==
'I' 59 && std::toupper(header[
pos+4]) ==
'D' 74 format == STLFormat::UNKNOWN
76 :
format == STLFormat::BINARY
95 const bool unCompressed =
103 <<
"Cannot read file " << filename
104 <<
" or file " << filename +
".gz" 122 is.read(reinterpret_cast<char*>(&nTris),
sizeof(int32_t));
127 bool bad = (!is || nTris < 0);
129 if (!bad && unCompressed)
144 return (bad ? 0 : nTris);
148 std::unique_ptr<std::istream>
152 label& nTrisEstimated
157 std::unique_ptr<std::istream> streamPtr;
158 bool unCompressed(
true);
167 streamPtr.reset(isPtr.
release());
169 auto& is = *streamPtr;
174 <<
"Cannot read file " << filename
175 <<
" or file " << filename +
".gz" 188 <<
"problem reading header, perhaps file is not binary " 195 is.read(reinterpret_cast<char*>(&nTris),
sizeof(int32_t));
200 bool bad = (!is || nTris < 0);
202 if (!bad && unCompressed)
219 <<
"problem reading number of triangles, perhaps file is not binary" 223 nTrisEstimated = nTris;
237 ::snprintf(header,
STLHeaderSize,
"STL binary file %u facets", nTris);
246 os.write(reinterpret_cast<char*>(&nTris),
sizeof(uint32_t));
A wrapped std::ifstream with possible compression handling (igzstream) that behaves much like a std::...
A class for handling file names.
off_t fileSize(const fileName &name, const bool followLink=true)
Return size of file or -1 on failure (normally follows symbolic links).
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...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
IOstreamOption::compressionType whichCompression() const
Which compression type?
std::istream * release() noexcept
Return managed pointer and release ownership.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
dimensionedScalar pos(const dimensionedScalar &ds)
static constexpr const unsigned STLHeaderSize
static bool startsWithSolid(const char header[STLHeaderSize])
OBJstream os(runTime.globalPath()/outputName)
word format(conversionProperties.get< word >("format"))
bool isspace(char c) noexcept
Test for whitespace (C-locale)
bool has_ext() const
Various checks for extensions.