Unit conversion structure. Contains the associated dimensions and the multiplier with which to convert values. More...


Classes | |
| struct | makeStandardOp |
| Functor to convert to standard. More... | |
| struct | makeUserOp |
| Functor to convert to user. More... | |
Public Types | |
| enum | { nDimlessUnits = 2 } |
| Define an enumeration for the number of dimensionless units. More... | |
| enum | dimlessUnitType { FRACTION , ANGLE } |
| Define an enumeration for the names of the dimensionless unit. More... | |
Public Member Functions | |
| ClassName ("unitSet") | |
| Run time type information. More... | |
| unitSet (const dimensionSet &, const scalar fraction, const scalar angle, const scalar multiplier) | |
| Construct from components. More... | |
| unitSet (const dimensionSet &) | |
| Construct from a dimension set. No dimensionless units. Unity. More... | |
| unitSet (const unitSet &)=default | |
| Copy constructor. More... | |
| unitSet (unitSet &&)=default | |
| Move constructor. More... | |
| unitSet (Istream &is) | |
| Construct from stream. More... | |
| const dimensionSet & | dimensions () const |
| Access the dimensions. More... | |
| bool | dimensionless () const |
| Return true if it is dimensionless. More... | |
| template<class T > | |
| T | toStandard (const T &) const |
| Convert a value to standard units. More... | |
| template<class T > | |
| void | makeStandard (T &) const |
| Convert a value to standard units. More... | |
| template<class T > | |
| T | toUser (const T &) const |
| Convert a value to user units. More... | |
| template<class T > | |
| void | makeUser (T &) const |
| Convert a value to user units. More... | |
| bool | any () const |
| Return whether this is the "any" unit. I.e., the case where. More... | |
| bool | none () const |
| Return whether this is the "none" unit. I.e., the case where unit. More... | |
| bool | standard () const |
| Return whether this unit is standard. I.e., is its multiplier one? More... | |
| void | reset (const unitSet &) |
| Reset the unit conversion. More... | |
| void | read (const word &keyword, const dictionary &) |
| Update. More... | |
| void | read (Istream &is) |
| Update. More... | |
| void | read (const word &keyword, const dictionary &, Istream &is) |
| Update. More... | |
| bool | readIfPresent (const word &keyword, const dictionary &) |
| Update if found in the dictionary. More... | |
| bool | readIfPresent (Istream &is) |
| Update if found on the stream. More... | |
| bool | readIfPresent (const word &keyword, const dictionary &, Istream &is) |
| Update if found on the dictionary stream. More... | |
| InfoProxy< unitSet > | info () const |
| Return info proxy. More... | |
| scalar | operator[] (const dimensionSet::dimensionType type) const |
| Access the dimension exponents. More... | |
| scalar | operator[] (const dimlessUnitType type) const |
| Access the dimensionless unit exponents. More... | |
| void | operator= (const unitSet &)=delete |
| Disallow default bitwise assignment. More... | |
| void | operator= (const unitSet &&)=delete |
| Disallow default bitwise move assignment. More... | |
Static Public Member Functions | |
| static unitSet | newUnitless () |
| Return a new "unitless" unit set. More... | |
| static unitSet | newAny () |
| Return a new "any" unit set. More... | |
| static unitSet | newNone () |
| Return a new "none" unit set. More... | |
Static Public Attributes | |
| static const NamedEnum< dimlessUnitType, 2 > & | dimlessUnitTypeNames_ = dimlessUnitTypeNamesPtr_() |
| Names of the dimensionless units. More... | |
| static const scalar | smallExponent = rootSmall |
| A small exponent with which to perform inexact comparisons. More... | |
Friends | |
| unitSet | pow (const unitSet &, const scalar) |
| Raise to a power. More... | |
| const unitSet & | operator+ (const unitSet &, const unitSet &) |
| Combine. More... | |
| unitSet | operator* (const unitSet &, const unitSet &) |
| Multiply. More... | |
| unitSet | operator/ (const unitSet &, const unitSet &) |
| Divide. More... | |
| Istream & | operator>> (Istream &, unitSet &) |
| Read from stream. More... | |
| Ostream & | operator<< (Ostream &, const unitSet &) |
| Write to stream. More... | |
| Ostream & | operator<< (Ostream &, const InfoProxy< unitSet > &) |
| Write info to stream. More... | |
Unit conversion structure. Contains the associated dimensions and the multiplier with which to convert values.
| anonymous enum |
| enum dimlessUnitType |
| unitSet | ( | const dimensionSet & | dimensions, |
| const scalar | fraction, | ||
| const scalar | angle, | ||
| const scalar | multiplier | ||
| ) |
Construct from components.
Definition at line 89 of file unitSet.C.
References unitSet::ANGLE, Foam::units::fraction, and unitSet::FRACTION.
Referenced by unitSet::newUnitless().

| unitSet | ( | const dimensionSet & | dimensions | ) |
Construct from a dimension set. No dimensionless units. Unity.
multiplier.
Definition at line 105 of file unitSet.C.
References unitSet::ANGLE, and unitSet::FRACTION.
Construct from stream.
Definition at line 33 of file unitSetIO.C.
| ClassName | ( | "unitSet" | ) |
Run time type information.
|
inlinestatic |
Return a new "unitless" unit set.
Definition at line 30 of file unitSetI.H.
References unitSet::unitSet().

