48 if (!compare(*
this, units,
false))
50 multiplier_ = scalar(1);
53 <<
"The units " << units.
info() <<
" of " << keyword
54 <<
" in dictionary " <<
dict.
name() <<
" do not have "
55 <<
"the required dimensions " << info()
67 if (!compare(*
this, units,
false))
69 multiplier_ = scalar(1);
72 <<
"The units " << units.
info() <<
" provided do not have "
73 <<
"the required dimensions " << info()
90 if (!compare(*
this, units,
false))
92 multiplier_ = scalar(1);
95 <<
"The units " << units.
info() <<
" of " << keyword
96 <<
" in dictionary " <<
dict.
name() <<
" do not have "
97 <<
"the required dimensions " << info()
117 if (!compare(*
this, units,
false))
119 multiplier_ = scalar(1);
122 <<
"The units " << units.
info() <<
" of " << keyword
123 <<
" in dictionary " <<
dict.
name() <<
" do not have "
124 <<
"the required dimensions " << info()
148 if (!unitSet::compare(units, *
this,
false))
150 multiplier_ = scalar(1);
153 <<
"The units " << units.
info() <<
" provided do not have "
154 <<
"the required dimensions " << info()
158 if (debug && (
any() || !unitSet::compare(units, *
this,
true)))
161 <<
" of file " << is.
name()
162 <<
" with factor " << units.multiplier_ <<
endl;
185 if (!unitSet::compare(units, *
this,
false))
187 multiplier_ = scalar(1);
190 <<
"The units " << units.
info() <<
" of " << keyword
191 <<
" in dictionary " <<
dict.
name() <<
" do not have "
192 <<
"the required dimensions " << info()
196 if (debug && (
any() || !unitSet::compare(units, *
this,
true)))
198 Info<<
"Unit conversion of " << keyword
200 <<
" with factor " << units.multiplier_ <<
endl;
221 <<
endl <<
"in stream " << is.
info() <<
", got a "
251 <<
endl <<
"in stream " << is.
info() <<
", got a "
256 is.
check(
"Istream& operator>>(Istream&, unitSet&)");
278 if (!nextToken.isNumber())
282 units.exponents_[i] = 0;
289 is >> units.exponents_[i];
304 if (!nextToken.isNumber())
306 units.multiplier_ = 1;
310 is >> units.multiplier_;
319 <<
endl <<
"in stream " << is.
info() <<
", got a "
325 units.multiplier_ = 1;
331 <<
" in unitSet " <<
endl <<
"in stream " << is.
info()
339 units.exponents_[i] = 0;
342 units.multiplier_ = 1;
348 <<
" in unitSet " <<
endl <<
"in stream " << is.
info()
353 is.
check(
"Istream& operator>>(Istream&, unitSet&)");
368 bool nonZeroDimlessUnits =
false;
371 nonZeroDimlessUnits =
377 bool nonUnityMultiplier = units.multiplier_ != 1;
380 if (nonZeroDimlessUnits || nonUnityMultiplier)
386 if (nonZeroDimlessUnits)
395 if (nonUnityMultiplier)
401 if (nonUnityMultiplier)
410 os.
check(
"Ostream& operator<<(Ostream&, const unitSet&)");
441 bool nonZeroDimlessUnits =
false;
444 nonZeroDimlessUnits =
450 bool nonUnityMultiplier = units.multiplier_ != 1;
453 if (nonZeroDimlessUnits || nonUnityMultiplier)
459 if (nonZeroDimlessUnits)
468 if (units.exponents_[i] != 1)
470 os <<
'^' << units.exponents_[i];
477 if (nonUnityMultiplier)
483 if (nonUnityMultiplier)
492 os.check(
"Ostream& operator<<(Ostream&, const InfoProxy<unitSet>&)");
label lineNumber() const
Return current stream line number.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
virtual const fileName & name() const
Return the name of the stream.
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,...
const fileName & name() const
Return the dictionary name.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Ostream & writeInfoNoBeginOrEnd(Ostream &os) const
Write info without the square brackets.
Ostream & writeNoBeginOrEnd(Ostream &os) const
Write without the square brackets.
Istream & readNoBeginOrEnd(Istream &is)
Read without the square brackets.
A keyword and a list of tokens is an 'entry'.
virtual ITstream & stream() const =0
Return token stream if this entry is a primitive entry.
A token holds items read from Istream.
Unit conversion structure. Contains the associated dimensions and the multiplier with which to conver...
bool readIfPresent(const word &keyword, const dictionary &)
Update if found in the dictionary.
bool none() const
Return whether this is the "none" unit. I.e., the case where unit.
InfoProxy< unitSet > info() const
Return info proxy.
void read(const word &keyword, const dictionary &)
Update.
unitSet(const dimensionSet &, const scalar fraction, const scalar angle, const scalar multiplier)
Construct from components.
static const scalar smallExponent
A small exponent with which to perform inexact comparisons.
static const NamedEnum< dimlessUnitType, 2 > & dimlessUnitTypeNames_
Names of the dimensionless units.
dimlessUnitType
Define an enumeration for the names of the dimensionless unit.
void reset(const unitSet &)
Reset the unit conversion.
bool any() const
Return whether this is the "any" unit. I.e., the case where.
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const dimensionSet dimless
Type parseNoBeginOrEnd(Istream &is, const Type &identity, const HashTable< Type > &table)
Parse tokens into a dimension set or unit conversion, assuming that the '['.
const HashTable< unitSet > & table()
Get the table of unit conversions.
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.
errorManip< error > abort(error &err)
bool any(const boolList &l)
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)