Go to the documentation of this file.
68 bool reachedFacet =
false;
73 if(
badInput(is, tok) )
return false;
76 if(tok.isWord() && tok.wordToken() !=
"facet" )
78 name += tok.wordToken();
80 else if( tok.isNumber())
82 auto val = tok.number();
85 else if( tok.isPunctuation())
89 else if (tok.isWord() && tok.wordToken() ==
"facet")
102 if(!reachedFacet)
return false;
108 if(
badInput(is,tok) || !tok.isWord() )
return false;
109 word wTok = tok.wordToken();
110 if( wTok ==
"endsolid" )
return true;
111 if( wTok !=
"facet" )
return false;
116 if( !readFacet(is, tri) )
return false;
118 vertecies.push_back(tri);
141 for(
uint32 i=0; i<3; i++ )
165 if( i==0 ) tri.
x() = v;
166 if( i==1 ) tri.
y() = v;
167 if( i==2) tri.
z() = v;
197 << tri.
x().z() <<
endl;
202 << tri.
y().z() <<
endl;
207 << tri.
z().z() <<
endl;
229 for(
const auto& tri: vertecies)
233 os<<
"endsolid"<<
endl;
253 addSolid(name, vertecies);
266 addSolid(name, vertecies);
275 solids_.push_back(makeUnique<realx3x3Vector>(vertecies));
276 solidNames_.push_back(name);
286 solids_.push_back(makeUnique<realx3x3Vector>(vertecies));
287 solidNames_.push_back(name);
306 if(!readSolid(is, vertecies, name))
312 addSolid(name, std::move(vertecies));
315 if( is.
eof() || !tok.good())
return true;
328 for(
size_t i=0; i<size(); i++)
330 writeSolid(os, solids_[i], solidNames_[i]);
351 return solids_.size();
362 "requested out of range solid from stlFile "<<
378 "requested out of range solid name from stlFile "<<
383 return solidNames_[i];
bool eof() const
Return true if end of input seen.
bool checkWordToken(iIstream &is, token &tok, const word &check)
#define fatalExit
Fatal exit.
Token class based on OpenFOAM stream, with some modifications/simplifications to be tailored to our n...
const realx3x3Vector & solid(size_t i) const
bool good() const
True if token is not UNDEFINED or ERROR.
bool writeFacet(iOstream &os, const realx3x3 &tri) const
real number() const
Return int64, float or double value.
virtual const word & name() const
Return the name of the stream.
bool writeSolid(iOstream &os, const realx3x3Vector &vertecies, const word &name) const
iOstream & endl(iOstream &os)
Add newline and flush stream.
int precision() const override
Get precision of output field.
const word & name(size_t i) const
bool checkNumberToken(iIstream &is, token &tok, real &val)
iOstream & indent(iOstream &os)
Indent stream.
Input file stream for reading binary or ascii data from a file.
INLINE_FUNCTION_HD T & y()
access component
Manages file pathes, manupulate and combines them.
void incrIndent()
Increment the indent level.
INLINE_FUNCTION_HD triple< T > cross(const triple< T > &v1, const triple< T > &v2)
Interface class for any input stream
bool bad() const
Return true if stream is corrupted.
void decrIndent()
Decrement the indent level.
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
void addSolid(const word &name, const realx3x3Vector &vertecies)
void putBack(const token &tok)
Put back token Only a single put back is permitted.
bool readSolid(iIstream &is, realx3x3Vector &vertecies, word &name)
INLINE_FUNCTION_HD T & z()
access component
Output file stream to send binary or ascii data to a file.
const wordList & names() const
void setFile(fileSystem file) const
bool readFacet(iIstream &is, realx3x3 &tri)
word real2Word(const real &v, int32 numPrecision=6)
Convert floating point variable to string with general format.
#define ioErrorInFile(fileName, lineNumber)
Report an error in file operation with supplied fileName and lineNumber.
int32 lineNumber() const
Const access to the current stream line number.
INLINE_FUNCTION_HD T & x()
access component
A set of 3 variables that can be used for vector variables.
bool isNumber() const
Token is int, float or duble.
Interface class for any output stream.
const word & wordToken() const
Return const reference to the word contents.
bool isWord() const
Token is word or DIRECTIVE word.
bool badInput(iIstream &is, token &tok)