31 void Foam::dimensionSet::round(
const scalar tol)
36 scalar fractionalPart = std::modf(exponents_[i], &integralPart);
38 if (
mag(fractionalPart-1.0) <= tol)
40 exponents_[i] = 1.0+integralPart;
42 else if (
mag(fractionalPart+1.0) <= tol)
44 exponents_[i] = -1.0+integralPart;
46 else if (
mag(fractionalPart) <= tol)
48 exponents_[i] = integralPart;
83 is >> exponents_[Dimension];
109 <<
endl <<
"in stream " << is.
info()
115 is.
check(
"Istream& operator>>(Istream&, dimensionSet&)");
124 token startToken(is);
130 <<
endl <<
"in stream " << is.
info()
134 return readNoBegin(is);
150 os.
check(
"Ostream& operator<<(Ostream&, const dimensionSet&)");
169 is.
check(
"Istream& operator>>(Istream&, dimensionSet&)");
180 os.
check(
"Ostream& operator<<(Ostream&, const dimensionSet&)");
204 if (dims.exponents_[i] != 1)
206 os <<
'^' << dims.exponents_[i];
216 os.
check(
"Ostream& operator<<(Ostream&, const InfoProxy<dimensionSet>&)");
virtual bool check(const char *operation) const
Check IOstream status for given operation.
InfoProxy< IOstream > info() const
Return info proxy.
A helper class for outputting values to Ostream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void putBack(const token &)
Put back token.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Dimension set for the base types.
Istream & readNoBegin(Istream &is)
Read, assuming the '[' has already been read.
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.
static const scalar smallExponent
A small exponent with which to perform inexact comparisons.
Ostream & write(Ostream &os) const
Write.
friend dimensionSet mag(const dimensionSet &)
static const NamedEnum< dimensionType, 7 > dimensionTypeNames_
Names of the dimensions.
dimensionType
Define an enumeration for the names of the dimension exponents.
Istream & read(Istream &is)
Read.
A token holds items read from Istream.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Type parseNoBegin(const label lastPrior, tokeniser &tis, const Type &identity, const HashTable< Type > &table)
Parse tokens into a dimension set or unit conversion, assuming that the '['.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimless
labelList first(const UList< labelPair > &p)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Istream & operator>>(Istream &, pistonPointEdgeData &)
dimensioned< scalar > mag(const dimensioned< Type > &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)