CARMA C++
carma::services::Velocity Class Reference

The Velocity class can represent an velocity in any units. More...

#include <carma/services/Velocity.h>

Inheritance diagram for carma::services::Velocity:
carma::services::ConformableQuantity

Public Member Functions

void cotra_radio_lsr (Angle ra, Angle dec)
 Converts velocity to FrameType=LSR and DefType=RADIO. More...
 
velocityDefType getDefinition () const
 
velocityFrameType getFrame () const
 
double kms () const
 Convenience method to return km/s. More...
 
double mph () const
 Convenience method to return miles per hour. More...
 
const Velocity operator+ (const Velocity &velocity) const
 Add two Velocities. More...
 
Velocityoperator+= (const Velocity &frequency)
 Increment Velocity. More...
 
const Velocity operator- (const Velocity &velocity) const
 Subtract two Velocities. More...
 
Velocityoperator-= (const Velocity &frequency)
 Decrement Velocity. More...
 
 Velocity (double value, const std::string &units, velocityFrameType velFrame=FRAME_LSR, velocityDefType velDef=VEL_RADIO)
 Construct an Velocity given a value and units. More...
 
virtual ~Velocity ()
 Destructor. More...
 
- Public Member Functions inherited from carma::services::ConformableQuantity
 ConformableQuantity (double value, const std::string &units)
 Construct an ConformableQuantity given a value and units. More...
 
virtual double convert (const std::string &convertTo) const
 Converts this quantity to any conformable units. More...
 
virtual std::string getUnits () const
 
double getValue () const
 
virtual const ConformableQuantity operator+ (const ConformableQuantity &quantity) const
 Add two ConformableQuantities. More...
 
virtual ConformableQuantityoperator+= (const ConformableQuantity &quantity)
 Add ConformableQuantity to itself. More...
 
virtual const ConformableQuantity operator- (const ConformableQuantity &quantity) const
 Subtract two ConformableQuantities. More...
 
virtual ConformableQuantityoperator-= (const ConformableQuantity &quantity)
 Subtract ConformableQuantity from itself. More...
 
virtual void reset (double value, const std::string &units)
 Reset method to change value and/or units. More...
 
virtual ~ConformableQuantity ()
 Destructor. More...
 

Static Public Member Functions

static velocityDefType translateDefinition (const std::string &def)
 Translate a string representation of a velocity definition into a velocityDef enumeration constant. More...
 
static velocityFrameType translateFrame (const std::string &frame)
 Translate a string representation of a velocity frame into a velocityFrame enumeration constant. More...
 

Additional Inherited Members

- Protected Attributes inherited from carma::services::ConformableQuantity
Units u_
 Used for converting between units. More...
 

Detailed Description

The Velocity class can represent an velocity in any units.

It uses the Units class internally to handle conversion of any velocity unit to any other velocity unit. For example,
Velocity velocity1(1.0,"km/s")
Velocity velocity2(1.0227,"pc/Myr")
both velocity1 and velocity2 represent the (approximately!) the same physical quantity. Binary operations + and - are supported, as is the stream operation <<. This is a special member function to convert velocities to an LSR frame of reference in the radio definition.

Definition at line 42 of file Velocity.h.

Constructor & Destructor Documentation

carma::services::Velocity::Velocity ( double  value,
const std::string &  units,
velocityFrameType  velFrame = FRAME_LSR,
velocityDefType  velDef = VEL_RADIO 
)

Construct an Velocity given a value and units.

Parameters
valueThe value of this velocity
unitsThe units of the value.
velFramethe velocity frame
velDefthe velocity definition
virtual carma::services::Velocity::~Velocity ( )
virtual

Destructor.

Member Function Documentation

void carma::services::Velocity::cotra_radio_lsr ( Angle  ra,
Angle  dec 
)

Converts velocity to FrameType=LSR and DefType=RADIO.

velocityDefType carma::services::Velocity::getDefinition ( ) const
Returns
the velocity definition for this Velocity (VEL_RADIO, VEL_OPTICAL, or VEL_RELATIVISTIC)

Definition at line 73 of file Velocity.h.

velocityFrameType carma::services::Velocity::getFrame ( ) const
Returns
the velocity frame for this Velocity (e.g. FRAME_LSR, FRAME_BARYCENTRIC, etc)

Definition at line 65 of file Velocity.h.

double carma::services::Velocity::kms ( ) const

Convenience method to return km/s.

Returns
value in km/s

Definition at line 122 of file Velocity.h.

double carma::services::Velocity::mph ( ) const

Convenience method to return miles per hour.

Returns
value in mph

Definition at line 131 of file Velocity.h.

const Velocity carma::services::Velocity::operator+ ( const Velocity velocity) const

Add two Velocities.

Returns
a Velocity with km/s units that is the sum of the two Velocities.
Exceptions
ConformabilityException
Velocity& carma::services::Velocity::operator+= ( const Velocity frequency)

Increment Velocity.

Returns
incremented Velocity
const Velocity carma::services::Velocity::operator- ( const Velocity velocity) const

Subtract two Velocities.

Returns
an Velocity with km/s units that is the difference of the two Velocities
Exceptions
ConformabilityException
Velocity& carma::services::Velocity::operator-= ( const Velocity frequency)

Decrement Velocity.

Returns
decremented Velocity
static velocityDefType carma::services::Velocity::translateDefinition ( const std::string &  def)
static

Translate a string representation of a velocity definition into a velocityDef enumeration constant.

Match is case insensitive.

Parameters
defA string that may represent a velocity definition, e.g., "RADIO", "VEL_RADIO", "OPTICAL", etc. "*RAD* --> VEL_RADIO<br> "*OPT* –> VEL_OPTICAL
"*RELAT* –> VEL_RELATIVISTIC
Returns
the velocity definition corresponding to input string
See Also
getDefinition()
Exceptions
NotFoundExceptionif the input string is unrecognized.
static velocityFrameType carma::services::Velocity::translateFrame ( const std::string &  frame)
static

Translate a string representation of a velocity frame into a velocityFrame enumeration constant.

Match is case insensitive.

Parameters
frameA string that may represent a velocity frame, e.g., "LSR", "FRAME_LSR", "TOPO[GRAPHIC]", "HELIO[CENTRIC]". "*LSR* –> VEL_LSR
Returns
the velocity frame corresponding to input string.
See Also
getDefinition()
Exceptions
NotFoundExceptionif the input string is unrecognized.

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