Interpolator::Table1D Class Reference

This class is used to manage a 1D table. More...

#include <Table1D.h>

Inherits Interpolator::Table.

Inheritance diagram for Interpolator::Table1D:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~Table1D ()
 Destructor.
 Table1D (std::string sName, std::string sDescription, std::string sEntryPoint, std::string sOutputPoint, Variable *mEntryPoint, Interpolator1D *mInterpolator1D)
 This constructor requires 6 parameters :
  • the name of the Table1D
  • the description of the Table1D
  • the entry point name (must follow the naming convention for the Movements/Variables)
  • the output point name (must follow the naming convention for the Movements/Variables)
  • the entry point variable
  • the direct interpolation object
  • the inverse interpolation object (USELESS !!!!).

 Table1D (std::string sName, std::string sDescription, std::string sEntryPoint, std::string sOutputPoint, Variable *mEntryPoint, std::string sInterpolationType, long lNbData, double *mX, double *mY)
 This constructor requires 9 parameters :
  • the name of the Table1D
  • the description of the Table1D
  • the entry point name (must follow the naming convention for the Movements/Variables)
  • the output point name (must follow the naming convention for the Movements/Variables)
  • the entry point variable
  • the wanted interpolation type ("Akima","Periodic Akima","Linear","Cubic Spline","Periodic Cubic Spline","Polynomial")
  • the number of Data
  • the X values
  • the Y values If the interpolation type name entered is invalid the interpolator object is set to NULL.

 Table1D (std::string sName, std::string sDescription, std::string sInterpolationType, std::string sFilePath, int iFirstColumn, int iSecondColumn)
 This constructor requires 6 parameters :
  • the name of the Table1D
  • the description of the Table1D
  • the wanted interpolation type ("Akima","Periodic Akima","Linear","Cubic Spline","Periodic Cubic Spline","Polynomial")
  • the file path for the data
  • the column to used in the GenericFileReader1D for the X column (first column = entry point)
  • the column to used in the GenericFileReader1D for the Y column (second column = output point) If the interpolation type name entered is invalid the interpolator object is set to NULL.

virtual double computeValue (double dValue)
 Return the output value according the entry point value dValue parameter.
virtual double computeValue ()
 Compute the value (use the singleton monochromator to get all the data according the entry point).
std::string getEntryPoint () const
 Return the entry point.
std::string getOutputPoint () const
 Return the output point.
Variable * getEntryPointVariable () const
virtual Interpolator1DgetInterpolator () const
 Return the interpolatordata object.
virtual InterpolationData1DgetInterpolationData () const
 Return the interpolation data object.
virtual void printInfos ()
 Display the table 1D informations
Used mainly for DEBUG.
void setXValue (int i, double dNewValue)
 Method to modify the ith value of the X interpolation data structure with the dNewValue.
void setYValue (int i, double dNewValue)
 Method to modify the ith value of the Y interpolation data structure with the dNewValue.
void setValues (long lNbData, double *dNewXValues, double *dNewYValues)
 Method to modify the values of the interpolation data structure with the dNewXValues and dNewYValues.
double getXValue (int i) const
 Return the ith value of X array
Exceptions:
This method throw a IndexOutOfBoundException exception if the i index is outside the bound
This method throw a NullPointerException exception if the X array is null.

double getYValue (int i) const
 Return the ith value of Y array
Exceptions:
This method throw a IndexOutOfBoundException exception if the i index is outside the bound
This method throw a NullPointerException exception if the Y array is null.

double * getXValues () const
 Return the X values (first column)
Exceptions:
This method throw a NullPointerException exception if the X array is null.

double * getYValues () const
 Return the Y values (second column)
Exceptions:
This method throw a NullPointerException exception if the Y array is null.

long getNbData () const
 Return the number of data.
void checkDataAreCorrects ()
void WriteTable ()

Private Attributes

