Interpolator::Table2D Class Reference

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

#include <Table2D.h>

Inherits Interpolator::Table.

Inheritance diagram for Interpolator::Table2D:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~Table2D ()
 Destructor.
 Table2D (std::string sName, std::string sDescription, std::string sInterpolationType, std::string sFilePath)
 This constructor requires 4 parameters :
  • the name of the table
  • the description of the table
  • the wanted interpolation type (Bilinear,Nearest,others)
  • the file path of the data.

 Table2D (std::string sName, std::string sDescription, std::string sInterpolationType, std::string sXName, std::string sYName, std::string sZName, long lNbDataX, long lNbDataY, double *mXValues, double *mYValues, double *mZValues)
 This constructor requires 11 parameters :
  • the name of the table
  • the description of the table
  • the wanted interpolation type ("Bilinear","Nearest","FourNearestMean")
  • the name of the X variable
  • the name of the Y variable
  • the name of the Z variable
  • the number of X Data
  • the number of Y Data
  • the X values
  • the Y values
  • the Z values (unidimensional array).

double computeValue ()
 Fake method
Only to provide the interface.
double computeValue (double dXValue, double dYvalue)
 Return the output value according the entry points couple (dXValue,dYvalue) given in parameter.
Interpolator2DgetInterpolator () const
InterpolationData2DgetInterpolationData () const
 Return the InterpolationData2D object which contains all the data.
virtual void printInfos ()
 Display info of the Table 2D
Mainly used in 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 setZValue (int i, int j, double dNewValue)
 Method to modify the ith value of the Z interpolation data structure with the dNewValue.
void setValues (long lNbXData, long lNbYData, double *dNewXValues, double *dNewYValues, double *dNewZValues)
 Method to modify the values of the interpolation data structure with the dNewXValues, dNewYValues and dNewZValues.
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 getZValue (int i, int j) const
 Return the (ith,jth) value of Z array
Exceptions:
This method throw a IndexOutOfBoundException exception if the i index is outside the bound
This method throw a NullPointerException exception if the Z 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.

double * getZValues () const
 Return the Z array
Exceptions:
This method throw a NullPointerException exception if the Z array is null.

long getNbXData () const
 Return the number of X data.
long getNbYData () const
 Return the number of Y data.
long getNbZData () const
 Return the number of Z data.

Private Member Functions

void initializeInterpolator ()
 Method to initialize the interpolator object according the wanted interpolation type.

Private Attributes

Interpolator2D_mInterpolator
InterpolationData2D_mData

Detailed Description

This class is used to manage a 2D 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.

Definition at line 28 of file Table2D.h.


Constructor & Destructor Documentation

Interpolator::Table2D::~Table2D  )  [virtual]
 

Destructor.

Definition at line 24 of file Table2D.cpp.

References _mData, and _mInterpolator.

00025 {
00026         DESTRUCTION(_mInterpolator);
00027         DESTRUCTION(_mData);
00028 }

Interpolator::Table2D::Table2D std::string  sName,
std::string  sDescription,
std::string  sInterpolationType,
std::string  sFilePath
 

This constructor requires 4 parameters :

  • the name of the table
  • the description of the table
  • the wanted interpolation type (Bilinear,Nearest,others)
  • the file path of the data.

Definition at line 35 of file Table2D.cpp.

References _mData, Interpolator::GenericFileReader2D::getDataX(), Interpolator::GenericFileReader2D::getDataXName(), Interpolator::GenericFileReader2D::getDataY(), Interpolator::GenericFileReader2D::getDataYName(), Interpolator::GenericFileReader2D::getDataZ(), Interpolator::GenericFileReader2D::getDataZName(), Interpolator::GenericFileReader2D::getNbDataX(), Interpolator::GenericFileReader2D::getNbDataY(), and initializeInterpolator().

00038                                                                                    : 
00039 Table(sName,sDescription,sInterpolationType,sFilePath)
00040 {
00041         GenericFileReader2D*    _mFileReader = new GenericFileReader2D(sFilePath);
00042         
00043         double* mXValues = _mFileReader->getDataX();
00044         double* mYValues = _mFileReader->getDataY();    
00045         double* mZValues = _mFileReader->getDataZ();
00046         
00047         long lNbXValues = _mFileReader->getNbDataX();
00048         long lNbYValues = _mFileReader->getNbDataY();
00049 //      long lNbZValues = _mFileReader->getNbDataZ();
00050 
00051         std::string _sXName = _mFileReader->getDataXName();
00052         std::string _sYName = _mFileReader->getDataYName();
00053         std::string _sZName = _mFileReader->getDataZName();
00054         
00055         _mData = new InterpolationData2D(       _sXName,_sYName,_sZName,
00056                                                                                 lNbXValues,lNbYValues,
00057                                                                                 mXValues,mYValues,mZValues);
00058         
00059         initializeInterpolator();
00060         delete(_mFileReader);
00061 
00062 }

