36 is.putBack(nextToken);
40 if (nextToken.isWord())
44 is.putBack(nextToken);
48 scalar multiplier = 1.0;
50 if (nextToken == token::BEGIN_SQR)
53 dims.
read(is, multiplier);
55 if (dims != dimensions_)
60 ) <<
"The dimensions " << dims
61 <<
" provided do not match the required dimensions " 96 dimensions_(dt.dimensions_),
124 dimensions_.read(is, multiplier);
126 value_ *= multiplier;
158 initialize(dict.
lookup(name));
180 const Type& defaultValue
183 if (dict.
found(name))
199 const Type& defaultValue
202 return lookupOrDefault(name, dict,
dimless, defaultValue);
212 const Type& defaultValue
225 const Type& defaultValue
228 return lookupOrAddToDict(name, dict,
dimless, defaultValue);
296 dimensions_ = dc.dimensions();
297 value_.replace(d, dc.value());
304 dict.
lookup(name_) >> value_;
324 dimensions_.
read(is, mult, readSet);
333 "Istream& dimensioned<Type>::read(Istream& is, const dictionary&)" 352 dimensions_.
read(is, mult, readSet);
361 "Istream& dimensioned<Type>::read" 362 "(Istream& is, const HashTable<dimensionedScalar>&)" 377 dimensions_.
read(is, mult);
386 "Istream& dimensioned<Type>::read(Istream& is)" 397 Foam::dimensioned<Type>::operator[]
407 void Foam::dimensioned<Type>::operator+=
412 dimensions_ += dt.dimensions_;
418 void Foam::dimensioned<Type>::operator-=
423 dimensions_ -= dt.dimensions_;
429 void Foam::dimensioned<Type>::operator*=
439 void Foam::dimensioned<Type>::operator/=
450 template<
class Type, Foam::direction r>
456 "pow(" + dt.
name() +
',' +
name(r) +
')',
469 "sqr(" + dt.
name() +
')',
480 "magSqr(" + dt.
name() +
')',
491 "mag(" + dt.
name() +
')',
507 "cmptMultiply(" + dt1.
name() +
',' + dt2.
name() +
')',
522 "cmptDivide(" + dt1.
name() +
',' + dt2.
name() +
')',
539 <<
"dimensions of arguments are not equal" 545 "max(" + dt1.
name() +
',' + dt2.
name() +
')',
562 <<
"dimensions of arguments are not equal" 568 "min(" + dt1.
name() +
',' + dt2.
name() +
')',
593 scalar multiplier = 1.0;
594 if (nextToken == token::BEGIN_SQR)
596 dt.dimensions_.read(is, multiplier);
601 dt.value_ *= multiplier;
604 is.
check(
"Istream& operator>>(Istream&, dimensioned<Type>&)");
611 Foam::Ostream& Foam::operator<<(Ostream& os, const dimensioned<Type>& dt)
614 os << dt.
name() << token::SPACE;
623 os << dt.
value()/mult;
626 os.check(
"Ostream& operator<<(Ostream&, const dimensioned<Type>&)");
665 '(' + dt1.
name() +
'+' + dt2.
name() +
')',
693 '(' + dt1.
name() +
'-' + dt2.
name() +
')',
709 '(' + ds.
name() +
'*' + dt.
name() +
')',
725 '(' + dt.
name() +
'|' + ds.
name() +
')',
732 #define PRODUCT_OPERATOR(product, op, opFunc) \ 734 template<class Type1, class Type2> \ 735 Foam::dimensioned<typename Foam::product<Type1, Type2>::type> \ 738 const dimensioned<Type1>& dt1, \ 739 const dimensioned<Type2>& dt2 \ 742 return dimensioned<typename product<Type1, Type2>::type> \ 744 '(' + dt1.name() + #op + dt2.name() + ')', \ 745 dt1.dimensions() op dt2.dimensions(), \ 746 dt1.value() op dt2.value() \ 750 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \ 751 Foam::dimensioned<typename Foam::product<Type, Form>::type> \ 754 const dimensioned<Type>& dt1, \ 755 const VectorSpace<Form,Cmpt,nCmpt>& t2 \ 758 return dimensioned<typename product<Type, Form>::type> \ 760 '(' + dt1.name() + #op + name(t2) + ')', \ 762 dt1.value() op static_cast<const Form&>(t2) \ 766 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \ 767 Foam::dimensioned<typename Foam::product<Form, Type>::type> \ 770 const VectorSpace<Form,Cmpt,nCmpt>& t1, \ 771 const dimensioned<Type>& dt2 \ 774 return dimensioned<typename product<Form, Type>::type> \ 776 '(' + name(t1) + #op + dt2.name() + ')', \ 778 static_cast<const Form&>(t1) op dt2.value() \ 788 #undef PRODUCT_OPERATOR
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
static dimensioned< Type > lookupOrAddToDict(const word &, dictionary &, const dimensionSet &dims=dimless, const Type &defaultValue=pTraits< Type >::zero)
Construct from dictionary, with default value.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
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.
T lookupOrAddDefault(const word &, const T &, bool recursive=false, bool patternMatch=true)
Find and return a T, if not found return the given.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
A token holds items read from Istream.
void putBack(const token &)
Put back token.
bool readIfPresent(const dictionary &)
Update the value of dimensioned<Type> if found in the dictionary.
void replace(const direction, const dimensioned< cmptType > &)
Return a component with a dimensioned<cmptType>
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Generic dimensioned Type class.
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Dimension set for the base types.
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.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define PRODUCT_OPERATOR(product, op, opFunc)
virtual Istream & read(token &)=0
Return next token from stream.
pTraits< Type >::cmptType cmptType
Component type.
void read(const dictionary &)
Update the value of dimensioned<Type>
A class for handling words, derived from string.
Istream & operator>>(Istream &, directionInfo &)
const Type & value() const
Return const reference to value.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
dimensioned< cmptType > component(const direction) const
Return a component as a dimensioned<cmptType>
tmp< fvMatrix< Type > > operator-(const fvMatrix< Type > &)
An STL-conforming hash table.
errorManip< error > abort(error &err)
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
dimensioned()
Null constructor.
const word & name() const
Return const reference to name.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const dimensionSet & dimensions() const
Return const reference to dimensions.
dimensioned< scalar > mag(const dimensioned< Type > &)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
Istream & read(Istream &is, scalar &multiplier, const dictionary &)
Read using provided units. Used only in initial parsing.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.