Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Mantid::Kernel::Interpolation Class Reference

Provide interpolation over a series of points. More...

#include <Interpolation.h>

Public Member Functions

void addPoint (const double &xx, const double &yy)
 add data point More...
 
bool containData () const
 return false if no data has been added More...
 
std::string getMethod () const
 get interpolation method More...
 
Unit_sptr getXUnit () const
 get x-axis unit More...
 
Unit_sptr getYUnit () const
 get y-axis unit More...
 
 Interpolation ()
 Constructor default to linear interpolation and x-unit set to TOF. More...
 
void printSelf (std::ostream &os) const
 Prints object to stream. More...
 
void resetData ()
 Clear interpolation values. More...
 
void setMethod (const std::string &method)
 set interpolation method More...
 
void setXUnit (const std::string &unit)
 set x-axis unit More...
 
void setYUnit (const std::string &unit)
 set y-axis unit More...
 
double value (const double &at) const
 get interpolated value at location at More...
 
virtual ~Interpolation ()=default
 

Protected Member Functions

std::vector< DataXY >::const_iterator cbegin () const
 
std::vector< DataXY >::const_iterator cend () const
 
std::vector< DataXY >::const_iterator findIndexOfNextLargerValue (double key) const
 Get iterator of item that is next larger than the supplied x value. More...
 

Private Attributes

std::vector< DataXYm_data
 internal storage of x and y values More...
 
std::string m_method
 method used for doing the interpolation More...
 
Unit_sptr m_xUnit
 unit of x-axis More...
 
Unit_sptr m_yUnit
 unit of y-axis More...
 

Detailed Description

Provide interpolation over a series of points.

Author
Anders Markvardsen, ISIS, RAL
Date
9/3/2010

Definition at line 29 of file Interpolation.h.

Constructor & Destructor Documentation

◆ Interpolation()

Mantid::Kernel::Interpolation::Interpolation ( )

Constructor default to linear interpolation and x-unit set to TOF.

Definition at line 30 of file Interpolation.cpp.

References Mantid::DataObjects::create().

◆ ~Interpolation()

virtual Mantid::Kernel::Interpolation::~Interpolation ( )
virtualdefault

Member Function Documentation

◆ addPoint()

void Mantid::Kernel::Interpolation::addPoint ( const double &  xx,
const double &  yy 
)

◆ cbegin()

std::vector< DataXY >::const_iterator Mantid::Kernel::Interpolation::cbegin ( ) const
protected

Definition at line 42 of file Interpolation.cpp.

References m_data.

◆ cend()

std::vector< DataXY >::const_iterator Mantid::Kernel::Interpolation::cend ( ) const
protected

Definition at line 44 of file Interpolation.cpp.

References m_data.

◆ containData()

bool Mantid::Kernel::Interpolation::containData ( ) const
inline

return false if no data has been added

Definition at line 78 of file Interpolation.h.

References m_data.

Referenced by Mantid::Kernel::AttenuationProfile::AttenuationProfile(), and Mantid::Geometry::FitParameter::getValue().

◆ findIndexOfNextLargerValue()

std::vector< DataXY >::const_iterator Mantid::Kernel::Interpolation::findIndexOfNextLargerValue ( double  key) const
protected

Get iterator of item that is next larger than the supplied x value.

Parameters
key:: the x value to base the search on
Returns
iterator of the next largest x value

Definition at line 38 of file Interpolation.cpp.

References m_data.

Referenced by addPoint(), and value().

◆ getMethod()

std::string Mantid::Kernel::Interpolation::getMethod ( ) const
inline

get interpolation method

Definition at line 63 of file Interpolation.h.

References m_method.

◆ getXUnit()

Unit_sptr Mantid::Kernel::Interpolation::getXUnit ( ) const
inline

get x-axis unit

Definition at line 72 of file Interpolation.h.

◆ getYUnit()

Unit_sptr Mantid::Kernel::Interpolation::getYUnit ( ) const
inline

get y-axis unit

Definition at line 75 of file Interpolation.h.

◆ printSelf()

void Mantid::Kernel::Interpolation::printSelf ( std::ostream &  os) const

Prints object to stream.

Parameters
os:: the Stream to output to

Definition at line 139 of file Interpolation.cpp.

References m_data, m_method, m_xUnit, and m_yUnit.

Referenced by Mantid::Kernel::operator<<().

◆ resetData()

void Mantid::Kernel::Interpolation::resetData ( )

Clear interpolation values.

Resets interpolation data by clearing the internal storage for x- and y-values.

Definition at line 150 of file Interpolation.cpp.

References m_data.

Referenced by Mantid::Kernel::operator>>().

◆ setMethod()

void Mantid::Kernel::Interpolation::setMethod ( const std::string &  method)
inline

set interpolation method

Definition at line 60 of file Interpolation.h.

References m_method.

Referenced by Mantid::Algorithms::CreateUserDefinedBackground::getInterpolator(), and Mantid::Kernel::operator>>().

◆ setXUnit()

void Mantid::Kernel::Interpolation::setXUnit ( const std::string &  unit)

◆ setYUnit()

void Mantid::Kernel::Interpolation::setYUnit ( const std::string &  unit)

◆ value()

double Mantid::Kernel::Interpolation::value ( const double &  at) const

get interpolated value at location at

Get interpolated value at location at.

Parameters
at:: Location where to get interpolated value
Returns
the value

Definition at line 54 of file Interpolation.cpp.

References Mantid::Kernel::Logger::error(), findIndexOfNextLargerValue(), Mantid::Kernel::DateAndTimeHelpers::g_log, and m_data.

Referenced by Mantid::Algorithms::TOFSANSResolutionByPixel::exec(), Mantid::Kernel::AttenuationProfile::getAttenuationCoefficient(), and Mantid::Geometry::FitParameter::getValue().

Member Data Documentation

◆ m_data

std::vector<DataXY> Mantid::Kernel::Interpolation::m_data
private

internal storage of x and y values

Definition at line 32 of file Interpolation.h.

Referenced by addPoint(), cbegin(), cend(), findIndexOfNextLargerValue(), printSelf(), resetData(), and value().

◆ m_method

std::string Mantid::Kernel::Interpolation::m_method
private

method used for doing the interpolation

Definition at line 35 of file Interpolation.h.

Referenced by printSelf().

◆ m_xUnit

Unit_sptr Mantid::Kernel::Interpolation::m_xUnit
private

unit of x-axis

Definition at line 38 of file Interpolation.h.

Referenced by printSelf(), and setXUnit().

◆ m_yUnit

Unit_sptr Mantid::Kernel::Interpolation::m_yUnit
private

unit of y-axis

Definition at line 41 of file Interpolation.h.

Referenced by printSelf(), and setYUnit().


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