Here is the call graph for this function:

Interpolator::Table2D::Table2D std::string  sName,
std::string  sDescription,
std::string  sInterpolationType,
std::string  sXName,
std::string  sYName,
std::string  sZName,
long  lNbDataX,
long  lNbDataY,
double *  mXValues,
double *  mYValues,
double *  mZValues
 

This constructor requires 11 parameters :

  • the name of the table
  • the description of the table
  • the wanted interpolation type ("Bilinear","Nearest","FourNearestMean")
  • the name of the X variable
  • the name of the Y variable
  • the name of the Z variable
  • the number of X Data
  • the number of Y Data
  • the X values
  • the Y values
  • the Z values (unidimensional array).

Definition at line 77 of file Table2D.cpp.

References _mData, and initializeInterpolator().

00087                                                                           :
00088 Table(sName,sDescription,sInterpolationType)
00089 {
00090 
00091         _mData = new InterpolationData2D(       sXName,sYName,sZName,
00092                                                                                 lNbDataX,lNbDataY,
00093                                                                                 mXValues,mYValues,mZValues);
00094         
00095         initializeInterpolator();
00096 
00097 
00098 }

Here is the call graph for this function:


Member Function Documentation

double Interpolator::Table2D::computeValue double  dXValue,
double  dYvalue
 

Return the output value according the entry points couple (dXValue,dYvalue) given in parameter.

Definition at line 131 of file Table2D.cpp.

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

00132 {
00133         return _mInterpolator->getInterpolatedValue(dXValue,dYvalue);
00134 }

Here is the call graph for this function:

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

Fake method
Only to provide the interface.

Implements Interpolator::Table.

Definition at line 138 of file Table2D.cpp.

Referenced by main().

00139 {
00140         return 0.0;
00141 }

InterpolationData2D * Interpolator::Table2D::getInterpolationData  )  const
 

Return the InterpolationData2D object which contains all the data.

Definition at line 144 of file Table2D.cpp.

References _mData.

Referenced by main().

00145 {
00146         return _mData;
00147 }

Interpolator2D* Interpolator::Table2D::getInterpolator  )  const
 

long Interpolator::Table2D::getNbXData  )  const
 

Return the number of X data.

Definition at line 247 of file Table2D.cpp.

References _mInterpolator, Interpolator::Interpolator2D::getInterpolatedData(), and Interpolator::InterpolationData2D::getNbXData().

00248 {
00249         return _mInterpolator->getInterpolatedData()->getNbXData();
00250 }

Here is the call graph for this function:

long Interpolator::Table2D::getNbYData  )  const
 

Return the number of Y data.

Definition at line 253 of file Table2D.cpp.

References _mInterpolator, Interpolator::Interpolator2D::getInterpolatedData(), and Interpolator::InterpolationData2D::getNbYData().

00254 {
00255         return _mInterpolator->getInterpolatedData()->getNbYData();
00256 }

Here is the call graph for this function:

long Interpolator::Table2D::getNbZData  )  const
 

Return the number of Z data.

Definition at line 259 of file Table2D.cpp.

References _mInterpolator, Interpolator::Interpolator2D::getInterpolatedData(), and Interpolator::InterpolationData2D::getNbZData().

00260 {
00261         return _mInterpolator->getInterpolatedData()->getNbZData();
00262 }

Here is the call graph for this function:

double Interpolator::Table2D::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 203 of file Table2D.cpp.

00204 {
00205         return _mInterpolator->getInterpolatedData()->getXValue(i);
00206 }

double * Interpolator::Table2D::getXValues  )  const
 

Return the X values (first column)

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

Definition at line 226 of file Table2D.cpp.

References _mInterpolator, Interpolator::Interpolator2D::getInterpolatedData(), and Interpolator::InterpolationData2D::getXValues().

00227 {
00228         return _mInterpolator->getInterpolatedData()->getXValues();
00229 }

Here is the call graph for this function:

double Interpolator::Table2D::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 211 of file Table2D.cpp.

00212 {
00213         return _mInterpolator->getInterpolatedData()->getYValue(i);
00214 }

double * Interpolator::Table2D::getYValues  )  const
 

Return the Y values (second column)

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

Definition at line 233 of file Table2D.cpp.

References _mInterpolator, Interpolator::Interpolator2D::getInterpolatedData(), and Interpolator::InterpolationData2D::getYValues().

00234 {
00235         return _mInterpolator->getInterpolatedData()->getYValues();
00236 }

Here is the call graph for this function:

double Interpolator::Table2D::getZValue int  i,
int  j
const
 

Return the (ith,jth) value of Z array

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

Definition at line 219 of file Table2D.cpp.

00220 {
00221         return _mInterpolator->getInterpolatedData()->getZValue(i,j);
00222 }

double * Interpolator::Table2D::getZValues  )  const
 

Return the Z array

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

Definition at line 240 of file Table2D.cpp.