std::string _sEntryPoint
std::string _sOutputPoint
Variable * _mEntryPoint
Interpolator1D_mInterpolator
InterpolationData1D_mData

Detailed Description

This class is used to manage a 1D table.

If you use the constructor with data (double*) it is necessary to delete the objects pointed. Indeed during the creation of the table, the data are copied in an internal structure.

Todo:
Template pour le type de données à interpolées (double -> Type)

Definition at line 30 of file Table1D.h.


Constructor & Destructor Documentation

Interpolator::Table1D::~Table1D  )  [virtual]
 

Destructor.

Definition at line 32 of file Table1D.cpp.

References _mData, and _mInterpolator.

00033 {       
00034         DESTRUCTION(_mInterpolator);
00035         DESTRUCTION(_mData);
00036 }

Interpolator::Table1D::Table1D std::string  sName,
std::string  sDescription,
std::string  sEntryPoint,
std::string  sOutputPoint,
Variable *  mEntryPoint,
Interpolator1D mInterpolator
 

This constructor requires 6 parameters :

  • the name of the Table1D
  • the description of the Table1D
  • the entry point name (must follow the naming convention for the Movements/Variables)
  • the output point name (must follow the naming convention for the Movements/Variables)
  • the entry point variable
  • the direct interpolation object
  • the inverse interpolation object (USELESS !!!!).

Todo:
MODIFIER LA CLASSE INTERPOLATOR pour permettre d'interpoler dans les 2 sens
_sEntryPoint peut être initialisé à partir de l'interpolateur->interpoaltionData->getXname()

Definition at line 47 of file Table1D.cpp.

00053                                                                                 : 
00054 Table(sName,sDescription,""),
00055 _sEntryPoint(sEntryPoint),_sOutputPoint(sOutputPoint),
00056 _mEntryPoint(mEntryPoint),_mInterpolator(mInterpolator)
00057 {
00059 }

Interpolator::Table1D::Table1D std::string  sName,
std::string  sDescription,
std::string  sEntryPoint,
std::string  sOutputPoint,
Variable *  mEntryPoint,
std::string  sInterpolationType,
long  lNbData,
double *  mX,
double *  mY
 

This constructor requires 9 parameters :

  • the name of the Table1D
  • the description of the Table1D
  • the entry point name (must follow the naming convention for the Movements/Variables)
  • the output point name (must follow the naming convention for the Movements/Variables)
  • the entry point variable
  • the wanted interpolation type ("Akima","Periodic Akima","Linear","Cubic Spline","Periodic Cubic Spline","Polynomial")
  • the number of Data
  • the X values
  • the Y values If the interpolation type name entered is invalid the interpolator object is set to NULL.

Todo:
MODIFIER LA CLASSE INTERPOLATOR pour permettre d'interpoler dans les 2 sens
Todo:
FAIRE les differents cas d'interpolateurs

Definition at line 74 of file Table1D.cpp.

References _mData, and _mInterpolator.

