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
|
/*@@
@file GetSymmetry.c
@date April 12 2002
@author Frank Herrmann
@desc
This file contains the routines for getting symmetry information
code stolen from SetSymmetry.c
@enddesc
@version $Id$
@@*/
#include <stdlib.h>
#include "cctk.h"
#include "cctk_Parameters.h"
#include "cctk_FortranString.h"
#include "Symmetry.h"
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusBase_CartGrid3D_GetSymmetry_c)
/********************************************************************
********************* Local Defines ***********************
********************************************************************/
#define MAX_DIM 3
#define MAX_FACE 6
/********************************************************************
********************* Local Routine Prototypes *********************
********************************************************************/
void DecodeSymParameters3D(int sym[6]);
void CCTK_FCALL CCTK_FNAME(GetCartSymVI)
(int *ierr, const cGH **GH, int *sym, const int *vi);
void CCTK_FCALL CCTK_FNAME(GetCartSymVN)
(int *ierr, const cGH **GH, int *sym, ONE_FORTSTRING_ARG);
/********************************************************************
********************* External Routines **********************
********************************************************************/
/*@@
@routine GetCartSymVI
@date Mon Mar 15 15:10:58 1999
@author Frank Herrmann
@desc
This routine returns symmetry for variable index.
@enddesc
@@*/
int GetCartSymVI(const cGH *GH, int *sym, int vi)
{
int domainsym[MAX_FACE];
SymmetryGHex *sGHex;
int dir;
DECLARE_CCTK_PARAMETERS
if (vi < 0 || vi >= CCTK_NumVars ())
{
CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,
"Invalid variable index %d in GetCartSymVI", vi);
return(-1);
}
/* Pointer to the SymmetryGHextension */
sGHex = (SymmetryGHex *)CCTK_GHExtension(GH, "Symmetry");
/* Reference the hash table in the GHex and get the kind of
* symmetry being applied
*/
#ifdef SYM_DEBUG
printf("GetSymmetry: %s [%d,%d,%d]\n",CCTK_VarName(vi),
sym[0],sym[1],sym[2]);
#endif
DecodeSymParameters3D(domainsym);
for (dir=0; dir<MAX_FACE; ++dir)
{
sym[dir/2] = GFSYM_UNKNOWN;
if (domainsym[dir])
sym[dir/2]=sGHex->GFSym[vi][dir];
}
return 0;
}
void CCTK_FCALL CCTK_FNAME(GetCartSymVI)
(int *ierr, const cGH **GH, int *sym, const int *vi)
{
*ierr = GetCartSymVI(*GH, sym, *vi);
}
/*@@
@routine GetCartSymVN
@date April 12 2002
@author Frank Herrmann
@desc
Gets symmetry boundary conditions from variable name
@enddesc
@@*/
int GetCartSymVN(const cGH *GH, int *sym, const char *vn)
{
int vi;
vi = CCTK_VarIndex(vn);
if (vi>-1)
{
return(GetCartSymVI(GH, sym, vi));
}
else
{
CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,
"Cannot find variable %s in GetCartSymVN",vn);
return(-1);
}
}
void CCTK_FCALL CCTK_FNAME(GetCartSymVN)
(int *ierr, const cGH **GH, int *sym, ONE_FORTSTRING_ARG)
{
ONE_FORTSTRING_CREATE(vn)
*ierr = GetCartSymVN(*GH, sym, vn);
free(vn);
}
|