CARMA C++
|
The Velocity class can represent an velocity in any units. More...
#include <carma/services/Velocity.h>
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... | |
Velocity & | operator+= (const Velocity &frequency) |
Increment Velocity. More... | |
const Velocity | operator- (const Velocity &velocity) const |
Subtract two Velocities. More... | |
Velocity & | operator-= (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... | |
![]() | |
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 ConformableQuantity & | operator+= (const ConformableQuantity &quantity) |
Add ConformableQuantity to itself. More... | |
virtual const ConformableQuantity | operator- (const ConformableQuantity &quantity) const |
Subtract two ConformableQuantities. More... | |
virtual ConformableQuantity & | operator-= (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 | |
![]() | |
Units | u_ |
Used for converting between units. More... | |
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")
both
Velocity velocity2(1.0227,"pc/Myr")
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.
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.
value | The value of this velocity |
units | The units of the value. |
velFrame | the velocity frame |
velDef | the velocity definition |
|
virtual |
Destructor.
Converts velocity to FrameType=LSR and DefType=RADIO.
velocityDefType carma::services::Velocity::getDefinition | ( | ) | const |
Definition at line 73 of file Velocity.h.
velocityFrameType carma::services::Velocity::getFrame | ( | ) | const |
Definition at line 65 of file Velocity.h.
double carma::services::Velocity::kms | ( | ) | const |
double carma::services::Velocity::mph | ( | ) | const |
Convenience method to return miles per hour.
Definition at line 131 of file Velocity.h.
Add two Velocities.
ConformabilityException |
Subtract two Velocities.
ConformabilityException |
|
static |
Translate a string representation of a velocity definition into a velocityDef enumeration constant.
Match is case insensitive.
def | A string that may represent a velocity definition, e.g., "RADIO", "VEL_RADIO", "OPTICAL", etc. "*RAD* --> VEL_RADIO<br>
"*OPT* –> VEL_OPTICAL "*RELAT* –> VEL_RELATIVISTIC |
NotFoundException | if the input string is unrecognized. |
|
static |
Translate a string representation of a velocity frame into a velocityFrame enumeration constant.
Match is case insensitive.
frame | A string that may represent a velocity frame, e.g., "LSR", "FRAME_LSR", "TOPO[GRAPHIC]", "HELIO[CENTRIC]". "*LSR* –> VEL_LSR |
NotFoundException | if the input string is unrecognized. |