Interpolator::InterpolationData2D Class Reference

This class stores 2D data for a 2D interpolator. More...

#include <InterpolationData2D.h>

List of all members.

Public Member Functions

 InterpolationData2D ()
 Default constructor.
 InterpolationData2D (std::string sXName, std::string sYName, std::string sZName, long lNbXData, long lNbYData, double *mXValues, double *mYValues, double *mZValues)
 This constructor requires 8 parameters :
  • the name of the X values
  • the name of the Y values
  • the name of the Z values
  • the number of X values
  • the number of Y values
  • the X values array
  • the Y values array
  • the Z values array.

virtual ~InterpolationData2D ()
 Destructor.
std::string getXName () const
 Return the X name (first column).
std::string getYName () const
 Return the Y name (first line).
std::string getZName () const
 Return the Z name (matrix).
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 array
Exceptions:
This method throw a NullPointerException exception if the X array is null.

double * getYValues () const
 Return the Y array
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.

void setXValue (int i, double dNewValue)
 Set 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.

void setYValue (int i, double dNewValue)
 Set 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.

void setZValue (int i, int j, double dNewValue)
 Set 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.

void setValues (long lNbXData, long lNbYData, double *dNewXValues, double *dNewYValues, double *dNewZValues)
 This method allows to change the values of the X,Y and Z arrays
If the matrix size is changed, memory is desallocated and new arrays are reallocated to match the new sizes.
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.
virtual void printInfos ()
 Display the interpolation 2D data
Used mainly for DEBUG.

Private Member Functions

void setXValues (double *dNewValues)
 This method allows to change the values of the X column It is required that the array size is not changed.
void setYValues (double *dNewValues)
 This method allows to change the values of the Y line It is required that the array size is not changed.
void setZValues (double *dNewValues)
 This method allows to change the values of the Z matrix It is required that the array size is not changed.

Private Attributes

std::string _sXName
std::string _sYName
std::string _sZName
long _lNbXData
long _lNbYData
long _lNbZData
double * _mXValues
double * _mYValues
double * _mZValues


Detailed Description

This class stores 2D data for a 2D interpolator.

Definition at line 22 of file InterpolationData2D.h.


Constructor & Destructor Documentation

Interpolator::InterpolationData2D::InterpolationData2D  ) 
 

Default constructor.

Definition at line 16 of file InterpolationData2D.cpp.

00017 {
00018 
00019 }

Interpolator::InterpolationData2D::InterpolationData2D std::string  sXName,
std::string  sYName,
std::string  sZName,
long  lNbXData,
long  lNbYData,
double *  mXValues,
double *  mYValues,
double *  mZValues
 

This constructor requires 8 parameters :

  • the name of the X values
  • the name of the Y values
  • the name of the Z values
  • the number of X values
  • the number of Y values
  • the X values array
  • the Y values array
  • the Z values array.

Definition at line 41 of file InterpolationData2D.cpp.

References _lNbXData, _lNbYData, _lNbZData, _mXValues, _mYValues, _mZValues, and setValues().

00043                                                                                                                                               : 
00044 _sXName(sXName),_sYName(sYName),_sZName(sZName),
00045 _lNbXData(lNbXData),_lNbYData(lNbYData),_lNbZData(lNbXData*lNbYData)
00046 {
00047 
00048         _mXValues = new double[_lNbXData];
00049         _mYValues = new double[_lNbYData];
00050         _mZValues = new double[_lNbZData];
00051 
00052         setValues(_lNbXData,_lNbYData,mXValues,mYValues,mZValues);
00053 }

Here is the call graph for this function:

Interpolator::InterpolationData2D::~InterpolationData2D  )  [virtual]
 

Destructor.

Definition at line 22 of file InterpolationData2D.cpp.

References _mXValues, _mYValues, and _mZValues.

00023 {
00024         delete [] _mXValues;
00025         delete [] _mYValues;
00026         delete [] _mZValues;
00027         _mXValues = 0;
00028         _mYValues = 0;
00029         _mZValues = 0;
00030 }


Member Function Documentation

long Interpolator::InterpolationData2D::getNbXData  )  const
 

Return the number of X data.

Definition at line 107 of file InterpolationData2D.cpp.

References _lNbXData.

Referenced by Interpolator::NearestNeighbourInterpolator2D::compute(), Interpolator::FourNearestNeighboursMeanInterpolator2D::compute(), Interpolator::BilinearInterpolator2D::compute(), Interpolator::Table2D::getNbXData(), printInfos(), setValues(), setXValue(), and setZValue().

