#include <GenericFileReader2D.h>
Inherits Interpolator::FileReader.
Inheritance diagram for Interpolator::GenericFileReader2D:


Public Member Functions | |||||||
| GenericFileReader2D () | |||||||
| Default constructor. | |||||||
| virtual | ~GenericFileReader2D () | ||||||
| Destructor. | |||||||
| GenericFileReader2D (const std::string &sFileName) | |||||||
This constructor requires 1 parameter :
| |||||||
| GenericFileReader2D (const std::string &sFileName, long lNbColumns, long lNbLines) | |||||||
This constructor requires 3 parameters :
| |||||||
| virtual void | Parse () | ||||||
| This method parse the buffer to read a generic file . | |||||||
| double * | getDataX () const | ||||||
| Return the X column data. | |||||||
| double * | getDataY () const | ||||||
| Return the Y line data. | |||||||
| double * | getDataZ () const | ||||||
| Return the Z matrix data. | |||||||
| double | getValue (int iColumnNumber, int iLineNumber) const | ||||||
| long | getNbDataX () | ||||||
| Return the number of X data. | |||||||
| long | getNbDataY () | ||||||
| Return the number of Y data. | |||||||
| long | getNbDataZ () | ||||||
| Return the number of Z data. | |||||||
| std::string | getDataXName () | ||||||
| Return the X column name. | |||||||
| std::string | getDataYName () | ||||||
| Return the Y line name. | |||||||
| std::string | getDataZName () | ||||||
| Return the Z matrix name. | |||||||
| void | displayAll () | ||||||
| Display the data Used for DEBUG. | |||||||
Private Member Functions | |||||||
| double * | getColumn (int iColumnNumber) const | ||||||
Return the iColumnNumber column data (0 for X,1 for Y,2 for Z)
| |||||||
Private Attributes | |||||||
| long | _lNbDataX | ||||||
| long | _lNbDataY | ||||||
| long | _lNbDataZ | ||||||
| std::string | _sXName | ||||||
| std::string | _sYName | ||||||
| std::string | _sZName | ||||||
| vector< double * > * | _mVector | ||||||
Definition at line 22 of file GenericFileReader2D.h.
|
|
Default constructor.
Definition at line 15 of file GenericFileReader2D.cpp. References _mVector. 00016 { 00017 _mVector = new vector< double* >(); 00018 }
|
|
|
Destructor.
Definition at line 21 of file GenericFileReader2D.cpp. References _mVector, and getColumn(). 00022 { 00023 for (int i=0;i< (signed)_mVector->size();i++) 00024 { 00025 double * pColumn = getColumn(i); 00026 if (pColumn) 00027 { 00028 delete [] pColumn; 00029 pColumn = 0; 00030 } 00031 } 00032 00033 DESTRUCTION(_mVector); 00034 }
Here is the call graph for this function: ![]() |
|
|
This constructor requires 1 parameter :
Definition at line 38 of file GenericFileReader2D.cpp. References _mVector, and Parse(). 00038 : FileReader(sFileName) 00039 { 00040 _mVector = new vector< double* >(); 00041 Parse(); 00042 }
Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
This constructor requires 3 parameters :
Definition at line 48 of file GenericFileReader2D.cpp. References _mVector, and Parse(). 00048 : FileReader(sFileName,lNbColumns,lNbLines) 00049 { 00050 _mVector = new vector< double* >(); 00051 Parse(); 00052 }
Here is the call graph for this function: ![]() |
|
|
Display the data
Definition at line 186 of file GenericFileReader2D.cpp. References Interpolator::Interpolator::_verb, getDataX(), getDataY(), getDataZ(), getNbDataX(), and getNbDataY(). 00187 { 00188 int k; 00189 for (int i=0;i<getNbDataX();i++) 00190 { 00191 for (int j=0;j<getNbDataY();j++) 00192 { 00193 k = i*_lNbDataY+j; 00194 if(Interpolator::_verb == true) cout << "(i=" << i << ",j=" << j << ",k=" << k << ")-->[" << getDataX()[i] << "," << getDataY()[j] << "," << getDataZ()[k] << "]" << endl; 00195 } 00196 } 00197 00198 }
Here is the call graph for this function: ![]() |
|
|
Return the iColumnNumber column data (0 for X,1 for Y,2 for Z)
Definition at line 160 of file GenericFileReader2D.cpp. Referenced by getDataX(), getDataY(), getDataZ(), and ~GenericFileReader2D(). 00161 { 00162 if ((iColumnNumber < 0) || (iColumnNumber >= (int)_mVector->size())) throw IndexOutOfBoundException("iColumnNumber",iColumnNumber,0,getNbData(),"GenericFileReader2D::getColumn(int iColumnNumber)",__FILE__,__LINE__); 00163 if (_mVector == 0) throw NullPointerException("_mVector","GenericFileReader2D::getColumn(int iColumnNumber)",__FILE__,__LINE__); 00164 return ((*_mVector)[iColumnNumber]); 00165 }
|
|
|
Return the X column data.
Definition at line 140 of file GenericFileReader2D.cpp. References getColumn(). Referenced by displayAll(), main(), and Interpolator::Table2D::Table2D(). 00141 { 00142 return getColumn(0); 00143 }
Here is the call graph for this function: ![]() |
|
|
Return the X column name.
Definition at line 122 of file GenericFileReader2D.cpp. References _sXName. Referenced by main(), and Interpolator::Table2D::Table2D(). 00123 { 00124 return _sXName; 00125 }
|
|
|
Return the Y line data.
Definition at line 146 of file GenericFileReader2D.cpp. References getColumn(). Referenced by displayAll(), main(), and Interpolator::Table2D::Table2D(). 00147 { 00148 return getColumn(1); 00149 }
Here is the call graph for this function: ![]() |
|
|
Return the Y line name.
Definition at line 128 of file GenericFileReader2D.cpp. References _sYName. Referenced by main(), and Interpolator::Table2D::Table2D(). 00129 { 00130 return _sYName; 00131 }
|
|
|
Return the Z matrix data.
Definition at line 152 of file GenericFileReader2D.cpp. References getColumn(). Referenced by displayAll(), main(), and Interpolator::Table2D::Table2D(). 00153 { 00154 return getColumn(2); 00155 }
Here is the call graph for this function: ![]() |
|
|
Return the Z matrix name.
Definition at line 134 of file GenericFileReader2D.cpp. References _sZName. Referenced by main(), and Interpolator::Table2D::Table2D(). 00135 { 00136 return _sZName; 00137 }
|
|
|
Return the number of X data.
Definition at line 168 of file GenericFileReader2D.cpp. Referenced by displayAll(), and Interpolator::Table2D::Table2D(). 00169 { 00170 return _lNbDataX; 00171 }
|
|
|
Return the number of Y data.
Definition at line 174 of file GenericFileReader2D.cpp. Referenced by displayAll(), and Interpolator::Table2D::Table2D(). 00175 { 00176 return _lNbDataY; 00177 }
|
|
|
Return the number of Z data.
Definition at line 180 of file GenericFileReader2D.cpp. 00181 { 00182 return _lNbDataZ; 00183 }
|
|
||||||||||||
|
|
|
|
This method parse the buffer to read a generic file
Implements Interpolator::FileReader. Definition at line 56 of file GenericFileReader2D.cpp. References _lNbDataX, _lNbDataY, _lNbDataZ, _mVector, _sXName, _sYName, _sZName, Interpolator::Interpolator::_verb, Interpolator::FileReader::extractDouble(), Interpolator::FileReader::extractString(), Interpolator::FileReader::getNbData(), and Interpolator::FileReader::getNbVariables(). Referenced by GenericFileReader2D(). 00057 { 00058 00059 int iNbLines = getNbData(); 00060 if(Interpolator::_verb == true) cout << "NbLines : " << iNbLines << endl; 00061 00062 int iNbColumns = getNbVariables(); 00063 if(Interpolator::_verb == true) cout << "NbColumns : " << iNbColumns << endl; 00064 00065 _lNbDataX = iNbLines; 00066 _lNbDataY = iNbColumns; 00067 _lNbDataZ = iNbLines*iNbColumns; 00068 00069 00070 //Reading of the first line to extract the variables names 00071 std::string sColumnName; 00072 00073 int i,j; 00074 00075 00076 _sXName = extractString(); 00077 _sYName = extractString(); 00078 _sZName = extractString(); 00079 if(Interpolator::_verb == true) cout << "Name X --> " << _sXName << endl; 00080 if(Interpolator::_verb == true) cout << "Name Y --> " << _sYName << endl; 00081 if(Interpolator::_verb == true) cout << "Name Z --> " << _sZName << endl; 00082 00083 00084 _mVector->push_back(new double[_lNbDataX]); 00085 _mVector->push_back(new double[_lNbDataY]); 00086 _mVector->push_back(new double[_lNbDataZ]); 00087 00088 //Columns 0 of the vector --> the X values 00089 //Columns 1 of the vector --> the Y values 00090 //Columns 2 of the vector --> the Z values (the matrix is stored in line like a vector. 00091 double dValue; 00092 //Extract the Y values and stores them in the column 1 (it begins at 0) 00093 00094 for (j=0;j<_lNbDataY;j++) 00095 { 00096 dValue = extractDouble(); 00097 ((*_mVector)[1])[j] = dValue; 00098 } 00099 00100 00101 for (i=0;i<_lNbDataX;i++) 00102 { 00103 for (j=0;j<_lNbDataY+1;j++) 00104 { 00105 dValue = extractDouble(); 00106 if (j == 0) 00107 { 00108 ((*_mVector)[0])[i] = dValue; 00109 } 00110 else 00111 { 00112 ((*_mVector)[2])[j+i*_lNbDataY-1] = dValue; 00113 } 00114 } 00115 } 00116 00117 //displayAll(); 00118 00119 }
Here is the call graph for this function: ![]() |
|
|
Definition at line 51 of file GenericFileReader2D.h. Referenced by Parse(). |
|
|
Definition at line 52 of file GenericFileReader2D.h. Referenced by Parse(). |
|
|
Definition at line 53 of file GenericFileReader2D.h. Referenced by Parse(). |
|
|
Definition at line 59 of file GenericFileReader2D.h. Referenced by GenericFileReader2D(), Parse(), and ~GenericFileReader2D(). |
|
|
Definition at line 55 of file GenericFileReader2D.h. Referenced by getDataXName(), and Parse(). |
|
|
Definition at line 56 of file GenericFileReader2D.h. Referenced by getDataYName(), and Parse(). |
|
|
Definition at line 57 of file GenericFileReader2D.h. Referenced by getDataZName(), and Parse(). |
1.4.5