ReFRACtor
FullPhysics::LinearInterpolate< TX, TY > Class Template Reference

This class takes a set of points and values, and linearly interpolates between those values. More...

#include <linear_interpolate.h>

+ Inheritance diagram for FullPhysics::LinearInterpolate< TX, TY >:
+ Collaboration diagram for FullPhysics::LinearInterpolate< TX, TY >:

Public Types

enum  BehaviorOutOfRange { OUT_OF_RANGE_EXTRAPOLATE = 0, OUT_OF_RANGE_CLIP, OUT_OF_RANGE_ERROR }
 

Public Member Functions

 LinearInterpolate ()
 
template<class I1 , class I2 >
 LinearInterpolate (I1 xstart, I1 xend, I2 ystart, BehaviorOutOfRange Out_of_range=OUT_OF_RANGE_EXTRAPOLATE)
 Constructor. More...
 
TY operator() (const TX &x) const
 
void print (std::ostream &Os) const
 
std::string print_to_string () const
 Print to string. More...
 

Detailed Description

template<class TX, class TY>
class FullPhysics::LinearInterpolate< TX, TY >

This class takes a set of points and values, and linearly interpolates between those values.

This works for any type TX of x and TY of y. TX is typically a double or float, but it might also be something like AutoDerivative<double>. TX has the same constraints as a key to std::map, it needs to be ordered by the "<" operator.

If you request a value for X outside of the range originally passed in, then the behavior depends on the value passed in the constructor. We can extrapolate, "clip" (i.e., use the minimum value for x < min, the maximum value for x > max), or trigger an exception.

Definition at line 79 of file linear_interpolate.h.

Member Enumeration Documentation

◆ BehaviorOutOfRange

template<class TX, class TY>
enum FullPhysics::LinearInterpolate::BehaviorOutOfRange
Enumerator
OUT_OF_RANGE_EXTRAPOLATE 
OUT_OF_RANGE_CLIP 
OUT_OF_RANGE_ERROR 

Definition at line 99 of file linear_interpolate.h.

Constructor & Destructor Documentation

◆ LinearInterpolate() [1/2]

template<class TX, class TY>
FullPhysics::LinearInterpolate< TX, TY >::LinearInterpolate ( )
inline

Definition at line 101 of file linear_interpolate.h.

◆ LinearInterpolate() [2/2]

template<class TX, class TY>
template<class I1 , class I2 >
FullPhysics::LinearInterpolate< TX, TY >::LinearInterpolate ( I1  xstart,
I1  xend,
I2  ystart,
BehaviorOutOfRange  Out_of_range = OUT_OF_RANGE_EXTRAPOLATE 
)
inline

Constructor.

This takes iterators to give x and y, along with the behavior when called with out of range data.

Definition at line 108 of file linear_interpolate.h.

Member Function Documentation

◆ operator()()

template<class TX, class TY>
TY FullPhysics::LinearInterpolate< TX, TY >::operator() ( const TX &  x) const
inline

Definition at line 140 of file linear_interpolate.h.

◆ print()

template<class TX, class TY>
void FullPhysics::LinearInterpolate< TX, TY >::print ( std::ostream &  Os) const
inline

Definition at line 190 of file linear_interpolate.h.

◆ print_to_string()

std::string FullPhysics::Printable< LinearInterpolate< TX, TY > >::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.


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

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