Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
dimensionSet Class Reference

Dimension set for the base types, which can be used to implement rigorous dimension checking for algebraic manipulation. More...

Public Types

enum  dimensionType {
  MASS, LENGTH, TIME, TEMPERATURE,
  MOLES, CURRENT, LUMINOUS_INTENSITY
}
 
typedef FixedList< scalar, 7 > list_type
 

Public Member Functions

 ClassName ("dimensionSet")
 
 dimensionSet ()
 
 dimensionSet (const scalar mass, const scalar length, const scalar time, const scalar temperature, const scalar moles, const scalar current=0, const scalar luminousIntensity=0)
 
 dimensionSet (const FixedList< scalar, 7 > &dimensions)
 
 dimensionSet (const dimensionSet &ds)
 
 dimensionSet (const word &entryName, const dictionary &dict, const bool mandatory=true)
 
 dimensionSet (const dictionary &dict, const word &entryName, const bool mandatory=true)
 
autoPtr< dimensionSetclone () const
 
 dimensionSet (Istream &is)
 
bool dimensionless () const
 
const FixedList< scalar, 7 > & values () const noexcept
 
FixedList< scalar, 7 > & values () noexcept
 
void clear ()
 
void reset (const dimensionSet &ds)
 
bool readEntry (const word &entryName, const dictionary &dict, const bool mandatory=true)
 
Istreamread (Istream &is, scalar &multiplier, const dictionary &)
 
Istreamread (Istream &is, scalar &multiplier, const HashTable< dimensionedScalar > &)
 
Istreamread (Istream &is, scalar &multiplier)
 
Ostreamwrite (Ostream &os, scalar &multiplier, const dimensionSets &) const
 
Ostreamwrite (Ostream &os, scalar &multiplier) const
 
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 Member Functions

static bool checking (const bool on) noexcept
 
static bool checking () noexcept
 

Static Public Attributes

static constexpr int nDimensions = 7
 
static const scalar smallExponent = SMALL
 

Detailed Description

Dimension set for the base types, which can be used to implement rigorous dimension checking for algebraic manipulation.

The dimensions are specified in the following order (SI units for reference only):

Property SI Description SI unit
MASS kilogram kg
LENGTH metre m
TIME second s
TEMPERATURE Kelvin K
MOLES mole mol
CURRENT Ampere A
LUMINOUS_INTENSITY Candela cd
Source files

Definition at line 104 of file dimensionSet.H.

Member Typedef Documentation

◆ list_type

typedef FixedList<scalar,7> list_type

Definition at line 109 of file dimensionSet.H.

Member Enumeration Documentation

◆ dimensionType

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 118 of file dimensionSet.H.

Constructor & Destructor Documentation

◆ dimensionSet() [1/7]

Definition at line 64 of file dimensionSet.C.

◆ dimensionSet() [2/7]

dimensionSet ( const scalar  mass,
const scalar  length,
const scalar  time,
const scalar  temperature,
const scalar  moles,
const scalar  current = 0,
const scalar  luminousIntensity = 0 
)

Definition at line 71 of file dimensionSet.C.

◆ dimensionSet() [3/7]

dimensionSet ( const FixedList< scalar, 7 > &  dimensions)

Definition at line 93 of file dimensionSet.C.

◆ dimensionSet() [4/7]

dimensionSet ( const dimensionSet ds)

Definition at line 99 of file dimensionSet.C.

◆ dimensionSet() [5/7]

dimensionSet ( const word entryName,
const dictionary dict,
const bool  mandatory = true 
)
Parameters
entryNameLookup key. LITERAL (not REGEX)

Definition at line 31 of file dimensionSetIO.C.

References dict.

◆ dimensionSet() [6/7]

dimensionSet ( const dictionary dict,
const word entryName,
const bool  mandatory = true 
)
Parameters
entryNameLookup key. LITERAL (not REGEX)

Definition at line 44 of file dimensionSetIO.C.

References dict.

◆ dimensionSet() [7/7]

dimensionSet ( Istream is)
explicit

Definition at line 56 of file dimensionSetIO.C.

Member Function Documentation

◆ ClassName()

ClassName ( "dimensionSet"  )

◆ checking() [1/2]

static bool checking ( const bool  on)
inlinestaticnoexcept

Definition at line 217 of file dimensionSet.H.

References Foam::expressions::patchExpr::debug.

◆ checking() [2/2]

static bool checking ( )
inlinestaticnoexcept

◆ clone()

autoPtr<dimensionSet> clone ( ) const
inline

Definition at line 272 of file dimensionSet.H.

References autoPtr::New().

Here is the call graph for this function:

◆ dimensionless()

bool dimensionless ( ) const

Definition at line 107 of file dimensionSet.C.

