cOkadaFault.h 1.73 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#ifndef OKADAFAULT_H
#define OKADAFAULT_H

// Position of the fault reference point (to which lon/lat/depth are related)
#define FLT_POS_C  0      // center of the fault, Okada's coordinates: (L/2;W/2)
#define FLT_POS_MT 1      // middle of the top edge: (L/2;W)
#define FLT_POS_BT 2      // beginning of the top edge: (0;W)
#define FLT_POS_BB 3      // beginning of the bottom edge: (0;0)
#define FLT_POS_MB 4      // middle of the bottom edge: (L/2;0)

#define FLT_ERR_DATA      1
#define FLT_ERR_ZTOP      3
#define FLT_ERR_INTERNAL  4
#define FLT_ERR_STRIKE    6

class cOkadaFault
{

protected:

  int checked;
  int adjust_depth;
  double sind;
  double cosd;
  double sins;
  double coss;
  double tand;
  double coslat;
  double zbot;
  double wp;
  double dslip;
  double sslip;

  double mw2m0();

public:

  int refpos;                 // 0- one of POS_XX (see above definitions)
  double mw;
  double slip;
  double lon,lat,depth;
  double strike;
  double dip;
  double rake;
  double length,width;
  double mu;

  cOkadaFault();
  ~cOkadaFault();
  int read( char *faultparam );
  int check();
  double getMw();
  double getM0();
  double getZtop();
  int global2local( double glon, double glat, double& lx, double& ly );
  int local2global( double lx, double ly, double& glon, double& glat );
  int getDeformArea( double& lonmin, double& lonmax, double& latmin, double& latmax );
  int calculate( double lon, double lat, double& uz, double& ulon, double &ulat );
  int calculate( double lon, double lat, double& uz );
};

int okada( double L,double W,double D,double sinD,double cosD,double U1,double U2,double x,double y,int flag_xy, double *Ux,double *Uy,double *Uz );

#endif // OKADAFAULT_H