summaryrefslogtreecommitdiff
path: root/src/comm/OverloadComm.c
blob: c0c291a848574f4d4afba30c9e26c7a46e3c645a (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
 /*@@
   @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 
 @@*/

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

#include "cctk_Flesh.h"
#include "cctk_FortranString.h"
#include "OverloadMacros.h"
#include "cctk_WarnLevel.h"

static char *rcsid="$Header$";

/* Define the prototypes for the dummy functions. */
#define OVERLOADABLE(name) OVERLOADABLE_DUMMYPROTOTYPE(name)

  /* Deal seperately with the SetupGH routine */
#define CCTKi_DummySetupGH  CactusDefaultSetupGH
#define CCTKi_DummyMyProc  CactusDefaultMyProc
#define CCTKi_DummynProcs  CactusDefaultnProcs
#define CCTKi_DummyBarrier CactusDefaultBarrier
#define CCTKi_DummyExit    CactusDefaultExit

#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 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_CHECK(name)

  /* Deal seperately with the SetupGH routine */
#define CCTKi_DummySetupGH CactusDefaultSetupGH
#define CCTKi_DummyMyProc  CactusDefaultMyProc
#define CCTKi_DummynProcs  CactusDefaultnProcs
#define CCTKi_DummyBarrier CactusDefaultBarrier
#define CCTKi_DummyExit    CactusDefaultExit

#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 OVERLOADABLE

  return 0;
}

/* Create the dummy functions. */
#define OVERLOADABLE(name) OVERLOADABLE_DUMMY(name)

#include "CommOverloadables.h"

#undef OVERLOADABLE



/*    Fortran bindings for the comm functions */



int FMODIFIER FORTRAN_NAME(CCTK_Exit)(int *retval, cGH *GH)
{
  return CCTK_Exit(*retval, GH);
}

int FMODIFIER FORTRAN_NAME(CCTK_ParallelInit)(cGH *GH)
{
  return CCTK_ParallelInit(GH);
}

int FMODIFIER FORTRAN_NAME(CCTK_Abort)(cGH *GH)
{
  CCTK_Abort(GH);
  return 0;
}

int FMODIFIER FORTRAN_NAME(CCTK_SyncGroup)(cGH *GH, ONE_FORTSTRING_ARG)
{
  ONE_FORTSTRING_CREATE(group_name)
  CCTK_SyncGroup(GH,group_name);
  free(group_name); 
  return 0;
}

int FMODIFIER FORTRAN_NAME(CCTK_nProcs)(cGH *GH)
{
  return CCTK_nProcs(GH);
}
 
int FMODIFIER FORTRAN_NAME(CCTK_MyProc)(cGH *GH)
{
  return CCTK_MyProc(GH);
}
 
int FMODIFIER FORTRAN_NAME(CCTK_Barrier)(cGH *GH)
{
  return CCTK_Barrier(GH);
}