cOkadaFault.h 2.82 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
/*
 * EasyWave - A realtime tsunami simulation program with GPU support.
 * Copyright (C) 2014  Andrey Babeyko, Johannes Spazier
 * GFZ German Research Centre for Geosciences (http://www.gfz-potsdam.de)
 *
 * Parts of this program (especially the GPU extension) were developed
 * within the context of the following publicly funded project:
 * - TRIDEC, EU 7th Framework Programme, Grant Agreement 258723
 *   (http://www.tridec-online.eu)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
#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