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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
|
/*@@
@file Faces.c
@author Erik Schnetter
@date 2004/03/07 09:48:53
@desc
Register a symmetry condition for a face
@version $Header$
@enddesc
@@*/
#include <stdlib.h>
#include "cctk.h"
#include "util_Table.h"
#include "SymBase.h"
/* the rcs ID and its dummy function to use it */
static const char *const rcsid = "$Header$";
CCTK_FILEVERSION (CactusBase_SymBase_Faces_c);
/*@@
@routine SymBase_SymmetryRegisterFaces
@author Erik Schnetter
@date 2004-03-06
@desc
Register a symmetry for certain faces
@enddesc
@var sym_table
@vtype CCTK_INT
@vdesc Table which describes the grid or grid array
@vio in
@endvar
@var group_dim
@vtype CCTK_INT
@vdesc Dimension of the grid or grid array
@vio in
@endvar
@var sym_handle
@vtype CCTK_INT
@vdesc Symmetry handle
@vio in
@endvar
@var which_faces
@vtype CCTK_INT[2*group_dim]
@vdesc The set of faces
@vio in
@endvar
@var symmetry_zone_width
@vtype CCTK_INT[2*group_dim]
@vdesc Symmetry boundary width
@vio in
@endvar
@returntype CCTK_INT
@returndesc
status code
0 for success
-1 if sym_table has an illegal value
-9 if group_dim has an illegal value
-2 if sym_handle has an illegal value
-3 if which_faces has an illegal value
-4 if symmetry_zone_width has an illegal value
@endreturndesc
@@*/
CCTK_INT
SymBase_SymmetryRegisterFaces (CCTK_INT const sym_table,
CCTK_INT const group_dim,
CCTK_INT const sym_handle,
CCTK_INT const *const which_faces,
CCTK_INT const *const new_symmetry_zone_width)
{
CCTK_INT symmetry_handle[100];
CCTK_INT symmetry_zone_width[100];
int face;
int ierr;
/* Check arguments */
if (sym_table < 0)
{
return -1; /* illegal argument */
}
if (group_dim < 0)
{
return -9; /* illegal argument */
}
if (sym_handle < 0 || sym_handle >= SymBase_num_symmetries)
{
return -2; /* illegal argument */
}
if (!which_faces)
{
return -3; /* illegal argument */
}
if (!symmetry_zone_width)
{
return -4; /* illegal argument */
}
/* Get table entries */
if (2 * group_dim > 100)
{
CCTK_WARN (0, "internal error");
}
ierr = Util_TableGetIntArray
(sym_table, 2 * group_dim, symmetry_handle, "symmetry_handle");
if (ierr != 2 * group_dim)
{
CCTK_WARN (0, "internal error");
}
ierr = Util_TableGetIntArray
(sym_table, 2 * group_dim, symmetry_zone_width, "symmetry_zone_width");
if (ierr != 2 * group_dim)
{
CCTK_WARN (0, "internal error");
}
/* Update table entries */
for (face = 0; face < 2 * group_dim; ++face)
{
if (which_faces[face])
{
if (symmetry_handle[face] != -1)
{
return -5; /* The face is already taken */
}
symmetry_handle[face] = sym_handle;
symmetry_zone_width[face] = new_symmetry_zone_width[face];
}
}
/* Set table entries */
ierr = Util_TableSetIntArray
(sym_table, 2 * group_dim, symmetry_handle, "symmetry_handle");
if (ierr != 1)
{
CCTK_WARN (0, "internal error");
}
ierr = Util_TableSetIntArray
(sym_table, 2 * group_dim, symmetry_zone_width, "symmetry_zone_width");
if (ierr != 1)
{
CCTK_WARN (0, "internal error");
}
return 0;
}
/*@@
@routine SymBase_SymmetryRegisterGrid
@author Erik Schnetter
@date 2004-03-06
@desc
Register a symmetry for certain faces of the grid hierarchy
@enddesc
@var cctkGH
@vtype cGH *
@vdesc The grid hierarchy
@vio in
@endvar
@var sym_handle
@vtype CCTK_INT
@vdesc Symmetry handle
@vio in
@endvar
@var which_faces
@vtype CCTK_INT[2*group_dim]
@vdesc The set of faces
@vio in
@endvar
@var symmetry_zone_width
@vtype CCTK_INT[2*group_dim]
@vdesc Symmetry boundary width
@vio in
@endvar
@returntype CCTK_INT
@returndesc
status code
0 for success
Error codes of SymBase_SymmetryRegisterFaces
@endreturndesc
@@*/
CCTK_INT
SymBase_SymmetryRegisterGrid (CCTK_POINTER const cctkGH_,
CCTK_INT const sym_handle,
CCTK_INT const *const which_faces,
CCTK_INT const *const new_symmetry_zone_width)
{
cGH const *const cctkGH = cctkGH_;
struct SymBase const *symdata;
if (!cctkGH)
{
CCTK_WARN (0, "internal error");
}
symdata = CCTK_GHExtension (cctkGH, "SymBase");
if (!symdata)
{
CCTK_WARN (0, "internal error");
}
return SymBase_SymmetryRegisterFaces
(symdata->sym_table, cctkGH->cctk_dim,
sym_handle, which_faces, new_symmetry_zone_width);
}
/*@@
@routine SymBase_SymmetryRegisterGI
@author Erik Schnetter
@date 2004-03-06
@desc
Register a symmetry for certain faces of grid arrays
@enddesc
@var cctkGH
@vtype cGH *
@vdesc The grid hierarchy
@vio in
@endvar
@var sym_handle
@vtype CCTK_INT
@vdesc Symmetry handle
@vio in
@endvar
@var which_faces
@vtype CCTK_INT[2*group_dim]
@vdesc The set of faces
@vio in
@endvar
@var symmetry_zone_width
@vtype CCTK_INT[2*group_dim]
@vdesc Symmetry boundary width
@vio in
@endvar
@var group_index
@vtype CCTK_INT
@vdesc Grid array group
@vio in
@endvar
@returntype CCTK_INT
@returndesc
status code
0 for success
-6 if group_index has an illegal value
-7 if the group has an illegal type
-8 internal error
Error codes of SymBase_SymmetryRegisterFaces
@endreturndesc
@@*/
CCTK_INT
SymBase_SymmetryRegisterGI (CCTK_POINTER const cctkGH_,
CCTK_INT const sym_handle,
CCTK_INT const *const which_faces,
CCTK_INT const *const new_symmetry_zone_width,
CCTK_INT const group_index)
{
cGH const *const cctkGH = cctkGH_;
struct SymBase const *symdata;
if (!cctkGH)
{
CCTK_WARN (0, "internal error");
}
symdata = CCTK_GHExtension (cctkGH, "SymBase");
if (!symdata)
{
CCTK_WARN (0, "internal error");
}
if (group_index < 0 || group_index >= CCTK_NumGroups ())
{
return -6; /* illegal argument */
}
switch (CCTK_GroupTypeI (group_index))
{
case CCTK_GF:
return -7; /* illegal group type */
case CCTK_SCALAR:
case CCTK_ARRAY:
return SymBase_SymmetryRegisterFaces
(symdata->array_sym_tables[group_index], CCTK_GroupDimI (group_index),
sym_handle, which_faces, new_symmetry_zone_width);
default:
CCTK_WARN (0, "internal error");
}
return -8; /* internal error */
}
/*@@
@routine SymBase_SymmetryRegisterGI
@author Erik Schnetter
@date 2004-03-06
@desc
Register a symmetry for certain faces of grid arrays
@enddesc
@var cctkGH
@vtype cGH *
@vdesc The grid hierarchy
@vio in
@endvar
@var sym_handle
@vtype CCTK_INT
@vdesc Symmetry handle
@vio in
@endvar
@var which_faces
@vtype CCTK_INT[2*group_dim]
@vdesc The set of faces
@vio in
@endvar
@var symmetry_zone_width
@vtype CCTK_INT[2*group_dim]
@vdesc Symmetry boundary width
@vio in
@endvar
@var group_name
@vtype CCTK_STRING
@vdesc Grid array group
@vio in
@endvar
@returntype CCTK_INT
@returndesc
status code
0 for success
Error codes of CCTK_GroupIndex
Error codes of SymBase_SymmetryRegisterGI
@endreturndesc
@@*/
CCTK_INT
SymBase_SymmetryRegisterGN (CCTK_POINTER const cctkGH_,
CCTK_INT const sym_handle,
CCTK_INT const *const which_faces,
CCTK_INT const *const new_symmetry_zone_width,
CCTK_STRING const group_name)
{
int group_index;
group_index = CCTK_GroupIndex (group_name);
if (group_index < 0)
{
return group_index; /* illegal argument */
}
return SymBase_SymmetryRegisterGI
(cctkGH_, sym_handle, which_faces, new_symmetry_zone_width, group_index);
}
/*@@
@routine SymBase_SymmetryRegisterInterpolatorFaces
@author Erik Schnetter
@date 2004-05-25
@desc
Register a symmetry interpolator for certain faces
@enddesc
@var sym_table
@vtype CCTK_INT
@vdesc Table which describes the grid or grid array
@vio in
@endvar
@var group_dim
@vtype CCTK_INT
@vdesc Dimension of the grid or grid array
@vio in
@endvar
@var sym_handle
@vtype CCTK_INT
@vdesc Symmetry handle
@vio in
@endvar
@var symmetry_interpolate
@vtype CCTK_FPOINTER
@vdesc Routine that applies symmetries to the interpolation points
and then calls back
(may be NULL)
@vio in
@endvar
@returntype CCTK_INT
@returndesc
status code
0 for success
-1 if sym_table has an illegal value
-9 if group_dim has an illegal value
-2 if sym_handle has an illegal value
-10 symmetry_interpolate is NULL
@endreturndesc
@@*/
CCTK_INT
SymBase_SymmetryRegisterInterpolatorFaces (CCTK_INT const sym_table,
CCTK_INT const group_dim,
CCTK_INT const sym_handle,
SymmetryInterpolateFPointer const new_symmetry_interpolate)
{
CCTK_INT symmetry_handle[100];
CCTK_FPOINTER symmetry_interpolate[100];
int face;
int ierr;
/* Check arguments */
if (sym_table < 0)
{
return -1; /* illegal argument */
}
if (group_dim < 0)
{
return -9; /* illegal argument */
}
if (sym_handle < 0 || sym_handle >= SymBase_num_symmetries)
{
return -2; /* illegal argument */
}
if (! new_symmetry_interpolate)
{
return -10;
}
/* Get table entries */
if (2 * group_dim > 100)
{
CCTK_WARN (0, "internal error");
}
ierr = Util_TableGetIntArray
(sym_table, 2 * group_dim, symmetry_handle, "symmetry_handle");
if (ierr != 2 * group_dim)
{
CCTK_WARN (0, "internal error");
}
ierr = Util_TableGetFPointerArray
(sym_table, 2 * group_dim, symmetry_interpolate, "symmetry_interpolate"); if (ierr != 2 * group_dim) {
CCTK_WARN (0, "internal error");
}
/* Update table entries */
for (face = 0; face < 2 * group_dim; ++face)
{
if (symmetry_handle[face] == sym_handle)
{
symmetry_interpolate[face] = (CCTK_FPOINTER)new_symmetry_interpolate;
}
}
/* Set table entries */
ierr = Util_TableSetFPointerArray
(sym_table, 2 * group_dim, symmetry_interpolate, "symmetry_interpolate");
if (ierr != 1)
{
CCTK_WARN (0, "internal error");
}
return 0;
}
/*@@
@routine SymBase_SymmetryRegisterGridInterpolator
@author Erik Schnetter
@date 2004-05-25
@desc
Register a symmetry interpolator
for certain faces of the grid hierarchy
@enddesc
@var cctkGH
@vtype cGH *
@vdesc The grid hierarchy
@vio in
@endvar
@var sym_handle
@vtype CCTK_INT
@vdesc Symmetry handle
@vio in
@endvar
@var symmetry_interpolate
@vtype CCTK_FPOINTER
@vdesc Routine that applies symmetries to the interpolation points
and then calls back
@vio in
@endvar
@returntype CCTK_INT
@returndesc
status code
0 for success
Error codes of SymBase_SymmetryRegisterInterpolatorFaces
@endreturndesc
@@*/
CCTK_INT
SymBase_SymmetryRegisterGridInterpolator (CCTK_POINTER const cctkGH_,
CCTK_INT const sym_handle,
SymmetryInterpolateFPointer const new_symmetry_interpolate)
{
cGH const *const cctkGH = cctkGH_;
struct SymBase const *symdata;
if (!cctkGH)
{
CCTK_WARN (0, "internal error");
}
symdata = CCTK_GHExtension (cctkGH, "SymBase");
if (!symdata)
{
CCTK_WARN (0, "internal error");
}
return SymBase_SymmetryRegisterInterpolatorFaces
(symdata->sym_table, cctkGH->cctk_dim, sym_handle,
new_symmetry_interpolate);
}
|