00108 {
00109         return _lNbXData;
00110 }

long Interpolator::InterpolationData2D::getNbYData  )  const
 

Return the number of Y data.

Definition at line 113 of file InterpolationData2D.cpp.

References _lNbYData.

Referenced by Interpolator::NearestNeighbourInterpolator2D::compute(), Interpolator::FourNearestNeighboursMeanInterpolator2D::compute(), Interpolator::BilinearInterpolator2D::compute(), Interpolator::Table2D::getNbYData(), printInfos(), setValues(), setYValue(), and setZValue().

00114 {
00115         return _lNbYData;
00116 }

long Interpolator::InterpolationData2D::getNbZData  )  const
 

Return the number of Z data.

Definition at line 119 of file InterpolationData2D.cpp.

References _lNbZData.

Referenced by Interpolator::Table2D::getNbZData().

00120 {
00121         return _lNbZData;
00122 }

std::string Interpolator::InterpolationData2D::getXName  )  const
 

Return the X name (first column).

Definition at line 56 of file InterpolationData2D.cpp.

References _sXName.

Referenced by printInfos().

00057 {
00058         return _sXName;
00059 }

double Interpolator::InterpolationData2D::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 77 of file InterpolationData2D.cpp.

Referenced by Interpolator::Interpolator2D::findXIndex(), and printInfos().

00078 {
00079         if ((i < 0) || (i >= getNbXData())) throw IndexOutOfBoundException("index",i,0,getNbXData(),"InterpolationData2D::getXValue(int i)",__FILE__,__LINE__); 
00080         if (_mXValues == 0) throw NullPointerException("_mXValues","InterpolationData2D::getXValue(int i)",__FILE__,__LINE__);
00081         return _mXValues[i];
00082 }

double * Interpolator::InterpolationData2D::getXValues  )  const
 

Return the X array

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

Definition at line 162 of file InterpolationData2D.cpp.

References _mXValues.

Referenced by Interpolator::Table2D::getXValues().

00163 {
00164         if (_mXValues == 0) throw NullPointerException("_mXValues","InterpolationData2D::getXValues()",__FILE__,__LINE__);
00165         return _mXValues;
00166 }

std::string Interpolator::InterpolationData2D::getYName  )  const
 

Return the Y name (first line).

Definition at line 62 of file InterpolationData2D.cpp.

References _sYName.

Referenced by printInfos().

00063 {
00064         return _sYName;
00065 }

double Interpolator::InterpolationData2D::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 87 of file InterpolationData2D.cpp.

Referenced by Interpolator::Interpolator2D::findYIndex(), and printInfos().

00088 {
00089         if ((i < 0) || (i >= getNbYData())) throw IndexOutOfBoundException("index",i,0,getNbYData(),"InterpolationData2D::getYValue(int i)",__FILE__,__LINE__); 
00090         if (_mYValues == 0) throw NullPointerException("_mYValues","InterpolationData2D::getYValue(int i)",__FILE__,__LINE__);
00091         return _mYValues[i];
00092 }

double * Interpolator::InterpolationData2D::getYValues  )  const
 

Return the Y array

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

Definition at line 170 of file InterpolationData2D.cpp.

References _mYValues.

Referenced by Interpolator::Table2D::getYValues().

00171 {
00172         if (_mYValues == 0) throw NullPointerException("_mYValues","InterpolationData2D::getYValues()",__FILE__,__LINE__);
00173         return _mYValues;
00174 }

std::string Interpolator::InterpolationData2D::getZName  )  const
 

Return the Z name (matrix).

Definition at line 68 of file InterpolationData2D.cpp.

References _sZName.

Referenced by printInfos().

00069 {
00070         return _sZName;
00071 }

double Interpolator::InterpolationData2D::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 97 of file InterpolationData2D.cpp.

Referenced by Interpolator::NearestNeighbourInterpolator2D::compute(), Interpolator::FourNearestNeighboursMeanInterpolator2D::compute(), Interpolator::BilinearInterpolator2D::compute(), and printInfos().

00098 {
00099         if ((i < 0) || (i >= getNbXData())) throw IndexOutOfBoundException("index",i,0,getNbXData(),"InterpolationData2D::getZValue(int i,int j)",__FILE__,__LINE__); 
00100         if ((j < 0) || (j >= getNbYData())) throw IndexOutOfBoundException("index",j,0,getNbYData(),"InterpolationData2D::getZValue(int i,int j)",__FILE__,__LINE__); 
00101         if (_mZValues == 0) throw NullPointerException("_mZValues","InterpolationData2D::getZValue(int i,int j)",__FILE__,__LINE__);
00102         return _mZValues[i*_lNbYData + j];
00103 }

