UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
grid2d.hpp
1 //grid2d.hpp
2 // $Id: grid2d.hpp,v 1.7 2008/01/09 13:36:46 sasha Exp $
3 //------------------------------------------------------------------
4 #ifndef __2dGrid_H
5 #define __2dGrid_H
6 
7 //#include <zm/ZmProgress.H>
8 
9 #include "vel2dmod.hpp"
10 #include "os.hpp"
11 
12 #include "vel2dmod_global.hpp"
13 
14 //==================================================================================================
16 struct GridParams
17 {
18  bool isWell;
19  int bodyNum;
20  double vel;
21 
26  void init_clean (){
27  brdns.clean();
28  n1.clean();
29  n2.clean();
30  }
31 };
32 
33 
34 
35 class Vel2dModel;
36 class AbstractProgress;
37 
38 //==================================================================================================
39 class Grid2d
40 {
41 public:
42  Grid2d(double xmn, double xmx, double zmn, double zmx, double stp=1);
43  Grid2d(Grid2d*);
44 
45  virtual ~Grid2d();
46 
48  //void set_progress_indicator (AbstractProgress* prind = NULL);
49 
51  void generate (Vel2dModel* pmod, ObservSys* pos = NULL, double step_size = -1);
52 
54  void re_generate (double x1, double z1, double x2, double z2,
55  Vel2dModel* pmod, ObservSys* pos = NULL);
56 
57  double get_cell_size();
58 
60  void fill_cell(int i, int j, Vel2dModel* pmod, ObservSys* pos, GridParams& gp, int &prevBodynum);
61 
62  void cell_copy(int i, int j, GridParams gp);
63 
65  void get_cell_id (double x, double z, int* ic, int* ir)
66  {
67  *ic=(int)((x-xmin)/step);
68  *ir=(int)((z-zmin)/step);
69 
70  if (x<xmin)
71  *ic = 0;
72  if (x>xmax)
73  *ic = nc-1;
74  if (z<zmin)
75  *ir = 0;
76  if (z>zmax)
77  *ir = nr-1;
78  };
79 
80  int get_last_ir () {return (nr-1);};
81  int get_last_ic () {return (nc-1);};
83  GridParams& Cell(int i, int j);
84 
85  void set_well_flag(int i, int j)
86  {
87  cell[i][j].isWell = true;
88  };
89 
90  void get_grid_sizes(double &xmn, double &zmn, double &xmx, double &zmx);
91  void get_cell_size(double &cs);
92 
93  GridParams get_cell(int i, int j) { return cell[i][j]; };
94  GridParams& set_cell(int i, int j) { return cell[i][j]; };
95 
96  double get_step() { return step; };
97 
98  void clean_well_info();
99 
100  bool getReady() { return m_ready; }
101 
102 private:
103 
104  double xmin, xmax, zmin, zmax;
105  double step;
106  int nr, nc;
107 
108  bool m_ready;
109 
110  AbstractProgress *pPrInd;
112  GridParams **cell;
113  GridParams *cell_mem;
114 };
115 
116 #endif
int_ar n2
Definition: grid2d.hpp:24
Definition: vel2dmod.hpp:19
int get_last_ic()
Definition: grid2d.hpp:81
Grid element structure.
Definition: grid2d.hpp:16
void fill_cell(int i, int j, Vel2dModel *pmod, ObservSys *pos, GridParams &gp, int &prevBodynum)
void generate(Vel2dModel *pmod, ObservSys *pos=NULL, double step_size=-1)
void get_cell_id(double x, double z, int *ic, int *ir)
Definition: grid2d.hpp:65
Definition: objectar.hpp:57
Observation system class.
Definition: os.hpp:13
Definition: grid2d.hpp:39
bool isWell
Definition: grid2d.hpp:18
int bodyNum
Definition: grid2d.hpp:19
void re_generate(double x1, double z1, double x2, double z2, Vel2dModel *pmod, ObservSys *pos=NULL)
int_ar n1
Definition: grid2d.hpp:23
GridParams & Cell(int i, int j)
int_ar brdns
Definition: grid2d.hpp:22