00082                                                                             :
00083 Table(sName,sDescription,sInterpolationType),
00084 _sEntryPoint(sEntryPoint),_sOutputPoint(sOutputPoint),_mEntryPoint(mEntryPoint)
00085 
00086 {
00087 _mData                  = new InterpolationData1D(sEntryPoint,sOutputPoint,lNbData,mX,mY);
00088         
00089 
00090 if (sInterpolationType == "Akima") 
00091 {
00092         std::string sInterpolationName = sEntryPoint;
00093         sInterpolationName+= "-->";
00094         sInterpolationName+= sOutputPoint;
00095         _mInterpolator = new AkimaInterpolator1D(sDescription,sInterpolationName,_mData);
00096 }
00097 
00098 else if (sInterpolationType == "Periodic Akima") 
00099 {
00100         std::string sInterpolationName = sEntryPoint;
00101         sInterpolationName+= "-->";
00102         sInterpolationName+= sOutputPoint;
00103         _mInterpolator = new PeriodicAkimaInterpolator1D(sDescription,sInterpolationName,_mData);
00104 }
00105 
00107 else if (sInterpolationType == "Linear") 
00108 {
00109         std::string sInterpolationName = sEntryPoint;
00110         sInterpolationName+= "-->";
00111         sInterpolationName+= sOutputPoint;
00112         _mInterpolator = new LinearInterpolator1D(sDescription,sInterpolationName,_mData);
00113 }
00114 
00115 else if (sInterpolationType == "Cubic Spline") 
00116 {
00117         std::string sInterpolationName = sEntryPoint;
00118         sInterpolationName+= "-->";
00119         sInterpolationName+= sOutputPoint;
00120         _mInterpolator = new CubicSplineInterpolator1D(sDescription,sInterpolationName,_mData);
00121 }
00122 
00123 else if (sInterpolationType == "Periodic Cubic Spline") 
00124 {
00125         std::string sInterpolationName = sEntryPoint;
00126         sInterpolationName+= "-->";
00127         sInterpolationName+= sOutputPoint;
00128         _mInterpolator = new PeriodicCubicSplineInterpolator1D(sDescription,sInterpolationName,_mData);
00129 }
00130 
00131 else if (sInterpolationType == "Polynomial") 
00132 {
00133         std::string sInterpolationName = sEntryPoint;
00134         sInterpolationName+= "-->";
00135         sInterpolationName+= sOutputPoint;
00136         _mInterpolator = new PolynomialInterpolator1D(sDescription,sInterpolationName,_mData);
00137 }
00138 
00139 else //Error
00140 {
00141         _mInterpolator = 0;
00142 
00143 }
00144 
00145 }

Interpolator::Table1D::Table1D std::string  sName,
std::string  sDescription,
std::string  sInterpolationType,
std::string  sFilePath,
int  iFirstColumn,
int  iSecondColumn
 

This constructor requires 6 parameters :

  • the name of the Table1D
  • the description of the Table1D
  • the wanted interpolation type ("Akima","Periodic Akima","Linear","Cubic Spline","Periodic Cubic Spline","Polynomial")
  • the file path for the data
  • the column to used in the GenericFileReader1D for the X column (first column = entry point)
  • the column to used in the GenericFileReader1D for the Y column (second column = output point) If the interpolation type name entered is invalid the interpolator object is set to NULL.

Todo:
FAIRE les differents cas d'interpolateurs

Definition at line 155 of file Table1D.cpp.

References _mData, _mEntryPoint, _mInterpolator, _sEntryPoint, _sOutputPoint, Interpolator::GenericFileReader1D::getColumn(), Interpolator::GenericFileReader1D::getColumnName(), and Interpolator::FileReader::getNbData().

