Go to the documentation of this file.
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 "
92 const dimensioned<Type>& dt
96 dimensions_(dt.dimensions_),
124 dimensions_.read(is, multiplier);
126 value_ *= multiplier;
134 const dimensionSet& dimSet,
140 value_(pTraits<Type>::zero)
150 const dimensionSet& dimSet,
151 const dictionary&
dict
156 value_(pTraits<Type>::zero)
180 const Type& defaultValue
189 return dimensioned<Type>(
name, dims, defaultValue);
198 const dictionary&
dict,
199 const Type& defaultValue
211 const dimensionSet& dims,
212 const Type& defaultValue
215 Type value =
dict.lookupOrAddDefault<Type>(
name, defaultValue);
216 return dimensioned<Type>(
name, dims, value);
225 const Type& defaultValue
296 dimensions_ = dc.dimensions();
297 value_.replace(d, dc.value());
304 dict.lookup(name_) >> value_;
311 return dict.readIfPresent(name_, value_);
324 dimensions_.
read(is, mult, readSet);
333 "Istream& dimensioned<Type>::read(Istream& is, const dictionary&)"
344 const HashTable<dimensionedScalar>& readSet
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)"
450 template<
class Type,
int r>
456 "pow(" + dt.
name() +
',' +
name(r) +
')',
469 "sqr(" + dt.name() +
')',
470 sqr(dt.dimensions()),
478 return dimensioned<scalar>
480 "magSqr(" + dt.name() +
')',
489 return dimensioned<scalar>
491 "mag(" + dt.name() +
')',
501 const dimensioned<Type>& dt1,
502 const dimensioned<Type>& dt2
505 return dimensioned<Type>
507 "cmptMultiply(" + dt1.name() +
',' + dt2.name() +
')',
516 const dimensioned<Type>& dt1,
517 const dimensioned<Type>& dt2
520 return dimensioned<Type>
522 "cmptDivide(" + dt1.name() +
',' + dt2.name() +
')',
523 cmptDivide(dt1.dimensions(), dt2.dimensions()),
532 const dimensioned<Type>& dt1,
533 const dimensioned<Type>& dt2
536 if (dt1.dimensions() != dt2.dimensions())
539 <<
"dimensions of arguments are not equal"
543 return dimensioned<Type>
545 "max(" + dt1.name() +
',' + dt2.name() +
')',
547 max(dt1.value(), dt2.value())
555 const dimensioned<Type>& dt1,
556 const dimensioned<Type>& dt2
559 if (dt1.dimensions() != dt2.dimensions())
562 <<
"dimensions of arguments are not equal"
566 return dimensioned<Type>
568 "min(" + dt1.name() +
',' + dt2.name() +
')',
570 min(dt1.value(), dt2.value())
581 is.putBack(nextToken);
585 if (nextToken.isWord())
589 is.putBack(nextToken);
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>&)");
614 os << dt.
name() << token::SPACE;
618 dt.dimensions().write(os, mult);
623 os << dt.value()/mult;
626 os.check(
"Ostream& operator<<(Ostream&, const dimensioned<Type>&)");
641 return dt1.
value() > dt2.value();
652 return dt1.
value() < dt2.value();
659 const dimensioned<Type>& dt1,
660 const dimensioned<Type>& dt2
663 return dimensioned<Type>
665 '(' + dt1.
name() +
'+' + dt2.name() +
')',
667 dt1.
value() + dt2.value()
675 return dimensioned<Type>
687 const dimensioned<Type>& dt1,
688 const dimensioned<Type>& dt2
691 return dimensioned<Type>
693 '(' + dt1.
name() +
'-' + dt2.name() +
')',
695 dt1.
value() - dt2.value()
703 const dimensioned<scalar>& ds,
704 const dimensioned<Type>& dt
707 return dimensioned<Type>
709 '(' + ds.
name() +
'*' + dt.name() +
')',
711 ds.
value() * dt.value()
719 const dimensioned<Type>& dt,
720 const dimensioned<scalar>& ds
723 return dimensioned<Type>
725 '(' + dt.name() +
'|' + ds.
name() +
')',
727 dt.value()/ds.
value()
735 #define PRODUCT_OPERATOR(product, op, opFunc) \
737 template<class Type1, class Type2> \
738 Foam::dimensioned<typename Foam::product<Type1, Type2>::type> \
741 const dimensioned<Type1>& dt1, \
742 const dimensioned<Type2>& dt2 \
745 return dimensioned<typename product<Type1, Type2>::type> \
747 '(' + dt1.name() + #op + dt2.name() + ')', \
748 dt1.dimensions() op dt2.dimensions(), \
749 dt1.value() op dt2.value() \
753 template<class Type, class Form, class Cmpt, int nCmpt> \
754 Foam::dimensioned<typename Foam::product<Type, Form>::type> \
757 const dimensioned<Type>& dt1, \
758 const VectorSpace<Form,Cmpt,nCmpt>& t2 \
761 return dimensioned<typename product<Type, Form>::type> \
763 '(' + dt1.name() + #op + name(t2) + ')', \
765 dt1.value() op static_cast<const Form&>(t2) \
769 template<class Type, class Form, class Cmpt, int nCmpt> \
770 Foam::dimensioned<typename Foam::product<Form, Type>::type> \
773 const VectorSpace<Form,Cmpt,nCmpt>& t1, \
774 const dimensioned<Type>& dt2 \
777 return dimensioned<typename product<Form, Type>::type> \
779 '(' + name(t1) + #op + dt2.name() + ')', \
781 static_cast<const Form&>(t1) op dt2.value() \
791 #undef PRODUCT_OPERATOR
dimensioned< cmptType > component(const direction) const
Return a component as a dimensioned<cmptType>
static dimensioned< Type > lookupOrAddToDict(const word &, dictionary &, const dimensionSet &dims=dimless, const Type &defaultValue=pTraits< Type >::zero)
Construct from dictionary, with default value.
void initialize(Istream &is)
Initialize from Istream.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
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.
A class for handling words, derived from string.
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
#define PRODUCT_OPERATOR(product, op, opFunc)
bool read(const char *, int32_t &)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
const word & name() const
Return const reference to name.
A token holds items read from Istream.
const Type & value() const
Return const reference to value.
Dimension set for the base types.
dimensioned< scalar > mag(const dimensioned< Type > &)
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *int(pTraits< arg1 >::rank) >::type type
tmp< fvMatrix< Type > > operator-(const fvMatrix< Type > &)
Istream & read(Istream &is, scalar &multiplier, const dictionary &)
Read using provided units. Used only in initial parsing.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void read(const dictionary &)
Update the value of dimensioned<Type>
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Ostream & operator<<(Ostream &, const edgeMesh &)
virtual bool check(const char *operation) const
Check IOstream status for given operation.
A list of keyword definitions, which are a keyword followed by any number of values (e....
bool readIfPresent(const dictionary &)
Update the value of dimensioned<Type> if found in the dictionary.
errorManip< error > abort(error &err)
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))
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionSet dimensions_
The dimension set.
void replace(const direction, const dimensioned< cmptType > &)
Return a component with a dimensioned<cmptType>
dimensioned()
Null constructor.
Traits class for primitives.
void putBack(const token &)
Put back token.
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Istream & operator>>(Istream &, edgeMesh &)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
const dimensionSet & dimensions() const
Return const reference to dimensions.
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
virtual const fileName & name() const
Return the name of the stream.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
virtual Istream & read(token &)=0
Return next token from stream.
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)