Go to the documentation of this file.
52 label end = (start_+size_)%tokens_.size();
54 if (size_ == tokens_.size())
56 start_ = tokens_.fcIndex(start_);
67 token t = tokens_[start_];
68 start_ = tokens_.fcIndex(start_);
77 start_ = tokens_.rcIndex(start_);
84 return size_ || is_.good();
123 else if (t.
pToken() ==
'^')
137 for (
size_t i=0; i<
w.size(); ++i)
143 word subWord =
w(start, i-start);
150 push(
token(subWord));
167 if (start <
w.size())
169 word subWord =
w(start,
w.size()-start);
176 push(
token(subWord));
222 scalar fractionalPart = std::modf(
exponents_[i], &integralPart);
224 if (
mag(fractionalPart-1.0) <= tol)
228 else if (
mag(fractionalPart+1.0) <= tol)
232 else if (
mag(fractionalPart) <= tol)
242 const label lastPrior,
254 bool haveReadSymbol =
false;
265 haveReadSymbol =
true;
271 haveReadSymbol =
true;
304 haveReadSymbol =
true;
313 if (nextPrior > lastPrior)
326 haveReadSymbol =
false;
330 if (nextPrior > lastPrior)
342 haveReadSymbol =
false;
344 else if (nextToken.
pToken() ==
'^')
346 if (nextPrior > lastPrior)
360 haveReadSymbol =
false;
385 if (nextToken.
error())
390 if (haveReadSymbol && (nextToken.
isWord() || nextToken.
isNumber()))
412 token startToken(is);
420 <<
endl <<
"in stream " << is.
info()
435 multiplier = ds.
value();
476 <<
endl <<
"in stream " << is.
info()
481 is.
check(
"Istream& operator>>(Istream&, dimensionSet&)");
507 token startToken(is);
515 <<
endl <<
"in stream " << is.
info()
524 bool continueParsing =
true;
530 symbolPow = symbolPow(0, symbolPow.size()-1);
531 continueParsing =
false;
538 size_t index = symbolPow.find(
'^');
539 if (index != string::npos)
541 word symbol = symbolPow(0, index);
542 word exp = symbolPow(index+1, symbolPow.size()-index+1);
546 s.read(readSet[symbol], readSet);
548 symbolSet.
reset(
pow(
s.dimensions(), exponent));
556 s.read(readSet[symbolPow], readSet);
558 symbolSet.
reset(
s.dimensions());
559 multiplier *=
s.value();
570 nextToken =
token(is);
574 continueParsing =
false;
578 while (continueParsing);
615 <<
endl <<
"in stream " << is.
info()
621 is.
check(
"Istream& operator>>(Istream&, dimensionSet&)");
647 bool hasPrinted =
false;
650 std::streamsize oldPrecision = os.
precision
652 std::numeric_limits<scalar>::digits10
669 os <<
'^' << exponents[i];
675 multiplier *= ds.
value();
695 os.
check(
"Ostream& operator<<(Ostream&, const dimensionSet&)");
716 dset.
read(is, multiplier);
721 <<
"Cannot use scaled units in dimensionSet"
726 is.
check(
"Istream& operator>>(Istream&, dimensionSet&)");
735 dset.
write(os, multiplier);
738 os.
check(
"Ostream& operator<<(Ostream&, const dimensionSet&)");
static bool valid(char c)
streamFormat format() const
Return current stream format.
void reset(const dimensionSet &)
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
A class for handling words, derived from string.
#define forAll(list, i)
Loop across all elements in list.
void unpop(const token &)
punctuationToken
Standard punctuation tokens.
const word & wordToken() const
void putBack(const token &)
const word & name() const
Return const reference to name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A token holds items read from Istream.
const Type & value() const
Return const reference to value.
dimensionedScalar exp(const dimensionedScalar &ds)
Dimension set for the base types.
const HashTable< dimensionedScalar > & unitSet()
Set of all dimensions.
virtual int precision() const =0
Get precision of output field.
static label priority(const token &t)
Istream & read(Istream &is, scalar &multiplier, const dictionary &)
Read using provided units. Used only in initial parsing.
friend dimensionSet pow(const dimensionSet &, const scalar)
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.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const dimensionSets & writeUnitSet()
Set of units.
void round(const scalar tol)
Reset exponents to nearest integer if close to it. Used to.
InfoProxy< IOstream > info() const
Return info proxy.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Ostream & operator<<(Ostream &, const edgeMesh &)
punctuationToken pToken() const
dimensionSet(const scalar mass, const scalar length, const scalar time, const scalar temperature, const scalar moles, const scalar current, const scalar luminousIntensity)
Construct given individual dimension exponents for all.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Generic dimensioned Type class.
Input from memory buffer stream.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
errorManipArg< error, int > exit(error &err, const int errNo=1)
An STL-conforming hash table.
Ostream & write(Ostream &os, scalar &multiplier, const dimensionSets &) const
Write using provided units.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
void putBack(const token &)
Put back token.
const PtrList< dimensionedScalar > & units() const
Return the units.
Istream & operator>>(Istream &, edgeMesh &)
dimensionedScalar parse(const label lastPrior, tokeniser &tis, const HashTable< dimensionedScalar > &) const
void coefficients(scalarField &) const
(if valid) obtain set of coefficients of unitNames
friend dimensionSet mag(const dimensionSet &)
const dimensionedScalar c
Speed of light in a vacuum.
bool valid() const
Is there a valid inverse of the selected unit.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
scalar exponents_[nDimensions]
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool isPunctuation() const
const dimensionSet & dimensions() const
Return const reference to dimensions.
static const scalar smallExponent
void splitWord(const word &)