Commit 04ef2c31 authored by Johannes Spazier's avatar Johannes Spazier

Removed strange control character '^M' from files.

parent b940b99c
This diff is collapsed.
This diff is collapsed.
......@@ -22,78 +22,78 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OGRD_H
#define OGRD_H
class cOgrd
{
protected:
public:
int nx,ny;
int nnod;
double noval;
double xmin,xmax;
double ymin,ymax;
double dx,dy;
double *val;
cOgrd();
cOgrd( const cOgrd& );
cOgrd( double xmin0, double xmax0, int nx0, double ymin0, double ymax0, int ny0 );
cOgrd( double xmin0, double xmax0, double dx0, double ymin0, double ymax0, double dy0 );
~cOgrd();
void setNoval( double val );
double getNoval();
int initialize( double xmin0, double xmax0, int nx0, double ymin0, double ymax0, int ny0 );
int initialize( double xmin0, double xmax0, double dx0, double ymin0, double ymax0, double dy0 );
int readShape( const char *grdfile );
int readHeader( const char *grdfile );
int readGRD( const char *grdfile );
int readXYZ( const char *xyzfile );
int readRasterStream( FILE *fp, int ordering, int ydirection );
cOgrd* extract( int i1, int i2, int j1, int j2 );
cOgrd* extract( double x1, double x2, double y1, double y2 );
int idx( int i, int j );
double& operator() ( int i, int j );
double& operator() ( int idx );
cOgrd& operator= ( const cOgrd& grd );
cOgrd& operator*= ( double coeff );
cOgrd& operator+= ( cOgrd& grd );
void getIJ( int idx, int& i, int& j );
int getIJ( double x, double y, int& i, int& j );
double getX( int i, int j );
double getX( int idx );
double getY( int i, int j );
double getY( int idx );
double getVal( int idx );
double getVal( int i, int j );
double getVal( double x, double y );
double getMaxVal();
double getMaxVal( int& i, int& j );
double getMinVal();
double getMinVal( int& i, int& j );
double getMaxAbsVal();
double getMaxAbsVal( int& i, int& j );
double getMaxAbsValBnd();
void setVal( double value, int i, int j );
void setVal( double value, int idx );
void reset();
void resetVal();
int getIntersectionRegion( const cOgrd &grd, int& imin, int& imax, int& jmin, int& jmax );
int interpolateFrom( cOgrd &grd, int resetValues );
int getNearestIdx( double x, double y );
int getNearestIdx( double x, double y, double rangemin, double rangemax );
int equalTo( cOgrd& grd );
int isSameShapeTo( cOgrd& grd );
void smooth( int radius );
int writeGRD( const char *fname );
int writeGRDbin( const char *fname );
int writeXYZ( const char *fname );
};
#endif // OGRD_H
#ifndef OGRD_H
#define OGRD_H
class cOgrd
{
protected:
public:
int nx,ny;
int nnod;
double noval;
double xmin,xmax;
double ymin,ymax;
double dx,dy;
double *val;
cOgrd();
cOgrd( const cOgrd& );
cOgrd( double xmin0, double xmax0, int nx0, double ymin0, double ymax0, int ny0 );
cOgrd( double xmin0, double xmax0, double dx0, double ymin0, double ymax0, double dy0 );
~cOgrd();
void setNoval( double val );
double getNoval();
int initialize( double xmin0, double xmax0, int nx0, double ymin0, double ymax0, int ny0 );
int initialize( double xmin0, double xmax0, double dx0, double ymin0, double ymax0, double dy0 );
int readShape( const char *grdfile );
int readHeader( const char *grdfile );
int readGRD( const char *grdfile );
int readXYZ( const char *xyzfile );
int readRasterStream( FILE *fp, int ordering, int ydirection );
cOgrd* extract( int i1, int i2, int j1, int j2 );
cOgrd* extract( double x1, double x2, double y1, double y2 );
int idx( int i, int j );
double& operator() ( int i, int j );
double& operator() ( int idx );
cOgrd& operator= ( const cOgrd& grd );
cOgrd& operator*= ( double coeff );
cOgrd& operator+= ( cOgrd& grd );
void getIJ( int idx, int& i, int& j );
int getIJ( double x, double y, int& i, int& j );
double getX( int i, int j );
double getX( int idx );
double getY( int i, int j );
double getY( int idx );
double getVal( int idx );
double getVal( int i, int j );
double getVal( double x, double y );
double getMaxVal();
double getMaxVal( int& i, int& j );
double getMinVal();
double getMinVal( int& i, int& j );
double getMaxAbsVal();
double getMaxAbsVal( int& i, int& j );
double getMaxAbsValBnd();
void setVal( double value, int i, int j );
void setVal( double value, int idx );
void reset();
void resetVal();
int getIntersectionRegion( const cOgrd &grd, int& imin, int& imax, int& jmin, int& jmax );
int interpolateFrom( cOgrd &grd, int resetValues );
int getNearestIdx( double x, double y );
int getNearestIdx( double x, double y, double rangemin, double rangemax );
int equalTo( cOgrd& grd );
int isSameShapeTo( cOgrd& grd );
void smooth( int radius );
int writeGRD( const char *fname );
int writeGRDbin( const char *fname );
int writeXYZ( const char *fname );
};
#endif // OGRD_H
......@@ -22,41 +22,41 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OKADAEARTHQUAKE_H
#define OKADAEARTHQUAKE_H
#include <cOgrd.h>
#include <cSphere.h>
#include "cOkadaFault.h"
class cOkadaEarthquake
{
protected:
int finalized;
int getDeformArea( int round, double& lonmin, double& lonmax, double& latmin, double& latmax );
int setGrid( cOgrd& u );
public:
int nfault; // total nuber of Okada faults
double m0; // total earthquake moment
cOkadaFault *fault; // array of composing faults
cOkadaEarthquake();
~cOkadaEarthquake();
int read( char *fname );
int finalizeInput();
double getM0();
double getMw();
int calculate( double lon, double lat, double& uz );
int calculate( double lon, double lat, double& uz, double& ulon, double &ulat );
int calculate( cObsArray& arr );
int calculate( cOgrd& uZ );
int calculate( cOgrd& uZ, cOgrd& uLon, cOgrd& uLat );
char *sprint();
};
#endif // OKADAEARTHQUAKE_H
#ifndef OKADAEARTHQUAKE_H
#define OKADAEARTHQUAKE_H
#include <cOgrd.h>
#include <cSphere.h>
#include "cOkadaFault.h"
class cOkadaEarthquake
{
protected:
int finalized;
int getDeformArea( int round, double& lonmin, double& lonmax, double& latmin, double& latmax );
int setGrid( cOgrd& u );
public:
int nfault; // total nuber of Okada faults
double m0; // total earthquake moment
cOkadaFault *fault; // array of composing faults
cOkadaEarthquake();
~cOkadaEarthquake();
int read( char *fname );
int finalizeInput();
double getM0();
double getMw();
int calculate( double lon, double lat, double& uz );
int calculate( double lon, double lat, double& uz, double& ulon, double &ulat );
int calculate( cObsArray& arr );
int calculate( cOgrd& uZ );
int calculate( cOgrd& uZ, cOgrd& uLon, cOgrd& uLat );
char *sprint();
};
#endif // OKADAEARTHQUAKE_H
This diff is collapsed.
......@@ -22,67 +22,67 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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
#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
This diff is collapsed.
......@@ -22,39 +22,39 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ONSPHERE_H
#define ONSPHERE_H
#define Re 6384.e+3 // Earth radius
class cObsArray
{
public:
int nPos;
int nObs;
char **id;
double *lon;
double *lat;
double **obs;
cObsArray();
~cObsArray();
int read( char *fname );
int write( char *fname );
int resetObs();
int resetObs( int newnobs );
int findById( char *id0 );
long writeBin( FILE *fp );
long readBin( FILE *fp );
double residual( cObsArray& ref );
double norm();
};
double GeoDistOnSphere( double lon1, double lat1, double lon2, double lat2 );
double GeoStrikeOnSphere( double lon1, double lat1, double lon2, double lat2 );
#endif // ONSPHERE_H
#ifndef ONSPHERE_H
#define ONSPHERE_H
#define Re 6384.e+3 // Earth radius
class cObsArray
{
public:
int nPos;
int nObs;
char **id;
double *lon;
double *lat;
double **obs;
cObsArray();
~cObsArray();
int read( char *fname );
int write( char *fname );
int resetObs();
int resetObs( int newnobs );
int findById( char *id0 );
long writeBin( FILE *fp );
long readBin( FILE *fp );
double residual( cObsArray& ref );
double norm();
};
double GeoDistOnSphere( double lon1, double lat1, double lon2, double lat2 );
double GeoStrikeOnSphere( double lon1, double lat1, double lon2, double lat2 );
#endif // ONSPHERE_H
......@@ -22,102 +22,102 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EASYWAVE_H
#define EASYWAVE_H
#define Re 6384.e+3 // Earth radius
#define Gravity 9.81 // gravity acceleration
#define Omega 7.29e-5 // Earth rotation period [1/sec]
#define MAX_VARS_PER_NODE 12
#define iD 0
#define iH 1
#define iHmax 2
#define iM 3
#define iN 4
#define iR1 5
#define iR2 6
#define iR3 7
#define iR4 8
#define iR5 9
#define iTime 10
#define iTopo 11
// Global data
struct EWPARAMS {
char *modelName;
char *modelSubset;
char *fileBathymetry;
char *fileSource;
char *filePOIs;
int dt;
int time;
int timeMax;
int poiDt;
int poiReport;
int outDump;
int outProgress;
int outPropagation;
int coriolis;
float dmin;
float poiDistMax;
float poiDepthMin;
float poiDepthMax;
float ssh0ThresholdRel;
float ssh0ThresholdAbs;
float sshClipThreshold;
float sshZeroThreshold;
float sshTransparencyThreshold;
float sshArrivalThreshold;
bool gpu;
bool adjustZtop;
bool verbose;
};
extern struct EWPARAMS Par;
extern int NLon,NLat;
extern double LonMin,LonMax,LatMin,LatMax;
extern double DLon,DLat; // steps in grad
extern double Dx,Dy; // steps in m, dx must be multiplied by cos(y) before use
extern float *R6;
extern float *C1;
extern float *C2;
extern float *C3;
extern float *C4;
extern int Imin;
extern int Imax;
extern int Jmin;
extern int Jmax;
#define idx(j,i) ((i-1)*NLat+j-1)
#define getLon(i) (LonMin+(i-1)*DLon)
#define getLat(j) (LatMin+(j-1)*DLat)
int ewLoadBathymetry();
int ewParam( int argc, char **argv );
void ewLogParams(void);
int ewReset();
int ewSource();
int ewStep();
int ewStepCor();
int ewStart2DOutput();
int ewOut2D();
int ewDump2D();
int ewLoadPOIs();
int ewSavePOIs();
int ewDumpPOIs();
int ewDumpPOIsCompact( int istage );
extern int NPOIs;
extern long *idxPOI;
/* verbose printf: only executed if -verbose was set */
#define printf_v( Args, ... ) if( Par.verbose ) printf( Args, ##__VA_ARGS__);
#include "ewNode.h"
extern CNode *gNode;
#endif /* EASYWAVE_H */
#ifndef EASYWAVE_H
#define EASYWAVE_H
#define Re 6384.e+3 // Earth radius
#define Gravity 9.81 // gravity acceleration
#define Omega 7.29e-5 // Earth rotation period [1/sec]
#define MAX_VARS_PER_NODE 12
#define iD 0
#define iH 1
#define iHmax 2
#define iM 3
#define iN 4
#define iR1 5
#define iR2 6
#define iR3 7
#define iR4 8
#define iR5 9
#define iTime 10
#define iTopo 11
// Global data
struct EWPARAMS {
char *modelName;
char *modelSubset;
char *fileBathymetry;
char *fileSource;
char *filePOIs;
int dt;
int time;
int timeMax;
int poiDt;
int poiReport;
int outDump;
int outProgress;
int outPropagation;
int coriolis;
float dmin;
float poiDistMax;
float poiDepthMin;
float poiDepthMax;
float ssh0ThresholdRel;
float ssh0ThresholdAbs;
float sshClipThreshold;
float sshZeroThreshold;
float sshTransparencyThreshold;
float sshArrivalThreshold;
bool gpu;
bool adjustZtop;
bool verbose;
};
extern struct EWPARAMS Par;