38 is.putBack(nextToken);
41 if (nextToken.isWord())
45 is.putBack(nextToken);
50 if (nextToken == token::BEGIN_SQR)
53 const dimensionSet curr(dimensions_);
54 dimensions_.read(is, mult);
59 <<
"The dimensions " << dimensions_
60 <<
" provided do not match the expected dimensions " 76 const dictionary&
dict,
77 IOobjectOption::readOption readOpt,
79 enum keyType::option matchOpt
82 if (readOpt == IOobjectOption::NO_READ)
90 const entry* eptr =
dict.findEntry(
key, matchOpt);
94 ITstream& is = eptr->stream();
102 else if (IOobjectOption::isReadRequired(readOpt))
105 <<
"Entry '" <<
key <<
"' not found in dictionary " 195 dimensions_(dt.dimensions_),
213 initialize(is,
false);
233 initialize(is,
true);
251 readEntry(
name,
dict, IOobjectOption::MUST_READ,
false);
268 readEntry(
name,
dict, IOobjectOption::MUST_READ);
278 const word& entryName
286 readEntry(entryName,
dict, IOobjectOption::MUST_READ);
304 readEntry(
name,
dict, IOobjectOption::READ_IF_PRESENT);
344 initialize(is,
true);
433 value_.replace(d, dc.value());
454 const word& entryName,
459 return readEntry(entryName,
dict, IOobjectOption::MUST_READ);
466 const word& entryName,
471 return readEntry(entryName,
dict, IOobjectOption::READ_IF_PRESENT);
486 dimensions_.
read(is, mult);
506 dimensions_.
read(is, mult, readSet);
529 dimensions_.
read(is, mult, readSet);
549 os.writeKeyword(keyword);
551 if (keyword != name_)
554 os << name_ << token::SPACE;
560 os.writeKeyword(name_);
565 dimensions_.write(
os, mult);
568 os << token::SPACE << value_/mult;
594 dimensions_ += dt.dimensions_;
605 dimensions_ -= dt.dimensions_;
632 template<
class Type, Foam::direction r>
638 "pow(" + dt.name() +
',' +
name(r) +
')',
639 pow(dt.dimensions(), r),
651 "sqr(" + dt.name() +
')',
652 sqr(dt.dimensions()),
663 return dimensioned<magType>
665 "magSqr(" + dt.name() +
')',
677 return dimensioned<magType>
679 "mag(" + dt.name() +
')',
689 const dimensioned<Type>& dt1,
690 const dimensioned<Type>& dt2
693 return dimensioned<Type>
695 "cmptMultiply(" + dt1.name() +
',' + dt2.name() +
')',
704 const dimensioned<Type>& dt1,
705 const dimensioned<Type>& dt2
708 return dimensioned<Type>
710 "cmptDivide(" + dt1.name() +
',' + dt2.name() +
')',
711 cmptDivide(dt1.dimensions(), dt2.dimensions()),
720 const dimensioned<Type>& a,
721 const dimensioned<Type>&
b 724 return dimensioned<Type>
726 "max(" + a.name() +
',' +
b.
name() +
')',
736 const dimensioned<Type>& a,
737 const dimensioned<Type>&
b 740 return dimensioned<Type>
742 "min(" + a.name() +
',' +
b.
name() +
')',
752 const dimensioned<Type>& a,
753 const dimensioned<Type>&
b,
757 return dimensioned<Type>
771 dt.initialize(is,
false);
778 Foam::Ostream& Foam::operator<<(Ostream& os, const dimensioned<Type>& dt)
781 os << dt.name() << token::SPACE;
785 dt.dimensions().write(
os, mult);
788 os << token::SPACE << dt.value()/mult;
800 const dimensioned<Type>& dt1,
801 const dimensioned<Type>& dt2
804 return dt1.value() < dt2.value();
811 const dimensioned<Type>& dt1,
812 const dimensioned<Type>& dt2
815 return dt2.value() < dt1.value();
822 const dimensioned<Type>& dt1,
823 const dimensioned<Type>& dt2
826 return dimensioned<Type>
828 '(' + dt1.
name() +
'+' + dt2.name() +
')',
830 dt1.
value() + dt2.value()
838 return dimensioned<Type>
850 const dimensioned<Type>& dt1,
851 const dimensioned<Type>& dt2
854 return dimensioned<Type>
856 '(' + dt1.
name() +
'-' + dt2.name() +
')',
858 dt1.
value() - dt2.value()
866 const dimensioned<scalar>& ds,
867 const dimensioned<Type>& dt
870 return dimensioned<Type>
872 '(' + ds.
name() +
'*' + dt.name() +
')',
874 ds.
value() * dt.value()
882 const dimensioned<Type>& dt,
883 const dimensioned<scalar>& ds
886 return dimensioned<Type>
888 '(' + dt.name() +
'|' + ds.
name() +
')',
890 dt.value() / ds.
value()
895 #define PRODUCT_OPERATOR(product, op, opFunc) \ 897 template<class Type1, class Type2> \ 898 Foam::dimensioned<typename Foam::product<Type1, Type2>::type> \ 901 const dimensioned<Type1>& dt1, \ 902 const dimensioned<Type2>& dt2 \ 905 return dimensioned<typename product<Type1, Type2>::type> \ 907 '(' + dt1.name() + #op + dt2.name() + ')', \ 908 dt1.dimensions() op dt2.dimensions(), \ 909 dt1.value() op dt2.value() \ 913 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \ 914 Foam::dimensioned<typename Foam::product<Type, Form>::type> \ 917 const dimensioned<Type>& dt1, \ 918 const VectorSpace<Form,Cmpt,nCmpt>& t2 \ 921 return dimensioned<typename product<Type, Form>::type> \ 923 '(' + dt1.name() + #op + name(t2) + ')', \ 925 dt1.value() op static_cast<const Form&>(t2) \ 929 template<class Type, class Form, class Cmpt, Foam::direction nCmpt> \ 930 Foam::dimensioned<typename Foam::product<Form, Type>::type> \ 933 const VectorSpace<Form,Cmpt,nCmpt>& t1, \ 934 const dimensioned<Type>& dt2 \ 937 return dimensioned<typename product<Form, Type>::type> \ 939 '(' + name(t1) + #op + dt2.name() + ')', \ 941 static_cast<const Form&>(t1) op dt2.value() \ 951 #undef PRODUCT_OPERATOR dimensioned< cmptType > component(const direction d) const
Return a component as a dimensioned<cmptType>
const Type & value() const noexcept
Return const reference to value.
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
virtual bool check(const char *operation) const
Check IOstream status for given operation.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
bool readIfPresent(const dictionary &dict)
Update the value of dimensioned<Type> if found in the dictionary, lookup in dictionary with the name(...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Ostream & endl(Ostream &os)
Add newline and flush stream.
A traits class, which is primarily used for primitives and vector-space.
void cross(FieldField< Field1, typename crossProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Generic dimensioned Type class.
const dimensionSet dimless
Dimensionless.
void dotdot(FieldField< Field1, typename scalarProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensioned< Type > cmptDivide(const dimensioned< Type > &, const dimensioned< Type > &)
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read...
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
#define PRODUCT_OPERATOR(product, op, opFunc)
const dimensionedScalar e
Elementary charge.
pTraits< Type >::cmptType cmptType
Component type.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
void writeEntry(const word &keyword, Ostream &os) const
Write as a dictionary entry with keyword.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
A class for handling words, derived from Foam::string.
Istream & operator>>(Istream &, directionInfo &)
const dimensionSet & dimensions() const noexcept
Return const reference to dimensions.
A HashTable similar to std::unordered_map.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Unary negation.
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
bool read(const dictionary &dict)
Update the value of dimensioned<Type>, lookup in dictionary with the name().
An Ostream is an abstract base class for all output systems (streams, files, token lists...
dimensioned()
A dimensionless Zero, named "0".
OBJstream os(runTime.globalPath()/outputName)
dimensioned< Type > lerp(const dimensioned< Type > &a, const dimensioned< Type > &b, const scalar t)
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.
const word & name() const noexcept
Return const reference to name.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
static bool checkDims(const char *what, const dimensionSet &a, const dimensionSet &b)
meshDefDict readIfPresent("polyMeshPatches", polyPatchNames)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
void replace(const direction d, const dimensioned< cmptType > &dc)
Return a component with a dimensioned<cmptType>
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))
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
An input stream of tokens.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)