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);
236 const Type& defaultValue,
237 const bool writeDefault
248 else if (writeDefault)
257 Info<<
" " << defaultValue;
259 if (
dict.name() != fileName::null)
261 Info<<
" in " <<
dict.name().relativePath();
272 const dictionary&
dict,
273 const Type& defaultValue,
274 const bool writeDefault
285 const unitConversion&
units,
286 const dictionary&
dict,
287 const Type& defaultValue,
288 const bool writeDefault
299 else if (writeDefault)
303 if (!
units.dimensions().dimensionless())
308 Info<<
" " << defaultValue;
310 if (
dict.name() != fileName::null)
312 Info<<
" in " <<
dict.name().relativePath();
383 dimensions_ = dc.dimensions();
384 value_.replace(d, dc.value());
398 isNull(defaultUnits) ? dimensions_ : defaultUnits,
411 const entry* entryPtr =
dict.lookupEntryPtr(name_,
false,
true);
418 isNull(defaultUnits) ? dimensions_ : defaultUnits,
425 if (dictionary::writeOptionalEntries)
428 <<
"Optional entry '" << name_ <<
"' is not present,"
429 <<
" the default value '" << *
this <<
"' will be used."
451 dimensions_ += dt.dimensions_;
459 dimensions_ -= dt.dimensions_;
480 template<
class Type, Foam::direction r>
486 "pow(" + dt.
name() +
',' +
name(r) +
')',
499 "sqr(" + dt.name() +
')',
500 sqr(dt.dimensions()),
509 return dimensioned<scalar>
511 "magSqr(" + dt.name() +
')',
521 return dimensioned<scalar>
523 "mag(" + dt.name() +
')',
533 const dimensioned<Type>& dt1,
534 const dimensioned<Type>& dt2
537 return dimensioned<Type>
539 "cmptMultiply(" + dt1.name() +
',' + dt2.name() +
')',
549 const dimensioned<Type>& dt1,
550 const dimensioned<Type>& dt2
553 return dimensioned<Type>
555 "cmptDivide(" + dt1.name() +
',' + dt2.name() +
')',
556 cmptDivide(dt1.dimensions(), dt2.dimensions()),
565 const dimensioned<Type>& dt1,
566 const dimensioned<Type>& dt2
569 if (dt1.dimensions() != dt2.dimensions())
572 <<
"dimensions of arguments are not equal"
576 return dimensioned<Type>
578 "max(" + dt1.name() +
',' + dt2.name() +
')',
580 max(dt1.value(), dt2.value())
588 const dimensioned<Type>& dt1,
589 const dimensioned<Type>& dt2
592 if (dt1.dimensions() != dt2.dimensions())
595 <<
"dimensions of arguments are not equal"
599 return dimensioned<Type>
601 "min(" + dt1.name() +
',' + dt2.name() +
')',
603 min(dt1.value(), dt2.value())
628 dt.initialise(word::null,
unitAny, is);
631 is.
check(
"Istream& operator>>(Istream&, dimensioned<Type>&)");
641 os << dt.
name() << token::SPACE;
644 dt.dimensions().write(os);
652 os.check(
"Ostream& operator<<(Ostream&, const dimensioned<Type>&)");
667 return dt1.value() > dt2.value();
678 return dt1.value() < dt2.value();
685 const dimensioned<Type>& dt1,
686 const dimensioned<Type>& dt2
689 return dimensioned<Type>
691 '(' + dt1.name() +
'+' + dt2.name() +
')',
692 dt1.dimensions() + dt2.dimensions(),
693 dt1.value() + dt2.value()
701 return dimensioned<Type>
713 const dimensioned<Type>& dt1,
714 const dimensioned<Type>& dt2
717 return dimensioned<Type>
719 '(' + dt1.name() +
'-' + dt2.name() +
')',
720 dt1.dimensions() - dt2.dimensions(),
721 dt1.value() - dt2.value()
729 const dimensioned<scalar>& ds,
730 const dimensioned<Type>& dt
733 return dimensioned<Type>
735 '(' + ds.
name() +
'*' + dt.name() +
')',
737 ds.
value() * dt.value()
745 const dimensioned<Type>& dt,
746 const dimensioned<scalar>& ds
749 return dimensioned<Type>
751 '(' + dt.name() +
'|' + ds.
name() +
')',
753 dt.value()/ds.
value()
758 #define PRODUCT_OPERATOR(product, op, opFunc) \
760 template<class Type1, class Type2> \
761 Foam::dimensioned<typename Foam::product<Type1, Type2>::type> \
764 const dimensioned<Type1>& dt1, \
765 const dimensioned<Type2>& dt2 \
768 return dimensioned<typename product<Type1, Type2>::type> \
770 '(' + dt1.name() + #op + dt2.name() + ')', \
771 dt1.dimensions() op dt2.dimensions(), \
772 dt1.value() op dt2.value() \
776 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
777 Foam::dimensioned<typename Foam::product<Type, Form>::type> \
780 const dimensioned<Type>& dt1, \
781 const VectorSpace<Form,Cmpt,nCmpt>& t2 \
784 return dimensioned<typename product<Type, Form>::type> \
786 '(' + dt1.name() + #op + name(t2) + ')', \
788 dt1.value() op static_cast<const Form&>(t2) \
792 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
793 Foam::dimensioned<typename Foam::product<Form, Type>::type> \
796 const VectorSpace<Form,Cmpt,nCmpt>& t1, \
797 const dimensioned<Type>& dt2 \
800 return dimensioned<typename product<Form, Type>::type> \
802 '(' + name(t1) + #op + dt2.name() + ')', \
804 static_cast<const Form&>(t1) op dt2.value() \
813 #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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Dimension set for the base types.
InfoProxy< dimensionSet > info() const
Return info proxy.
Ostream & write(Ostream &os) const
Write.
bool dimensionless() const
Return true if it is dimensionless.
Generic dimensioned Type class.
void operator+=(const dimensioned< Type > &)
void read(const dictionary &, const unitConversion &defaultUnits=NullObjectRef< unitConversion >())
Update the value of dimensioned<Type>
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 > &)
dimensioned< cmptType > operator[](const direction) const
Return a component as a dimensioned<cmptType>
const word & name() const
Return const reference to name.
bool readIfPresent(const dictionary &, const unitConversion &defaultUnits=NullObjectRef< unitConversion >())
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
Unit conversion structure. Contains the associated dimensions and the multiplier with which to conver...
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(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define IOInfoInFunction(ios)
Report an IO information message using Foam::Info.
void dot(LagrangianPatchField< typename innerProduct< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void cmptMultiply(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1, const LagrangianPatchField< Type > &f2)
void outer(LagrangianPatchField< typename outerProduct< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void dotdot(LagrangianPatchField< typename scalarProduct< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
const unitConversion unitAny
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
void cmptDivide(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1, const LagrangianPatchField< Type > &f2)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
const dimensionSet dimless
void cross(LagrangianPatchField< typename crossProduct< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const HashTable< unitConversion > & units()
Get the table of unit conversions.
void component(LagrangianPatchField< typename LagrangianPatchField< Type >::cmptType > &sf, const LagrangianPatchField< Type > &f, const direction d)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
void pow(LagrangianPatchField< typename powProduct< Type, r >::type > &f, const LagrangianPatchField< Type > &f1)
Istream & operator>>(Istream &, pistonPointEdgeData &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
void magSqr(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
tmp< fvMatrix< Type > > operator-(const fvMatrix< Type > &)
Ostream & indent(Ostream &os)
Indent stream.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.