thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.1.5
ThePEG::Qty< L, E, Q, DL, DE, DQ > Class Template Reference

This template class allows the compiler to check calculations with physical quantities for dimensional correctness. More...

#include <PhysicalQty.h>

Inheritance diagram for ThePEG::Qty< L, E, Q, DL, DE, DQ >:

Public Types

typedef Qty< 2 *L, 2 *E, 2 *Q, DL, DE, DQ > Squared
 The squared type.
 

Public Member Functions

constexpr Qty ()
 Default constructor to 0.
 
constexpr Qty (ZeroUnit)
 Default constructor to 0.
 
template<int DL2, int DE2, int DQ2>
constexpr Qty (const Qty< QtyInt< L, DL, DL2 >::I, QtyInt< E, DE, DE2 >::I, QtyInt< Q, DQ, DQ2 >::I, DL2, DE2, DQ2 > &q, double factor=1.0)
 Constructor from a compatible quantity.
 
constexpr double rawValue () const
 Access to the raw value. Breaks consistency.
 
Qty< L, E, Q, DL, DE, DQ > & operator*= (double x)
 Assignment multiplication by dimensionless number.
 
Qty< L, E, Q, DL, DE, DQ > & operator/= (double x)
 Assignment division by dimensionless number.
 
template<int DL2, int DE2, int DQ2>
Qty< L, E, Q, DL, DE, DQ > & operator+= (const Qty< QtyInt< L, DL, DL2 >::I, QtyInt< E, DE, DE2 >::I, QtyInt< Q, DQ, DQ2 >::I, DL2, DE2, DQ2 > x)
 Assignment addition with compatible quantity.
 
template<int DL2, int DE2, int DQ2>
Qty< L, E, Q, DL, DE, DQ > & operator-= (const Qty< QtyInt< L, DL, DL2 >::I, QtyInt< E, DE, DE2 >::I, QtyInt< Q, DQ, DQ2 >::I, DL2, DE2, DQ2 > x)
 Assignment subtraction with compatible quantity.
 

Static Public Member Functions

static std::string className ()
 The name of the class for persistent IO.
 
static constexpr Qty< L, E, Q, DL, DE, DQ > baseunit ()
 Basic unit of this quantity.
 

Private Member Functions

constexpr Qty (double val)
 Constructor from raw values. Breaks consistency.
 

Private Attributes

double rawValue_
 The raw value in units of Qty::baseunit().
 

Detailed Description

template<int L, int E, int Q, int DL = 1, int DE = 1, int DQ = 1>
class ThePEG::Qty< L, E, Q, DL, DE, DQ >

This template class allows the compiler to check calculations with physical quantities for dimensional correctness.

A quantity can be composed of arbitrary fractional powers of length L, energy E and charge Q. Commonly used quantities should be typedef'ed (see Units.h).

Some member functions can break dimensional consistency if the user is not careful; these are marked explicitly.

Do not use this class directly in ThePEG, use the pre-defined quantities from Units.h or the wrapper in Phys_Qty.h instead.

Definition at line 81 of file PhysicalQty.h.


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