UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vel2dmod_service.hpp
1 // vel2dmod_service.hpp
2 // $Id: vel2dmod_service.hpp,v 1.17 2007/11/30 09:12:06 guser1 Exp $
3 //-----------------------------------------------------------------------------
4 #ifndef __2dModelServiceH
5 #define __2dModelServiceH
6 
7 #include "vel2dmod.hpp"
8 #include "vel2dmod_global.hpp"
9 
10 //------------------------------------------------------------------------------
13 {
14  int kn1, kn2;
15  int initial_kn1, initial_kn2;
16 };
17 
19 
20 //==============================================================================
22 
23 class Bound
24 {
25 
26 #ifndef GE_BUILD
27  friend class Vel2dModelLDB;
28 #else
29  friend class Vel2dModelGEDB;
30 #endif
31 
32  public:
33 
35  Bound(double *xx, double *zz, int nn, bool *flag, double rc, double sp,
36  double *xx1 = NULL, double *zz1 = NULL, int nn1 = 0);
37 
39  Bound(double *xx, double *zz, int nn, double rc, double sp);
40 
42  Bound(double *xx, double *zz, double *dx, double *dz, double *curv, bool *flag, int nn,
43  double *init_x = NULL, double *init_z = NULL, bool *init_flags = NULL, int init_num = 0);
44 
46  Bound(double *xx, double *zz, double *dx, double *dz, double *curv, bool *flag, int nn, int app_type,
47  double *init_x = NULL, double *init_z = NULL, bool *init_flags = NULL, int init_num = 0);
48 
49  Bound(Bound*);
50 
51  ~Bound();
52 
54  int getApproxType() {
55  return m_approx_type;
56  }
57 
60  bool BoundInt(double x1, double z1, double x2, double z2,
61  double eps, double &resultX, double &resultZ, bool flag=true,
62  bool finitLine=true, int *nn=NULL);
63 
65  void GetEndPoints(double &x1, double &z1, double &x2, double &z2);
66 
67  void Segmentation();
68  int GetSegNum();
69  int GetSegNum(int n);
70  int GetSegNum(double x, double z);
71 
72  int InitialPNum();
73  void GetInitialPoints(double *x, double *z, bool *flags);
74  void GetRC_SP(double &rc, double &sp);
75 
76  void ReInterpolate(double *x, double *z, bool *flag, int n, double r_c = 0, double s_p = 0, bool *im_flag=NULL);
77 
78  void GetZLimits(double &z_min, double &z_max);
79 
80  void GetFirstPoint(double &x, double &z) { if ((initial_x!=NULL)&&(initial_z!=NULL)&&(initial_pnum>0)&&filled)
81  { x=initial_x[0]; z=initial_z[0]; } else {x=0; z=0;} }
82 
83  void GetLastPoint(double &x, double &z) { if ((initial_x!=NULL)&&(initial_z!=NULL)&&(initial_pnum>0)&&filled)
84  { x=initial_x[initial_pnum-1]; z=initial_z[initial_pnum-1]; }
85  else {x=0; z=0;} }
86 
87  ParSpline* spline();
88 
90  int num;
91 
93  int bNum1;
94  int bNum2;
95 
97  bool filled;
98 
99  private:
100 
101  void CalcZLimits();
102  double GetPeak(double *x, double *z, bool top);
103  void SetRC_SP(double rc, double sp);
104 
105  BoundSegmentsAr Segments;
106  double *ixs;
107  double *izs;
108  int *inns;
109 
110  // first/last numbers of the nodes of Curve, between which the respective Bound is situated
111  //int knotNum1;
112  //int knotNum2;
113  //int initial_kn1;
114  //int initial_kn2;
115 
116  double *initial_x;
117  double *initial_z;
118  bool *initial_flags;
119  int initial_pnum;
120  double RC, SP;
121 
122  ParSpline *psp;
123  double zMin;
124  double zMax;
125 
127  int m_approx_type;
128 };
129 
130 typedef Bound* pBound;
131 
132 // dynamic Bound arrays definition
134 
135 
136 
137 //==============================================================================
139 
145 {
146 public:
147 
148  BodyParam(int vMN, double *x, double *z, double *vp, double *vs, double *pkz,
149  double *skz, double *den, double ma_xmin, double ma_xmax,
150  double an_kp, double an_ks, double R);
151 
152  BodyParam(double vp, double vs, double pkz, double skz, double den, double ma_xmin, double ma_xmax,
153  double an_kp, double an_ks, double R);
154 
155  BodyParam(int vMN, double *x, double *vp, double *vs, double *pkz,
156  double *skz, double *den, double ma_xmin, double ma_xmax,
157  double an_kp, double an_ks, double R);
158 
160 
161  ~BodyParam();
162 
164  double GetV0(double x, WAVE_TYPE wt);
165 
167  double GetKx(double x, WAVE_TYPE wt);
168 
170  bool ParamsConst();
171 
172  double GetCVel(WAVE_TYPE wt);
173 
175  double GetCKz(WAVE_TYPE wt);
176 
177  double GetCDen();
178 
179  void GetParams(int &pn, double *&px, double *&pz, double *&pPVel, double *&pSVel,
180  double *&pPKz, double *&pSKz, double *&pDen);
181 
183  bool filled;
184 
187 
189  void RebuildParams(int vMN, double *new_x, double *new_vp, double *new_vs, double *new_kzp,
190  double *new_kzs, double *new_den);
191 
193  void SortParams();
194 
195  void GetMASizes(double &xmn, double &xmx) { xmn=x_min; xmx=x_max; };
196 
197  Spline* GetSpVS();
198  Spline* GetSpVP();
199 
200  int GetParamNum() { return paramNum; };
201 
202  double GetAnCoef(WAVE_TYPE wt, double ang);
203 
204  double GetAn(WAVE_TYPE wt);
205 
207  double GetAnKP() { return m_an_kp; }
208 
210  double GetAnKS() { return m_an_ks; }
211 
213  double GetRParam() { return m_R; }
214 
216  void SetAnKP(double an_kp) { m_an_kp = an_kp; }
217 
219  void SetAnKS(double an_ks) { m_an_ks = an_ks; }
220 
222  void SetRParam(double R) { m_R = R; }
223 
224  private:
225 
227  void Replace(int N, double *M, int i, int j);
228 
230  void RefreshParams(int vMN, double *new_x, double *new_vp, double *new_vs, double *new_kzp,
231  double *new_kzs, double *new_den);
232 
233  Spline *SpVS;
234  Spline *SpVP;
235 
237  int paramNum;
238 
240  double *x;
241  double *z;
242  double *vp;
243  double *vs;
244  double *kzP;
245  double *kzS;
246  double *den;
247 
248  double cKzP;
249  double cKzS;
250  double cDen;
251  double cVelP;
252  double cVelS;
253 
254  double *vLine;
255 
257  double x_min, x_max;
258 
259  double m_an_kp;
260  double m_an_ks;
261  double m_R;
262 };
263 
264 
265 
266 //==============================================================================
268 class Body //------------------------------------------------------
269 { // BODY
270 public: // ----------
271  // |BodyParam| a set of pointers to the Bounds
272  // ----------
273  //------------------------------------------------------
274 
275  Body(int bAm);
276  Body(Body*);
277  ~Body();
278 
280  void AddBoundPtr(Bound *pB);
281 
283  bool TopBorder(double x, double &z);
284 
286  bool BotBorder(double x, double &z);
287 
289  bool BodyBorder(int bNum, double x, double &z);
290 
292  void GetBodyBrd(int &num, int *&brds);
293 
295  void SetConstParams(double vp, double vs, double kzp, double kzs, double den,
296  double an_kp = 1, double an_ks = 1, double R = 1);
297 
299  void SetParams(int pNum, double *x, double *vp, double *vs, double *kzp, double *kzs, double *den,
300  double an_kp = 1, double an_ks = 1, double R = 1);
301 
303  int GetTopBN();
304 
306  int GetBotBN();
307 
308  bool GetLateralBounds(int &left_bN, int &right_bN);
309 
310  void GetZLimits(double &z_min, double &z_max);
311 
312  void GetLZLimits(double &z_min, double &z_max);
313 
314  void GetRZlimits(double &z_min, double &z_max);
315 
319  int num;
320  int boundNum;
321  int *bounds;
322  int *bPos;
328  bool *n_direct;
332  bool filled;
333  bool ready;
334  int presParams;
335 
336  BoundsAr Bounds;
338 };
339 
340 
341 typedef Body* pBody;
343 
344 //--------------------------------------------------------
346 {
347  double x,z;
348  double vp, vs;
349  double pkz, skz;
350  double density;
351 };
352 
354 
355 struct BodyInfo
356 {
357  ParamsInfoAr *Params; // parameters
358  double_ar tbx; // top border coordinats
359  double_ar tbz;
360  int_ar flag;
361  double an_kp;
362  double an_ks;
363  double R;
364 };
365 
367 
368 
369 #endif
Class, describing bodies bound.
Definition: vel2dmod_service.hpp:23
bool ParamsConst()
Bound(double *xx, double *zz, int nn, bool *flag, double rc, double sp, double *xx1=NULL, double *zz1=NULL, int nn1=0)
Definition: spline.hpp:24
double GetV0(double x, WAVE_TYPE wt)
Class, describing the geological body.
Definition: vel2dmod_service.hpp:268
void SetConstParams(double vp, double vs, double kzp, double kzs, double den, double an_kp=1, double an_ks=1, double R=1)
int getApproxType()
Definition: vel2dmod_service.hpp:54
int bNum1
Definition: vel2dmod_service.hpp:93
double an_ks
Definition: vel2dmod_service.hpp:362
int GetBotBN()
double GetRParam()
Definition: vel2dmod_service.hpp:213
void GetBodyBrd(int &num, int *&brds)
bool filled
Definition: vel2dmod_service.hpp:97
double GetCKz(WAVE_TYPE wt)
Body(int bAm)
double GetAnKS()
Definition: vel2dmod_service.hpp:210
Class, containing bodies parameters.
Definition: vel2dmod_service.hpp:144
int * bounds
Definition: vel2dmod_service.hpp:321
Definition: vel2dmod_service.hpp:345
BodyParam * Param
Definition: vel2dmod_service.hpp:316
bool BotBorder(double x, double &z)
bool paramsConst
Definition: vel2dmod_service.hpp:186
Definition: objectar.hpp:57
Definition: vel2dmod_service.hpp:355
bool BoundInt(double x1, double z1, double x2, double z2, double eps, double &resultX, double &resultZ, bool flag=true, bool finitLine=true, int *nn=NULL)
Definition: vel2dmod_ldb.hpp:16
Definition: parspline.hpp:14
int GetTopBN()
void SetAnKS(double an_ks)
Definition: vel2dmod_service.hpp:219
bool TopBorder(double x, double &z)
int boundNum
Definition: vel2dmod_service.hpp:320
double GetKx(double x, WAVE_TYPE wt)
bool * n_direct
Definition: vel2dmod_service.hpp:328
void AddBoundPtr(Bound *pB)
void GetEndPoints(double &x1, double &z1, double &x2, double &z2)
Definition: objectar.hpp:55
void SetParams(int pNum, double *x, double *vp, double *vs, double *kzp, double *kzs, double *den, double an_kp=1, double an_ks=1, double R=1)
int * bPos
Definition: vel2dmod_service.hpp:322
void SortParams()
double R
Definition: vel2dmod_service.hpp:363
int num
Definition: vel2dmod_service.hpp:319
bool filled
Definition: vel2dmod_service.hpp:183
bool BodyBorder(int bNum, double x, double &z)
BoundsAr Bounds
Definition: vel2dmod_service.hpp:336
void SetAnKP(double an_kp)
Definition: vel2dmod_service.hpp:216
void SetRParam(double R)
Definition: vel2dmod_service.hpp:222
void RebuildParams(int vMN, double *new_x, double *new_vp, double *new_vs, double *new_kzp, double *new_kzs, double *new_den)
double GetAnKP()
Definition: vel2dmod_service.hpp:207
int num
Definition: vel2dmod_service.hpp:90
Structure, describing bound segment (a part of bound between the special points)
Definition: vel2dmod_service.hpp:12