00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00055 #ifndef GRID_H
00056 #define GRID_H
00057
00058 const int N=512;
00059
00060
00062 class flowinfo
00063 {
00064 private:
00065 flowinfo* nbsFrom[8];
00066 int contributing;
00067 float total;
00068 float share;
00069 bool checked;
00070
00071 public:
00072 flowinfo(void) {contributing = 0; checked = 0; total=1; share=1.0;}
00073 ~flowinfo() {};
00074 float getContributing (void) {return contributing;}
00075 float getTotalContributing (void) {return total>0.5?total:1;}
00076 float getTotalContributing (flowinfo* receivingCell);
00077 void setInflow (flowinfo* pCell);
00078 void setShare (float s) {share = s;}
00079 };
00080
00081
00083 struct celldata
00084 {
00085 char Position;
00086 float NCellsAll;
00087 };
00088
00089
00091
00092 struct xyC
00093 {
00094 int col;
00095 int row;
00096 float height;
00097 };
00098
00099
00101
00102 class TGrid
00103 {
00104 public:
00105 TGrid (void);
00106 ~TGrid ();
00107
00109
00112 void clearArrays();
00113
00114
00116
00126 void createMountain (int Iterations, int Sigma, float Hurst, bool Addition);
00127
00128
00130
00132 void createWadi (float Grad, bool Parabel);
00133
00134
00136
00138 void calculateElevation (void);
00139
00141
00144 void countHigherCellsGIS (void);
00145
00146
00148
00149 void outputContributing(void);
00150
00151
00153
00154 void outputElevation(void);
00155
00156
00158
00160 void outputTestVariable(void);
00161
00162
00164
00167 void writeFile(float slope, int r);
00168
00169
00170 private:
00171 celldata CellCount[N+1][N+1];
00172 float CellArray[N+1][N+1];
00173 float CellArrayF[N+1][N+1];
00174 float CellArrayL[N+1][N+1];
00175
00176 flowinfo dir[N+1][N+1];
00177 float f3 (float delta, float x0, float x1, float x2);
00178 float f4 (float delta, float x0,float x1, float x2, float x3);
00179 };
00180
00181 #endif