47 if (!compare(*
this,
units,
false))
50 <<
"The units " <<
units.info() <<
" of " << keyword
51 <<
" in dictionary " <<
dict.
name() <<
" do not match "
52 <<
"the required units " << info()
64 if (!compare(*
this,
units,
false))
67 <<
"The units " <<
units.info() <<
" provided do not match "
68 <<
"the required units " << info()
85 if (!compare(*
this,
units,
false))
88 <<
"The units " <<
units.info() <<
" of " << keyword
89 <<
" in dictionary " <<
dict.
name() <<
" do not match "
90 <<
"the required units " << info()
110 if (!compare(*
this,
units,
false))
113 <<
"The units " <<
units.info() <<
" of " << keyword
114 <<
" in dictionary " <<
dict.
name() <<
" do not match "
115 <<
"the required units " << info()
128 <<
"Optional entry '" << keyword <<
"' is not present,"
129 <<
" the default value '" << info() <<
"' will be used."
147 if (!unitConversion::compare(
units, *
this,
false))
150 <<
"The units " <<
units.info() <<
" provided do not match "
151 <<
"the required units " << info()
155 if (debug && (
any() || !unitConversion::compare(
units, *
this,
true)))
158 <<
" of file " << is.
name()
159 <<
" with factor " <<
units.multiplier_ <<
endl;
182 if (!unitConversion::compare(
units, *
this,
false))
185 <<
"The units " <<
units.info() <<
" of " << keyword
186 <<
" in dictionary " <<
dict.
name() <<
" do not match "
187 <<
"the required units " << info()
191 if (debug && (
any() || !unitConversion::compare(
units, *
this,
true)))
193 Info<<
"Unit conversion of " << keyword
195 <<
" with factor " <<
units.multiplier_ <<
endl;
216 <<
endl <<
"in stream " << is.
info() <<
", got a "
246 <<
endl <<
"in stream " << is.
info() <<
", got a "
251 is.
check(
"Istream& operator>>(Istream&, unitConversion&)");
259 units.dimensions_.readNoBeginOrEnd(is);
273 if (!nextToken.isNumber())
277 units.exponents_[i] = 0;
284 is >>
units.exponents_[i];
299 if (!nextToken.isNumber())
301 units.multiplier_ = 1;
305 is >>
units.multiplier_;
314 <<
endl <<
"in stream " << is.
info() <<
", got a "
320 units.multiplier_ = 1;
326 <<
" in unitConversion " <<
endl <<
"in stream " << is.
info()
334 units.exponents_[i] = 0;
337 units.multiplier_ = 1;
343 <<
" in unitConversion " <<
endl <<
"in stream " << is.
info()
348 is.
check(
"Istream& operator>>(Istream&, unitConversion&)");
360 units.dimensions_.writeNoBeginOrEnd(os);
363 bool nonZeroDimlessUnits =
false;
366 nonZeroDimlessUnits =
372 bool nonUnityMultiplier =
units.multiplier_ != 1;
375 if (nonZeroDimlessUnits || nonUnityMultiplier)
381 if (nonZeroDimlessUnits)
390 if (nonUnityMultiplier)
396 if (nonUnityMultiplier)
405 os.
check(
"Ostream& operator<<(Ostream&, const unitConversion&)");
433 units.dimensions_.writeInfoNoBeginOrEnd(os);
436 bool nonZeroDimlessUnits =
false;
439 nonZeroDimlessUnits =
445 bool nonUnityMultiplier =
units.multiplier_ != 1;
448 if (nonZeroDimlessUnits || nonUnityMultiplier)
454 if (nonZeroDimlessUnits)
463 if (
units.exponents_[i] != 1)
465 os <<
'^' <<
units.exponents_[i];
472 if (nonUnityMultiplier)
478 if (nonUnityMultiplier)
487 os.check(
"Ostream& operator<<(Ostream&, const InfoProxy<unitConversion>&)");
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.
static int writeOptionalEntries
If true write optional keywords and values.
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.
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.
static const NamedEnum< dimlessUnitType, 2 > dimlessUnitTypeNames_
Names of the dimensionless units.
static const scalar smallExponent
A small exponent with which to perform inexact comparisons.
unitConversion(const dimensionSet &, const scalar fraction, const scalar angle, const scalar multiplier)
Construct from components.
void read(const word &keyword, const dictionary &)
Update.
dimlessUnitType
Define an enumeration for the names of the dimensionless unit.
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define IOInfoInFunction(ios)
Report an IO information message using Foam::Info.
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)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
const dimensionSet dimless
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
const HashTable< unitConversion > & units()
Get the table of unit conversions.
Istream & operator>>(Istream &, pistonPointEdgeData &)
bool any(const boolList &l)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)