Referenced by Foam::pow(), and Foam::trans().

Here is the caller graph for this function:

◆ values() [1/2]

Foam::FixedList< Foam::scalar, 7 > & values ( ) const
noexcept

Definition at line 123 of file dimensionSet.C.

Referenced by Foam::operator*(), Foam::operator/(), and dimensionSet::read().

Here is the caller graph for this function:

◆ values() [2/2]

FixedList<scalar,7>& values ( )
noexcept

◆ clear()

void clear ( )

Definition at line 136 of file dimensionSet.C.

References Foam::Zero.

◆ reset()

void reset ( const dimensionSet ds)

Definition at line 142 of file dimensionSet.C.

Referenced by dimensionSet::read(), and KinematicCloud< Cloud< basicKinematicCollidingParcel > >::SU().

Here is the caller graph for this function:

◆ readEntry()

bool readEntry ( const word entryName,
const dictionary dict,
const bool  mandatory = true 
)
Parameters
entryNameLookup key. LITERAL (not REGEX)
dictThe dictionary
mandatoryThe entry is mandatory

Definition at line 422 of file dimensionSetIO.C.

References dict, Foam::constant::electromagnetic::e, Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, dictionary::findEntry(), keyType::LITERAL, Foam::nl, and dictionary::relativeName().

Here is the call graph for this function:

◆ read() [1/3]

Foam::Istream & read ( Istream is,
scalar &  multiplier,
const dictionary readSet 
)

◆ read() [2/3]

Foam::Istream & read ( Istream is,
scalar &  multiplier,
const HashTable< dimensionedScalar > &  readSet 
)

◆ read() [3/3]

Foam::Istream & read ( Istream is,
scalar &  multiplier 
)

Definition at line 531 of file dimensionSetIO.C.

References Foam::read(), and Foam::unitSet().

Here is the call graph for this function:

◆ write() [1/2]

Foam::Ostream & write ( Ostream os,
scalar &  multiplier,
const dimensionSets writeUnits 
) const

◆ write() [2/2]

Foam::Ostream & write ( Ostream os,
scalar &  multiplier 
) const

Definition at line 737 of file dimensionSetIO.C.

References os(), Foam::vtk::write(), and Foam::writeUnitSet().

Here is the call graph for this function:

◆ operator[]() [1/4]

Foam::scalar operator[] ( const dimensionType  type) const

Definition at line 150 of file dimensionSet.C.

References Foam::type().

Here is the call graph for this function:

◆ operator[]() [2/4]

Foam::scalar & operator[] ( const dimensionType  type)

Definition at line 156 of file dimensionSet.C.

References Foam::type().

Here is the call graph for this function:

◆ operator[]() [3/4]

Foam::scalar operator[] ( const label  type) const

Definition at line 162 of file dimensionSet.C.

References Foam::type().

Here is the call graph for this function:

◆ operator[]() [4/4]

Foam::scalar & operator[] ( const label  type)

Definition at line 168 of file dimensionSet.C.

References Foam::type().

Here is the call graph for this function:

◆ operator==()

bool operator== ( const dimensionSet ds) const

Definition at line 174 of file dimensionSet.C.

References Foam::mag().

Here is the call graph for this function:

◆ operator!=()

bool operator!= ( const dimensionSet ds) const

Definition at line 192 of file dimensionSet.C.

References Foam::operator==().

Here is the call graph for this function:

◆ operator=()

bool operator= ( const dimensionSet ds) const

Definition at line 198 of file dimensionSet.C.

References Foam::checkDims(), and dimensionSet::checking().

Here is the call graph for this function:

◆ operator+=()

bool operator+= ( const dimensionSet ds) const

Definition at line 209 of file dimensionSet.C.

References Foam::checkDims(), and dimensionSet::checking().

Here is the call graph for this function:

◆ operator-=()

bool operator-= ( const dimensionSet ds) const

Definition at line 220 of file dimensionSet.C.

References Foam::checkDims(), and dimensionSet::checking().

Here is the call graph for this function:

◆ operator*=()

bool operator*= ( const dimensionSet ds)

Definition at line 231 of file dimensionSet.C.

References reset().

Here is the call graph for this function:

◆ operator/=()

bool operator/= ( const dimensionSet ds)

Definition at line 239 of file dimensionSet.C.

References reset().

Here is the call graph for this function:

Member Data Documentation

◆ nDimensions

constexpr int nDimensions = 7
staticconstexpr

Definition at line 115 of file dimensionSet.H.

Referenced by dimensionSet::read(), and dimensionSet::write().

◆ smallExponent

const Foam::scalar smallExponent = SMALL
static

Definition at line 133 of file dimensionSet.H.

Referenced by Foam::operator>>().


The documentation for this class was generated from the following files: