Dimension set for the base types. More...
Public Types | |
enum | dimensionType { MASS, LENGTH, TIME, TEMPERATURE, MOLES, CURRENT, LUMINOUS_INTENSITY } |
Enumeration for the dimension exponents. More... | |
typedef FixedList< scalar, 7 > | list_type |
The array of dimension exponents. More... | |
Public Member Functions | |
ClassName ("dimensionSet") | |
dimensionSet () | |
Default construct (dimensionless). More... | |
dimensionSet (const scalar mass, const scalar length, const scalar time, const scalar temperature, const scalar moles, const scalar current=0, const scalar luminousIntensity=0) | |
Construct from exponents for the first five or all seven dimensions. More... | |
dimensionSet (const FixedList< scalar, 7 > &dimensions) | |
Construct from exponents for all seven dimensions. More... | |
dimensionSet (const dimensionSet &ds) | |
Copy construct. More... | |
dimensionSet (const dictionary &dict, const word &entryName) | |
Construct from dictionary entry - usually "dimensions". More... | |
autoPtr< dimensionSet > | clone () const |
Construct and return a clone. More... | |
dimensionSet (Istream &is) | |
Construct from Istream. More... | |
bool | dimensionless () const |
Return true if it is dimensionless. More... | |
const FixedList< scalar, 7 > & | values () const |
Return const access to the exponents as a list. More... | |
FixedList< scalar, 7 > & | values () |
Return non-const access to the exponents as a list. More... | |
void | clear () |
Reset exponents to be dimensionless. More... | |
void | reset (const dimensionSet &ds) |
Copy assign the exponents from the dimensionSet. More... | |
Istream & | read (Istream &is, scalar &multiplier, const dictionary &) |
Read using provided units. Used only in initial parsing. More... | |
Istream & | read (Istream &is, scalar &multiplier, const HashTable< dimensionedScalar > &) |
Read using provided units. More... | |
Istream & | read (Istream &is, scalar &multiplier) |
Read using system units. More... | |
Ostream & | write (Ostream &os, scalar &multiplier, const dimensionSets &) const |
Write using provided units. More... | |
Ostream & | write (Ostream &os, scalar &multiplier) const |
Write using system units. More... | |
scalar | operator[] (const dimensionType) const |
scalar & | operator[] (const dimensionType) |
scalar | operator[] (const label) const |
scalar & | operator[] (const label) |
bool | operator== (const dimensionSet &) const |
bool | operator!= (const dimensionSet &) const |
bool | operator= (const dimensionSet &) const |
bool | operator+= (const dimensionSet &) const |
bool | operator-= (const dimensionSet &) const |
bool | operator*= (const dimensionSet &) |
bool | operator/= (const dimensionSet &) |
Static Public Attributes | |
static constexpr int | nDimensions = 7 |
There are 7 base dimensions. More... | |
static const scalar | smallExponent = SMALL |
Tolerance for 'small' exponents, for near-zero rounding. More... | |
Dimension set for the base types.
This type may be used to implement rigorous dimension checking for algebraic manipulation.
Definition at line 65 of file dimensionSet.H.
The array of dimension exponents.
Definition at line 70 of file dimensionSet.H.
enum dimensionType |
Enumeration for the dimension exponents.
Enumerator | |
---|---|
MASS | kilogram kg |
LENGTH | metre m |
TIME | second s |
TEMPERATURE | Kelvin K. |
MOLES | mole mol |
CURRENT | Ampere A. |
LUMINOUS_INTENSITY | Candela Cd. |
Definition at line 79 of file dimensionSet.H.
dimensionSet | ( | ) |
Default construct (dimensionless).
Definition at line 71 of file dimensionSet.C.
dimensionSet | ( | const scalar | mass, |
const scalar | length, | ||
const scalar | time, | ||
const scalar | temperature, | ||
const scalar | moles, | ||
const scalar | current = 0 , |
||
const scalar | luminousIntensity = 0 |
||
) |
Construct from exponents for the first five or all seven dimensions.
Definition at line 78 of file dimensionSet.C.
dimensionSet | ( | const FixedList< scalar, 7 > & | dimensions | ) |
Construct from exponents for all seven dimensions.
Definition at line 100 of file dimensionSet.C.
dimensionSet | ( | const dimensionSet & | ds | ) |
Copy construct.
Definition at line 106 of file dimensionSet.C.
dimensionSet | ( | const dictionary & | dict, |
const word & | entryName | ||
) |
Construct from dictionary entry - usually "dimensions".
Definition at line 36 of file dimensionSetIO.C.
References dict, Foam::constant::electromagnetic::e, and keyType::LITERAL.
|
explicit |
Construct from Istream.
Definition at line 47 of file dimensionSetIO.C.
ClassName | ( | "dimensionSet" | ) |
|
inline |
Construct and return a clone.
Definition at line 200 of file dimensionSet.H.
References autoPtr< T >::New().
bool dimensionless | ( | ) | const |
Return true if it is dimensionless.
Definition at line 114 of file dimensionSet.C.
Referenced by Foam::pow(), and Foam::trans().
const Foam::FixedList< Foam::scalar, 7 > & values | ( | ) | const |
Return const access to the exponents as a list.
Definition at line 129 of file dimensionSet.C.
Referenced by Foam::operator*(), Foam::operator/(), and dimensionSet::read().
Foam::FixedList< Foam::scalar, 7 > & values | ( | ) |
Return non-const access to the exponents as a list.
Definition at line 135 of file dimensionSet.C.
void clear | ( | ) |
Reset exponents to be dimensionless.
Definition at line 141 of file dimensionSet.C.
References Foam::Zero.
Referenced by Foam::transform().
void reset | ( | const dimensionSet & | ds | ) |
Copy assign the exponents from the dimensionSet.
Definition at line 147 of file dimensionSet.C.
Referenced by dimensionSet::read().
Foam::Istream & read | ( | Istream & | is, |
scalar & | multiplier, | ||
const dictionary & | readSet | ||
) |
Read using provided units. Used only in initial parsing.
Definition at line 500 of file dimensionSetIO.C.
References token::BEGIN_SQR, IOstream::check(), dimensionSet::CURRENT, Foam::dimless, token::END_SQR, Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, FUNCTION_NAME, IOstream::info(), token::isNumber(), token::isWord(), dictionary::lookup(), dimensionSet::LUMINOUS_INTENSITY, dimensionSet::MASS, dimensionSet::nDimensions, Foam::nl, token::number(), Foam::pow(), dimensionSet::reset(), s, and token::wordToken().
Referenced by Foam::operator>>().
Foam::Istream & read | ( | Istream & | is, |
scalar & | multiplier, | ||
const HashTable< dimensionedScalar > & | readSet | ||
) |
Read using provided units.
Definition at line 413 of file dimensionSetIO.C.
References token::BEGIN_SQR, IOstream::check(), dimensionSet::CURRENT, dimensioned< Type >::dimensions(), token::END_SQR, Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, FUNCTION_NAME, IOstream::info(), token::isNumber(), dimensionSet::LUMINOUS_INTENSITY, dimensionSet::MASS, Foam::nl, token::number(), Istream::putBack(), dimensioned< Type >::value(), and dimensionSet::values().
Foam::Istream & read | ( | Istream & | is, |
scalar & | multiplier | ||
) |
Read using system units.
Definition at line 490 of file dimensionSetIO.C.
References Foam::read(), and Foam::unitSet().
Foam::Ostream & write | ( | Ostream & | os, |
scalar & | multiplier, | ||
const dimensionSets & | writeUnits | ||
) | const |
Write using provided units.
Definition at line 624 of file dimensionSetIO.C.
References IOstreamOption::ASCII, token::BEGIN_SQR, IOstream::check(), dimensionSets::coefficients(), token::END_SQR, forAll, IOstreamOption::format(), FUNCTION_NAME, Foam::mag(), dimensioned< Type >::name(), dimensionSet::nDimensions, Foam::pow(), Ostream::precision(), token::SPACE, dimensionSets::units(), dimensionSets::valid(), and dimensioned< Type >::value().
Referenced by Foam::operator<<().
Foam::Ostream & write | ( | Ostream & | os, |
scalar & | multiplier | ||
) | const |
Write using system units.
Definition at line 696 of file dimensionSetIO.C.
References Foam::vtk::write(), and Foam::writeUnitSet().
Foam::scalar operator[] | ( | const dimensionType | type | ) | const |
Definition at line 155 of file dimensionSet.C.
References Foam::type().
Foam::scalar & operator[] | ( | const dimensionType | type | ) |
Definition at line 161 of file dimensionSet.C.
References Foam::type().
Foam::scalar operator[] | ( | const label | type | ) | const |
Definition at line 167 of file dimensionSet.C.
References Foam::type().
Foam::scalar & operator[] | ( | const label | type | ) |
Definition at line 173 of file dimensionSet.C.
References Foam::type().
bool operator== | ( | const dimensionSet & | ds | ) | const |
Definition at line 179 of file dimensionSet.C.
References Foam::mag().
bool operator!= | ( | const dimensionSet & | ds | ) | const |
Definition at line 197 of file dimensionSet.C.
References Foam::operator==().
bool operator= | ( | const dimensionSet & | ds | ) | const |
Definition at line 203 of file dimensionSet.C.
References Foam::checkDims(), and Foam::expressions::patchExpr::debug.
bool operator+= | ( | const dimensionSet & | ds | ) | const |
Definition at line 214 of file dimensionSet.C.
References Foam::checkDims(), and Foam::expressions::patchExpr::debug.
bool operator-= | ( | const dimensionSet & | ds | ) | const |
Definition at line 225 of file dimensionSet.C.
References Foam::checkDims(), and Foam::expressions::patchExpr::debug.
bool operator*= | ( | const dimensionSet & | ds | ) |
Definition at line 236 of file dimensionSet.C.
bool operator/= | ( | const dimensionSet & | ds | ) |
Definition at line 244 of file dimensionSet.C.
|
staticconstexpr |
There are 7 base dimensions.
Definition at line 76 of file dimensionSet.H.
Referenced by dimensionSet::read(), and dimensionSet::write().
|
static |
Tolerance for 'small' exponents, for near-zero rounding.
Definition at line 94 of file dimensionSet.H.
Referenced by Foam::operator>>().