ReFRACtor
FullPhysics::DoubleWithUnit Class Reference

We frequently have a double with units associated with it. More...

#include <double_with_unit.h>

+ Inheritance diagram for FullPhysics::DoubleWithUnit:
+ Collaboration diagram for FullPhysics::DoubleWithUnit:

Public Member Functions

 DoubleWithUnit ()
 
 DoubleWithUnit (double V, const Unit &U)
 
 DoubleWithUnit (double V, const std::string &U)
 
 DoubleWithUnit (double V)
 
DoubleWithUnit convert (const Unit &R) const
 Convert to the given units. More...
 
DoubleWithUnit convert_wave (const Unit &R) const
 We often need to handle conversion from wavenumber to/from wavelength. More...
 
DoubleWithUnit convert_wave (const Unit &R, const SpectralDomain &Pixel_grid) const
 Variation of convert_wave that also handles the units of sample_index. More...
 
DoubleWithUnitoperator*= (const DoubleWithUnit &D)
 Basic math operators for class. More...
 
DoubleWithUnitoperator+= (const DoubleWithUnit &D)
 
DoubleWithUnitoperator-= (const DoubleWithUnit &D)
 
DoubleWithUnitoperator/= (const DoubleWithUnit &D)
 
void print (std::ostream &Os) const
 
std::string print_to_string () const
 Print to string. More...
 

Public Attributes

Unit units
 
double value
 

Detailed Description

We frequently have a double with units associated with it.

This is a simple structure that just keeps these two things together.

Definition at line 13 of file double_with_unit.h.

Constructor & Destructor Documentation

◆ DoubleWithUnit() [1/4]

FullPhysics::DoubleWithUnit::DoubleWithUnit ( )
inline

Definition at line 16 of file double_with_unit.h.

◆ DoubleWithUnit() [2/4]

FullPhysics::DoubleWithUnit::DoubleWithUnit ( double  V,
const Unit U 
)
inline

Definition at line 17 of file double_with_unit.h.

◆ DoubleWithUnit() [3/4]

FullPhysics::DoubleWithUnit::DoubleWithUnit ( double  V,
const std::string &  U 
)
inline

Definition at line 19 of file double_with_unit.h.

◆ DoubleWithUnit() [4/4]

FullPhysics::DoubleWithUnit::DoubleWithUnit ( double  V)
inline

Definition at line 21 of file double_with_unit.h.

Member Function Documentation

◆ convert()

DoubleWithUnit FullPhysics::DoubleWithUnit::convert ( const Unit R) const
inline

Convert to the given units.

Definition at line 42 of file double_with_unit.h.

◆ convert_wave() [1/2]

DoubleWithUnit FullPhysics::DoubleWithUnit::convert_wave ( const Unit R) const
inline

We often need to handle conversion from wavenumber to/from wavelength.

This is either a normal conversion of the units before and after match in the power of length (so cm^-1 to m^-1), or do an inversion. Since we do this often enough, it is worth having a function that handles this logic.

Definition at line 53 of file double_with_unit.h.

◆ convert_wave() [2/2]

DoubleWithUnit DoubleWithUnit::convert_wave ( const Unit R,
const SpectralDomain Pixel_grid 
) const

Variation of convert_wave that also handles the units of sample_index.

Definition at line 34 of file double_with_unit.cc.

◆ operator*=()

DoubleWithUnit& FullPhysics::DoubleWithUnit::operator*= ( const DoubleWithUnit D)
inline

Basic math operators for class.

Definition at line 29 of file double_with_unit.h.

◆ operator+=()

DoubleWithUnit& FullPhysics::DoubleWithUnit::operator+= ( const DoubleWithUnit D)
inline

Definition at line 33 of file double_with_unit.h.

◆ operator-=()

DoubleWithUnit& FullPhysics::DoubleWithUnit::operator-= ( const DoubleWithUnit D)
inline

Definition at line 35 of file double_with_unit.h.

◆ operator/=()

DoubleWithUnit& FullPhysics::DoubleWithUnit::operator/= ( const DoubleWithUnit D)
inline

Definition at line 31 of file double_with_unit.h.

◆ print()

void FullPhysics::DoubleWithUnit::print ( std::ostream &  Os) const
inline

Definition at line 64 of file double_with_unit.h.

◆ print_to_string()

std::string FullPhysics::Printable< DoubleWithUnit >::print_to_string ( ) const
inlineinherited

Print to string.

This is primarily useful for SWIG wrappers to this class, e.g. a to_s method in ruby.

Definition at line 31 of file printable.h.

Member Data Documentation

◆ units

Unit FullPhysics::DoubleWithUnit::units

Definition at line 24 of file double_with_unit.h.

◆ value

double FullPhysics::DoubleWithUnit::value

Definition at line 23 of file double_with_unit.h.


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

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:12