#include "GenericFileReader2D.h"#include "Table2D.h"#include "Table1D.h"#include "Exception.h"Include dependency graph for TestInterpolator2D.cpp:

Go to the source code of this file.
Functions | |
| int | main (int argc, char *argv[]) |
|
||||||||||||
|
Definition at line 9 of file TestInterpolator2D.cpp. References Interpolator::Table2D::computeValue(), Interpolator::GenericFileReader2D::getDataX(), Interpolator::GenericFileReader2D::getDataXName(), Interpolator::GenericFileReader2D::getDataY(), Interpolator::GenericFileReader2D::getDataYName(), Interpolator::GenericFileReader2D::getDataZ(), Interpolator::GenericFileReader2D::getDataZName(), Interpolator::Table1D::getInterpolationData(), Interpolator::Table2D::getInterpolationData(), and Interpolator::Table::getInterpolationType(). 00010 { 00011 00012 Interpolator::GenericFileReader2D* mFileReader = new Interpolator::GenericFileReader2D("..\\data\\TempoRes.txt");//"D:\\Repository\\Tests\\TestInterpolator2D\\data\\TempoRes.txt"); 00013 00014 double* X = mFileReader->getDataX(); 00015 double* Y = mFileReader->getDataY(); 00016 double* Z = mFileReader->getDataZ(); 00017 00018 cout << mFileReader->getDataXName() << endl; 00019 for (int i=0;i<mFileReader->getNbDataX();i++) 00020 { 00021 cout << "X[" << i << "]= " << X[i] << endl; 00022 } 00023 00024 cout << mFileReader->getDataYName() << endl; 00025 for (int j=0;j<mFileReader->getNbDataY();j++) 00026 { 00027 cout << "Y[" << j << "]= " << Y[j] << endl; 00028 } 00029 cout << mFileReader->getDataZName() << endl; 00030 for (int k=0;k<mFileReader->getNbDataZ();k++) 00031 { 00032 cout << "Z[" << k << "]= " << Z[k] << endl; 00033 } 00034 00035 00036 00037 Interpolator::Table2D* mTable = new Interpolator::Table2D( "Res=f(E,fs)", 00038 "Interpolation of the resolution", 00039 "Bilinear", 00040 "..\\data\\TempoResolution350AFe10.txt"); 00041 cout << mTable->getInterpolationData()->getXName() << endl; 00042 cout << mTable->getInterpolationData()->getYName() << endl; 00043 cout << mTable->getInterpolationData()->getZName() << endl; 00044 00045 00046 00047 cout << "INTERPOLATION --> " << mTable->getInterpolationType() << endl; 00048 //Cas oł les 2 indexes ne sont pas dans le tableau 00049 mTable->computeValue(3,30); 00050 cout << endl; 00051 00052 mTable->computeValue(700,30); 00053 cout << endl; 00054 00055 00056 mTable->computeValue(3,130.0); 00057 cout << endl; 00058 mTable->computeValue(700,130.0); 00059 cout << endl; 00060 00061 //Cas oł 1 des 2 indexes n'est pas dans le tableau 00062 mTable->computeValue(3,55.0); 00063 cout << endl; 00064 mTable->computeValue(700,55.0); 00065 cout << endl; 00066 00067 mTable->computeValue(27.5,30.0); 00068 cout << endl; 00069 mTable->computeValue(27.5,130.0); 00070 cout << endl; 00071 00072 //Les 2 indexes sont bons 00073 mTable->computeValue(70.0,45.5); 00074 00075 Interpolator::Table1D* _mGrooveDepthGrating1Table; 00076 00077 00078 try 00079 { 00080 00081 _mGrooveDepthGrating1Table = new Interpolator::Table1D("Table 1" , 00082 "X->Depth" , 00083 "Linear", 00084 "..\\data\\TEMPO350Transl_Depth.txt", 00085 0, 00086 1); 00087 } 00088 catch (Exception& e) 00089 { 00090 cout << e.getReason() << endl; 00091 cout << e.getDescription() << endl; 00092 cout << e.getOrigin() << endl; 00093 } 00094 00095 Interpolator::Table1D* _mGrooveDepthGrating2Table; 00096 00097 try 00098 { 00099 00100 _mGrooveDepthGrating2Table = new Interpolator::Table1D("Table 2" , 00101 "X->Depth" , 00102 "Linear", 00103 "..\\data\\TEMPO800Transl_Depth.txt", 00104 0, 00105 1); 00106 } 00107 catch (Exception& e) 00108 { 00109 cout << e.getReason() << endl; 00110 cout << e.getDescription() << endl; 00111 cout << e.getOrigin() << endl; 00112 } 00113 00114 00115 cout << _mGrooveDepthGrating2Table->getInterpolationData()->getNbData() << endl; 00116 cout << _mGrooveDepthGrating2Table->getInterpolationData()->getXName() << endl; 00117 cout << _mGrooveDepthGrating2Table->getInterpolationData()->getYName() << endl; 00118 cout << _mGrooveDepthGrating2Table->getInterpolationData()->getXValue(2) << endl; 00119 cout << _mGrooveDepthGrating2Table->getInterpolationData()->getYValue(3) << endl; 00120 00121 _mGrooveDepthGrating2Table->getInterpolationData()->setXValue(2,12.6); 00122 _mGrooveDepthGrating2Table->getInterpolationData()->setYValue(3,24.6); 00123 00124 cout << _mGrooveDepthGrating2Table->getInterpolationData()->getXValue(2) << endl; 00125 cout << _mGrooveDepthGrating2Table->getInterpolationData()->getYValue(3) << endl; 00126 00127 double* newDataX = new double[3]; 00128 double* newDataY = new double[3]; 00129 00130 newDataX[0] = 1.0; newDataX[1] = 2.0; newDataX[2] = 3.0; 00131 newDataY[0] = 4.0; newDataY[1] = 5.0; newDataY[2] = 6.0; 00132 00133 _mGrooveDepthGrating2Table->getInterpolationData()->setValues(3,newDataX,newDataY); 00134 00135 delete(newDataX); 00136 delete(newDataY); 00137 00138 cout << _mGrooveDepthGrating2Table->getInterpolationData()->getNbData() << endl; 00139 cout << _mGrooveDepthGrating2Table->getInterpolationData()->getXName() << endl; 00140 cout << _mGrooveDepthGrating2Table->getInterpolationData()->getYName() << endl; 00141 cout << _mGrooveDepthGrating2Table->getInterpolationData()->getXValue(2) << endl; 00142 cout << _mGrooveDepthGrating2Table->getInterpolationData()->getYValue(1) << endl; 00143 00144 00145 00146 00147 Interpolator::Table2D* mTable2 = new Interpolator::Table2D( "Res=f(E,fs)", 00148 "Interpolation of the resolution", 00149 "Nearest", 00150 "..\\data\\TempoResolution350AFe10.txt"); 00151 cout << mTable2->getInterpolationData()->getXName() << endl; 00152 cout << mTable2->getInterpolationData()->getYName() << endl; 00153 cout << mTable2->getInterpolationData()->getZName() << endl; 00154 00155 00156 cout << "\nINTERPOLATION --> " << mTable2->getInterpolationType() << endl; 00157 //Cas oł les 2 indexes ne sont pas dans le tableau 00158 mTable2->computeValue(3,30);cout << endl; 00159 mTable2->computeValue(700,30);cout << endl; 00160 mTable2->computeValue(3,130.0);cout << endl; 00161 mTable2->computeValue(700,130.0);cout << endl; 00162 00163 //Cas oł 1 des 2 indexes n'est pas dans le tableau 00164 mTable2->computeValue(3,55.0);cout << endl; 00165 mTable2->computeValue(700,55.0);cout << endl; 00166 mTable2->computeValue(27.5,30.0);cout << endl; 00167 mTable2->computeValue(27.5,130.0);cout << endl; 00168 00169 //Les 2 indexes sont bons 00170 mTable2->computeValue(70.0,45.5); 00171 00172 Interpolator::Table2D* mTable3 = new Interpolator::Table2D( "Res=f(E,fs)", 00173 "Interpolation of the resolution","FourNearestMean", 00174 "..\\data\\TempoResolution350AFe10.txt"); 00175 cout << mTable3->getInterpolationData()->getXName() << endl; 00176 cout << mTable3->getInterpolationData()->getYName() << endl; 00177 cout << mTable3->getInterpolationData()->getZName() << endl; 00178 00179 cout << "\nINTERPOLATION --> " << mTable3->getInterpolationType() << endl; 00180 //Cas oł les 2 indexes ne sont pas dans le tableau 00181 mTable3->computeValue(3,30);cout << endl; 00182 mTable3->computeValue(700,30);cout << endl; 00183 mTable3->computeValue(3,130.0);cout << endl; 00184 mTable3->computeValue(700,130.0);cout << endl; 00185 00186 //Cas oł 1 des 2 indexes n'est pas dans le tableau 00187 mTable3->computeValue(3,55.0);cout << endl; 00188 mTable3->computeValue(700,55.0);cout << endl; 00189 mTable3->computeValue(27.5,30.0);cout << endl; 00190 mTable3->computeValue(27.5,130.0);cout << endl; 00191 00192 //Les 2 indexes sont bons 00193 mTable3->computeValue(70.0,45.5); 00194 00195 00196 long lNbDataX = 3; 00197 long lNbDataY = 4; 00198 00199 double* mDataX = new double[lNbDataX]; 00200 double* mDataY = new double[lNbDataY]; 00201 double* mDataZ = new double[lNbDataX*lNbDataY]; 00202 00203 mDataX[0] = 1.0; mDataX[1] = 2.0; mDataX[2] = 3.0; 00204 mDataY[0] = 4.0; mDataY[1] = 5.0; mDataY[2] = 6.0; mDataY[3] = 7.0; 00205 00206 mDataZ[0] = 8.0; mDataZ[1] = 9.0; mDataZ[2] = 10.0; mDataZ[3] = 11.0; 00207 mDataZ[4] = 12.0; mDataZ[5] = 13.0; mDataZ[6] = 14.0; mDataZ[7] = 15.0; 00208 mDataZ[8] = 16.0; mDataZ[9] = 17.0; mDataZ[10] = 18.0; mDataZ[11] = 19.0; 00209 00210 00211 Interpolator::Table2D* tableVinz = new Interpolator::Table2D("Table Vinz","Test","Bilinear","X","Y","Z",lNbDataX,lNbDataY,mDataX,mDataY,mDataZ); 00212 00213 tableVinz->getInterpolationData()->printInfos(); 00214 cout << endl; 00215 cout << tableVinz->getInterpolationData()->getNbXData() << endl; 00216 cout << tableVinz->getInterpolationData()->getNbYData() << endl; 00217 cout << tableVinz->getInterpolationData()->getNbZData() << endl; 00218 cout << tableVinz->getInterpolationData()->getXName() << endl; 00219 cout << tableVinz->getInterpolationData()->getYName() << endl; 00220 cout << tableVinz->getInterpolationData()->getZName() << endl; 00221 cout << tableVinz->getInterpolationData()->getXValue(2) << endl; 00222 cout << tableVinz->getInterpolationData()->getYValue(3) << endl; 00223 cout << tableVinz->getInterpolationData()->getZValue(2,3) << endl; 00224 00225 00226 cout << "\nINTERPOLATION --> " << tableVinz->getInterpolationType() << endl; 00227 //Cas oł les 2 indexes ne sont pas dans le tableau 00228 tableVinz->computeValue(0.0,3.0);cout << endl; 00229 tableVinz->computeValue(4.0,3.0);cout << endl; 00230 tableVinz->computeValue(4.0,8.0);cout << endl; 00231 tableVinz->computeValue(0.0,8.0);cout << endl; 00232 00233 //Cas oł 1 des 2 indexes n'est pas dans le tableau 00234 tableVinz->computeValue(1.0,3.0);cout << endl; 00235 tableVinz->computeValue(4.0,4.0);cout << endl; 00236 tableVinz->computeValue(4.0,7.0);cout << endl; 00237 tableVinz->computeValue(1.0,8.0);cout << endl; 00238 00239 //Les 2 indexes sont bons 00240 tableVinz->computeValue(2.5,5.5); 00241 00242 00243 cout << endl; 00244 00245 tableVinz->getInterpolationData()->setXValue(2,12.6); 00246 tableVinz->getInterpolationData()->setYValue(3,24.6); 00247 tableVinz->getInterpolationData()->setZValue(2,3,34.6); 00248 00249 cout << tableVinz->getInterpolationData()->getXValue(2) << endl; 00250 cout << tableVinz->getInterpolationData()->getYValue(3) << endl; 00251 cout << tableVinz->getInterpolationData()->getZValue(2,3) << endl; 00252 00253 tableVinz->getInterpolationData()->printInfos(); 00254 00255 delete(_mGrooveDepthGrating1Table); 00256 delete(_mGrooveDepthGrating2Table); 00257 00258 delete(mTable); 00259 delete(mTable2); 00260 delete(mTable3); 00261 delete(mFileReader); 00262 00263 00264 00265 00266 return 0; 00267 }
Here is the call graph for this function: ![]() |
1.4.5