Go to the documentation of this file.
39 is.putBack(nextToken);
42 if (nextToken.isWord())
46 is.putBack(nextToken);
51 if (nextToken == token::BEGIN_SQR)
54 const dimensionSet curr(dimensions_);
55 dimensions_.read(is, mult);
60 <<
"The dimensions " << dimensions_
61 <<
" provided do not match the expected dimensions "
77 const dictionary&
dict,
80 enum keyType::option matchOpt
86 const entry* eptr =
dict.findEntry(key, matchOpt);
90 ITstream& is = eptr->stream();
94 dict.checkITstream(is, key);
101 <<
"Entry '" << key <<
"' not found in dictionary "
147 dimensions_(dt.dimensions_),
179 initialize(is,
false);
199 initialize(is,
true);
244 const word& entryName
252 readEntry(entryName,
dict);
310 initialize(is,
true);
440 dimensions_ = dc.dimensions();
441 value_.replace(d, dc.value());
455 return readIfPresent(name_,
dict);
462 const word& entryName,
467 return readEntry(entryName,
dict);
474 const word& entryName,
479 return readEntry(entryName,
dict,
false);
494 dimensions_.read(is, mult);
514 dimensions_.read(is, mult, readSet);
537 dimensions_.read(is, mult, readSet);
557 if (keyword != name_)
560 os << name_ << token::SPACE;
565 dimensions_.write(os, mult);
568 os << token::SPACE << value_/mult << token::END_STATEMENT <<
endl;
593 dimensions_ += dt.dimensions_;
604 dimensions_ -= dt.dimensions_;
631 template<
class Type, Foam::direction r>
637 "pow(" + dt.
name() +
',' +
name(r) +
')',
650 "sqr(" + dt.name() +
')',
651 sqr(dt.dimensions()),
662 return dimensioned<magType>
664 "magSqr(" + dt.name() +
')',
676 return dimensioned<magType>
678 "mag(" + dt.name() +
')',
688 const dimensioned<Type>& dt1,
689 const dimensioned<Type>& dt2
692 return dimensioned<Type>
694 "cmptMultiply(" + dt1.name() +
',' + dt2.name() +
')',
703 const dimensioned<Type>& dt1,
704 const dimensioned<Type>& dt2
707 return dimensioned<Type>
709 "cmptDivide(" + dt1.name() +
',' + dt2.name() +
')',
710 cmptDivide(dt1.dimensions(), dt2.dimensions()),
719 const dimensioned<Type>& dt1,
720 const dimensioned<Type>& dt2
723 if (dt1.dimensions() != dt2.dimensions())
726 <<
"dimensions of arguments are not equal"
730 return dimensioned<Type>
732 "max(" + dt1.name() +
',' + dt2.name() +
')',
734 max(dt1.value(), dt2.value())
742 const dimensioned<Type>& dt1,
743 const dimensioned<Type>& dt2
746 if (dt1.dimensions() != dt2.dimensions())
749 <<
"dimensions of arguments are not equal"
753 return dimensioned<Type>
755 "min(" + dt1.name() +
',' + dt2.name() +
')',
757 min(dt1.value(), dt2.value())
767 dt.initialize(is,
false);
777 os << dt.
name() << token::SPACE;
781 dt.dimensions().write(os, mult);
784 os << token::SPACE << dt.value()/mult;
800 return dt1.
value() < dt2.value();
811 return dt2.value() < dt1.
value();
818 const dimensioned<Type>& dt1,
819 const dimensioned<Type>& dt2
822 return dimensioned<Type>
824 '(' + dt1.
name() +
'+' + dt2.name() +
')',
826 dt1.
value() + dt2.value()
834 return dimensioned<Type>
846 const dimensioned<Type>& dt1,
847 const dimensioned<Type>& dt2
850 return dimensioned<Type>
852 '(' + dt1.
name() +
'-' + dt2.name() +
')',
854 dt1.
value() - dt2.value()
862 const dimensioned<scalar>& ds,
863 const dimensioned<Type>& dt
866 return dimensioned<Type>
868 '(' + ds.
name() +
'*' + dt.name() +
')',
870 ds.
value() * dt.value()
878 const dimensioned<Type>& dt,
879 const dimensioned<scalar>& ds
882 return dimensioned<Type>
884 '(' + dt.name() +
'|' + ds.
name() +
')',
886 dt.value() / ds.
value()
891 #define PRODUCT_OPERATOR(product, op, opFunc) \
893 template<class Type1, class Type2> \
894 Foam::dimensioned<typename Foam::product<Type1, Type2>::type> \
897 const dimensioned<Type1>& dt1, \
898 const dimensioned<Type2>& dt2 \
901 return dimensioned<typename product<Type1, Type2>::type> \
903 '(' + dt1.name() + #op + dt2.name() + ')', \
904 dt1.dimensions() op dt2.dimensions(), \
905 dt1.value() op dt2.value() \
909 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
910 Foam::dimensioned<typename Foam::product<Type, Form>::type> \
913 const dimensioned<Type>& dt1, \
914 const VectorSpace<Form,Cmpt,nCmpt>& t2 \
917 return dimensioned<typename product<Type, Form>::type> \
919 '(' + dt1.name() + #op + name(t2) + ')', \
921 dt1.value() op static_cast<const Form&>(t2) \
925 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
926 Foam::dimensioned<typename Foam::product<Form, Type>::type> \
929 const VectorSpace<Form,Cmpt,nCmpt>& t1, \
930 const dimensioned<Type>& dt2 \
933 return dimensioned<typename product<Form, Type>::type> \
935 '(' + name(t1) + #op + dt2.name() + ')', \
937 static_cast<const Form&>(t1) op dt2.value() \
947 #undef PRODUCT_OPERATOR
label ListType::const_reference val
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)
Dimensionless.
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read,...
A class for handling words, derived from Foam::string.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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 > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
#define PRODUCT_OPERATOR(product, op, opFunc)
static constexpr const zero Zero
Global zero.
bool read(const dictionary &dict)
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
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.
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
Istream & operator>>(Istream &, directionInfo &)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type & value() const
Return const reference to value.
Dimension set for the base types.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
bool readIfPresent(const dictionary &dict)
An input stream of tokens.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
word name(const complex &c)
Return string representation of complex.
virtual const fileName & name() const
Return the name of the stream.
void writeEntry(const word &keyword, Ostream &os) const
Write as a dictionary entry with keyword.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Generic dimensioned Type class.
virtual Ostream & writeKeyword(const keyType &kw)
Write the keyword followed by an appropriate indentation.
errorManip< error > abort(error &err)
static dimensioned< Type > getOrDefault(const word &name, const dictionary &dict, const dimensionSet &dims=dimless, const Type &deflt=Type(Zero))
static dimensioned< Type > getOrAddToDict(const word &name, dictionary &dict, const dimensionSet &dims=dimless, const Type &deflt=Type(Zero))
Construct dimensioned from dictionary, with default value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A HashTable similar to std::unordered_map.
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void replace(const direction d, const dimensioned< cmptType > &dc)
Return a component with a dimensioned<cmptType>
dimensioned< cmptType > component(const direction d) const
Return a component as a dimensioned<cmptType>
dimensioned()
A dimensionless Zero, named "0".
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const dimensionedScalar e
Elementary charge.
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
#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,...
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)
pTraits< Type >::cmptType cmptType
Component type.
static bool checkDims(const char *what, const dimensionSet &a, const dimensionSet &b)
Ostream & operator<<(Ostream &, const boundaryPatch &)
A class representing the concept of 0 (zero), which can be used to avoid manipulating objects that ar...
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)