double * Interpolator::InterpolationData2D::getZValues  )  const
 

Return the Z array

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

Definition at line 178 of file InterpolationData2D.cpp.

References _mZValues.

Referenced by Interpolator::Table2D::getZValues().

00179 {
00180         if (_mZValues == 0) throw NullPointerException("_mZValues","InterpolationData2D::getZValues()",__FILE__,__LINE__);
00181         return _mZValues;
00182 }

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

Display the interpolation 2D data
Used mainly for DEBUG.

Definition at line 248 of file InterpolationData2D.cpp.

References Interpolator::Interpolator::_verb, getNbXData(), getNbYData(), getXName(), getXValue(), getYName(), getYValue(), getZName(), and getZValue().

00249 {
00250         int i,j;
00251 
00252         if(Interpolator::_verb == true) cout << "\n##### INTERPOLATION DATA 2D #####" << endl;
00253         if(Interpolator::_verb == true) cout << "X Name=" << getXName() << " | Y Name=" << getYName() << " | Z Name=" << getZName() << endl;
00254         if(Interpolator::_verb == true) cout << "\t";
00255 
00256         for (i=0;i < getNbYData();i++) 
00257         {
00258                 if(Interpolator::_verb == true) cout << getYValue(i) << "\t";
00259         }
00260         if(Interpolator::_verb == true) cout << endl;
00261 
00262         for (i=0;i< getNbXData();i++)
00263         {
00264                 for (j=-1;j < getNbYData();j++)
00265                 {
00266                         if (j==-1) if(Interpolator::_verb == true) cout << getXValue(i) << "\t";
00267                         else if(Interpolator::_verb == true) cout << getZValue(i,j) << "\t";
00268                 }
00269                 if(Interpolator::_verb == true) cout << endl;
00270         }
00271 
00272 }

Here is the call graph for this function:

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

This method allows to change the values of the X,Y and Z arrays
If the matrix size is changed, memory is desallocated and new arrays are reallocated to match the new sizes.

Definition at line 222 of file InterpolationData2D.cpp.

References _lNbXData, _lNbYData, _lNbZData, _mXValues, _mYValues, _mZValues, getNbXData(), getNbYData(), setXValues(), setYValues(), and setZValues().

Referenced by InterpolationData2D(), and Interpolator::Table2D::setValues().

00223 {
00224 
00225   if (lNbXData != getNbXData() || lNbYData != getNbYData()) //It is necessary to reallocate the X and Z array
00226   { 
00227         delete [] _mXValues;
00228         delete [] _mYValues;
00229         delete [] _mZValues;
00230         
00231         _lNbXData = lNbXData;
00232         _lNbYData = lNbYData;
00233         _lNbZData = lNbXData * lNbYData;
00234 
00235         _mXValues = new double[_lNbXData];
00236         _mYValues = new double[_lNbYData];
00237         _mZValues = new double[_lNbZData];
00238    }
00239         
00240   setXValues(dNewXValues);
00241   setYValues(dNewYValues);
00242   setZValues(dNewZValues);
00243 }

Here is the call graph for this function:

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

Set 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 131 of file InterpolationData2D.cpp.

References _mXValues, and getNbXData().

Referenced by Interpolator::Table2D::setXValue(), and setXValues().

00132 {
00133         if ((i < 0) || (i >= getNbXData())) throw IndexOutOfBoundException("index",i,0,getNbXData(),"InterpolationData2D::setXValue(int i,double dNewValue)",__FILE__,__LINE__); 
00134         if (_mXValues == 0) throw NullPointerException("_mXValues","InterpolationData2D::setXValue(int i,double dNewValue)",__FILE__,__LINE__);
00135         _mXValues[i] = dNewValue;
00136 }

Here is the call graph for this function:

void Interpolator::InterpolationData2D::setXValues double *  dNewValues  )  [private]
 

This method allows to change the values of the X column It is required that the array size is not changed.

Definition at line 187 of file InterpolationData2D.cpp.

References _lNbXData, and setXValue().

Referenced by setValues().

00188 {
00189     for (int i=0;i<_lNbXData;i++)
00190         {
00191           setXValue(i,*(dNewValues+i));
00192         }
00193 }

Here is the call graph for this function:

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

Set 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 141 of file InterpolationData2D.cpp.

References _mYValues, and getNbYData().

