summaryrefslogtreecommitdiff
path: root/src/comm/CactusSync.c
blob: 07120a91f95ccf594011804bc3bd393c46200bc7 (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
 /*@@
   @file      CactusSync.c
   @date      Thu Sep  18 14:27:18 1999
   @author    Gerd Lanfermann
   @desc 
   A collection of SyncGroup routines: Sync a group by the GROUP INDEX, 
   by the group's VARIABLE NAME, by the group's VARIABLE INDEX.

   It ends up calling CCTK_SyncGroup(GH,groupname), which is overloaded (currently
   by PUGH).
   
   @enddesc
   @version $Header$
 @@*/

#include <stdlib.h>

#include "cctk_Flesh.h"
#include "cctk_FortranString.h"
#include "cctk_Comm.h"
#include "cctk_Groups.h"
#include "cctk_Sync.h"

static char *rcsid = "$Header$";

 /*@@
   @routine    CCTK_SyncGroupI
   @date       Thu Sep  18 14:27:18 1999
   @author     Gerd Lanfermann
   @desc 
   
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/
void CCTK_SyncGroupI(cGH *GH, 
                     int groupi) 
{
  char *groupname = CCTK_GroupName(groupi);

  CCTK_SyncGroup(GH,groupname);

  free(groupname);
}

void FMODIFIER FORTRAN_NAME(CCTK_SyncGroupI)(cGH *GH, int *groupi) 
{
  CCTK_SyncGroupI(GH, *groupi);
}



 /*@@
   @routine    CCTK_SyncGroupWithVar
   @date       Thu Sep  18 14:27:18 1999
   @author     Gerd Lanfermann
   @desc 
   
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/
void CCTK_SyncGroupWithVar(cGH *GH, 
                           const char *varn) 
{
  int groupi;

  groupi = CCTK_GroupIndexFromVarI(CCTK_VarIndex(varn));

  CCTK_SyncGroupI(GH,groupi);
}

void FMODIFIER FORTRAN_NAME(CCTK_SyncGroupWithVar)(cGH *GH, ONE_FORTSTRING_ARG) 
{
  ONE_FORTSTRING_CREATE(varn);
  CCTK_SyncGroupWithVar(GH,varn);
  free(varn);
}



 /*@@
   @routine    CCTK_SyncGroupWithVarI
   @date       Thu Sep  18 14:27:18 1999
   @author     Gerd Lanfermann
   @desc 
   
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/
void CCTK_SyncGroupWithVarI(cGH *GH, 
                            int vari) 
{
  int groupi;

  groupi = CCTK_GroupIndexFromVarI(vari);

  CCTK_SyncGroupI(GH,groupi);
}

void FMODIFIER FORTRAN_NAME(CCTK_SyncGroupWithVarI)(cGH *GH, int *vari) 
{
  CCTK_SyncGroupWithVarI(GH,*vari);
}

 /*@@
   @routine    CCTK_SyncGroupsI
   @date       Thu Jan 27 18:00:15 2000
   @author     Tom Goodale
   @desc 
   Synchronises a list of groups by group index. 
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/
int CCTK_SyncGroupsI(cGH *GH, 
                     int n_groups, 
                     int *groups)
{
  int i;

  for(i = 0; i < n_groups; i++)
  {
    CCTK_SyncGroupI(GH, i);
  }

  return 0;
}