32 void Foam::dimensionSet::round(
const scalar tol)
37 scalar fractionalPart = std::modf(exponents_[i], &integralPart);
39 if (
mag(fractionalPart - 1.0) <= tol)
41 exponents_[i] = 1.0 + integralPart;
43 else if (
mag(fractionalPart + 1.0) <= tol)
45 exponents_[i] = -1.0 + integralPart;
47 else if (
mag(fractionalPart) <= tol)
49 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.
Ostream & writeNoBeginOrEnd(Ostream &os) const
Write without the square brackets.
Ostream & write(Ostream &os) const
Write.
friend dimensionSet mag(const dimensionSet &)
static const scalar smallExponent
A small exponent with which to perform inexact comparisons.
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.
static const NamedEnum< dimensionType, 7 > & dimensionTypeNames_
Names of the dimensions.
A token holds items read from Istream.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const HashTable< dimensionSet > table
Table of dimensions.
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)
Istream & operator>>(Istream &, pointEdgeDist &)
const dimensionSet & dimless
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList first(const UList< labelPair > &p)
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)