Unit conversion structure. Contains the associated dimensions and the multiplier with which to convert values. 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 ("unitConversion") | |
| Run time type information. More... | |
| unitConversion (const dimensionSet &, const scalar fraction, const scalar angle, const scalar multiplier) | |
| Construct from components. More... | |
| unitConversion (const dimensionSet &) | |
| Construct from a dimension set. No dimensionless units. Unity. More... | |
| unitConversion (const unitConversion &)=default | |
| Copy constructor. More... | |
| unitConversion (unitConversion &&)=default | |
| Move constructor. More... | |
| unitConversion (Istream &is) | |
| Construct from stream. More... | |
| const dimensionSet & | dimensions () const |
| Access the dimensions. More... | |
| template<class T > | |
| T | toStandard (const T &) const |
| Convert a value to standard units. More... | |
| template<class T > | |
| Pair< T > | toStandard (const Pair< T > &) const |
| Convert a pair of values to standard units. More... | |
| template<class T > | |
| List< T > | toStandard (const List< T > &) const |
| Convert a list of values to standard units. More... | |
| template<class T > | |
| tmp< Field< T > > | toStandard (const Field< T > &) const |
| Convert a field of values to standard units. More... | |
| template<class T > | |
| tmp< Field< T > > | toStandard (const tmp< Field< T >> &) const |
| Convert a tmp field of values to standard units. More... | |
| template<class T > | |
| void | makeStandard (T &) const |
| Convert a value to standard units. More... | |
| template<class T > | |
| void | makeStandard (Pair< T > &) const |
| Convert a pair of values to standard units. More... | |
| template<class T > | |
| void | makeStandard (List< T > &) const |
| Convert a list of values to standard units. More... | |
| template<class T > | |
| T | toUser (const T &) const |
| Convert a value to user units. More... | |
| template<class T > | |
| Pair< T > | toUser (const Pair< T > &) const |
| Convert a pair of values to user units. More... | |
| template<class T > | |
| List< T > | toUser (const List< T > &) const |
| Convert a list of values to user units. More... | |
| template<class T > | |
| tmp< Field< T > > | toUser (const Field< T > &) const |
| Convert a field of values to user units. More... | |
| template<class T > | |
| tmp< Field< T > > | toUser (const tmp< Field< T >> &) const |
| Convert a tmp field of values 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 unitConversion &) |
| 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< unitConversion > | info () const |
| Return info proxy. More... | |
| void | operator= (const unitConversion &)=delete |
| Disallow default bitwise assignment. More... | |
| void | operator= (const unitConversion &&)=delete |
| Disallow default bitwise move assignment. More... | |
| template<class T > | |
| Foam::Pair< T > | toStandard (const Pair< T > &p) const |
| template<class T > | |
| Foam::List< T > | toStandard (const List< T > &l) const |
| template<class T > | |
| Foam::tmp< Foam::Field< T > > | toStandard (const Field< T > &f) const |
| template<class T > | |
| Foam::tmp< Foam::Field< T > > | toStandard (const tmp< Field< T >> &tf) const |
| template<class T > | |
| Foam::Pair< T > | toUser (const Pair< T > &p) const |
| template<class T > | |
| Foam::List< T > | toUser (const List< T > &l) const |
| template<class T > | |
| Foam::tmp< Foam::Field< T > > | toUser (const Field< T > &f) const |
| template<class T > | |
| Foam::tmp< Foam::Field< T > > | toUser (const tmp< Field< T >> &tf) const |
Static Public Attributes | |
| static const NamedEnum< dimlessUnitType, 2 > | dimlessUnitTypeNames_ |
| Names of the dimensionless units. More... | |
| static const scalar | smallExponent = rootSmall |
| A small exponent with which to perform inexact comparisons. More... | |
Friends | |
| unitConversion | pow (const unitConversion &, const scalar) |
| Raise to a power. More... | |
| const unitConversion & | operator+ (const unitConversion &, const unitConversion &) |
| Combine. More... | |
| unitConversion | operator* (const unitConversion &, const unitConversion &) |
| Multiply. More... | |
| unitConversion | operator/ (const unitConversion &, const unitConversion &) |
| Divide. More... | |
| Istream & | operator>> (Istream &, unitConversion &) |
| Read from stream. More... | |
| Ostream & | operator<< (Ostream &, const unitConversion &) |
| Write to stream. More... | |
| Ostream & | operator<< (Ostream &, const InfoProxy< unitConversion > &) |
| Write info to stream. More... | |
Unit conversion structure. Contains the associated dimensions and the multiplier with which to convert values.
Definition at line 67 of file unitConversion.H.
| anonymous enum |
Define an enumeration for the number of dimensionless units.
| Enumerator | |
|---|---|
| nDimlessUnits | |
Definition at line 74 of file unitConversion.H.
| enum dimlessUnitType |
Define an enumeration for the names of the dimensionless unit.
exponents
| Enumerator | |
|---|---|
| FRACTION | |
| ANGLE | |
Definition at line 81 of file unitConversion.H.
| unitConversion | ( | const dimensionSet & | dimensions, |
| const scalar | fraction, | ||
| const scalar | angle, | ||
| const scalar | multiplier | ||
| ) |
Construct from components.
Definition at line 87 of file unitConversion.C.
References unitConversion::ANGLE, and unitConversion::FRACTION.
| unitConversion | ( | const dimensionSet & | dimensions | ) |
Construct from a dimension set. No dimensionless units. Unity.
multiplier.
Definition at line 103 of file unitConversion.C.
References unitConversion::ANGLE, and unitConversion::FRACTION.
|
default |
Copy constructor.
|
default |
Move constructor.
| unitConversion | ( | Istream & | is | ) |
Construct from stream.
Definition at line 32 of file unitConversionIO.C.
| ClassName | ( | "unitConversion" | ) |
Run time type information.
|
inline |
Access the dimensions.
Definition at line 31 of file unitConversionI.H.
Convert a value to standard units.
Definition at line 31 of file unitConversionTemplates.C.
References unitConversion::standard().
Referenced by Foam::degToRad().


