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);
57 if (checkDims && curr != dimensions_)
60 <<
"The dimensions " << dimensions_
61 <<
" provided do not match the expected dimensions "
63 <<
abort(FatalIOError);
77 const dictionary&
dict,
80 enum keyType::option matchOpt
86 const entry* eptr =
dict.findEntry(key, matchOpt);
90 ITstream& is = eptr->stream();
92 initialize(is, checkDims);
94 dict.checkITstream(is, key);
101 <<
"Entry '" <<
key <<
"' not found in dictionary "
103 <<
exit(FatalIOError);
191 dimensions_(dt.dimensions_),
209 initialize(is,
false);
229 initialize(is,
true);
282 readEntry(entryName,
dict);
340 initialize(is,
true);
399 return getOrAddToDict(name,
dict, dimless, deflt);
470 dimensions_ = dc.dimensions();
471 value_.replace(d, dc.value());
478 return read(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_;
661template<
class Type, Foam::direction r>
667 "pow(" + dt.
name() +
',' +
name(r) +
')',
678 return dimensioned<typename outerProduct<Type, Type>::type>
680 "sqr(" + dt.name() +
')',
681 sqr(dt.dimensions()),
690 typedef typename typeOfMag<Type>::type magType;
692 return dimensioned<magType>
694 "magSqr(" + dt.name() +
')',
704 typedef typename typeOfMag<Type>::type magType;
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"
757 <<
abort(FatalError);
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"
780 <<
abort(FatalError);
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() +
')',
855 dt1.dimensions() + dt2.dimensions(),
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() +
')',
883 dt1.dimensions() - dt2.dimensions(),
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) \
923template<class Type1, class Type2> \
924Foam::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() \
939template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
940Foam::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) \
955template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \
956Foam::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
A HashTable similar to std::unordered_map.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An input stream of tokens.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
virtual Istream & read(token &)=0
Return next token from stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual bool read()
Re-read model coefficients if they have changed.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Generic dimensioned Type class.
void replace(const direction d, const dimensioned< cmptType > &dc)
Return a component with a dimensioned<cmptType>
dimensioned()
A dimensionless Zero, named "0".
const dimensionSet & dimensions() const
Return const reference to dimensions.
pTraits< Type >::cmptType cmptType
Component type.
const Type & value() const
Return const reference to value.
void writeEntry(const word &keyword, Ostream &os) const
Write as a dictionary entry with keyword.
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.
const word & name() const
Return const reference to name.
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.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
A traits class, which is primarily used for primitives.
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read,...
type
Volume classification types.
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define PRODUCT_OPERATOR(product, op, opFunc)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
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))
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Unary negation.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const dimensionSet dimless
Dimensionless.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Istream & operator>>(Istream &, directionInfo &)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
propsDict readIfPresent("fields", acceptFields)