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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
/*@@
@file Overload.c
@date Wed Feb 3 23:27:18 1999
@author Tom Goodale
@desc
Contains routines to overload the communication functions.
Uses the overload macros to make sure of consistency and
to save typing !
@enddesc
@version $Header$
@@*/
#include <stdio.h>
#include <stdlib.h>
#include "cctk_Flesh.h"
#include "cctk_FortranString.h"
#include "cctk_WarnLevel.h"
#include "CactusRegister.h"
#include "OverloadMacros.h"
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(comm_OverloadComm_c);
/* Define the prototypes for the dummy functions. */
#define OVERLOADABLE(name) OVERLOADABLE_DUMMYPROTOTYPE(name)
/* Deal seperately with the SetupGH routine */
#define CCTKi_DummyAbort CactusDefaultAbort
#define CCTKi_DummyBarrier CactusDefaultBarrier
#define CCTKi_DummyExit CactusDefaultExit
#define CCTKi_DummyMyProc CactusDefaultMyProc
#define CCTKi_DummynProcs CactusDefaultnProcs
#define CCTKi_DummySetupGH CactusDefaultSetupGH
/* Need to do some stuff to make sure old routines still work. */
#define CCTKi_DummyEnableGroupStorage CactusDefaultEnableGroupStorage
#define CCTKi_DummyDisableGroupStorage CactusDefaultDisableGroupStorage
#define CCTKi_DummyGroupStorageIncrease CactusDefaultGroupStorageIncrease
#define CCTKi_DummyGroupStorageDecrease CactusDefaultGroupStorageDecrease
#include "CommOverloadables.h"
/* Reset the #define to prevent complications. */
#undef CCTKi_DummySetupGH
#undef CCTKi_DummyMyProc
#undef CCTKi_DummynProcs
#undef CCTKi_DummyBarrier
#undef CCTKi_DummyExit
#undef CCTKi_DummyAbort
#undef CCTKi_DummyEnableGroupStorage
#undef CCTKi_DummyDisableGroupStorage
#undef CCTKi_DummyGroupStorageIncrease
#undef CCTKi_DummyGroupStorageDecrease
#undef OVERLOADABLE
/* Create the overloadable function variables and the
* functions allowing the variables to be set.
*/
#define OVERLOADABLE(name) OVERLOADABLE_FUNCTION(name)
#include "CommOverloadables.h"
#undef OVERLOADABLE
/*@@
@routine CCTKi_SetupCommFunctions
@date Thu Feb 4 08:21:26 1999
@author Tom Goodale
@desc
Set any comm function which hasn't been overloaded to the default.
@enddesc
@calls
@calledby
@history
@endhistory
@@*/
int CCTKi_SetupCommFunctions(void)
{
#define OVERLOADABLE(name) OVERLOADABLE_INITIALISE(name)
/* Deal seperately with the SetupGH routine */
#define CCTKi_DummyAbort CactusDefaultAbort
#define CCTKi_DummyBarrier CactusDefaultBarrier
#define CCTKi_DummyExit CactusDefaultExit
#define CCTKi_DummyMyProc CactusDefaultMyProc
#define CCTKi_DummynProcs CactusDefaultnProcs
#define CCTKi_DummySetupGH CactusDefaultSetupGH
#define CCTKi_DummyEnableGroupStorage CactusDefaultEnableGroupStorage
#define CCTKi_DummyDisableGroupStorage CactusDefaultDisableGroupStorage
#define CCTKi_DummyGroupStorageIncrease CactusDefaultGroupStorageIncrease
#define CCTKi_DummyGroupStorageDecrease CactusDefaultGroupStorageDecrease
#include "CommOverloadables.h"
/* Reset the #define to prevent complications. */
#undef CCTKi_DummyAbort
#undef CCTKi_DummyBarrier
#undef CCTKi_DummyExit
#undef CCTKi_DummyMyProc
#undef CCTKi_DummynProcs
#undef CCTKi_DummySetupGH
#undef CCTKi_DummyEnableGroupStorage
#undef CCTKi_DummyDisableGroupStorage
#undef CCTKi_DummyGroupStorageIncrease
#undef CCTKi_DummyGroupStorageDecrease
#undef OVERLOADABLE
return 0;
}
/* Create the dummy function prototypes. */
#define OVERLOADABLE(name) OVERLOADABLE_DUMMYPROTOTYPE(name)
#include "CommOverloadables.h"
#undef OVERLOADABLE
/* Create the dummy functions. */
#define OVERLOADABLE(name) OVERLOADABLE_DUMMY(name)
#include "CommOverloadables.h"
#undef OVERLOADABLE
/* Fortran bindings prototypes for the comm functions */
int CCTK_FCALL CCTK_FNAME (CCTK_nProcs) (const cGH *GH);
int CCTK_FCALL CCTK_FNAME (CCTK_MyProc) (const cGH *GH);
void CCTK_FCALL CCTK_FNAME (CCTK_Barrier) (int *ierror, const cGH *GH);
void CCTK_FCALL CCTK_FNAME (CCTK_Exit) (int *ierror, cGH *GH, const int *retval);
void CCTK_FCALL CCTK_FNAME (CCTK_Abort) (int *ierror, cGH *GH, const int *retval);
void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroup) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG);
void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupComm) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG);
void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupComm) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG);
void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupStorage) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG);
void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupStorage) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG);
void CCTK_FCALL CCTK_FNAME (CCTK_QueryGroupStorage) (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG);
/* Fortran bindings definitions for the comm functions */
int CCTK_FCALL CCTK_FNAME (CCTK_nProcs) (const cGH *GH)
{
return (CCTK_nProcs (GH));
}
int CCTK_FCALL CCTK_FNAME (CCTK_MyProc) (const cGH *GH)
{
return (CCTK_MyProc (GH));
}
void CCTK_FCALL CCTK_FNAME (CCTK_Barrier) (int *ierror, const cGH *GH)
{
*ierror = CCTK_Barrier (GH);
}
void CCTK_FCALL CCTK_FNAME (CCTK_Exit) (int *ierror, cGH *GH, const int *retval)
{
*ierror = CCTK_Exit (GH, *retval);
}
void CCTK_FCALL CCTK_FNAME (CCTK_Abort) (int *ierror, cGH *GH, const int *retval)
{
*ierror = CCTK_Abort (GH, *retval);
}
void CCTK_FCALL CCTK_FNAME (CCTK_SyncGroup) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (group_name)
*ierror = CCTK_SyncGroup (GH, group_name);
free (group_name);
}
void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupComm) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (group_name)
*ierror = CCTK_EnableGroupComm (GH, group_name);
free (group_name);
}
void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupComm) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (group_name)
*ierror = CCTK_DisableGroupComm (GH, group_name);
free (group_name);
}
void CCTK_FCALL CCTK_FNAME (CCTK_EnableGroupStorage) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (group_name)
*ierror = CCTK_EnableGroupStorage (GH, group_name);
free (group_name);
}
void CCTK_FCALL CCTK_FNAME (CCTK_DisableGroupStorage) (int *ierror, cGH *GH, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE (group_name)
*ierror = CCTK_DisableGroupStorage (GH, group_name);
free (group_name);
}
void CCTK_FCALL CCTK_FNAME (CCTK_QueryGroupStorage) (int *ierror, const cGH *GH, ONE_FORTSTRING_ARG)
{
extern int CCTK_QueryGroupStorage (const cGH *, const char *);
ONE_FORTSTRING_CREATE (group_name)
*ierror = CCTK_QueryGroupStorage (GH, group_name);
free (group_name);
}
|