References _mInterpolator, Interpolator::Interpolator2D::getInterpolatedData(), and Interpolator::InterpolationData2D::getZValues().

00241 {
00242         return _mInterpolator->getInterpolatedData()->getZValues();
00243 }

Here is the call graph for this function:

void Interpolator::Table2D::initializeInterpolator  )  [private]
 

Method to initialize the interpolator object according the wanted interpolation type.

Todo:
FAIRE les differents cas d'interpolateurs avec un switch case !!!!
Todo:
FAIRE les differents cas d'interpolateurs
Todo:
FAIRE les differents cas d'interpolateurs

Definition at line 101 of file Table2D.cpp.

References _mData, _mInterpolator, Interpolator::Table::getDescription(), and Interpolator::Table::getInterpolationType().

Referenced by Table2D().

00102 {
00104         if (getInterpolationType() == "Bilinear") 
00105         {
00106                 _mInterpolator = new BilinearInterpolator2D("Bilinear Interpolator",
00107                                                                                                         getDescription(),
00108                                                                                                         _mData);
00109         }
00110 
00112         else if (getInterpolationType() == "Nearest") 
00113         {
00114                 _mInterpolator = new NearestNeighbourInterpolator2D("Nearest Neighbour Interpolator",
00115                                                                                                                         getDescription(),
00116                                                                                                                         "Nearest Neighbour",
00117                                                                                                                         _mData);
00118         }
00119 
00121         else if (getInterpolationType() == "FourNearestMean") 
00122         {
00123                 _mInterpolator = new FourNearestNeighboursMeanInterpolator2D(   "FourNearestNeighboursMean Interpolator",
00124                                                                                                                                                 getDescription(),
00125                                                                                                                                                 _mData);
00126         }
00127 }

Here is the call graph for this function:

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

Display info of the Table 2D
Mainly used in DEBUG.

Implements Interpolator::Table.

Definition at line 150 of file Table2D.cpp.

References Interpolator::Interpolator::_verb, Interpolator::Table::getDescription(), Interpolator::Table::getInterpolationType(), and Interpolator::Table::getName().

00151 {
00152         if(Interpolator::_verb == true) cout << "\n##### TABLE 2D --> " << getName() << " #####" << endl;
00153         if(Interpolator::_verb == true) cout << "\tInterpolation Type:" << getInterpolationType() << endl;
00154         if(Interpolator::_verb == true) cout << "\t" << getDescription() << endl;
00155 }

Here is the call graph for this function:

void Interpolator::Table2D::setValues long  lNbXData,
long  lNbYData,
double *  dNewXValues,
double *  dNewYValues,
double *  dNewZValues
 

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

Definition at line 192 of file Table2D.cpp.

References _mInterpolator, Interpolator::Interpolator2D::getInterpolatedData(), and Interpolator::InterpolationData2D::setValues().

00193 {
00194         //First we update the interpolation data structure values
00195         _mInterpolator->getInterpolatedData()->setValues(lNbXData,lNbYData,dNewXValues,dNewYValues,dNewZValues);
00196 }

Here is the call graph for this function:

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

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

Definition at line 171 of file Table2D.cpp.

References _mInterpolator, Interpolator::Interpolator2D::getInterpolatedData(), and Interpolator::InterpolationData2D::setXValue().

00172 {
00173         //First we update the interpolation data structure values
00174         _mInterpolator->getInterpolatedData()->setXValue(i,dNewValue);
00175 }

Here is the call graph for this function:

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

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

Definition at line 178 of file Table2D.cpp.

References _mInterpolator, Interpolator::Interpolator2D::getInterpolatedData(), and Interpolator::InterpolationData2D::setYValue().

00179 {
00180         //First we update the interpolation data structure values
00181         _mInterpolator->getInterpolatedData()->setYValue(i,dNewValue);
00182 }

Here is the call graph for this function:

void Interpolator::Table2D::setZValue int  i,
int  j,
double  dNewValue
 

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

Definition at line 185 of file Table2D.cpp.

References _mInterpolator, Interpolator::Interpolator2D::getInterpolatedData(), and Interpolator::InterpolationData2D::setZValue().

00186 {
00187         //First we update the interpolation data structure values
00188         _mInterpolator->getInterpolatedData()->setZValue(i,j,dNewValue);
00189 }

Here is the call graph for this function:


Member Data Documentation

InterpolationData2D* Interpolator::Table2D::_mData [private]
 

Definition at line 84 of file Table2D.h.

Referenced by getInterpolationData(), initializeInterpolator(), Table2D(), and ~Table2D().

Interpolator2D* Interpolator::Table2D::_mInterpolator [private]
 

Definition at line 83 of file Table2D.h.

Referenced by computeValue(), getNbXData(), getNbYData(), getNbZData(), getXValues(), getYValues(), getZValues(), initializeInterpolator(), setValues(), setXValue(), setYValue(), setZValue(), and ~Table2D().


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