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.1 2008/05/13 12:19:18 sad Exp $ */
3 //---------------------------------------------------------------------
4 #ifndef __u3d_migrhpp
5 #define __u3d_migrhpp
6 
7 #include "u3d_migr_shooter.hpp"
8 #include <rbm/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 
128 
129  /* ------------ DEBUG ---------------- */
130 
131  /* Returns migration 3d-grid, contained in the object */
132  MigrDataCube accessMigrCube() { return m_migr_cube; }
133  /* Delete all children of each migration cell */
134  void cleanMigrChildren();
135 
136  U3dRay* testRayShoot(U3dPoint startP, double f, double az, U3dCodeAr rCode, bool waySave)
137  { return rayShoot(startP, f, az, rCode, waySave); }
138 
139 
140 
141 
142  time_t startTimer() { return time(NULL); }
143  void stopTimer(time_t beg, const char* message)
144  {
145  time_t end = time(NULL);
146  double t = difftime(end, beg);
147  UMessage::info("%s : complete... WORKING TIME = %g s", message, t);
148  }
149 
150  /* ------------ DEBUG ---------------- */
151 
152 
153 
154 
156  void prepareSecondStage();
157 
159  void prepareThirdStage();
160 
161 
162 
163 private:
164 
165 
166  // ****************************************************************************
167  // Stage 1 procedures (private) ***********************************************
168 
169 
171  bool coverCubeFace(U3dPoint p, U3D_WAVE_TYPE wt, int faceId,
172  double f, double az);
173 
174 
175  // ****************************************************************************
176  // Stage 2 procedures (private) ***********************************************
177 
180  bool migrCellComp(MigrCell cell1, MigrCell cell2, ushort i, ushort j, ushort k);
181 
183  bool getNormalDirection(ushort i, ushort j, ushort k, double &normF, double &normAz);
184 
185 
186  // ****************************************************************************
187  // Stage 3 procedures (private) ***********************************************
188 
190  double getAmpl(int spId, std::vector<int> &recIds, std::vector<double> &recT,
191  std::vector<double> &recF, std::vector<double> &recAz);
192 
193 
194  // ****************************************************************************
195  // Service procedures (private) ***********************************************
196 
197 
199  inline bool getCellPoint(const ushort& i, const ushort& j, const ushort& k, U3dPoint& p);
200 
201 
202 
203 
204 
205  /* Forms migration-cell structures array on the basis of 3d migration grid;
206  is used in procedure getMigrGrid */
207  //bool formMigrGrid(MigrCell *&grid, int &size);
208 
209 
210 
211 
212 
213 
214  // ****************************************************************************
215  // ****************************************************************************
216  // ****************************************************************************
217  /*============ debug ==================*/
218  /* Remember start parameters of current shooted ray ??????? */
219  bool rayError(U3dRay *ray, const char* message, double f, double az, U3dPoint sp);
220  void Log(const char* str);
221 
222  /* Saving incident points grid (debug) */
223  void saveIPGrid(MigrDataCube migr_cube, int i_max, int j_max, int k_max,
224  int prog_id,int sp_num);
225 
226  /*============ debug ==================*/
227  // ****************************************************************************
228  // ****************************************************************************
229  // ****************************************************************************
230 
231 
232 
233 
234 
235 
236  // ****************************************************************************
237  // ****************************************************************************
238 
239  NormDataCube m_norm_cube;
241  double m_dfEps;
244  double m_migrAngle; /* ray angle sector half-width for well
245  shooting (see procedure GetIPValue) (UNUSED) */
246 
247  U3dAbstractSeis *m_seis;
250  U3D_MIGR_TYPE m_mType;
252  bool m_ready;
254 };
255 
256 
257 
258 
259 //==============================================================================
260 //------------------------------------------------------------------------------
261 inline bool U3dMigr::getCellPoint(const ushort& i, const ushort& j, const ushort& k, U3dPoint& p)
262 {
263  if (i>m_i_max || j>m_j_max || k>m_k_max)
264  return false;
265  double stepx = m_stepX, stepy = m_stepY, stepz = m_stepZ;
266  if (i==m_i_max) stepx = m_model->getModelBox().getXMax() - i*m_stepX;
267  if (j==m_j_max) stepy = m_model->getModelBox().getYMax() - j*m_stepY;
268  if (k==m_k_max) stepz = m_model->getModelBox().getZMax() - k*m_stepZ;
269  p.setXYZ(stepx/2 + i*m_stepX,
270  stepy/2 + j*m_stepY,
271  stepz/2 + k*m_stepZ);
272  return true;
273 }
274 
275 //---------------------------------------------------------------------
276 #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
static void info(const char *format,...)
ushort getIMax()
bool getMigrCube(U3dPoint p, U3D_WAVE_TYPE wType)
bool formMigrGrid(MigrCell *&grid, int &size)
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