00160                                                                                                :
00161 Table(sName,sDescription,sInterpolationType,sFilePath)
00162 {
00163         GenericFileReader1D* _mFileReader = new GenericFileReader1D(sFilePath);
00164         
00165         double* mX = _mFileReader->getColumn(iFirstColumn);
00166         double* mY = _mFileReader->getColumn(iSecondColumn);
00167 
00168         _sEntryPoint = _mFileReader->getColumnName(iFirstColumn);
00169         _sOutputPoint = _mFileReader->getColumnName(iSecondColumn);
00170         
00171         _mEntryPoint = (Variable*)0; //Or mMono->getVariable(_sEntryPoint);
00172 
00173         long lNbData = _mFileReader->getNbData();
00174 
00175         _mData                  = new InterpolationData1D(_sEntryPoint,_sOutputPoint,lNbData,mX,mY);
00176         
00177         if (sInterpolationType == "Akima") 
00178         {
00179                 std::string sInterpolationName = _sEntryPoint;
00180                 sInterpolationName+= "-->";
00181                 sInterpolationName+= _sOutputPoint;
00182                 _mInterpolator = new AkimaInterpolator1D(sDescription,sInterpolationName,_mData);
00183         }
00184 
00185         else if (sInterpolationType == "Periodic Akima") 
00186         {
00187                 std::string sInterpolationName = _sEntryPoint;
00188                 sInterpolationName+= "-->";
00189                 sInterpolationName+= _sOutputPoint;
00190                 _mInterpolator = new PeriodicAkimaInterpolator1D(sDescription,sInterpolationName,_mData);
00191         }
00192 
00194         else if (sInterpolationType == "Linear") 
00195         {
00196                 std::string sInterpolationName = _sEntryPoint;
00197                 sInterpolationName+= "-->";
00198                 sInterpolationName+= _sOutputPoint;
00199                 _mInterpolator = new LinearInterpolator1D(sDescription,sInterpolationName,_mData);
00200         }
00201 
00202         else if (sInterpolationType == "Cubic Spline") 
00203         {
00204                 std::string sInterpolationName = _sEntryPoint;
00205                 sInterpolationName+= "-->";
00206                 sInterpolationName+= _sOutputPoint;
00207                 _mInterpolator = new CubicSplineInterpolator1D(sDescription,sInterpolationName,_mData);
00208         }
00209 
00210         else if (sInterpolationType == "Periodic Cubic Spline") 
00211         {
00212                 std::string sInterpolationName = _sEntryPoint;
00213                 sInterpolationName+= "-->";
00214                 sInterpolationName+= _sOutputPoint;
00215                 _mInterpolator = new PeriodicCubicSplineInterpolator1D(sDescription,sInterpolationName,_mData);
00216         }
00217 
00218         else if (sInterpolationType == "Polynomial") 
00219         {
00220                 std::string sInterpolationName = _sEntryPoint;
00221                 sInterpolationName+= "-->";
00222                 sInterpolationName+= _sOutputPoint;
00223                 _mInterpolator = new PolynomialInterpolator1D(sDescription,sInterpolationName,_mData);
00224         }
00225 
00226         else //Error
00227         {
00228                 _mInterpolator = 0;
00229 
00230         }
00231 
00232         delete (_mFileReader);
00233 }

Here is the call graph for this function:


Member Function Documentation

void Interpolator::Table1D::checkDataAreCorrects  ) 
 

double Interpolator::Table1D::computeValue  )  [virtual]
 

Compute the value (use the singleton monochromator to get all the data according the entry point).

Implements Interpolator::Table.

Definition at line 242 of file Table1D.cpp.

00243 {
00244         /*/------------ !!!!! ATTENTION: F. LANGLOIS:
00245         La partie ci dessous est commentée pour permettre a la lib Interpolator de ne plus faire reference a la librairie Monochromator
00246         Ceci peut avoir des consequences sur les devices deja existants.
00247         a ma connaissance, aucun device a ce jour n'utilise cette methode
00248         */
00249 
00250 
00251         /*Monochromator* mMonochromator = Monochromator::GetMonochromatorInstance();
00252         //std::string sEntryPointCorrection     = _mInterpolator->getInterpolatedData()->getXName();
00253         Variable* mVariable                             = mMonochromator->getVariable(_sEntryPoint);
00254         double dValue                                   = mVariable->getValue(); 
00255         return _mInterpolator->getInterpolatedValue(dValue);*/
00256 
00257         return 0.0;
00258 }

double Interpolator::Table1D::computeValue double  dValue  )  [virtual]
 

Return the output value according the entry point value dValue parameter.

Definition at line 236 of file Table1D.cpp.

References _mInterpolator, and Interpolator::Interpolator1D::getInterpolatedValue().

00237 {
00238         return _mInterpolator->getInterpolatedValue(dValue);
00239 }

Here is the call graph for this function:

std::string Interpolator::Table1D::getEntryPoint  )  const
 

Return the entry point.

Definition at line 261 of file Table1D.cpp.

References _sEntryPoint.

