#include <InterpolationData1D.h>
Public Member Functions | |||||||
| InterpolationData1D () | |||||||
| Default constructor. | |||||||
| InterpolationData1D (std::string sXName, std::string sYName, long lNbData, double *mXValues, double *mYValues) | |||||||
This constructor requires 5 parameters :
| |||||||
| virtual | ~InterpolationData1D () | ||||||
| Destructor. | |||||||
| std::string | getXName () const | ||||||
| Return the X name (first column --> entry point for the interpolation). | |||||||
| std::string | getYName () const | ||||||
| Return the Y name (second column --> value interpolated). | |||||||
| double | getXValue (int i) const | ||||||
Return the ith value of X array
| |||||||
| double | getYValue (int i) const | ||||||
Return the ith value of Y array
| |||||||
| double * | getXValues () const | ||||||
Return the X values (first column)
| |||||||
| double * | getYValues () const | ||||||
Return the Y values (second column)
| |||||||
| void | setXValue (int i, double dNewValue) | ||||||
Set the ith value of X array THE NEW VALUE MUST LET THE X ARRAY INCREASINGLY ORDERED !!!!
| |||||||
| void | setYValue (int i, double dNewValue) | ||||||
Set the ith value of Y array
| |||||||
| void | setValues (long lNbData, double *dNewXValues, double *dNewYValues) | ||||||
| This method allows to change the values of the X and Y columns If the array size is changed, memory is desallocated and new arrays are reallocated to match the new size. | |||||||
| long | getNbData () const | ||||||
| Return the number of data. | |||||||
| int | checkDataValidity (long lNbData, double *dNewXValues) | ||||||
| This method allow to check if the data are valids One limitation of the interpolator of GSL is that the data must be ordered increasingly. | |||||||
| void | checkSize (long lNbData) | ||||||
| void | DisplayData () | ||||||
| Display the data Used for debug. | |||||||
Private Member Functions | |||||||
| void | setXValues (double *dNewValues) | ||||||
| This method allows to change the values of the X column THE NEW VALUES MUST LET THE X ARRAY INCREASINGLY ORDERED !!!! It is required that the array size is not changed. | |||||||
| void | setYValues (double *dNewValues) | ||||||
| This method allows to change the values of the Y column It is required that the array size is not changed. | |||||||
| void | setXValuesInInverseOrder (double *dNewValues) | ||||||
| This method allows to change the values of the X column in inverse order (useful when data are not increasingly ordered) THE NEW VALUES MUST LET THE X ARRAY INCREASINGLY ORDERED !!!! It is required that the array size is not changed. | |||||||
| void | setYValuesInInverseOrder (double *dNewValues) | ||||||
| This method allows to change the values of the Y column in inverse order (useful when data are not increasingly ordered) It is required that the array size is not changed. | |||||||
Private Attributes | |||||||
| std::string | _sXName | ||||||
| std::string | _sYName | ||||||
| long | _lNbData | ||||||
| double * | _mXValues | ||||||
| double * | _mYValues | ||||||
Definition at line 22 of file InterpolationData1D.h.
|
|
Default constructor.
Definition at line 18 of file InterpolationData1D.cpp.
|
|
||||||||||||||||||||||||
|
This constructor requires 5 parameters :
Definition at line 45 of file InterpolationData1D.cpp. References _lNbData, _mXValues, _mYValues, and setValues(). 00047 : 00048 _sXName(sXName),_sYName(sYName),_lNbData(lNbData),_mXValues(0),_mYValues(0) 00049 { 00050 _mXValues = new double[_lNbData]; 00051 _mYValues = new double[_lNbData]; 00052 00053 setValues(lNbData,mXValues,mYValues); 00054 }
Here is the call graph for this function: ![]() |
|
|
Destructor.
Definition at line 24 of file InterpolationData1D.cpp. References _mXValues, and _mYValues. 00025 { 00026 if (_mXValues) 00027 { 00028 delete [] _mXValues; 00029 _mXValues = 0; 00030 } 00031 00032 if (_mYValues) 00033 { 00034 delete [] _mYValues; 00035 _mYValues = 0; 00036 } 00037 }
|
|
||||||||||||
|
This method allow to check if the data are valids One limitation of the interpolator of GSL is that the data must be ordered increasingly. It is necessary to check that the data are ordered, moreover in increasing order and that there are no two same values Return an int which indicate how are the data 1 : the data are ok and in increasingly ordered -1 : the data are ok but decreasingly ordered (must be reorder in order to work) 0 : the data are not ok they are not ordered -2 : two data are identical (must remove one) Definition at line 274 of file InterpolationData1D.cpp. Referenced by setValues(). 00275 { 00276 double dFirstValue = *dNewXValues; 00277 double dSecondValue = *(dNewXValues+1); 00278 int i; 00279 bool bIsIncreasing = true; 00280 00281 //Check the possible ordering 00282 00283 if (dFirstValue == dSecondValue) //The two first values are identical : problem !!! 00284 { 00285 return -2; 00286 } 00287 else if (dFirstValue < dSecondValue) //All the values must be in increasing order 00288 { 00289 bIsIncreasing = true; 00290 } 00291 else //All the values must be in decreasing order 00292 { 00293 bIsIncreasing = false; 00294 } 00295 00296 double dLastValue = dSecondValue; 00297 double dNewValue; 00298 00299 //Check the ordering of the values 00300 for (i=2;i<lNbData;i++) 00301 { 00302 dNewValue = *(dNewXValues+i); 00303 00304 if (bIsIncreasing) 00305 { 00306 if (dNewValue < dLastValue) return 0; 00307 else if (dNewValue == dLastValue) return -2; 00308 } 00309 else 00310 { 00311 if (dNewValue > dLastValue) return 0; 00312 else if (dNewValue == dLastValue) return -2; 00313 } 00314 00315 dLastValue = dNewValue; 00316 } 00317 00318 //In this case it's ok the data are ordered and with the boolean i know if i need to sort or no the values 00319 if (i == lNbData) 00320 { 00321 if (bIsIncreasing) return 1; 00322 else return -1; 00323 } 00324 00325 return 2; //This case must never happen 00326 }
|
|
|
Definition at line 246 of file InterpolationData1D.cpp. References _lNbData, _mXValues, _mYValues, and getNbData(). Referenced by setValues(). 00247 { 00248 if (lNbData != getNbData()) //It is necessary to reallocate the arrays 00249 { 00250 delete [] _mXValues; 00251 delete [] _mYValues; 00252 00253 _lNbData = lNbData; 00254 00255 _mXValues = new double[_lNbData]; 00256 _mYValues = new double[_lNbData]; 00257 } 00258 }
Here is the call graph for this function: ![]() |
|
|
Display the data
Definition at line 331 of file InterpolationData1D.cpp. References Interpolator::Interpolator::_verb, getNbData(), getXName(), getXValue(), getYName(), and getYValue(). Referenced by Interpolator::Table1D::printInfos(). 00332 { 00333 if(Interpolator::_verb == true) cout << "\t" << getXName() << "\t\t " << getYName() << endl; 00334 for (int i=0;i<getNbData();i++) 00335 { 00336 if(Interpolator::_verb == true) cout << i << "\t" << getXValue(i) << "\t\t " << getYValue(i) << endl; 00337 } 00338 }
Here is the call graph for this function: ![]() |
|
|
Return the number of data.
Definition at line 90 of file InterpolationData1D.cpp. References _lNbData. Referenced by checkSize(), DisplayData(), Interpolator::Table1D::getNbData(), Interpolator::Interpolator1D::getNbData(), setXValue(), and setYValue(). 00091 { 00092 return _lNbData; 00093 }
|
|
|
Return the X name (first column --> entry point for the interpolation).
Definition at line 57 of file InterpolationData1D.cpp. References _sXName. Referenced by DisplayData(), and setValues(). 00058 { 00059 return _sXName; 00060 }
|
|
|
Return the ith value of X array
Definition at line 71 of file InterpolationData1D.cpp. Referenced by DisplayData(), and Interpolator::Table1D::getXValue(). 00072 { 00073 00074 if ((i < 0) || (i >= getNbData())) throw IndexOutOfBoundException("index",i,0,getNbData(),"InterpolationData1D::getXValue(int i)",__FILE__,__LINE__); 00075 if (_mXValues == 0) throw NullPointerException("_mXValues","InterpolationData1D::getXValue(int i)",__FILE__,__LINE__); 00076 return _mXValues[i]; 00077 }
|
|
|
Return the X values (first column)
Definition at line 120 of file InterpolationData1D.cpp. References _mXValues. Referenced by Interpolator::AkimaInterpolator1D::AkimaInterpolator1D(), Interpolator::CubicSplineInterpolator1D::CubicSplineInterpolator1D(), Interpolator::Table1D::getXValues(), Interpolator::LinearInterpolator1D::LinearInterpolator1D(), Interpolator::PeriodicAkimaInterpolator1D::PeriodicAkimaInterpolator1D(), Interpolator::PeriodicCubicSplineInterpolator1D::PeriodicCubicSplineInterpolator1D(), and Interpolator::PolynomialInterpolator1D::PolynomialInterpolator1D(). 00121 { 00122 if (_mXValues == 0) throw NullPointerException("_mXValues","InterpolationData1D::getXValues()",__FILE__,__LINE__); 00123 return _mXValues; 00124 }
|
|
|
Return the Y name (second column --> value interpolated).
Definition at line 63 of file InterpolationData1D.cpp. References _sYName. Referenced by DisplayData(), and setValues(). 00064 { 00065 return _sYName; 00066 }
|
|
|
Return the ith value of Y array
Definition at line 82 of file InterpolationData1D.cpp. Referenced by DisplayData(), and Interpolator::Table1D::getYValue(). 00083 { 00084 if ((i < 0) || (i >= getNbData())) throw IndexOutOfBoundException("index",i,0,getNbData(),"InterpolationData1D::getYValue(int i)",__FILE__,__LINE__); 00085 if (_mYValues == 0) throw NullPointerException("_mYValues","InterpolationData1D::getYValue(int i)",__FILE__,__LINE__); 00086 return _mYValues[i]; 00087 }
|
|
|
Return the Y values (second column)
Definition at line 128 of file InterpolationData1D.cpp. References _mYValues. Referenced by Interpolator::AkimaInterpolator1D::AkimaInterpolator1D(), Interpolator::CubicSplineInterpolator1D::CubicSplineInterpolator1D(), Interpolator::Table1D::getYValues(), Interpolator::LinearInterpolator1D::LinearInterpolator1D(), Interpolator::PeriodicAkimaInterpolator1D::PeriodicAkimaInterpolator1D(), Interpolator::PeriodicCubicSplineInterpolator1D::PeriodicCubicSplineInterpolator1D(), and Interpolator::PolynomialInterpolator1D::PolynomialInterpolator1D(). 00129 { 00130 if (_mYValues == 0) throw NullPointerException("_mYValues","InterpolationData1D::getYValues()",__FILE__,__LINE__); 00131 return _mYValues; 00132 }
|
|
||||||||||||||||
|
This method allows to change the values of the X and Y columns
Definition at line 183 of file InterpolationData1D.cpp. References Interpolator::Interpolator::_verb, checkDataValidity(), checkSize(), getXName(), getYName(), setXValues(), setXValuesInInverseOrder(), setYValues(), and setYValuesInInverseOrder(). Referenced by InterpolationData1D(), and Interpolator::Table1D::setValues(). 00184 { 00185 00186 switch(checkDataValidity(lNbData,dNewXValues)) 00187 { 00188 case -1 : //the data are ok but decreasingly ordered (must be reorder in order to work) 00189 checkSize(lNbData); 00190 if(Interpolator::_verb == true) cout << "DATA NOT ORDERED --> ORDERING FOR YOU !!!" << endl; 00191 setXValuesInInverseOrder(dNewXValues); 00192 setYValuesInInverseOrder(dNewYValues); 00193 break; 00194 case 1 : //the data are ok and in increasingly ordered 00195 00196 setXValues(dNewXValues); 00197 setYValues(dNewYValues); 00198 break; 00199 case 0 : //the data are not ok they are not ordered 00200 { 00201 std::string sTableName = "("; 00202 sTableName+=getXName(); 00203 sTableName+=" --> "; 00204 sTableName+=getYName(); 00205 sTableName+=")"; 00206 00207 throw NotAllowedOperationException( sTableName, 00208 "The values of the table are not ordered !!! --> Check the table values", 00209 "void InterpolationData1D::setValues(long lNbData,double* dNewXValues,double* dNewYValues)", 00210 __FILE__, 00211 __LINE__); 00212 break; 00213 } 00214 case -2 : //two data are identical (must remove one) 00215 { 00216 std::string sTableName = "("; 00217 sTableName+=getXName(); 00218 sTableName+=" --> "; 00219 sTableName+=getYName(); 00220 sTableName+=")"; 00221 throw NotAllowedOperationException( sTableName, 00222 "Two values of the entry column are the same !!! --> Check the table values", 00223 "void InterpolationData1D::setValues(long lNbData,double* dNewXValues,double* dNewYValues)", 00224 __FILE__, 00225 __LINE__); 00226 00227 break; 00228 } 00229 default : 00230 { 00231 std::string sTableName = "("; 00232 sTableName+=getXName(); 00233 sTableName+=" --> "; 00234 sTableName+=getYName(); 00235 sTableName+=")"; 00236 throw NotAllowedOperationException( sTableName, 00237 "Unknow Exception during the set values of the table --> Check the table values", 00238 "void InterpolationData1D::setValues(long lNbData,double* dNewXValues,double* dNewYValues)", 00239 __FILE__, 00240 __LINE__); 00241 } 00242 } 00243 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
Set the ith value of X array THE NEW VALUE MUST LET THE X ARRAY INCREASINGLY ORDERED !!!!
Definition at line 100 of file InterpolationData1D.cpp. References _mXValues, and getNbData(). Referenced by Interpolator::Table1D::setXValue(), setXValues(), and setXValuesInInverseOrder(). 00101 { 00102 if ((i < 0) || (i >= getNbData())) throw IndexOutOfBoundException("index",i,0,getNbData(),"InterpolationData1D::setXValue(int i,double dNewValue)",__FILE__,__LINE__); 00103 if (_mXValues == 0) throw NullPointerException("_mXValues","InterpolationData1D::setXValue(int i,double dNewValue)",__FILE__,__LINE__); 00104 _mXValues[i] = dNewValue; 00105 }
Here is the call graph for this function: ![]() |
|
|
This method allows to change the values of the X column THE NEW VALUES MUST LET THE X ARRAY INCREASINGLY ORDERED !!!! It is required that the array size is not changed.
Definition at line 138 of file InterpolationData1D.cpp. References _lNbData, and setXValue(). Referenced by setValues(). 00139 { 00140 for (int i=0;i<_lNbData;i++) 00141 { 00142 setXValue(i,*(dNewValues+i)); 00143 } 00144 }
Here is the call graph for this function: ![]() |
|
|
This method allows to change the values of the X column in inverse order (useful when data are not increasingly ordered) THE NEW VALUES MUST LET THE X ARRAY INCREASINGLY ORDERED !!!! It is required that the array size is not changed.
Definition at line 160 of file InterpolationData1D.cpp. References _lNbData, and setXValue(). Referenced by setValues(). 00161 { 00162 for (int i=0;i<_lNbData;i++) 00163 { 00164 setXValue(i,*(dNewValues + _lNbData - i - 1)); 00165 } 00166 }
Here is the call graph for this function: ![]() |
|
||||||||||||
|
Set the ith value of Y array
Definition at line 110 of file InterpolationData1D.cpp. References _mYValues, and getNbData(). Referenced by Interpolator::Table1D::setYValue(), setYValues(), and setYValuesInInverseOrder(). 00111 { 00112 if ((i < 0) || (i >= getNbData())) throw IndexOutOfBoundException("index",i,0,getNbData(),"InterpolationData1D::setYValue(int i,double dNewValue)",__FILE__,__LINE__); 00113 if (_mYValues == 0) throw NullPointerException("_mYValues","InterpolationData1D::setYValue(int i,double dNewValue)",__FILE__,__LINE__); 00114 _mYValues[i] = dNewValue; 00115 }
Here is the call graph for this function: ![]() |
|
|
This method allows to change the values of the Y column It is required that the array size is not changed.
Definition at line 148 of file InterpolationData1D.cpp. References _lNbData, and setYValue(). Referenced by setValues(). 00149 { 00150 for (int i=0;i<_lNbData;i++) 00151 { 00152 setYValue(i,*(dNewValues+i)); 00153 } 00154 }
Here is the call graph for this function: ![]() |
|
|
This method allows to change the values of the Y column in inverse order (useful when data are not increasingly ordered) It is required that the array size is not changed.
Definition at line 170 of file InterpolationData1D.cpp. References _lNbData, and setYValue(). Referenced by setValues(). 00171 { 00172 for (int i=0;i<_lNbData;i++) 00173 { 00174 setYValue(i,*(dNewValues + _lNbData - i - 1)); 00175 } 00176 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 53 of file InterpolationData1D.h. Referenced by checkSize(), getNbData(), InterpolationData1D(), setXValues(), setXValuesInInverseOrder(), setYValues(), and setYValuesInInverseOrder(). |
|
|
Definition at line 54 of file InterpolationData1D.h. Referenced by checkSize(), getXValues(), InterpolationData1D(), setXValue(), and ~InterpolationData1D(). |
|
|
Definition at line 55 of file InterpolationData1D.h. Referenced by checkSize(), getYValues(), InterpolationData1D(), setYValue(), and ~InterpolationData1D(). |
|
|
Definition at line 51 of file InterpolationData1D.h. Referenced by getXName(). |
|
|
Definition at line 52 of file InterpolationData1D.h. Referenced by getYName(). |
1.4.5