Classes | Namespaces
electromagnetism.h File Reference

Dimensioned variables representing electromagnetic quantities. More...

#include "lardataalg/Utilities/quantities.h"
#include <string_view>
#include <ratio>

Go to the source code of this file.

Classes

struct  util::quantities::units::Coulomb
 
struct  util::quantities::units::Volt
 

Namespaces

 util::quantities
 Types of variables with a unit.
 
 util::quantities::units
 Definitions of actual units.
 
 util::quantities::electromagnetism_literals
 Literal constants for quantities.
 

Typedefs

Charge quantities

These charge quantities are tied to util::quantities::units::Coulomb. A few options are provided:

  • most general template, scaled_coulomb, allowing to choose both the scale of the unit (e.g. std::pico for picocoulomb) and the type of the numerical representation
  • generic templates (e.g. coulomb_as), allowing to choose which numerical representation to use
  • double precision (e.g. coulomb), ready for use
template<typename R , typename T = double>
using util::quantities::scaled_coulomb = concepts::scaled_quantity< units::Coulomb, R, T >
 The most generic units::Coulomb-based quantity. More...
 
template<typename T = double>
using util::quantities::coulomb_as = scaled_coulomb< std::ratio< 1 >, T >
 Type of charge stored in coulomb. More...
 
using util::quantities::coulomb = coulomb_as<>
 Type of charge stored in coulombs, in double precision. More...
 
template<typename T = double>
using util::quantities::millicoulomb_as = concepts::rescale< coulomb_as< T >, std::milli >
 Type of charge stored in millicoulomb. More...
 
using util::quantities::millicoulomb = millicoulomb_as<>
 Type of charge stored in millicoulomb, in double precision. More...
 
template<typename T = double>
using util::quantities::microcoulomb_as = concepts::rescale< coulomb_as< T >, std::micro >
 Type of charge stored in microcoulomb. More...
 
using util::quantities::microcoulomb = microcoulomb_as<>
 Type of charge stored in microcoulomb, in double precision. More...
 
template<typename T = double>
using util::quantities::nanocoulomb_as = concepts::rescale< coulomb_as< T >, std::nano >
 Type of charge stored in nanocoulomb. More...
 
using util::quantities::nanocoulomb = nanocoulomb_as<>
 Type of charge stored in nanocoulomb, in double precision. More...
 
template<typename T = double>
using util::quantities::picocoulomb_as = concepts::rescale< coulomb_as< T >, std::pico >
 Type of charge stored in picocoulomb. More...
 
using util::quantities::picocoulomb = picocoulomb_as<>
 Type of charge stored in picocoulomb, in double precision. More...
 
template<typename T = double>
using util::quantities::femtocoulomb_as = concepts::rescale< coulomb_as< T >, std::femto >
 Type of charge stored in femtocoulomb. More...
 
using util::quantities::femtocoulomb = femtocoulomb_as<>
 Type of charge stored in femtocoulomb, in double precision. More...
 
Electric potential quantities

These potential quantities are tied to util::quantities::units::Volt. A few options are provided:

  • most general template, scaled_volt, allowing to choose both the scale of the unit (e.g. std::kilo for kilovolt) and the type of the numerical representation
  • generic templates (e.g. volt_as), allowing to choose which numerical representation to use
  • double precision (e.g. volt), ready for use
template<typename R , typename T = double>
using util::quantities::scaled_volt = concepts::scaled_quantity< units::Volt, R, T >
 The most generic units::Volt-based quantity. More...
 
template<typename T = double>
using util::quantities::volt_as = scaled_volt< std::ratio< 1 >, T >
 Type of potential stored in volt. More...
 
using util::quantities::volt = volt_as<>
 Type of potential stored in volts, in double precision. More...
 
template<typename T = double>
using util::quantities::millivolt_as = concepts::rescale< volt_as< T >, std::milli >
 Type of potential stored in millivolt. More...
 
using util::quantities::millivolt = millivolt_as<>
 Type of potential stored in millivolt, in double precision. More...
 
template<typename T = double>
using util::quantities::microvolt_as = concepts::rescale< volt_as< T >, std::micro >
 Type of potential stored in microvolt. More...
 
using util::quantities::microvolt = microvolt_as<>
 Type of potential stored in microvolt, in double precision. More...
 
