UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
u3d_migr.hpp
1 /* u3d_migr.hpp */
2 /* $Id: u3d_migr.hpp,v 1.65 2007/11/13 12:46:29 guser3 Exp $ */
3 //---------------------------------------------------------------------
4 #ifndef __u3d_migrhpp
5 #define __u3d_migrhpp
6 
7 #include "u3d_migr_shooter.hpp"
8 #include <u3d_seis.hpp>
9 //#include "u3d_migr_defines.hpp"
10 
11 //==============================================================================
13 class U3dMigr : public U3dMigrRayShooter
14 {
15 public:
16 
17  U3dMigr(U3dModel *model, U3dAbstractSeis *seis,
18  float stpX, float stpY, float stpZ,
19  double dfe, double mAngle, U3D_MIGR_TYPE mt, bool slave=true);
20 
21  ~U3dMigr();
22 
24  void initMigrCube(ushort imx, ushort jmx, ushort kmx);
25 
26 
27 
28  // ***************************************************************************
29  // Stage 1 procedures ********************************************************
30 
32  bool getMigrCubeSP(int sp_num, MigrCell *&cube, int &size);
33 
35  bool getMigrCubeRec(int recNum, MigrCell *&cube, int &size);
36 
38  bool getMigrCube(U3dPoint p, U3D_WAVE_TYPE wType);
40  bool getMigrCubeDummy(U3dPoint p, U3D_WAVE_TYPE wType);
41 
42 
43 
44  // ***************************************************************************
45  // Stage 2 procedures ********************************************************
46 
50  void compMigrGrid(MigrCell *grid1, int size1, MigrCell *grid2, int size2,
51  int recId,
52  IPCell *&ip_info, int &ip_cell_num,
53  int i_beg = -1, int i_end = -1);
54 
60  void addIPInfo(MigrDataCube ip_data, IPCell* ip_info, int ip_cell_num);
61 
64  void recalculateIPGrid(MigrDataCube ip_data);
65 
66 
67 
68 
69  // ***************************************************************************
70  // Stage 3 procedures ********************************************************
71 
72 
73  /***/
74  bool loadSPTraces(int spId);
75 
81  double getIPValue(const IPCell& ip_cell);
82 
83 
84 
85 
86  // ***************************************************************************
87  // Service procedures ********************************************************
88 
90  void calculateImageBox();
91 
93  ushort getIMax();
94 
96  ushort getJMax();
97 
99  ushort getKMax();
100 
102  void getSteps(float &step_x, float &step_y, float &step_z);
103 
106 
108  bool getReady();
109 
111  bool formMigrGrid(MigrCell *&grid, int &size);
112 
113 
114 
115 
117  void cleanMigrCube();
118 
120  void freeMigrCube();
121 
123  void freeNormCube();
124 
125 
126 
127  /* Returns migration 3d-grid, contained in the object */
128  MigrDataCube accessMigrCube() { return m_migr_cube; }
129 
130 
131 
132  /* ------------ DEBUG ---------------- */
133 
134  /* Delete all children of each migration cell */
135  void cleanMigrChildren();
136 
137  U3dRay* testRayShoot(U3dPoint startP, double f, double az, U3dCodeAr rCode, bool waySave)
138  { return rayShoot(startP, f, az, rCode, waySave); }
139 
140 
141 
142 
143  time_t startTimer() { return time(NULL); }
144  void stopTimer(time_t beg, const char* message)
145  {
146  time_t end = time(NULL);
147  double t = difftime(end, beg);
148  U3dMessage::info("%s : complete... WORKING TIME = %g s", message, t);
149  }
150 
151  /* ------------ DEBUG ---------------- */
152 
153 
154 
155 
157  void prepareSecondStage();
158 
160  void prepareThirdStage();
161 
162 
163 
164 private:
165 
166 
167  // ****************************************************************************
168  // Stage 1 procedures (private) ***********************************************
169 
170 
172  bool coverCubeFace(U3dPoint p, U3D_WAVE_TYPE wt, int faceId,
173  double f, double az);
174 
175 
176  // ****************************************************************************
177  // Stage 2 procedures (private) ***********************************************
178 
181  bool migrCellComp(MigrCell cell1, MigrCell cell2, ushort i, ushort j, ushort k);
182 
184  bool getNormalDirection(ushort i, ushort j, ushort k, double &normF, double &normAz);
185 
186 
187  // ****************************************************************************
188  // Stage 3 procedures (private) ***********************************************
189 
191  double getAmpl(int spId, std::vector<int> &recIds, std::vector<double> &recT,
192  std::vector<double> &recF, std::vector<double> &recAz);
193 
194 
195  // ****************************************************************************
196  // Service procedures (private) ***********************************************
197 
198 
200  inline bool getCellPoint(const ushort& i, const ushort& j, const ushort& k, U3dPoint& p);
201 
202 
203 
204 
205 
206  /* Forms migration-cell structures array on the basis of 3d migration grid;
207  is used in procedure getMigrGrid */
208  //bool formMigrGrid(MigrCell *&grid, int &size);
209 
210 
211 
212 
213 
214 
215  // ****************************************************************************
216  // ****************************************************************************
217  // ****************************************************************************
218  /*============ debug ==================*/
219  /* Remember start parameters of current shooted ray ??????? */
220  bool rayError(U3dRay *ray, const char* message, double f, double az, U3dPoint sp);
221  void Log(const char* str);
222 
223  /* Saving incident points grid (debug) */
224  void saveIPGrid(MigrDataCube migr_cube, int i_max, int j_max, int k_max,
225  int prog_id,int sp_num);
226 
227  /*============ debug ==================*/
228  // ****************************************************************************
229  // ****************************************************************************
230  // ****************************************************************************
231 
232 
233 
234 
235 
236 
237  // ****************************************************************************
238  // ****************************************************************************
239 
240  NormDataCube m_norm_cube;
242  double m_dfEps;
245  double m_migrAngle; /* ray angle sector half-width for well
246  shooting (see procedure GetIPValue) (UNUSED) */
247 
248  U3dAbstractSeis *m_seis;
251  U3D_MIGR_TYPE m_mType;
253  bool m_ready;
255 };
256 
257 
258 
259 
260 //==============================================================================
261 //------------------------------------------------------------------------------
262 inline bool U3dMigr::getCellPoint(const ushort& i, const ushort& j, const ushort& k, U3dPoint& p)
263 {
264  if (i>m_i_max || j>m_j_max || k>m_k_max)
265  return false;
266  double stepx = m_stepX, stepy = m_stepY, stepz = m_stepZ;
267  if (i==m_i_max) stepx = m_model->getModelBox().getXMax() - i*m_stepX;
268  if (j==m_j_max) stepy = m_model->getModelBox().getYMax() - j*m_stepY;
269  if (k==m_k_max) stepz = m_model->getModelBox().getZMax() - k*m_stepZ;
270  p.setXYZ(stepx/2 + i*m_stepX,
271  stepy/2 + j*m_stepY,
272  stepz/2 + k*m_stepZ);
273  return true;
274 }
275 
276 //---------------------------------------------------------------------
277 #endif /* u3d_migr.hpp */
void freeNormCube()
void addIPInfo(MigrDataCube ip_data, IPCell *ip_info, int ip_cell_num)
ushort getJMax()
Definition: u3d_migr.hpp:13
U3dBox getModelBox() const
Definition: u3d_model.hpp:66
void prepareSecondStage()
double getIPValue(const IPCell &ip_cell)
bool getReady()
void setXYZ(double x, double y, double z)
Definition: u3d_point.hpp:147
ushort getKMax()
void prepareThirdStage()
void calculateImageBox()
double getYMax() const
Definition: u3d_box.hpp:182
U3dRay * rayShoot(U3dPoint startP, double f, double az, U3dCodeAr rCode, bool waySave)
MigrDataCube m_migr_cube
Definition: u3d_migr_shooter.hpp:92
ushort m_k_max
Definition: u3d_migr_shooter.hpp:102
Definition: u3d_migr_defines.hpp:82
U3dAbstractSeis * getSeis()
bool getMigrCubeRec(int recNum, MigrCell *&cube, int &size)
double getXMax() const
Definition: u3d_box.hpp:172
float m_stepY
Definition: u3d_migr_shooter.hpp:97
migration-cell structure
Definition: u3d_migr_defines.hpp:47
bool getMigrCubeDummy(U3dPoint p, U3D_WAVE_TYPE wType)
Definition: u3d_point.hpp:16
Definition: rays.H:81
incident-point-cell structure
Definition: u3d_migr_defines.hpp:63
void cleanMigrCube()
U3dModel * m_model
Definition: u3d_raytracing.hpp:32
Definition: u3d_ray.hpp:14
void freeMigrCube()
float m_stepX
Definition: u3d_migr_shooter.hpp:96
void compMigrGrid(MigrCell *grid1, int size1, MigrCell *grid2, int size2, int recId, IPCell *&ip_info, int &ip_cell_num, int i_beg=-1, int i_end=-1)
ushort m_j_max
Definition: u3d_migr_shooter.hpp:101
ushort getIMax()
bool getMigrCube(U3dPoint p, U3D_WAVE_TYPE wType)
bool formMigrGrid(MigrCell *&grid, int &size)
static void info(const char *format,...)
Definition: u3d_model.hpp:15
void initMigrCube(ushort imx, ushort jmx, ushort kmx)
bool getMigrCubeSP(int sp_num, MigrCell *&cube, int &size)
double getZMax() const
Definition: u3d_box.hpp:192
migration-cell structure
Definition: u3d_migr_defines.hpp:31
Definition: u3d_seis.hpp:14
void recalculateIPGrid(MigrDataCube ip_data)
float m_stepZ
Definition: u3d_migr_shooter.hpp:98
void getSteps(float &step_x, float &step_y, float &step_z)
ushort m_i_max
Definition: u3d_migr_shooter.hpp:100
Definition: u3d_migr_shooter.hpp:11