Referenced by printInfos().

00262 {
00263         return _sEntryPoint;
00264 }

Variable* Interpolator::Table1D::getEntryPointVariable  )  const
 

InterpolationData1D * Interpolator::Table1D::getInterpolationData  )  const [virtual]
 

Return the interpolation data object.

Definition at line 273 of file Table1D.cpp.

References _mData.

Referenced by main().

00274 {
00275         return _mData;
00276 }

Interpolator1D * Interpolator::Table1D::getInterpolator  )  const [virtual]
 

Return the interpolatordata object.

Definition at line 279 of file Table1D.cpp.

References _mInterpolator.

00280 {
00281         return _mInterpolator;
00282 }

long Interpolator::Table1D::getNbData  )  const
 

Return the number of data.

Definition at line 357 of file Table1D.cpp.

References _mInterpolator, Interpolator::Interpolator1D::getInterpolatedData(), and Interpolator::InterpolationData1D::getNbData().

00358 {
00359         return _mInterpolator->getInterpolatedData()->getNbData();
00360 }

Here is the call graph for this function:

std::string Interpolator::Table1D::getOutputPoint  )  const
 

Return the output point.

Definition at line 267 of file Table1D.cpp.

References _sOutputPoint.

Referenced by printInfos().

00268 {
00269         return _sOutputPoint;
00270 }

double Interpolator::Table1D::getXValue int  i  )  const
 

Return the ith value of X array

Exceptions:
This method throw a IndexOutOfBoundException exception if the i index is outside the bound
This method throw a NullPointerException exception if the X array is null.

Definition at line 329 of file Table1D.cpp.

References _mInterpolator, Interpolator::Interpolator1D::getInterpolatedData(), and Interpolator::InterpolationData1D::getXValue().

00330 {
00331         return _mInterpolator->getInterpolatedData()->getXValue(i);
00332 }

Here is the call graph for this function:

double * Interpolator::Table1D::getXValues  )  const
 

Return the X values (first column)

Exceptions:
This method throw a NullPointerException exception if the X array is null.

Definition at line 344 of file Table1D.cpp.

References _mInterpolator, Interpolator::Interpolator1D::getInterpolatedData(), and Interpolator::InterpolationData1D::getXValues().

00345 {
00346         return _mInterpolator->getInterpolatedData()->getXValues();
00347 }

Here is the call graph for this function:

double Interpolator::Table1D::getYValue int  i  )  const
 

Return the ith value of Y array

Exceptions:
This method throw a IndexOutOfBoundException exception if the i index is outside the bound
This method throw a NullPointerException exception if the Y array is null.

Definition at line 337 of file Table1D.cpp.

References _mInterpolator, Interpolator::Interpolator1D::getInterpolatedData(), and Interpolator::InterpolationData1D::getYValue().

00338 {
00339         return _mInterpolator->getInterpolatedData()->getYValue(i);
00340 }

Here is the call graph for this function:

double * Interpolator::Table1D::getYValues  )  const
 

Return the Y values (second column)

Exceptions:
This method throw a NullPointerException exception if the Y array is null.

Definition at line 351 of file Table1D.cpp.

References _mInterpolator, Interpolator::Interpolator1D::getInterpolatedData(), and Interpolator::InterpolationData1D::getYValues().

00352 {
00353         return _mInterpolator->getInterpolatedData()->getYValues();
00354 }

Here is the call graph for this function:

void Interpolator::Table1D::printInfos  )  [virtual]
 

Display the table 1D informations
Used mainly for DEBUG.

Implements Interpolator::Table.

Definition at line 285 of file Table1D.cpp.

References _mData, Interpolator::Interpolator::_verb, Interpolator::InterpolationData1D::DisplayData(), Interpolator::Table::getDescription(), getEntryPoint(), Interpolator::Table::getInterpolationType(), Interpolator::Table::getName(), and getOutputPoint().

