TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTK::Quantity::Derived< Units, Exponents > Class Template Reference

Derived Quantity. More...

#include <Derived.h>

Inheritance diagram for TBTK::Quantity::Derived< Units, Exponents >:
TBTK::Quantity::Quantity< Units, Exponents > TBTK::Real TBTK::PseudoSerializable

Public Types

using IsBaseQuantity = std::false_type
 
using Unit = typename Quantity< Units, Exponents >::Unit
 
using Exponent = typename Quantity< Units, Exponents >::Exponent
 
- Public Types inherited from TBTK::Quantity::Quantity< Units, Exponents >
using Unit = Units
 
using Exponent = Exponents
 

Static Public Member Functions

static double getConversionFactor (Angle::Unit angleUnit, Charge::Unit chargeUnit, Count::Unit countUnit, Energy::Unit energyUnit, Length::Unit lengthUnit, Temperature::Unit temperatureUnit, Time::Unit timeUnit)
 
static int getExponent (Angle)
 
static int getExponent (Charge)
 
static int getExponent (Count)
 
static int getExponent (Energy)
 
static int getExponent (Length)
 
static int getExponent (Temperature)
 
static int getExponent (Time)
 
- Static Public Member Functions inherited from TBTK::Quantity::Quantity< Units, Exponents >
static std::string getUnitString (Unit unit)
 
static Unit getUnit (const std::string &unit)
 
static double getConversionFactor (Unit unit)
 

Friends

void initializeDerivedQuantities ()
 

Related Functions

(Note that these are not member functions.)

typedef Derived< MassUnit, MassExponent > Mass
 
typedef Derived< MagneticFieldUnit, MagneticFieldExponent > MagneticField
 
typedef Derived< VoltageUnit, VoltageExponent > Voltage
 
typedef Derived< VelocityUnit, VelocityExponent > Velocity
 
typedef Derived< PlanckUnit, PlanckExponent > Planck
 
typedef Derived< BoltzmannUnit, BoltzmannExponent > Boltzmann
 
typedef Derived< PermeabilityUnit, PermeabilityExponent > Permeability
 
typedef Derived< PermittivityUnit, PermittivityExponent > Permittivity
 
typedef Derived< MagnetonUnit, MagnetonExponent > Magneton
 

Additional Inherited Members

- Public Member Functions inherited from TBTK::Quantity::Quantity< Units, Exponents >
 Quantity ()
 
 Quantity (double value)
 
- Public Member Functions inherited from TBTK::Real
 Real ()
 
constexpr Real (double value)
 
 Real (const std::string &serialization, Serializable::Mode mode)
 
constexpr operator double () const
 
Realoperator= (double rhs)
 
Realoperator+= (const Real &rhs)
 
Realoperator-= (const Real &rhs)
 
Realoperator*= (const Real &rhs)
 
Realoperator/= (const Real &rhs)
 
std::string serialize (Serializable::Mode mode) const
 
- Static Protected Attributes inherited from TBTK::Quantity::Quantity< Units, Exponents >
static class TBTK::Quantity::Quantity::ConversionTable conversionTable
 

Detailed Description

template<typename Units, typename Exponents>
class TBTK::Quantity::Derived< Units, Exponents >

Derived Quantity.

The Derived Quantity is a Quantity with the compile time directive IsBaseQuantity set to std::true_false to differentiate it from Base Quantities. The Derived extends the Quantity with functions for getting the conversion factor and exponents. For more information, see Quantity and the individual typedefs below.

Get conversion factor

Since the Derived unit is defined in terms of Base units, the conversion factor from the reference unit is dependent on all of the Base units. The Derived Quantity therefore provides an additional function for retreiving the conversion factor. For example, the conversion factor between the default base unit for Mass and the units rad, C, pcs, eV, nm, K, and s can be obtained using.

double conversionFactor = Quantity::Mass::getConversionFactor(
Quantity::Angle::Unit::rad,
Quantity::Charge::Unit::C,
Quantity::Count::Unit::pcs,
Quantity::Energy::Unit::eV,
Quantity::Length::Unit::nm,
Quantity::Temperature::Unit::K,
Quantity::Time::Unit::s
);

Get exponent

The Derived units are product of exponents of the Base unit. For example, Velocity (m/s) corresponds to the exponents 1 and -1 for Length and Time. The exponents can be obtained as follows.

int lengthExponent = Quantity::Velocity::getExponent(Quantity::Length);
int timeExponent = Quantity::Velocity::getExponent(Quantity::Time);

Member Function Documentation

◆ getConversionFactor()

template<typename Units , typename Exponents >
double TBTK::Quantity::Derived< Units, Exponents >::getConversionFactor ( Angle::Unit  angleUnit,
Charge::Unit  chargeUnit,
Count::Unit  countUnit,
Energy::Unit  energyUnit,
Length::Unit  lengthUnit,
Temperature::Unit  temperatureUnit,
Time::Unit  timeUnit 
)
static

Get the conversion factor for converting from the reference unit to the given units.

Parameters
angleUnitThe unit of angle to convert to.
chargeUnitThe unit of charge to convert to.
countUnitThe unit of charge to convert to.
energyUnitThe unit of energy to convert to.
lengthUnitThe unit of length to convert to.
temperatureUnitThe unit of temeprature to convert to.
timeUnitThe unit of time to convert to.

