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 "
118 dimensions_(dt.dimensions_),
146 dimensions_.read(is, multiplier);
148 value_ *= multiplier;
202 const Type& defaultValue
221 const Type& defaultValue
234 const Type& defaultValue
237 Type value =
dict.lookupOrAddDefault<Type>(
name, defaultValue);
247 const Type& defaultValue
318 dimensions_ = dc.dimensions();
319 value_.replace(d, dc.value());
326 initialise(
dict.lookup(name_));
333 return dict.readIfPresent(name_, value_);
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)"
434 dimensions_ += dt.dimensions_;
445 dimensions_ -= dt.dimensions_;
472 template<
class Type, Foam::direction r>
478 "pow(" + dt.
name() +
',' +
name(r) +
')',
491 "sqr(" + dt.name() +
')',
492 sqr(dt.dimensions()),
500 return dimensioned<scalar>
502 "magSqr(" + dt.name() +
')',
511 return dimensioned<scalar>
513 "mag(" + dt.name() +
')',
523 const dimensioned<Type>& dt1,
524 const dimensioned<Type>& dt2
527 return dimensioned<Type>
529 "cmptMultiply(" + dt1.name() +
',' + dt2.name() +
')',
538 const dimensioned<Type>& dt1,
539 const dimensioned<Type>& dt2
542 return dimensioned<Type>
544 "cmptDivide(" + dt1.name() +
',' + dt2.name() +
')',
545 cmptDivide(dt1.dimensions(), dt2.dimensions()),
554 const dimensioned<Type>& dt1,
555 const dimensioned<Type>& dt2
558 if (dt1.dimensions() != dt2.dimensions())
561 <<
"dimensions of arguments are not equal"
565 return dimensioned<Type>
567 "max(" + dt1.name() +
',' + dt2.name() +
')',
569 max(dt1.value(), dt2.value())
577 const dimensioned<Type>& dt1,
578 const dimensioned<Type>& dt2
581 if (dt1.dimensions() != dt2.dimensions())
584 <<
"dimensions of arguments are not equal"
588 return dimensioned<Type>
590 "min(" + dt1.name() +
',' + dt2.name() +
')',
592 min(dt1.value(), dt2.value())
612 is.putBack(nextToken);
616 if (nextToken.isWord())
620 is.putBack(nextToken);
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>&)");
645 os << dt.
name() << token::SPACE;
649 dt.dimensions().write(os, mult);
654 os << dt.value()/mult;
657 os.check(
"Ostream& operator<<(Ostream&, const dimensioned<Type>&)");
672 return dt1.value() > dt2.value();
683 return dt1.value() < dt2.value();
690 const dimensioned<Type>& dt1,
691 const dimensioned<Type>& dt2
694 return dimensioned<Type>
696 '(' + dt1.name() +
'+' + dt2.name() +
')',
697 dt1.dimensions() + dt2.dimensions(),
698 dt1.value() + dt2.value()
706 return dimensioned<Type>
718 const dimensioned<Type>& dt1,
719 const dimensioned<Type>& dt2
722 return dimensioned<Type>
724 '(' + dt1.name() +
'-' + dt2.name() +
')',
725 dt1.dimensions() - dt2.dimensions(),
726 dt1.value() - dt2.value()
734 const dimensioned<scalar>& ds,
735 const dimensioned<Type>& dt
738 return dimensioned<Type>
740 '(' + ds.
name() +
'*' + dt.name() +
')',
742 ds.
value() * dt.value()
750 const dimensioned<Type>& dt,
751 const dimensioned<scalar>& ds
754 return dimensioned<Type>
756 '(' + dt.name() +
'|' + ds.
name() +
')',
758 dt.value()/ds.
value()
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
An STL-conforming hash table.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
virtual const fileName & name() const
Return the name of the stream.
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,...
A list of keyword definitions, which are a keyword followed by any number of values (e....
Dimension set for the base types.
Generic dimensioned Type class.
static dimensioned< Type > lookupOrAddToDict(const word &, dictionary &, const dimensionSet &dims=dimless, const Type &defaultValue=pTraits< Type >::zero)
Construct from dictionary, with default value.
dimensioned()
Null constructor.
void replace(const direction, const dimensioned< cmptType > &)
Return a component with a dimensioned<cmptType>
const dimensionSet & dimensions() const
Return const reference to dimensions.
pTraits< Type >::cmptType cmptType
Component type.
const Type & value() const
Return const reference to value.
dimensioned< cmptType > component(const direction) const
Return a component as a dimensioned<cmptType>
void read(const dictionary &)
Update the value of dimensioned<Type>
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.
const word & name() const
Return const reference to name.
bool readIfPresent(const dictionary &)
Update the value of dimensioned<Type> if found in the dictionary.
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
A class for handling words, derived from string.
#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.
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.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensionedSymmTensor sqr(const dimensionedVector &dv)
word name(const bool)
Return a word representation of a bool.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
errorManip< error > abort(error &err)
const dimensionSet dimless
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Istream & operator>>(Istream &, directionInfo &)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Ostream & operator<<(Ostream &, const ensightPart &)
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
tmp< fvMatrix< Type > > operator-(const fvMatrix< Type > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.