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();
101 <<
"Entry '" <<
key <<
"' not found in dictionary "
191 dimensions_(dt.dimensions_),
209 initialize(is,
false);
229 initialize(is,
true);
274 const word& entryName
282 readEntry(entryName,
dict);
340 initialize(is,
true);
470 dimensions_ = dc.dimensions();
471 value_.replace(d, dc.value());
485 return readIfPresent(name_,
dict);
492 const word& entryName,
497 return readEntry(entryName,
dict);
504 const word& entryName,
509 return readEntry(entryName,
dict,
false);
524 dimensions_.
read(is, mult);
544 dimensions_.
read(is, mult, readSet);
567 dimensions_.
read(is, mult, readSet);
585 os.writeKeyword(keyword);
587 if (keyword != name_)
590 os << name_ << token::SPACE;
595 dimensions_.write(
os, mult);
598 os << token::SPACE << value_/mult << token::END_STATEMENT <<
endl;
623 dimensions_ += dt.dimensions_;
634 dimensions_ -= dt.dimensions_;
661 template<
class Type, Foam::direction r>
667 "pow(" + dt.
name() +
',' +
name(r) +
')',
680 "sqr(" + dt.name() +
')',
681 sqr(dt.dimensions()),
692 return dimensioned<magType>
694 "magSqr(" + dt.name() +
')',
706 return dimensioned<magType>
708 "mag(" + dt.name() +
')',
718 const dimensioned<Type>& dt1,
719 const dimensioned<Type>& dt2
722 return dimensioned<Type>
724 "cmptMultiply(" + dt1.name() +
',' + dt2.name() +
')',
733 const dimensioned<Type>& dt1,
734 const dimensioned<Type>& dt2
737 return dimensioned<Type>
739 "cmptDivide(" + dt1.name() +
',' + dt2.name() +
')',
740 cmptDivide(dt1.dimensions(), dt2.dimensions()),
749 const dimensioned<Type>& dt1,
750 const dimensioned<Type>& dt2
753 if (dt1.dimensions() != dt2.dimensions())
756 <<
"dimensions of arguments are not equal"
760 return dimensioned<Type>
762 "max(" + dt1.name() +
',' + dt2.name() +
')',
764 max(dt1.value(), dt2.value())
772 const dimensioned<Type>& dt1,
773 const dimensioned<Type>& dt2
776 if (dt1.dimensions() != dt2.dimensions())
779 <<
"dimensions of arguments are not equal"
783 return dimensioned<Type>
785 "min(" + dt1.name() +
',' + dt2.name() +
')',
787 min(dt1.value(), dt2.value())
797 dt.initialize(is,
false);
807 os << dt.name() << token::SPACE;
811 dt.dimensions().write(
os, mult);
814 os << token::SPACE << dt.value()/mult;
830 return dt1.
value() < dt2.value();
841 return dt2.value() < dt1.
value();
848 const dimensioned<Type>& dt1,
849 const dimensioned<Type>& dt2
852 return dimensioned<Type>
854 '(' + dt1.
name() +
'+' + dt2.name() +
')',
856 dt1.
value() + dt2.value()
864 return dimensioned<Type>
876 const dimensioned<Type>& dt1,
877 const dimensioned<Type>& dt2
880 return dimensioned<Type>
882 '(' + dt1.
name() +
'-' + dt2.name() +
')',
884 dt1.
value() - dt2.value()
892 const dimensioned<scalar>& ds,
893 const dimensioned<Type>& dt
896 return dimensioned<Type>
898 '(' + ds.
name() +
'*' + dt.name() +
')',
900 ds.
value() * dt.value()
908 const dimensioned<Type>& dt,
909 const dimensioned<scalar>& ds
912 return dimensioned<Type>
914 '(' + dt.name() +
'|' + ds.
name() +
')',
916 dt.value() / ds.
value()
921 #define PRODUCT_OPERATOR(product, op, opFunc) \
923 template<class Type1, class Type2> \
924 Foam::dimensioned<typename Foam::product<Type1, Type2>::type> \
927 const dimensioned<Type1>& dt1, \
928 const dimensioned<Type2>& dt2 \
931 return dimensioned<typename product<Type1, Type2>::type> \
933 '(' + dt1.name() + #op + dt2.name() + ')', \
934 dt1.dimensions() op dt2.dimensions(), \
935 dt1.value() op dt2.value() \
939 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
940 Foam::dimensioned<typename Foam::product<Type, Form>::type> \
943 const dimensioned<Type>& dt1, \
944 const VectorSpace<Form,Cmpt,nCmpt>& t2 \
947 return dimensioned<typename product<Type, Form>::type> \
949 '(' + dt1.name() + #op + name(t2) + ')', \
951 dt1.value() op static_cast<const Form&>(t2) \
955 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
956 Foam::dimensioned<typename Foam::product<Form, Type>::type> \
959 const VectorSpace<Form,Cmpt,nCmpt>& t1, \
960 const dimensioned<Type>& dt2 \
963 return dimensioned<typename product<Form, Type>::type> \
965 '(' + name(t1) + #op + dt2.name() + ')', \
967 static_cast<const Form&>(t1) op dt2.value() \
977 #undef PRODUCT_OPERATOR
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
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 (0)
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)
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
const word & name() const
Return const reference to name.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
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, which can be used to implement rigorous dimension checking for alge...
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)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
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)....
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,...
OBJstream os(runTime.globalPath()/outputName)
Generic dimensioned Type class.
errorManip< error > abort(error &err)
static dimensioned< Type > getOrDefault(const word &name, const dictionary &dict, const dimensionSet &dims=dimless, const Type &deflt=Type(Zero))
Construct dimensioned from dictionary, with default value.
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".
A traits class, which is primarily used for primitives.
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)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
#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)
const dimensionSet dimless
Dimensionless.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
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)