◆ getExponent() [1/7]

template<typename Units , typename Exponents >
int TBTK::Quantity::Derived< Units, Exponents >::getExponent ( Angle  )
static

Get the exponent for the given Quantity.

◆ getExponent() [2/7]

template<typename Units , typename Exponents >
int TBTK::Quantity::Derived< Units, Exponents >::getExponent ( Charge  )
static

Get the exponent for the given Quantity.

◆ getExponent() [3/7]

template<typename Units , typename Exponents >
int TBTK::Quantity::Derived< Units, Exponents >::getExponent ( Count  )
static

Get the exponent for the given Quantity.

◆ getExponent() [4/7]

template<typename Units , typename Exponents >
int TBTK::Quantity::Derived< Units, Exponents >::getExponent ( Energy  )
static

Get the exponent for the given Quantity.

◆ getExponent() [5/7]

template<typename Units , typename Exponents >
int TBTK::Quantity::Derived< Units, Exponents >::getExponent ( Length  )
static

Get the exponent for the given Quantity.

◆ getExponent() [6/7]

template<typename Units , typename Exponents >
int TBTK::Quantity::Derived< Units, Exponents >::getExponent ( Temperature  )
static

Get the exponent for the given Quantity.

◆ getExponent() [7/7]

template<typename Units , typename Exponents >
int TBTK::Quantity::Derived< Units, Exponents >::getExponent ( Time  )
static

Get the exponent for the given Quantity.

Friends And Related Function Documentation

◆ Boltzmann

template<typename Units , typename Exponents >
typedef Derived<BoltzmannUnit, BoltzmannExponent> Boltzmann
related

The Quantity::Boltzmann is a Quantity::Quantity without any predefined units.

The default base unit signature is eV K^-1.

◆ initializeDerivedQuantities

template<typename Units , typename Exponents >
void initializeDerivedQuantities ( )
friend

Initialize the Derived Quantitites.

◆ MagneticField

template<typename Units , typename Exponents >
typedef Derived<MagneticFieldUnit, MagneticFieldExponent> MagneticField
related

The Quantity::MagneticField is a Quantity::Quantity with the following predefined derived units.

  • Quantity::MagneticField::Unit::MT
  • Quantity::MagneticField::Unit::kT
  • Quantity::MagneticField::Unit::T
  • Quantity::MagneticField::Unit::mT
  • Quantity::MagneticField::Unit::uT
  • Quantity::MagneticField::Unit::nT
  • Quantity::MagneticField::Unit::GG
  • Quantity::MagneticField::Unit::MG
  • Quantity::MagneticField::Unit::kG
  • Quantity::MagneticField::Unit::G
  • Quantity::MagneticField::Unit::mG
  • Quantity::MagneticField::Unit::uG

The default base unit signature is C^-1 eV m^-2 s.

◆ Magneton

template<typename Units , typename Exponents >
typedef Derived<MagnetonUnit, MagnetonExponent> Magneton
related

The Quantity::Magneton is a Quantity::Quantity without any predefined units.

The default base unit signature is C m^2 s^-1.

◆ Mass

template<typename Units , typename Exponents >
typedef Derived<MassUnit, MassExponent> Mass
related

The Quantity::Mass is a Quantity::Quantity with the following predefined derived units.

  • Quantity::Mass::Unit::kg
  • Quantity::Mass::Unit::g
  • Quantity::Mass::Unit::mg
  • Quantity::Mass::Unit::ug
  • Quantity::Mass::Unit::ng
  • Quantity::Mass::Unit::pg
  • Quantity::Mass::Unit::fg
  • Quantity::Mass::Unit::ag
  • Quantity::Mass::Unit::u

The default base unit signature is eV m^-2 s^2.

◆ Permeability

template<typename Units , typename Exponents >
typedef Derived<PermeabilityUnit, PermeabilityExponent> Permeability
related

The Quantity::Permeability is a Quantity::Quantity without any predefined units.

The default base unit signature is C^-2 eV m^-1 s^2.

◆ Permittivity

template<typename Units , typename Exponents >
typedef Derived<PermittivityUnit, PermittivityExponent> Permittivity
related

The Quantity::Permittivity is a Quantity::Quantity without any predefined units.

The default base unit signature is C^2 eV^-1 m^-1.

◆ Planck

template<typename Units , typename Exponents >
typedef Derived<PlanckUnit, PlanckExponent> Planck
related

The Quantity::Planck is a Quantity::Quantity without any predefined units.

The default base unit signature is eV s.

◆ Velocity

template<typename Units , typename Exponents >
typedef Derived<VelocityUnit, VelocityExponent> Velocity
related

The Quantity::Velocity is a Quantity::Quantity without any predefined units.

The default base unit signature is m s^-1.

◆ Voltage

template<typename Units , typename Exponents >
typedef Derived<VoltageUnit, VoltageExponent> Voltage
related

The Quantity::Voltage is a Quantity::Quantity with the following predefined derived units.

  • Quantity::Voltage::Unit::GV
  • Quantity::Voltage::Unit::MV
  • Quantity::Voltage::Unit::kV
  • Quantity::Voltage::Unit::V
  • Quantity::Voltage::Unit::mV
  • Quantity::Voltage::Unit::uV
  • Quantity::Voltage::Unit::nV

The default base unit signature is C^-1 eV.


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