Mantid
Loading...
Searching...
No Matches
Static Public Member Functions | Static Private Member Functions | List of all members
Mantid::Kernel::UnitConversion Class Reference

A set of static helper methods to perform conversions between units. More...

#include <UnitConversion.h>

Static Public Member Functions

static double convertToElasticQ (const double theta, const double efixed)
 Convert to ElasticQ from Energy. More...
 
static double run (const std::string &src, const std::string &dest, const double srcValue, const double l1, const DeltaEMode::Type emode, const UnitParametersMap &params={})
 
static double run (const std::string &src, const std::string &dest, const double srcValue, const double l1, const double l2, const double theta, const DeltaEMode::Type emode, const double efixed)
 Convert a single value between the given units (as strings) More...
 
static double run (Unit &srcUnit, Unit &destUnit, const double srcValue, const double l1, const DeltaEMode::Type emode, const UnitParametersMap &params={})
 Convert a single value between the given units. More...
 

Static Private Member Functions

static double convertQuickly (const double srcValue, const double factor, const double power)
 Perform a quick conversion. More...
 
static double convertViaTOF (Unit &srcUnit, Unit &destUnit, const double srcValue, const double l1, const DeltaEMode::Type emode, const UnitParametersMap &params)
 Convert through TOF. More...
 

Detailed Description

A set of static helper methods to perform conversions between units.

Definition at line 24 of file UnitConversion.h.

Member Function Documentation

◆ convertQuickly()

double Mantid::Kernel::UnitConversion::convertQuickly ( const double  srcValue,
const double  factor,
const double  power 
)
staticprivate

Perform a quick conversion.

Perform a quick conversion by raising the value to a power & multiplying by the factor.

Parameters
srcValue:: The value to convert
factor:: A multiplicative constant
power:: Raise the src value to this power
Returns
The converted unit

Definition at line 82 of file UnitConversion.cpp.

Referenced by run().

◆ convertToElasticQ()

double Mantid::Kernel::UnitConversion::convertToElasticQ ( const double  theta,
const double  efixed 
)
static

◆ convertViaTOF()

double Mantid::Kernel::UnitConversion::convertViaTOF ( Unit srcUnit,
Unit destUnit,
const double  srcValue,
const double  l1,
const DeltaEMode::Type  emode,
const UnitParametersMap params 
)
staticprivate

Convert through TOF.

Parameters
srcUnit:: The starting unit
destUnit:: The destination unit
srcValue:: The value to convert
l1:: The source-sample distance (in metres)
emode:: The energy mode enumeration
params:: Map containing optional parameters eg The sample-detector distance (in metres) The scattering angle (in radians) Fixed energy: EI (emode=1) or EF (emode=2)(in meV) Delta (not currently used)
Returns
The value converted to the destination unit

Definition at line 99 of file UnitConversion.cpp.

References Mantid::Kernel::Unit::convertSingleFromTOF(), Mantid::Kernel::Unit::convertSingleToTOF(), Mantid::Kernel::DeltaEMode::Direct, Mantid::Kernel::DeltaEMode::Elastic, Mantid::Kernel::DeltaEMode::Indirect, and std::to_string().

Referenced by run().

◆ run() [1/3]

double Mantid::Kernel::UnitConversion::run ( const std::string &  src,
const std::string &  dest,
const double  srcValue,
const double  l1,
const DeltaEMode::Type  emode,
const UnitParametersMap params = {} 
)
static

Definition at line 39 of file UnitConversion.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance(), and run().

◆ run() [2/3]

double Mantid::Kernel::UnitConversion::run ( const std::string &  src,
const std::string &  dest,
const double  srcValue,
const double  l1,
const double  l2,
const double  theta,
const DeltaEMode::Type  emode,
const double  efixed 
)
static

Convert a single value between the given units (as strings)

Parameters
src:: The starting unit
dest:: The destination unit
srcValue:: The value to convert
l1:: The source-sample distance (in metres)
l2:: The sample-detector distance (in metres)
theta:: The scattering angle (in radians)
emode:: The energy mode enumeration
efixed:: Value of fixed energy: EI (emode=1) or EF (emode=2) (in meV)
Returns
The value converted to the destination unit

Definition at line 28 of file UnitConversion.cpp.

References Mantid::Kernel::efixed, Mantid::Kernel::SingletonHolder< T >::Instance(), Mantid::Kernel::l2, run(), and Mantid::Kernel::twoTheta.

Referenced by Mantid::DataObjects::PeaksWorkspace::createPeakQSample(), deprecatedSignature(), Mantid::Algorithms::CreateEPP::exec(), export_UnitConversion(), Mantid::CurveFitting::Functions::PawleyFunction::getTransformedCenter(), Mantid::CurveFitting::Algorithms::PawleyFit::getTransformedCenter(), Mantid::Algorithms::GetEiMonDet3::minimumTOF(), and run().

◆ run() [3/3]

double Mantid::Kernel::UnitConversion::run ( Unit srcUnit,
Unit destUnit,
const double  srcValue,
const double  l1,
const DeltaEMode::Type  emode,
const UnitParametersMap params = {} 
)
static

Convert a single value between the given units.

Convert a single value between the given units (overload for Unit objects)

Parameters
srcUnit:: The starting unit
destUnit:: The destination unit
srcValue:: The value to convert
l1:: The source-sample distance (in metres)
emode:: The energy mode enumeration
params:: Map containing optional parameters eg The sample-detector distance (in metres) The scattering angle (in radians) Fixed energy: EI (emode=1) or EF (emode=2)(in meV) Delta (not currently used)
Returns
The value converted to the destination unit

Definition at line 60 of file UnitConversion.cpp.

References convertQuickly(), convertViaTOF(), and Mantid::Kernel::Unit::quickConversion().


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