Referenced by Interpolator::Table2D::setYValue(), and setYValues().

00142 {
00143         if ((i < 0) || (i >= getNbYData())) throw IndexOutOfBoundException("index",i,0,getNbYData(),"InterpolationData2D::setYValue(int i,double dNewValue)",__FILE__,__LINE__); 
00144         if (_mYValues == 0) throw NullPointerException("_mYValues","InterpolationData2D::setYValue(int i,double dNewValue)",__FILE__,__LINE__);
00145         _mYValues[i] = dNewValue;
00146 }

Here is the call graph for this function:

void Interpolator::InterpolationData2D::setYValues double *  dNewValues  )  [private]
 

This method allows to change the values of the Y line It is required that the array size is not changed.

Definition at line 197 of file InterpolationData2D.cpp.

References _lNbYData, and setYValue().

Referenced by setValues().

00198 {   
00199     for (int i=0;i<_lNbYData;i++)
00200         {
00201           setYValue(i,*(dNewValues+i));
00202         }
00203 }

Here is the call graph for this function:

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

Set 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 152 of file InterpolationData2D.cpp.

References _lNbYData, _mZValues, getNbXData(), and getNbYData().

Referenced by Interpolator::Table2D::setZValue(), and setZValues().

00153 {
00154         if ((i < 0) || (i >= getNbXData())) throw IndexOutOfBoundException("index",i,0,getNbXData(),"InterpolationData2D::setZValue(int i,int j,double dNewValue)",__FILE__,__LINE__); 
00155         if ((j < 0) || (j >= getNbYData())) throw IndexOutOfBoundException("index",j,0,getNbYData(),"InterpolationData2D::setZValue(int i,int j,double dNewValue)",__FILE__,__LINE__); 
00156         if (_mZValues == 0) throw NullPointerException("_mZValues","InterpolationData2D::setZValue(int i,int j,double dNewValue)",__FILE__,__LINE__);
00157         _mZValues[i*_lNbYData + j] = dNewValue;
00158 }

Here is the call graph for this function:

void Interpolator::InterpolationData2D::setZValues double *  dNewValues  )  [private]
 

This method allows to change the values of the Z matrix It is required that the array size is not changed.

Definition at line 208 of file InterpolationData2D.cpp.

References _lNbXData, _lNbYData, and setZValue().

Referenced by setValues().

00209 {   
00210  for (int i=0;i<_lNbXData;i++)
00211  {
00212         for (int j=0;j<_lNbYData;j++)
00213         {
00214                 setZValue(i,j,*(dNewValues+(i*_lNbYData + j)));
00215         }
00216  }
00217 }

Here is the call graph for this function:


Member Data Documentation

long Interpolator::InterpolationData2D::_lNbXData [private]
 

Definition at line 63 of file InterpolationData2D.h.

Referenced by getNbXData(), InterpolationData2D(), setValues(), setXValues(), and setZValues().

long Interpolator::InterpolationData2D::_lNbYData [private]
 

Definition at line 64 of file InterpolationData2D.h.

Referenced by getNbYData(), InterpolationData2D(), setValues(), setYValues(), setZValue(), and setZValues().

long Interpolator::InterpolationData2D::_lNbZData [private]
 

Definition at line 65 of file InterpolationData2D.h.

Referenced by getNbZData(), InterpolationData2D(), and setValues().

double* Interpolator::InterpolationData2D::_mXValues [private]
 

Definition at line 67 of file InterpolationData2D.h.

Referenced by getXValues(), InterpolationData2D(), setValues(), setXValue(), and ~InterpolationData2D().

double* Interpolator::InterpolationData2D::_mYValues [private]
 

Definition at line 68 of file InterpolationData2D.h.

Referenced by getYValues(), InterpolationData2D(), setValues(), setYValue(), and ~InterpolationData2D().

double* Interpolator::InterpolationData2D::_mZValues [private]
 

Definition at line 69 of file InterpolationData2D.h.

Referenced by getZValues(), InterpolationData2D(), setValues(), setZValue(), and ~InterpolationData2D().

std::string Interpolator::InterpolationData2D::_sXName [private]
 

Definition at line 59 of file InterpolationData2D.h.

Referenced by getXName().

std::string Interpolator::InterpolationData2D::_sYName [private]
 

Definition at line 60 of file InterpolationData2D.h.

Referenced by getYName().

std::string Interpolator::InterpolationData2D::_sZName [private]
 

Definition at line 61 of file InterpolationData2D.h.

Referenced by getZName().


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