00286 {
00287         if(Interpolator::_verb == true) cout << "\n############ Table1D : " << getName() << " ############\n" << endl;
00288         if(Interpolator::_verb == true) cout << "Interpolation Type   : " << getInterpolationType() << endl;
00289         if(Interpolator::_verb == true) cout << "Description          : " << getDescription() << endl;
00290         if(Interpolator::_verb == true) cout << "Columns Names        : " << getEntryPoint() << " --> " << getOutputPoint() << endl;
00291         if(Interpolator::_verb == true) cout << "Values\n" << endl;
00292         _mData->DisplayData();
00293 }

Here is the call graph for this function:

void Interpolator::Table1D::setValues long  lNbData,
double *  dNewXValues,
double *  dNewYValues
 

Method to modify the values of the interpolation data structure with the dNewXValues and dNewYValues.

Definition at line 316 of file Table1D.cpp.

References _mInterpolator, Interpolator::Interpolator1D::getInterpolatedData(), Interpolator::InterpolationData1D::setValues(), and Interpolator::Interpolator1D::updateInterpolator().

00317 {
00318         //First we update the interpolation data structure values
00319         _mInterpolator->getInterpolatedData()->setValues(lNbData,dNewXValues,dNewYValues);
00320         //And after update of the gsl object according the new InterpolationData values
00321         _mInterpolator->updateInterpolator();
00322 }

Here is the call graph for this function:

void Interpolator::Table1D::setXValue int  i,
double  dNewValue
 

Method to modify the ith value of the X interpolation data structure with the dNewValue.

Definition at line 298 of file Table1D.cpp.

References _mInterpolator, Interpolator::Interpolator1D::getInterpolatedData(), Interpolator::InterpolationData1D::setXValue(), and Interpolator::Interpolator1D::updateInterpolator().

00299 {
00300         //First we update the interpolation data structure values
00301         _mInterpolator->getInterpolatedData()->setXValue(i,dNewValue);
00302         //And after update of the gsl object according the new InterpolationData values
00303         _mInterpolator->updateInterpolator();
00304 }

Here is the call graph for this function:

void Interpolator::Table1D::setYValue int  i,
double  dNewValue
 

Method to modify the ith value of the Y interpolation data structure with the dNewValue.

Definition at line 307 of file Table1D.cpp.

References _mInterpolator, Interpolator::Interpolator1D::getInterpolatedData(), Interpolator::InterpolationData1D::setYValue(), and Interpolator::Interpolator1D::updateInterpolator().

00308 {
00309         //First we update the interpolation data structure values
00310         _mInterpolator->getInterpolatedData()->setYValue(i,dNewValue);
00311         //And after update of the gsl object according the new InterpolationData values
00312         _mInterpolator->updateInterpolator();
00313 }

Here is the call graph for this function:

void Interpolator::Table1D::WriteTable  ) 
 


Member Data Documentation

InterpolationData1D* Interpolator::Table1D::_mData [private]
 

Definition at line 96 of file Table1D.h.

Referenced by getInterpolationData(), printInfos(), Table1D(), and ~Table1D().

Variable* Interpolator::Table1D::_mEntryPoint [private]
 

Definition at line 93 of file Table1D.h.

Referenced by Table1D().

Interpolator1D* Interpolator::Table1D::_mInterpolator [private]
 

Definition at line 95 of file Table1D.h.

Referenced by computeValue(), getInterpolator(), getNbData(), getXValue(), getXValues(), getYValue(), getYValues(), setValues(), setXValue(), setYValue(), Table1D(), and ~Table1D().

std::string Interpolator::Table1D::_sEntryPoint [private]
 

Definition at line 91 of file Table1D.h.

Referenced by getEntryPoint(), and Table1D().

std::string Interpolator::Table1D::_sOutputPoint [private]
 

Definition at line 92 of file Table1D.h.

Referenced by getOutputPoint(), and Table1D().


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