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 " 104 name_(::
Foam::name(t)),
118 dimensions_(dt.dimensions_),
146 dimensions_.read(is, multiplier);
148 value_ *= multiplier;
180 initialise(dict.
lookup(name));
202 const Type& defaultValue
205 if (dict.
found(name))
221 const Type& defaultValue
224 return lookupOrDefault(name, dict,
dimless, defaultValue);
234 const Type& defaultValue
247 const Type& defaultValue
250 return lookupOrAddToDict(name, dict,
dimless, defaultValue);
318 dimensions_ = dc.dimensions();
319 value_.replace(d, dc.value());
326 initialise(dict.
lookup(name_));
346 dimensions_.
read(is, mult, readSet);
355 "Istream& dimensioned<Type>::read(Istream& is, const dictionary&)" 374 dimensions_.
read(is, mult, readSet);
383 "Istream& dimensioned<Type>::read" 384 "(Istream& is, const HashTable<dimensionedScalar>&)" 399 dimensions_.
read(is, mult);
408 "Istream& dimensioned<Type>::read(Istream& is)" 419 Foam::dimensioned<Type>::operator[]
429 void Foam::dimensioned<Type>::operator+=
434 dimensions_ += dt.dimensions_;
440 void Foam::dimensioned<Type>::operator-=
445 dimensions_ -= dt.dimensions_;
451 void Foam::dimensioned<Type>::operator*=
461 void Foam::dimensioned<Type>::operator/=
472 template<
class Type, Foam::direction r>
478 "pow(" + dt.
name() +
',' +
name(r) +
')',
491 "sqr(" + dt.
name() +
')',
502 "magSqr(" + dt.
name() +
')',
513 "mag(" + dt.
name() +
')',
529 "cmptMultiply(" + dt1.
name() +
',' + dt2.
name() +
')',
544 "cmptDivide(" + dt1.
name() +
',' + dt2.
name() +
')',
561 <<
"dimensions of arguments are not equal" 567 "max(" + dt1.
name() +
',' + dt2.
name() +
')',
584 <<
"dimensions of arguments are not equal" 590 "min(" + dt1.
name() +
',' + dt2.
name() +
')',
624 scalar multiplier = 1.0;
625 if (nextToken == token::BEGIN_SQR)
627 dt.dimensions_.read(is, multiplier);
632 dt.value_ *= multiplier;
635 is.
check(
"Istream& operator>>(Istream&, dimensioned<Type>&)");
642 Foam::Ostream& Foam::operator<<(Ostream& os, const dimensioned<Type>& dt)
645 os << dt.
name() << token::SPACE;
654 os << dt.
value()/mult;
657 os.check(
"Ostream& operator<<(Ostream&, const dimensioned<Type>&)");
696 '(' + dt1.
name() +
'+' + dt2.
name() +
')',
724 '(' + dt1.
name() +
'-' + dt2.
name() +
')',
740 '(' + ds.
name() +
'*' + dt.
name() +
')',
756 '(' + dt.
name() +
'|' + ds.
name() +
')',
763 #define PRODUCT_OPERATOR(product, op, opFunc) \ 765 template<class Type1, class Type2> \ 766 Foam::dimensioned<typename Foam::product<Type1, Type2>::type> \ 769 const dimensioned<Type1>& dt1, \ 770 const dimensioned<Type2>& dt2 \ 773 return dimensioned<typename product<Type1, Type2>::type> \ 775 '(' + dt1.name() + #op + dt2.name() + ')', \ 776 dt1.dimensions() op dt2.dimensions(), \ 777 dt1.value() op dt2.value() \ 781 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \ 782 Foam::dimensioned<typename Foam::product<Type, Form>::type> \ 785 const dimensioned<Type>& dt1, \ 786 const VectorSpace<Form,Cmpt,nCmpt>& t2 \ 789 return dimensioned<typename product<Type, Form>::type> \ 791 '(' + dt1.name() + #op + name(t2) + ')', \ 793 dt1.value() op static_cast<const Form&>(t2) \ 797 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \ 798 Foam::dimensioned<typename Foam::product<Form, Type>::type> \ 801 const VectorSpace<Form,Cmpt,nCmpt>& t1, \ 802 const dimensioned<Type>& dt2 \ 805 return dimensioned<typename product<Form, Type>::type> \ 807 '(' + name(t1) + #op + dt2.name() + ')', \ 809 static_cast<const Form&>(t1) op dt2.value() \ 819 #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.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#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)
const dimensionSet dimless
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>
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
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.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
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)
#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.