Q:/Codes/PPF/FullPPF/ppfdatatype.hpp

Go to the documentation of this file.
00001 // NOTES TO SELF: when implementing comments and unit string set methods I don't need to bounds check , this is done at read/write time.
00002 
00003 
00004 // datatype class
00005 
00006 #ifndef __PPFDATATYPE_HPP__
00007 #define __PPFDATATYPE_HPP__
00008 
00009 #include <vector>
00010 #include <string>
00011 #include "ppftypes.hpp"
00012 
00013 using namespace std;
00014 
00015 namespace ppf
00016 {
00017         class system;
00018 
00020         class datatype
00021         {
00022                 // friend functions ----------------------------------------------------
00023 
00025                         friend class system;
00026 
00027                 public:
00028                 // constructors/destructors
00029 
00030                         // basic constructors ----------------------------------------------
00031 
00033                         datatype();
00034 
00036                         ~datatype();
00037 
00038                         // create constructors ---------------------------------------------
00039 
00040 //                      datatype(int Nt, int Nx);
00041 
00042                         // read constructors -----------------------------------------------
00043 
00047                         datatype(string filename);
00048 
00049                 // class methods -------------------------------------------------------
00050 
00051                         // create ----------------------------------------------------------
00052 /*
00053                         // indexes
00054                         void create(int Nt, int Nx);
00055                         // indexes and initialise type 1
00056                         void create( min_t, int Nt, float dt, int Nx);
00057                         void create(int Nt, float min_x, int Nx, float dx);
00058                         void create(float min_t, int Nt, float dt, float min_x, int Nx, float dx);
00059                         // indexes and initialise type 2
00060                         void create(float min_t, float max_t, int Nt, int Nx);
00061                         void create(int Nt, float min_x, float max_x, int Nx);
00062                         void create(float min_t, float max_t, int Nt, float min_x, float max_x, int Nx);
00063 */
00064                         // read ------------------------------------------------------------
00065 
00066                         // read from local
00067 
00070                         void readLocal(string filename);
00071 
00072                         // write -----------------------------------------------------------
00073 
00074                         // write to local
00075 
00078                         void writeLocal(string filename);
00079 
00080                         // get -------------------------------------------------------------
00081 
00082                         // get datatype meta data
00083 
00086                         int getTDim();
00087 
00090                         int getXDim();
00091 
00094                         string getTUnit();
00095 
00098                         string getXUnit();
00099 
00102                         string getDataUnit();
00103 
00106                         string getComment();
00107 
00110                         int getUserDTStatus();
00111 
00114                         int getSysDDAStatus();
00115 
00118                         int getSysDTStatus();
00119 
00120                         // get data by index
00121 
00125                         float getT(int It);
00126 
00130                         float getX(int Ix);
00131 
00136                         float getDataIt(int It);
00137 
00142                         float getDataIx(int Ix);
00143 
00148                         float getDataItIx(int It, int Ix);
00149 
00150                         // get data by co-ordinate
00151 
00156                         int getIt(float t);
00157 
00162                         int getIx(float x);
00163 
00168                         float getDataT(float t);
00169 
00176                         float getDataT(float t, processflag flag);
00177 
00184                         coord getDataCT(float t, processflag flag);
00185 
00190                         float getDataX(float x);
00191 
00198                         float getDataX(float x, processflag flag);
00199 
00206                         coord getDataCX(float x, processflag flag);
00207 
00213                         float getDataTIx(float t, long Ix);
00214 
00222                         float getDataTIx(float t, long Ix, processflag t_flag);
00223 
00231                         coord getDataCTIx(float t, long Ix, processflag t_flag);
00232 
00238                         float getDataItX(long It, float x);
00239 
00247                         float getDataItX(long It, float x, processflag x_flag);
00248 
00256                         coord getDataCItX(long It, float x, processflag x_flag);
00257 
00263                         float getDataTX(float t, float x);
00264 
00273                         float getDataTX(float t, float x, processflag t_flag, processflag x_flag);
00274 
00283                         coord getDataCTX(float t, float x, processflag t_flag, processflag x_flag);
00284 
00285                         // get average data
00286 
00287 
00288 
00289                         // set -------------------------------------------------------------
00290 
00291                         // set datatype meta data
00292 
00293 
00294                         // set data by index
00295 
00299                         void setT(int It, float v);
00300 
00304                         void setX(int Ix, float v);
00305 
00310                         void setDataIt(int It, float v);
00311 
00316                         void setDataIx(int Ix, float v);
00317 
00322                         void setDataItIx(int It, int Ix, float v);
00323 
00324                         // set data by co-ordinate
00325                         // set routines can take nearest and insert process flags - nearest sets the value for the nearest point, insert inserts a new element in the array and data tables and assigns the passed value
00326 
00327 
00328                 private:
00329                 // variables
00330 
00331                         vector<float> t;                                
00332                         vector<float> x;                                
00333                         vector<vector<float> > data;    
00334                         string xunit;                   
00335                         string tunit;                   
00336                         string dataunit;                
00337                         string comment;                 
00338                         int userdtstatus;               
00339                         int sysddastatus;               
00340                         int sysdtstatus;                
00341 
00342                 // functions
00343 
00344                         // process ---------------------------------------------------------
00345 
00359                         void findNearest(vector<float> &v, int Imin, int Imax, float f, int &Ilower, int &Iupper);
00360 
00369                         double interpolateLinear(double p1, double v1, double p2, double v2, double pt);
00370 
00381 //                      double interpolateCubic(double p1, double g1, double v1, double p2, double g2, double v2, double pt);
00382 
00391                         void getDataTIx(float t, long Ix, processflag t_flag, float &ta, float &v);
00392 
00401                         void getDataItX(long It, float x, processflag x_flag, float &xa, float &v);
00402 
00413                         void getDataTX(float t, float x, processflag t_flag, processflag x_flag, float &ta, float &xa, float &v);
00414         };
00415 
00416 };
00417 
00418 
00419 #endif

Generated on Tue May 23 15:11:51 2006 for PPF C++ by  doxygen 1.4.6-NO