|
inlinestatic |
Return a new "any" unit set.
Definition at line 36 of file unitSetI.H.
Referenced by Foam::readAndConvert().

|
inlinestatic |
Return a new "none" unit set.
Definition at line 42 of file unitSetI.H.
|
inline |
Access the dimensions.
Definition at line 50 of file unitSetI.H.
Referenced by Foam::dimensionedConstant().

|
inline |
Return true if it is dimensionless.
Definition at line 56 of file unitSetI.H.
Convert a value to standard units.
Definition at line 33 of file unitSetTemplates.C.
References unitSet::standard().
Referenced by TableReader< Coordinate, Value >::convertRead(), Foam::degToRad(), and Foam::dimensionedConstant().


| void makeStandard | ( | T & | t | ) | const |
Convert a value to standard units.
Definition at line 40 of file unitSetTemplates.C.
Referenced by unitSet::makeStandardOp::operator()().

Convert a value to user units.
Definition at line 50 of file unitSetTemplates.C.
Referenced by greyMean::aCont(), wideBand::aCont(), TableReader< Coordinate, Value >::convertWrite(), Foam::radToDeg(), and cyclicTransform::str().

| void makeUser | ( | T & | t | ) | const |
Convert a value to user units.
Definition at line 57 of file unitSetTemplates.C.
Referenced by unitSet::makeUserOp::operator()().

|
inline |
Return whether this is the "any" unit. I.e., the case where.
dimensions and dimensionless units are not checked, and any conversion is permitted.
Definition at line 62 of file unitSetI.H.
Referenced by Foam::operator<<(), and Foam::pow().

|
inline |
Return whether this is the "none" unit. I.e., the case where unit.
conversions are prohibited.
Definition at line 68 of file unitSetI.H.
Referenced by Foam::operator<<(), and Foam::pow().

|
inline |
Return whether this unit is standard. I.e., is its multiplier one?
Definition at line 74 of file unitSetI.H.
References Foam::any().
Referenced by Foam::assertNoConvertUnits(), unitSet::toStandard(), and Foam::writeEntry().


| void reset | ( | const unitSet & | units | ) |
Reset the unit conversion.
Definition at line 117 of file unitSet.C.
References unitSet::nDimlessUnits.
Referenced by Foam::operator>>(), Foam::units::setLength(), and unitSets::unitSets().

| void read | ( | const word & | keyword, |
| const dictionary & | dict | ||
| ) |
Update.
Definition at line 44 of file unitSetIO.C.
References Foam::abort(), dict, Foam::FatalIOError, FatalIOErrorInFunction, unitSet::info(), dictionary::lookup(), and dictionaryName::name().
Referenced by namedUnitSet::read().


| void read | ( | Istream & | is | ) |
Update.
Definition at line 63 of file unitSetIO.C.
References Foam::abort(), Foam::FatalIOError, FatalIOErrorInFunction, and unitSet::info().

| void read | ( | const word & | keyword, |
| const dictionary & | dict, | ||
| Istream & | is | ||
| ) |
Update.
Definition at line 81 of file unitSetIO.C.
References Foam::abort(), dict, Foam::FatalIOError, FatalIOErrorInFunction, unitSet::info(), and dictionaryName::name().

| bool readIfPresent | ( | const word & | keyword, |
| const dictionary & | dict | ||
| ) |
Update if found in the dictionary.
Definition at line 105 of file unitSetIO.C.
References Foam::abort(), dict, Foam::FatalIOError, FatalIOErrorInFunction, unitSet::info(), dictionary::lookupEntryPtr(), dictionaryName::name(), and entry::stream().
Referenced by Field< tensor >::clone(), Foam::readAndConvert(), namedUnitSet::readIfPresent(), and Field< tensor >::rmap().


| bool readIfPresent | ( | Istream & | is | ) |
Update if found on the stream.
Definition at line 139 of file unitSetIO.C.
References Foam::abort(), Foam::any(), token::BEGIN_SQR, Foam::endl(), Foam::FatalIOError, FatalIOErrorInFunction, Foam::Info, unitSet::info(), IOstream::lineNumber(), IOstream::name(), and Istream::putBack().

| bool readIfPresent | ( | const word & | keyword, |
| const dictionary & | dict, | ||
| Istream & | is | ||
| ) |
Update if found on the dictionary stream.
Definition at line 171 of file unitSetIO.C.
References Foam::abort(), Foam::any(), token::BEGIN_SQR, dict, Foam::endl(), Foam::FatalIOError, FatalIOErrorInFunction, Foam::Info, unitSet::info(), dictionaryName::name(), and Istream::putBack().

Return info proxy.
Definition at line 228 of file unitSet.H.
Referenced by unitSet::read(), and unitSet::readIfPresent().

|
inline |
Access the dimension exponents.
Definition at line 82 of file unitSetI.H.
References Foam::type().

|
inline |
Access the dimensionless unit exponents.
Definition at line 91 of file unitSetI.H.
References Foam::type().

|
delete |
Disallow default bitwise assignment.
|
delete |
Disallow default bitwise move assignment.
|
static |
Names of the dimensionless units.
Definition at line 88 of file unitSet.H.
Referenced by Foam::operator<<().
|
static |
A small exponent with which to perform inexact comparisons.
Definition at line 94 of file unitSet.H.
Referenced by Foam::operator<<().