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;
112 token startToken(is);
117 <<
endl <<
"in stream " << is.
info()
121 readNoBeginOrEnd(is);
129 <<
endl <<
"in stream " << is.
info()
134 is.
check(
"Istream& operator>>(Istream&, dimensionSet&)");
164 writeNoBeginOrEnd(os);
169 os.
check(
"Ostream& operator<<(Ostream&, const dimensionSet&)");
189 if (exponents_[i] != 1)
191 os <<
'^' << exponents_[i];
215 is.
check(
"Istream& operator>>(Istream&, dimensionSet&)");
226 os.
check(
"Ostream& operator<<(Ostream&, const dimensionSet&)");
236 ip.
t_.writeInfoNoBeginOrEnd(os);
241 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.
Ostream & writeInfoNoBeginOrEnd(Ostream &os) const
Write info without the square brackets.
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 & writeNoBeginOrEnd(Ostream &os) const
Write without the square brackets.
Ostream & write(Ostream &os) const
Write.
friend dimensionSet mag(const dimensionSet &)
static const NamedEnum< dimensionType, 7 > dimensionTypeNames_
Names of the dimensions.
Istream & readNoBeginOrEnd(Istream &is)
Read without the square brackets.
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 parseNoBeginOrEnd(Istream &is, 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
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
labelList first(const UList< labelPair > &p)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Istream & operator>>(Istream &, pistonPointEdgeData &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)