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
|
#ifndef FUNCTIONS_HH
#define FUNCTIONS_HH
#include <map>
#include <string>
#include <vector>
#include <mpi.h>
#include <cctk.h>
#include <cctk_Schedule.h>
#include <bbox.hh>
#include <dh.hh>
#include <gh.hh>
#include <vect.hh>
namespace Carpet {
using namespace std;
using namespace CarpetLib;
int SyncGroupsByDirI (const cGH* cctkGH, int num_groups,
const int* groups, const int* directions);
int EnableGroupComm (const cGH* cgh, const char* groupname);
int DisableGroupComm (const cGH* cgh, const char* groupname);
int EnableGroupStorage (const cGH* cgh, const char* groupname);
int DisableGroupStorage (const cGH* cgh, const char* groupname);
int GroupStorageIncrease (const cGH* cgh, int n_groups, const int* groups,
const int* timelevels, int* status);
int GroupStorageDecrease (const cGH* cgh, int n_groups, const int* groups,
const int* timelevels, int* status);
int Barrier (const cGH* cgh);
int NamedBarrier (const cGH* cgh, int id);
int Exit (const cGH* cgh, int retval);
int Abort (const cGH* cgh, int retval);
int MyProc (const cGH* cgh) CCTK_ATTRIBUTE_CONST;
int nProcs (const cGH* cgh) CCTK_ATTRIBUTE_CONST;
const int* ArrayGroupSizeB (const cGH* cgh, int dir, int group,
const char* groupname) CCTK_ATTRIBUTE_PURE;
int QueryGroupStorageB (const cGH* cgh, int group, const char* groupname) CCTK_ATTRIBUTE_PURE;
int GroupDynamicData (const cGH* cgh, int group, cGroupDynamicData* data);
void Restrict (const cGH* cgh);
// Multi-Model
void
SplitUniverse (MPI_Comm const world, string const model, MPI_Comm & comm,
bool verbose);
// Model id to model name
vector <string> Models ();
string Model (int id) CCTK_ATTRIBUTE_PURE;
// Model name to model id
std::map <string, int> ModelMap ();
int ModelMap (string name) CCTK_ATTRIBUTE_PURE;
// Processor to model id
vector <int> ModelIds ();
int ModelId (int proc) CCTK_ATTRIBUTE_PURE;
// Model id to processors
vector <vector <int> > ModelProcs () CCTK_ATTRIBUTE_PURE;
vector <int> ModelProcs (int proc) CCTK_ATTRIBUTE_PURE;
extern "C" {
CCTK_POINTER_TO_CONST
Carpet_GetMPICommUniverse (CCTK_POINTER_TO_CONST cctkGH);
CCTK_POINTER_TO_CONST
Carpet_GetMPICommWorld (CCTK_POINTER_TO_CONST cctkGH);
CCTK_INT
Carpet_GetCoordRange (CCTK_POINTER_TO_CONST const cctkGH_,
CCTK_INT const m,
CCTK_INT const ml,
CCTK_INT const size,
CCTK_INT * const gsh,
CCTK_REAL * const lower,
CCTK_REAL * const upper,
CCTK_REAL * const delta);
}
// Helpers for storage
void GroupsStorageCheck (cGH const * const cctkGH);
// Helpers for recomposing the grid hierarchy
void
RegridMap (cGH const * cctkGH,
int m,
gh::rregs const & supeerregss,
gh::mregs const & regsss,
bool do_init);
void
PostRegrid (cGH const * cctkGH);
bool
Recompose (cGH const * cctkGH,
int rl,
bool do_init);
void
RegridFree (cGH const * cctkGH,
bool do_init);
void
CheckRegions (gh::mregs const & regsss);
void
OutputSuperregions (cGH const * cctkGH,
int m,
gh const & hh,
gh::rregs const & superregss);
void
OutputGrids (cGH const * cctkGH,
int const m,
gh const & hh,
dh const & dd);
void
OutputGridStructure (cGH const * cctkGH,
int const m,
gh::mregs const & regsss);
void
OutputGridCoordinates (cGH const * cctkGH,
int const m,
gh::mregs const & regsss);
void
OutputGridStatistics (cGH const * cctkGH);
// Functions for recomposing the grid hierarchy
void
SplitRegions (cGH const * cctkGH,
vector<region_t> & superregs,
vector<region_t> & regs);
void
SplitRegions_AlongZ (cGH const * cctkGH,
vector<region_t> & superregs,
vector<region_t> & regs);
void
SplitRegions_AlongDir (cGH const * cctkGH,
vector<region_t> & superregs,
vector<region_t> & regs,
int dir);
void
SplitRegions_Automatic (cGH const * cctkGH,
vector<region_t> & superregs,
vector<region_t> & regs);
void
SplitRegionsMaps (cGH const * cctkGH,
vector<vector<region_t> > & superregss,
vector<vector<region_t> > & regss);
void
SplitRegionsMaps_Automatic (cGH const * cctkGH,
vector<vector<region_t> > & superregss,
vector<vector<region_t> > & regss);
void
MakeMultigridBoxes (cGH const * cctkGH,
int m,
gh::rregs const & regss,
gh::mregs & regsss);
void
MakeMultigridBoxesMaps (cGH const * cctkGH,
vector<gh::rregs> const & regsss,
vector<gh::mregs> & regssss);
// Timing statistics functions
void InitTimingStats (cGH const * cctkGH);
void BeginTimingEvolution (cGH const * cctkGH);
void StepTimingEvolution (cGH const * cctkGH);
void BeginTimingIO (cGH const * cctkGH);
void EndTimingIO (cGH const * cctkGH,
CCTK_REAL files, CCTK_REAL bytes, bool is_binary);
void BeginTimingCommunication (cGH const * cctkGH);
void EndTimingCommunication (cGH const * cctkGH,
CCTK_REAL messages, CCTK_REAL bytes);
void UpdateTimingStats (cGH const * cctkGH);
void PrintTimingStats (cGH const * cctkGH);
} // namespace Carpet
#endif // !defined(FUNCTIONS_HH)
|