Main Page   Compound List   File List   Compound Members  

Data.h

00001 #if !defined(__FLOWVIZ_H)
00002 #define __FLOWVIZ_H
00003 
00004 #include "MyMathUtils.h"
00005 #include "Streamline.h"
00006 
00007 
00008 const int rasterPosX=350;     //raster position in x where pixel image output starts
00009 const int rasterPosY=70;      //raster position in y where pixel image output starts
00010 const int xOut=350;           //dimension in x of output array
00011 const int yOut=560;           //dimension in y of output array
00012 //const int maxIntegrationSteps=10000; //maximum number of integration steps
00013 const int maxIntegrationSteps=1000; //maximum number of integration steps
00014 const float eps = static_cast<float>(0.0001);   //error bound for float calculations
00015 const float stride = static_cast<float>(0.1);  //stride for integration
00016 
00017 
00022 class Data
00023 {
00024 public:
00025         Vektor2f *position; //data structure to keep position data (no equidistant grid!)
00026         GLubyte *show;    //data to be shown
00027         float *flowX;     //data structure to keep flow data in x-direction
00028         float *flowY;     //data structure to keep flow data in y-direction
00029         float *pressure;  //pressure data
00030         float *vorticity; //vorticity data
00031         float *fx;
00032         float *fy;
00033         float *fv;
00034         float *fp;
00035         float *fvor;
00036         float length_interval_x;
00037         float length_interval_y;
00038         int dsep;
00039         float dtest;
00040         float dtestfactor;
00041         int method;
00042         int background;
00043         bool hedgehog;
00044         bool vel;
00045         float scale_SmallToBig_x;
00046         float scale_SmallToBig_y;
00047         float scale_BigToSmall_x;
00048         float scale_BigToSmall_y;
00049         int cells[9];
00050         Streamline *slByHand;
00051         vector<Streamline*> streamLines;
00052         vector<Vektor2i*> seedCandidates;
00053 
00064         struct Header
00065         {
00066                 short xDim;
00067                 short yDim;
00068                 short zDim;
00069                 short nf;       //number of additional sets
00070                 short nt;   //number of time steps
00071                 double dt;   //time between 2 time steps
00072         };
00073 
00074         Header header;
00075 
00076 public:
00077 
00082         Data()
00083         {
00084                 Initialize();
00085         }
00086 
00091         virtual ~Data()
00092         {
00093                 Destroy();
00094         }
00095 
00099         void getData(CString fileName);
00100 
00104         void showData();
00105 
00109         void drawHedgehogPlot(int length);
00110 
00114         void drawStreamlines();
00115 
00119         void drawSingleStreamline(Streamline *sl);
00120 
00125         void showSingleStreamline(int x, int y);
00126 
00130         void processUserInput();
00131 
00132 
00133 
00134 private:
00135 
00139         void Initialize();
00140 
00144         void Destroy();
00145 
00149         void initializeGlobals();
00150 
00155         void doCleanUp();
00156 
00162         void extractData();
00163 
00168         void addSamplePointsToCells(Streamline *sl);
00169 
00173         void calculateStreamlines();
00174 
00179         void addStreamLineToVector(Streamline *sl);
00180 
00184         Streamline getStreamLineFromVector(int pos);
00185 
00189         void calculateSeedCandidates(Streamline *sl);
00190 
00195         void addSeedCandidate(int x, int y);
00196 
00200         Vektor2i getSeedCandidate(int pos);
00201 
00205         void deleteFirstSeedCandidate();
00206 
00211         float* getInterpolatedMatrix(float *in, float *out, float *minval, float *maxval);
00212 
00217         float getMaxValue(float *in, int xDim, int yDim);
00218 
00223         float getMinValue(float *in, int xDim, int yDim);
00224 
00228         float getMaxAbs(float a, float b);
00229 
00235         float* getVelocityMatrix(float *in1, float *in2, float *out, int xDim, int yDim);
00236 
00244         void generateShowArray(float *in, float posFactor, float negFactor);
00245 
00250         float* addToMatrix(float *in, float val, int xDim, int yDim);
00251 
00255         float round(float a);
00256 
00260         float getDistance(Vektor2i v1, Vektor2i v2);
00261 
00267         Vektor2f integrateEuler(Vektor2f old, float dt, int direction);
00268 
00274         Vektor2f integrateRK2(Vektor2f old, float dt, int direction);
00275 
00281         Vektor2f integrateRK4(Vektor2f old, float dt, int direction);
00282 
00286         bool checkPoint(Vektor2f point);
00287 
00291         bool checkCoordinates(int x, int y);
00292 
00296         Vektor2f getFlow(Vektor2f in);
00297 
00301         Vektor2f getInitialStreamlineSeedPoint();
00302 
00308         bool checkValidity(Vektor2i sp, float mindistance);
00309 
00316         void integrateStreamline(Streamline* sl, Vektor2f seed, int method, int direction, bool single);
00317 
00324         Streamline* getStreamline(Vektor2f seed, int method, bool single);
00325 
00330         void transformSmallToBig(float x, float y, int *res_x, int *res_y);
00331 
00336         void transformBigToSmall(float *res_x, float *res_y, int x, int y);
00337 
00343         int getAddress(float x, float y, int old_adr);
00344 
00349         void drawLine(int x1, int y1, int x2, int y2);
00350 
00355         float bilinearInterpolationRegular(float x,                             //x-coordinate to interpolate
00356                                                                            float y,                             //y-coordinate to interpolate
00357                                                                            float val_lxly,              //value on lower x/lower y
00358                                                                            float val_uxly,              //value on upper x/lower y
00359                                                                            float val_lxuy,              //value on lower x/upper y
00360                                                                            float val_uxuy);             //value on upper x/upper y
00361 
00362 
00367         float bilinearInterpolationIrregular(float x,                   //x-coordinate to interpolate
00368                                                                              float y,                   //y-coordinate to interpolate
00369                                                                                  float lxb,                     //lower x bound
00370                                                                                  float lyb,                     //lower y bound
00371                                                                                  float uxb,                     //upper x bound
00372                                                                                  float uyb,                     //upper y bound
00373                                                                                  float val_lxly,        //value on lower x/lower y
00374                                                                                  float val_uxly,        //value on upper x/lower y
00375                                                                                  float val_lxuy,        //value on lower x/upper y
00376                                                                                  float val_uxuy);       //value on upper x/upper y
00377 
00378 };
00379 #endif //#if !defined(__FLOWVIZ_H)

Generated on Tue Jan 22 19:13:37 2002 for FlowViz by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001