Interpolator::LinearInterpolator1D Class Reference

This class performs an Linear interpolation. More...

#include <LinearInterpolator1D.h>

Inherits Interpolator::Interpolator1D.

Inheritance diagram for Interpolator::LinearInterpolator1D:

Inheritance graph
[legend]
Collaboration diagram for Interpolator::LinearInterpolator1D:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LinearInterpolator1D ()
 Default constructor.
virtual ~LinearInterpolator1D ()
 Destructor.
 LinearInterpolator1D (std::string sName, std::string sDescription, InterpolationData1D *mInterpolationData)
 This constructor requires 3 parameters :
  • the name of the interpolator
  • the description of the interpolator
  • the interpolated data.

virtual double getInterpolatedValue (double dValue)
 Return the interpolated value for the wanted dValue.
virtual void updateInterpolator ()
 Method to update the interpolator according the new InterpolationData values.

Detailed Description

This class performs an Linear interpolation.

Definition at line 18 of file LinearInterpolator1D.h.


Constructor & Destructor Documentation

Interpolator::LinearInterpolator1D::LinearInterpolator1D  ) 
 

Default constructor.

Definition at line 17 of file LinearInterpolator1D.cpp.

00018 {
00019 
00020 }

Interpolator::LinearInterpolator1D::~LinearInterpolator1D  )  [virtual]
 

Destructor.

Definition at line 23 of file LinearInterpolator1D.cpp.

References Interpolator::Interpolator1D::acc, and Interpolator::Interpolator1D::spline.

00024 {
00025     gsl_spline_free (spline);
00026     gsl_interp_accel_free (acc);
00027 }

Interpolator::LinearInterpolator1D::LinearInterpolator1D std::string  sName,
std::string  sDescription,
InterpolationData1D mInterpolationData
 

This constructor requires 3 parameters :

  • the name of the interpolator
  • the description of the interpolator
  • the interpolated data.

Definition at line 33 of file LinearInterpolator1D.cpp.

References Interpolator::Interpolator::_verb, Interpolator::Interpolator1D::acc, Interpolator::Interpolator1D::getNbData(), Interpolator::InterpolationData1D::getXValues(), Interpolator::InterpolationData1D::getYValues(), and Interpolator::Interpolator1D::spline.

00035                                                                                                                                  : 
00036 Interpolator1D(sName,sDescription,"Linear",mInterpolationData)
00037 
00038 {
00039         acc             = gsl_interp_accel_alloc ();
00040         spline  = gsl_spline_alloc (gsl_interp_linear, getNbData());
00041 
00042         if(Interpolator::_verb == true) cout << "Values at init" << endl;
00043         for (unsigned int i=0;i<getNbData();i++) 
00044   {
00045     if(Interpolator::_verb == true) cout << i << " --> " << *(mInterpolationData->getXValues()+i) << " " << *(mInterpolationData->getYValues()+i) << endl;      
00046   }
00047         
00048         gsl_spline_init (spline, mInterpolationData->getXValues(), mInterpolationData->getYValues(), getNbData());
00049 }

Here is the call graph for this function:


Member Function Documentation

double Interpolator::LinearInterpolator1D::getInterpolatedValue double  dValue  )  [virtual]
 

Return the interpolated value for the wanted dValue.

Implements Interpolator::Interpolator1D.

Definition at line 52 of file LinearInterpolator1D.cpp.

References Interpolator::Interpolator::_verb, and Interpolator::Interpolator1D::acc.

00053 {
00054         if(Interpolator::_verb == true) cout << "Values used to interpolate : " << endl;
00055         for (unsigned int i=0;i<spline->size;i++)
00056   {
00057     if(Interpolator::_verb == true) cout << i << " --> " << *(spline->x+i) << " " << *(spline->y+i) << endl;
00058   }
00059         return gsl_spline_eval (spline, dValue, acc);
00060           
00061 }

void Interpolator::LinearInterpolator1D::updateInterpolator  )  [virtual]
 

Method to update the interpolator according the new InterpolationData values.

Implements Interpolator::Interpolator1D.

Definition at line 64 of file LinearInterpolator1D.cpp.

References Interpolator::Interpolator1D::acc, Interpolator::Interpolator1D::getInterpolatedData(), and Interpolator::Interpolator1D::getNbData().

00065 {
00066         gsl_spline_free (spline);
00067     gsl_interp_accel_free (acc);
00068         acc             = gsl_interp_accel_alloc ();
00069         spline  = gsl_spline_alloc (gsl_interp_linear, getNbData());
00070         gsl_spline_init (spline, getInterpolatedData()->getXValues(), getInterpolatedData()->getYValues(), getNbData());
00071 }

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Tue Apr 14 09:51:34 2009 for Interpolator Library by  doxygen 1.4.5