Commit d7b1efc0 authored by Steffen Christgau's avatar Steffen Christgau Committed by Matthias Rüster
Browse files

refactor header file usage

- Avoid circular dependency between ewNode.h and easywave.h
  by introducing ewdefs.h. The circular dependency may cause
  problems during automatic code analytics or compilation.
- Add missing headers, like stdio.h for FILE, e.g. This prevents
  compiler warnings.
- Follow conventions for system/vendor and user headers.
parent c1dbff50
......@@ -33,8 +33,9 @@
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <utilits.h>
#include <cOgrd.h>
#include "utilits.h"
#include "cOgrd.h"
#define DEFAULT_NOVAL 0.0
#define ROWWISE 1
......
......@@ -33,6 +33,8 @@
#ifndef OGRD_H
#define OGRD_H
#include <stdio.h>
class cOgrd
{
......
......@@ -36,7 +36,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <utilits.h>
#include "utilits.h"
#include "cOkadaEarthquake.h"
......
......@@ -33,8 +33,8 @@
#ifndef OKADAEARTHQUAKE_H
#define OKADAEARTHQUAKE_H
#include <cOgrd.h>
#include <cSphere.h>
#include "cOgrd.h"
#include "cSphere.h"
#include "cOkadaFault.h"
......
......@@ -32,7 +32,8 @@
#include <stdio.h>
#include <string.h>
#include <utilits.h>
#include "utilits.h"
#include "cOkadaFault.h"
static const double Rearth=6384.e+3;
......
......@@ -33,8 +33,8 @@
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <utilits.h>
#include <cSphere.h>
#include "utilits.h"
#include "cSphere.h"
//=========================================================================
......
......@@ -33,6 +33,8 @@
#ifndef ONSPHERE_H
#define ONSPHERE_H
#include <stdio.h>
#define Re 6384.e+3 // Earth radius
class cObsArray
......
......@@ -33,75 +33,12 @@
#ifndef EASYWAVE_H
#define EASYWAVE_H
#include "ewdefs.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);
......
......@@ -33,6 +33,8 @@
#ifndef EW_KERNELS_H
#define EW_KERNELS_H
#include "ewGpuNode.cuh"
__global__ void runWaveUpdateKernel( KernelData data );
__global__ void runWaveBoundaryKernel( KernelData data );
__global__ void runFluxUpdateKernel( KernelData data );
......
......@@ -34,9 +34,10 @@
#define EW_GPUNODE_H
/* FIXME: check header dependencies */
#include <stdio.h>
#include "easywave.h"
#include "ewNode.h"
#include <stdio.h>
#define CUDA_CALL(x) if( x != cudaSuccess ) { fprintf( stderr, "Error in file %s on line %u: %s\n", __FILE__, __LINE__, cudaGetErrorString( cudaGetLastError() ) ); return 1; }
......
......@@ -33,7 +33,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <utilits.h>
#include "utilits.h"
#include "easywave.h"
int NLon,NLat;
......
......@@ -35,7 +35,8 @@
#include <stdlib.h>
#include <string.h>
#include "easywave.h"
#include "ewdefs.h"
#define CHKRET( x ) if( (x) == NULL ) return 1;
......
......@@ -32,7 +32,8 @@
#include <stdio.h>
#include <string.h>
#include <utilits.h>
#include "utilits.h"
#include "easywave.h"
......
......@@ -33,7 +33,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <utilits.h>
#include "utilits.h"
#include "easywave.h"
//#define SSHMAX_TO_SINGLE_FILE 0
......
......@@ -33,7 +33,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <utilits.h>
#include "utilits.h"
#include "easywave.h"
struct EWPARAMS Par;
......
......@@ -31,7 +31,7 @@
*/
#include <stdio.h>
#include <utilits.h>
#include "utilits.h"
#include "easywave.h"
......
......@@ -32,8 +32,9 @@
#include <stdio.h>
#include <string.h>
#include <utilits.h>
#include <cOgrd.h>
#include "utilits.h"
#include "cOgrd.h"
#include "cOkadaEarthquake.h"
#include "easywave.h"
......
......@@ -33,7 +33,8 @@
// Time stepping
#include <stdio.h>
#include <stdlib.h>
#include <utilits.h>
#include "utilits.h"
#include "easywave.h"
/* TODO: still not perfect */
......
#ifndef EWDEFS_H
#define EWDEFS_H
#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;
};
int ewStep();
int ewStepCor();
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)
#endif /* EWDEFS_H */
......@@ -39,7 +39,8 @@
#include <math.h>
#include <ctype.h>
#include <time.h>
#include <utilits.h>
#include "utilits.h"
#define ERRORFILE "error.msg"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment