UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
optimize1d.hpp
1 /* optimize1d.hpp */
2 /* $Id: optimize1d.hpp,v 1.9 2008/12/11 08:59:33 ibadm Exp $ */
3 #ifndef __optimize1d_hpp
4 #define __optimize1d_hpp
5 
6 #include "ikp1ddata.hpp"
7 #include "ikp1dmod.hpp"
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif /* __cplusplus */
12 
13 #ifndef Fortran
14 #define Fortran(x) x##_
15 #endif
16 
17  void Fortran(tmell)(double*, double*, double*, int*, int*, int*,
18  double*, double*, double*, int*, double*, int*,
19  double*, double*, int*, int*, double*);
20 
21  void Fortran(gradtu)(double*, double*, double*, int*, int*, int*,
22  double*, double*, double*, int*,
23  double*, double*, double*, double*);
24 
25  void Fortran(ldikp)(double*, double*, double*, double*, double*,
26  int*, int*, double*, double*, double*, double*, double*, double*,
27  double*, double*, double*,double*, double*, double*,double*, double*,
28  int*);
29 
30 #ifdef __cplusplus
31 };
32 #endif /* __cplusplus */
33 
42 {
43 public:
44 
46  struct OptType {
47  static const int VP = 1; // 001 - Velocity optimization
48  static const int KP = 2; // 010 - Anizotropy koefficients optimization
49  static const int DIP = 4; // 100 - Dip optimization
50  };
51 
54  Optimize1d(IKP1dModel *mod, IKP1dData *data);
55 
57  virtual ~Optimize1d();
58 
62  void inverseProblem(int IterNum);
63 
66  void directProblem();
67 
70  void setAnizLim(double lim);
71 
73  void setOptimType(int type);
74 
76  void setDipArea(double min, double max);
77 
79  void initData();
80 
83  return m_data;
84  }
85 
88  return m_mod;
89  }
90 
92  double getCurDerVal()
93  {return calc_derivatives();}
94 
97  {return cur_iter_val;}
98 
101  void stopOptim()
102  {m_optim_continue = false;}
103 
106  static void calcPolylineHodVels(IKP1dHod *hod, IKP1dModel *mod,
107  IKP1dWaveType wt, double maxVelocity);
108 
110  void set_dip_az(double dip, double az);
111 
112 protected:
113 
115  struct IntData
116  {
118  IntData();
119 
120  virtual ~IntData() {
121  clean();
122  }
123 
125  void clean();
126 
127  double *q0p, *q0s, *q1p, *q1s;
129  double *q0pcur, *q1pcur;
131  double *q0scur, *q1scur;
133  std::vector<int*> Lr, Ls;
135  std::vector<double*> L0;
137  std::vector<double**> dtdqp0;
139  std::vector<double**> dtdqp1;
141  std::vector<double**> dtdqs0;
143  std::vector<double**> dtdqs1;
145  std::vector<double**> dtdDip;
147  double *ztop;
149  double *hr;
151  int *Ln;
153  double *dFdqp0, *dFdqp1;
155  double *dFdqs0, *dFdqs1;
157  double *dFdDip;
159  double dFdDipFull;
161  int N;
165  } iData;
166 
169 
172 
174  typedef double CMatrix[3][3];
175 
177  double m_aniz_lim;
178 
181 
184  float m_min_sin;
185 
188 
190  double cur_der_val;
191 
194 
196  double m_min_sin_fi;
197 
200 
202  double m_min_dip_val, m_max_dip_val;
203 
205  virtual void setProgressValue(int val){};
206 
208  void init_data();
209 
211  void remove_idata();
212 
214  double calc_f();
215 
218  double calc_derivatives();
219 
221  void trans_os(IKP1dDataLayer *lay, CMatrix &m);
222 
225  void make_trans_matrix(double dip, double az, CMatrix &m1, CMatrix &m2);
226 
229  void set_lr_ls(int n);
230 
232  void q_step(int n, double *q0p, double *q1p, double alf, double k_lim);
233 
235  void fix_slownes_vel_ranges(int n, double &q0);
236 
238  void v2q();
239 
241  void q2v();
242 
243 private:
244 
246  Optimize1d() {;}
247 };
248 
249 #endif /* optimize1d.hpp */
void setOptimType(int type)
void remove_idata()
double * hr
Definition: optimize1d.hpp:149
void setDipArea(double min, double max)
void initData()
void set_dip_az(double dip, double az)
void stopOptim()
Definition: optimize1d.hpp:101
double calc_derivatives()
void inverseProblem(int IterNum)
bool m_optim_continue
Definition: optimize1d.hpp:187
void v2q()
double * dFdqp0
Definition: optimize1d.hpp:153
Definition: optimize1d.hpp:46
void fix_slownes_vel_ranges(int n, double &q0)
IKP1dData * m_data
Definition: optimize1d.hpp:171
void setAnizLim(double lim)
Definition: ikp1dmod.hpp:58
int m_opt_type
Definition: optimize1d.hpp:180
Definition: ikp1ddata.hpp:21
virtual void setProgressValue(int val)
Definition: optimize1d.hpp:205
double calc_f()
float m_min_sin
Definition: optimize1d.hpp:184
IKP1dData * getHodsData()
Definition: optimize1d.hpp:82
int N
Definition: optimize1d.hpp:161
int getCurIterVal()
Definition: optimize1d.hpp:96
int * Ln
Definition: optimize1d.hpp:151
Definition: ikp1ddata.hpp:43
double dFdDipFull
Definition: optimize1d.hpp:159
std::vector< double ** > dtdqs1
Definition: optimize1d.hpp:143
Definition: ikp1dhod.hpp:41
double * dFdDip
Definition: optimize1d.hpp:157
void q_step(int n, double *q0p, double *q1p, double alf, double k_lim)
std::vector< double ** > dtdDip
Definition: optimize1d.hpp:145
std::vector< double ** > dtdqs0
Definition: optimize1d.hpp:141
double m_min_sin_fi
Definition: optimize1d.hpp:196
double * ztop
Definition: optimize1d.hpp:147
double cur_der_val
Definition: optimize1d.hpp:190
double m_min_dip_val
Definition: optimize1d.hpp:202
double getCurDerVal()
Definition: optimize1d.hpp:92
void trans_os(IKP1dDataLayer *lay, CMatrix &m)
IKP1dModel * m_mod
Definition: optimize1d.hpp:168
IKP1dData * data
Definition: optimize1d.hpp:163
void init_data()
int cur_iter_val
Definition: optimize1d.hpp:193
virtual ~Optimize1d()
Definition: optimize1d.hpp:41
double * q0pcur
Definition: optimize1d.hpp:129
void set_lr_ls(int n)
void directProblem()
double * dFdqs0
Definition: optimize1d.hpp:155
bool m_compute_dip
Definition: optimize1d.hpp:199
IKP1dModel * getCurrentModel()
Definition: optimize1d.hpp:87
double * q0scur
Definition: optimize1d.hpp:131
std::vector< double ** > dtdqp0
Definition: optimize1d.hpp:137
std::vector< double ** > dtdqp1
Definition: optimize1d.hpp:139
void make_trans_matrix(double dip, double az, CMatrix &m1, CMatrix &m2)
double m_aniz_lim
Definition: optimize1d.hpp:177
Definition: optimize1d.hpp:115
std::vector< double * > L0
Definition: optimize1d.hpp:135
static void calcPolylineHodVels(IKP1dHod *hod, IKP1dModel *mod, IKP1dWaveType wt, double maxVelocity)
double CMatrix[3][3]
Definition: optimize1d.hpp:174
std::vector< int * > Lr
Definition: optimize1d.hpp:133
void q2v()