Convert a tmp field of values to standard units.
| void makeStandard | ( | T & | t | ) | const |
Convert a value to standard units.
Definition at line 73 of file unitConversionTemplates.C.
Convert a pair of values to standard units.
Definition at line 83 of file unitConversionTemplates.C.
References p.
Convert a list of values to standard units.
Definition at line 94 of file unitConversionTemplates.C.
References forAll.
Convert a value to user units.
Definition at line 107 of file unitConversionTemplates.C.
Referenced by greyMean::aCont(), wideBand::aCont(), Foam::radToDeg(), cyclicTransform::str(), and Foam::writeEntry().

Convert a tmp field of values to user units.
|
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 37 of file unitConversionI.H.
|
inline |
Return whether this is the "none" unit. I.e., the case where unit.
conversions are prohibited.
Definition at line 43 of file unitConversionI.H.
|
inline |
Return whether this unit is standard. I.e., is its multiplier one?
Definition at line 49 of file unitConversionI.H.
References Foam::any().
Referenced by unitConversion::toStandard().


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


| void read | ( | const word & | keyword, |
| const dictionary & | dict | ||
| ) |
Update.
Definition at line 43 of file unitConversionIO.C.
References Foam::abort(), dict, Foam::FatalIOError, FatalIOErrorInFunction, dictionary::lookup(), dictionaryName::name(), and Foam::units().
Referenced by namedUnitConversion::read().


| void read | ( | Istream & | is | ) |
Update.
Definition at line 60 of file unitConversionIO.C.
References Foam::abort(), Foam::FatalIOError, FatalIOErrorInFunction, and Foam::units().

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

| bool readIfPresent | ( | const word & | keyword, |
| const dictionary & | dict | ||
| ) |
Update if found in the dictionary.
Definition at line 98 of file unitConversionIO.C.
References Foam::abort(), dict, Foam::endl(), Foam::FatalIOError, FatalIOErrorInFunction, IOInfoInFunction, dictionary::lookupEntryPtr(), dictionaryName::name(), entry::stream(), Foam::units(), and dictionary::writeOptionalEntries.
Referenced by namedUnitConversion::readIfPresent().


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

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

|
inline |
Return info proxy.
Definition at line 249 of file unitConversion.H.
|
delete |
Disallow default bitwise assignment.
|
delete |
Disallow default bitwise move assignment.
| Foam::Pair<T> toStandard | ( | const Pair< T > & | p | ) | const |
Definition at line 38 of file unitConversionTemplates.C.
References p.
| Foam::List<T> toStandard | ( | const List< T > & | l | ) | const |
Definition at line 45 of file unitConversionTemplates.C.
References forAll, and List< T >::size().

| Foam::tmp<Foam::Field<T> > toStandard | ( | const Field< T > & | f | ) | const |
Definition at line 58 of file unitConversionTemplates.C.
References f().

Definition at line 66 of file unitConversionTemplates.C.
References tf.
| Foam::Pair<T> toUser | ( | const Pair< T > & | p | ) | const |
Definition at line 114 of file unitConversionTemplates.C.
References p.
| Foam::List<T> toUser | ( | const List< T > & | l | ) | const |
Definition at line 121 of file unitConversionTemplates.C.
References forAll, and List< T >::size().

| Foam::tmp<Foam::Field<T> > toUser | ( | const Field< T > & | f | ) | const |
Definition at line 134 of file unitConversionTemplates.C.
References f().

Definition at line 142 of file unitConversionTemplates.C.
References tf.
|
friend |
Raise to a power.
|
friend |
Combine.
|
friend |
Multiply.
|
friend |
Divide.
|
friend |
Read from stream.
|
friend |
Write to stream.
|
friend |
Write info to stream.
|
static |
Names of the dimensionless units.
Definition at line 88 of file unitConversion.H.
Referenced by Foam::operator<<().
|
static |
A small exponent with which to perform inexact comparisons.
Definition at line 94 of file unitConversion.H.
Referenced by Foam::operator<<().