template<typename T = double>
using util::quantities::kilovolt_as = concepts::rescale< volt_as< T >, std::kilo >
 Type of potential stored in kilovolt. More...
 
using util::quantities::kilovolt = kilovolt_as<>
 Type of potential stored in kilovolt, in double precision. More...
 
template<typename T = double>
using util::quantities::megavolt_as = concepts::rescale< volt_as< T >, std::mega >
 Type of potential stored in megavolt. More...
 
using util::quantities::megavolt = megavolt_as<>
 Type of potential stored in megavolt, in double precision. More...
 
template<typename T = double>
using util::quantities::gigavolt_as = concepts::rescale< volt_as< T >, std::giga >
 Type of potential stored in gigavolt. More...
 
using util::quantities::gigavolt = gigavolt_as<>
 Type of potential stored in gigavolt, in double precision. More...
 

Functions

constexpr coulomb util::quantities::electromagnetism_literals::operator""_C (long double v)
 Literal coulomb value. More...
 
constexpr coulomb util::quantities::electromagnetism_literals::operator""_C (unsigned long long int v)
 
constexpr millicoulomb util::quantities::electromagnetism_literals::operator""_mC (long double v)
 Literal millicoulomb value. More...
 
constexpr millicoulomb util::quantities::electromagnetism_literals::operator""_mC (unsigned long long int v)
 
constexpr microcoulomb util::quantities::electromagnetism_literals::operator""_uC (long double v)
 Literal microcoulomb value. More...
 
constexpr microcoulomb util::quantities::electromagnetism_literals::operator""_uC (unsigned long long int v)
 
constexpr nanocoulomb util::quantities::electromagnetism_literals::operator""_nC (long double v)
 Literal nanocoulomb value. More...
 
constexpr nanocoulomb util::quantities::electromagnetism_literals::operator""_nC (unsigned long long int v)
 
constexpr picocoulomb util::quantities::electromagnetism_literals::operator""_pC (long double v)
 Literal picocoulomb value. More...
 
constexpr picocoulomb util::quantities::electromagnetism_literals::operator""_pC (unsigned long long int v)
 
constexpr femtocoulomb util::quantities::electromagnetism_literals::operator""_fC (long double v)
 Literal femtocoulomb value. More...
 
constexpr femtocoulomb util::quantities::electromagnetism_literals::operator""_fC (unsigned long long int v)
 
constexpr volt util::quantities::electromagnetism_literals::operator""_V (long double v)
 Literal volt value. More...
 
constexpr volt util::quantities::electromagnetism_literals::operator""_V (unsigned long long int v)
 
constexpr millivolt util::quantities::electromagnetism_literals::operator""_mV (long double v)
 Literal millivolt value. More...
 
constexpr millivolt util::quantities::electromagnetism_literals::operator""_mV (unsigned long long int v)
 
constexpr microvolt util::quantities::electromagnetism_literals::operator""_uV (long double v)
 Literal microvolt value. More...
 
constexpr microvolt util::quantities::electromagnetism_literals::operator""_uV (unsigned long long int v)
 
constexpr kilovolt util::quantities::electromagnetism_literals::operator""_kV (long double v)
 Literal kilovolt value. More...
 
constexpr kilovolt util::quantities::electromagnetism_literals::operator""_kV (unsigned long long int v)
 
constexpr megavolt util::quantities::electromagnetism_literals::operator""_MV (long double v)
 Literal megavolt value. More...
 
constexpr megavolt util::quantities::electromagnetism_literals::operator""_MV (unsigned long long int v)
 
constexpr gigavolt util::quantities::electromagnetism_literals::operator""_GV (long double v)
 Literal gigavolt value. More...
 
constexpr gigavolt util::quantities::electromagnetism_literals::operator""_GV (unsigned long long int v)
 

Detailed Description

Dimensioned variables representing electromagnetic quantities.

Author
Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.slac..nosp@m.stan.nosp@m.ford..nosp@m.edu)
Date
November 2, 2018
See also
lardataalg/Utilities/quantities.h

Set of basic quantities related to electromagnetism. Currently, quantities are defined based on the following units:

This is a header-only library.

Todo:
Also belong here: ampere, volt, farad, ohm...

Definition in file electromagnetism.h.