summaryrefslogtreecommitdiff
path: root/src/include/cctk.h
blob: 96f553cc06ff58434296deab68fcabb94204fe03 (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
 /*@@
   @header    cctk.h
   @date      Tue Jan 26 17:29:34 1999
   @author    Tom Goodale
   @desc 
   Main include file for the CCTK.  All thorns should include this...
   @enddesc
   @version $Id$
 @@*/

#ifndef _CCTK_H_
#define _CCTK_H_

/* Grab the main configuration info. */

#include "config.h"

/* The thorn definitions #define <PACKAGE>_<THORN> */

#include "definethorn.h"

/* Define which thorn the file is in */

#include "definethisthorn.h"

/* Include the constants */

#include "cctk_constants.h"

/* Define some stuff */

#ifdef FCODE

#define CCTK_PRINTSEPARATOR\
  print *,"-----------------------------------------------------------"

#define _CCTK_FARGUMENTS  cctk_dim, cctk_gsh, cctk_lsh, cctk_lbnd,        \
                          cctk_ubnd, cctk_from, cctk_to, cctk_bbox,       \
                          cctk_delta_time, cctk_time, cctk_delta_space,   \
                          cctk_origin_space, cctk_levfac, cctk_convlevel, \
                          cctk_nghostzones, cctk_iteration, cctkGH

#define _DECLARE_CCTK_FARGUMENTS INTEGER cctk_dim&&\
                           INTEGER cctk_gsh(cctk_dim),cctk_lsh(cctk_dim)&&\
                           INTEGER cctk_lbnd(cctk_dim),cctk_ubnd(cctk_dim)&&\
                           INTEGER cctk_from(cctk_dim),cctk_to(cctk_dim)&&\
                           INTEGER cctk_bbox(2*cctk_dim)&&\
                           CCTK_REAL cctk_delta_time, cctk_time&&\
                           CCTK_REAL cctk_delta_space(cctk_dim)&&\
			   CCTK_REAL cctk_origin_space(cctk_dim)&&\
                           INTEGER cctk_levfac(cctk_dim)&&\
                           INTEGER cctk_convlevel&&\
                           INTEGER cctk_nghostzones(cctk_dim)&&\
                           INTEGER cctk_iteration&&\
                           CCTK_POINTER cctkGH&&\

#define CCTK_WARN(a,b) CCTK_Warn(a,__LINE__,__FORTRANFILE__,CCTK_THORNSTRING,b)
#define CCTK_EQUALS(a,b) (CCTK_Equals(a,b).eq.1)

#define CCTK_PASS_FTOF CCTK_FARGUMENTS

#define CCTK_DELTA_SPACE(x) cctk_delta_space(x)/cctk_levfac(x)
#define CCTK_DELTA_TIME cctk_delta_time

#define DECLARE_CCTK_FUNCTIONS integer CCTK_Equals, CCTK_MyProc, CCTK_nProcs

#endif /*FCODE*/

#ifdef CCODE

#include "cGH.h"
#include "cctk_Flesh.h"
#include "cctk_IO.h"
#include "cctk_Comm.h"
#include "cctk_GHExtensions.h"

#include "cctk_ActiveThorns.h"
#include "cctk_Banner.h"
#include "cctk_Coord.h"
#include "cctk_File.h"
#include "cctk_Groups.h"
#include "cctk_GroupsOnGH.h"
#include "cctk_GHExtensions.h"
#include "cctk_Interp.h"
#include "cctk_IOMethods.h"
#include "cctk_Misc.h"
#include "cctk_Reduction.h"
#include "cctk_WarnLevel.h"

#define CCTK_GFINDEX3D(GH,i,j,k) ((i) + GH->cctk_lsh[0]*((j)+GH->cctk_lsh[1]*(k)))
#define CCTK_GFINDEX2D(GH,i,j)   ((i) + GH->cctk_lsh[0]*((j)))
#define CCTK_GFINDEX1D(GH,i)      (i)


#define CCTK_PRINTSEPARATOR \
  printf("--------------------------------------------------------------------------------\n");

#define _DECLARE_CCTK_CARGUMENTS \
            int cctk_dim=cctkGH->cctk_dim;\
            int *cctk_gsh=cctkGH->cctk_gsh;\
            int *cctk_lsh=cctkGH->cctk_lsh;\
            int *cctk_lbnd=cctkGH->cctk_lbnd;\
            int *cctk_ubnd=cctkGH->cctk_ubnd;\
            int *cctk_from=cctkGH->cctk_from;\
            int *cctk_to=cctkGH->cctk_to;\
            int *cctk_bbox=cctkGH->cctk_bbox;\
            CCTK_REAL cctk_delta_time=cctkGH->cctk_delta_time;\
            CCTK_REAL cctk_time=cctkGH->cctk_time;\
            CCTK_REAL *cctk_delta_space=cctkGH->cctk_delta_space;\
            CCTK_REAL *cctk_origin_space=cctkGH->cctk_origin_space;\
            int *cctk_levfac=cctkGH->cctk_levfac;\
            int cctk_convlevel=cctkGH->cctk_convlevel;\
            int *cctk_nghostzones=cctkGH->cctk_nghostzones;\
            int cctk_iteration=cctkGH->cctk_iteration;


#define _INITIALISE_CCTK_C2F
#define _DECLARE_CCTK_C2F 
#define _PASS_CCTK_C2F(xGH) &((xGH)->cctk_dim),\
                            (xGH)->cctk_gsh,(xGH)->cctk_lsh, \
                            (xGH)->cctk_lbnd,(xGH)->cctk_ubnd, \
                            (xGH)->cctk_from,(xGH)->cctk_to, \
                            (xGH)->cctk_bbox,\
                            &((xGH)->cctk_delta_time), \
                            &((xGH)->cctk_time), (xGH)->cctk_delta_space,\
			    (xGH)->cctk_origin_space,\
                            (xGH)->cctk_levfac,\
                            &((xGH)->cctk_convlevel),\
                            (xGH)->cctk_nghostzones,\
                            &((xGH)->cctk_iteration),\
                            (xGH)
#define _CCTK_C2F_PROTO     int *,\
                            int *,\
                            int *,int *, int *, int *,int *,int *,\
                            CCTK_REAL *, CCTK_REAL *, CCTK_REAL *,\
			    CCTK_REAL *,\
                            int *,\
                            int *,\
                            int *,\
                            int *,\
                            cGH *

#define CCTK_STORAGESIZE(xGH, cctk_dim, group) \
                  (CCTK_QueryGroupStorage(xGH,group) ?\
                  (CCTK_ArrayGroupSize(xGH, cctk_dim, group)) : &(_cctk_one))


extern int _cctk_one;

#define CCTK_EQUALS(a,b) (CCTK_Equals(a,b)==1)

#define CCTK_PASS_CTOC cctkGH

#define CCTK_DELTA_SPACE(x) cctk_delta_space[x]/cctk_levfac[x]
#define CCTK_DELTA_TIME cctk_delta_time

#define CCTK_WARN(a,b) CCTK_Warn(a,__LINE__,__FILE__,CCTK_THORNSTRING,b)

#endif /*CCODE*/

#define CCTK_INFO(a) CCTK_Info(CCTK_THORNSTRING,a)
#define CCTK_PARAMWARN(a) CCTK_ParamWarn(CCTK_THORNSTRING,a)

/*
#define CCTK_MAKESTRING(x) CCTK_REALSTRING(x)
#define CCTK_REALSTRING(x) #x
#define CCTK_WARN(a,b) CCTK_Warn(a,CCTK_MAKESTRING(CCTK_THORN),b,__LINE__,__FILE__)
*/


#endif