36 const unitConversion& defaultUnits,
49 else if (nextToken.isWord())
51 name_ = nextToken.wordToken();
59 if (!nextToken.isWord())
61 is.putBack(nextToken);
65 unitConversion
units(defaultUnits);
66 const bool haveUnits =
units.readIfPresent(is);
69 value_ = pTraits<Type>(is);
72 if (!haveUnits && !is.eof())
74 units.readIfPresent(is);
84 dimensions_.reset(
units.dimensions());
87 units.makeStandard(value_);
142 dimensions_(dt.dimensions_),
178 initialise(
name, dims, is);
206 const Type& defaultValue
225 const Type& defaultValue
238 const Type& defaultValue
251 const Type& defaultValue
322 dimensions_ = dc.dimensions();
323 value_.replace(d, dc.value());
330 initialise(name_, dimensions_,
dict.
lookup(name_));
341 initialise(name_, dimensions_, entryPtr->
stream());
349 <<
"Optional entry '" << name_ <<
"' is not present,"
350 <<
" the default value '" << *
this <<
"' will be used."
372 dimensions_ += dt.dimensions_;
380 dimensions_ -= dt.dimensions_;
401 template<
class Type, Foam::direction r>
407 "pow(" + dt.
name() +
',' +
name(r) +
')',
420 "sqr(" + dt.name() +
')',
421 sqr(dt.dimensions()),
430 return dimensioned<scalar>
432 "magSqr(" + dt.name() +
')',
442 return dimensioned<scalar>
444 "mag(" + dt.name() +
')',
454 const dimensioned<Type>& dt1,
455 const dimensioned<Type>& dt2
458 return dimensioned<Type>
460 "cmptMultiply(" + dt1.name() +
',' + dt2.name() +
')',
470 const dimensioned<Type>& dt1,
471 const dimensioned<Type>& dt2
474 return dimensioned<Type>
476 "cmptDivide(" + dt1.name() +
',' + dt2.name() +
')',
477 cmptDivide(dt1.dimensions(), dt2.dimensions()),
486 const dimensioned<Type>& dt1,
487 const dimensioned<Type>& dt2
490 if (dt1.dimensions() != dt2.dimensions())
493 <<
"dimensions of arguments are not equal"
497 return dimensioned<Type>
499 "max(" + dt1.name() +
',' + dt2.name() +
')',
501 max(dt1.value(), dt2.value())
509 const dimensioned<Type>& dt1,
510 const dimensioned<Type>& dt2
513 if (dt1.dimensions() != dt2.dimensions())
516 <<
"dimensions of arguments are not equal"
520 return dimensioned<Type>
522 "min(" + dt1.name() +
',' + dt2.name() +
')',
524 min(dt1.value(), dt2.value())
546 is.
check(
"Istream& operator>>(Istream&, dimensioned<Type>&)");
559 dt.dimensions().write(os);
567 os.check(
"Ostream& operator<<(Ostream&, const dimensioned<Type>&)");
582 return dt1.value() > dt2.value();
593 return dt1.value() < dt2.value();
600 const dimensioned<Type>& dt1,
601 const dimensioned<Type>& dt2
604 return dimensioned<Type>
606 '(' + dt1.name() +
'+' + dt2.name() +
')',
607 dt1.dimensions() + dt2.dimensions(),
608 dt1.value() + dt2.value()
616 return dimensioned<Type>
628 const dimensioned<Type>& dt1,
629 const dimensioned<Type>& dt2
632 return dimensioned<Type>
634 '(' + dt1.name() +
'-' + dt2.name() +
')',
635 dt1.dimensions() - dt2.dimensions(),
636 dt1.value() - dt2.value()
644 const dimensioned<scalar>& ds,
645 const dimensioned<Type>& dt
648 return dimensioned<Type>
650 '(' + ds.
name() +
'*' + dt.name() +
')',
652 ds.
value() * dt.value()
660 const dimensioned<Type>& dt,
661 const dimensioned<scalar>& ds
664 return dimensioned<Type>
666 '(' + dt.name() +
'|' + ds.
name() +
')',
668 dt.value()/ds.
value()
673 #define PRODUCT_OPERATOR(product, op, opFunc) \
675 template<class Type1, class Type2> \
676 Foam::dimensioned<typename Foam::product<Type1, Type2>::type> \
679 const dimensioned<Type1>& dt1, \
680 const dimensioned<Type2>& dt2 \
683 return dimensioned<typename product<Type1, Type2>::type> \
685 '(' + dt1.name() + #op + dt2.name() + ')', \
686 dt1.dimensions() op dt2.dimensions(), \
687 dt1.value() op dt2.value() \
691 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
692 Foam::dimensioned<typename Foam::product<Type, Form>::type> \
695 const dimensioned<Type>& dt1, \
696 const VectorSpace<Form,Cmpt,nCmpt>& t2 \
699 return dimensioned<typename product<Type, Form>::type> \
701 '(' + dt1.name() + #op + name(t2) + ')', \
703 dt1.value() op static_cast<const Form&>(t2) \
707 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
708 Foam::dimensioned<typename Foam::product<Form, Type>::type> \
711 const VectorSpace<Form,Cmpt,nCmpt>& t1, \
712 const dimensioned<Type>& dt2 \
715 return dimensioned<typename product<Form, Type>::type> \
717 '(' + name(t1) + #op + dt2.name() + ')', \
719 static_cast<const Form&>(t1) op dt2.value() \
728 #undef PRODUCT_OPERATOR
virtual bool check(const char *operation) const
Check IOstream status for given operation.
virtual const fileName & name() const
Return the name of the stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of keyword definitions, which are a keyword followed by any number of values (e....
static bool 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.
T lookupOrAddDefault(const word &, const T &, bool recursive=false, bool patternMatch=true)
Find and return a T, if not found return the given.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Dimension set for the base types.
Generic dimensioned Type class.
void operator+=(const dimensioned< Type > &)
static dimensioned< Type > lookupOrAddToDict(const word &, dictionary &, const dimensionSet &dims=dimless, const Type &defaultValue=pTraits< Type >::zero)
Construct from dictionary, with default value.
dimensioned()
Null constructor.
void replace(const direction, const dimensioned< cmptType > &)
Return a component with a dimensioned<cmptType>
const dimensionSet & dimensions() const
Return const reference to dimensions.
pTraits< Type >::cmptType cmptType
Component type.
const Type & value() const
Return const reference to value.
dimensioned< cmptType > component(const direction) const
Return a component as a dimensioned<cmptType>
void operator/=(const scalar)
void operator-=(const dimensioned< Type > &)
void read(const dictionary &)
Update the value of dimensioned<Type>
dimensioned< cmptType > operator[](const direction) const
Return a component as a dimensioned<cmptType>
static dimensioned< Type > lookupOrDefault(const word &, const dictionary &, const dimensionSet &dims=dimless, const Type &defaultValue=pTraits< Type >::zero)
Construct from dictionary, with default dimensions and value.
const word & name() const
Return const reference to name.
bool readIfPresent(const dictionary &)
Update the value of dimensioned<Type> if found in the dictionary.
void operator*=(const scalar)
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.
Traits class for primitives.
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
A class for handling words, derived from string.
static const word null
An empty word.
#define PRODUCT_OPERATOR(product, op, opFunc)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define IOInfoInFunction(ios)
Report an IO information message using Foam::Info.
const unitConversion unitAny
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
errorManip< error > abort(error &err)
const dimensionSet dimless
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const HashTable< unitConversion > & units()
Get the table of unit conversions.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Istream & operator>>(Istream &, pistonPointEdgeData &)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
tmp< fvMatrix< Type > > operator-(const fvMatrix< Type > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.