blob: 78990e15870d315bf736e842a24802b9185ae3c5 (
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
/*@@
@file Table.c
@author Erik Schnetter
@date 2004/03/07 09:48:53
@desc
Get the symmetry table handle for a grid or grid array
@version $Header$
@enddesc
@@*/
#include "cctk.h"
#include "SymBase.h"
/* the rcs ID and its dummy function to use it */
static const char *const rcsid = "$Header$";
CCTK_FILEVERSION (CactusBase_SymBase_Table_c);
/*@@
@routine SymBase_SymmetryTableHandleForGrid
@author Erik Schnetter
@date 2004-03-06
@desc
Return the symmetry table handle for the grid hierarchy
@enddesc
@var cctkGH
@vtype CCTK_POINTER_TO_CONST
@vdesc Grid hierarchy
@vio in
@endvar
@returntype CCTK_INT
@returndesc
>=0 symmetry table handle
@endreturndesc
@@*/
CCTK_INT
SymBase_SymmetryTableHandleForGrid (CCTK_POINTER_TO_CONST const cctkGH_)
{
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 symdata->sym_table;
}
/*@@
@routine SymBase_SymmetryTableHandleForGI
@author Erik Schnetter
@date 2004-03-06
@desc
Return the symmetry table handle for a grid array
@enddesc
@var cctkGH
@vtype CCTK_POINTER_TO_CONST
@vdesc Grid hierarchy
@vio in
@endvar
@var group_index
@vtype CCTK_INT
@vdesc Group
@vio in
@endvar
@returntype CCTK_INT
@returndesc
>=0 symmetry table handle
-6 if group_index has an illegal value
-7 if the group type has an illegal value
-8 if there was an internal error
@endreturndesc
@@*/
CCTK_INT
SymBase_SymmetryTableHandleForGI (CCTK_POINTER_TO_CONST const cctkGH_,
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 symdata->array_sym_tables[group_index];
default:
CCTK_WARN (0, "internal error");
}
return -8; /* internal error */
}
/*@@
@routine SymBase_SymmetryTableHandleForGN
@author Erik Schnetter
@date 2004-03-06
@desc
Return the symmetry table handle for a grid array
@enddesc
@var cctkGH
@vtype CCTK_POINTER_TO_CONST
@vdesc Grid hierarchy
@vio in
@endvar
@var group_name
@vtype CCTK_STRING
@vdesc Group
@vio in
@endvar
@returntype CCTK_INT
@returndesc
>=0 symmetry table handle
Error codes of CCTK_GroupIndex
Error codes of SymBase_SymmetryTableHandleForGI
@endreturndesc
@@*/
CCTK_INT
SymBase_SymmetryTableHandleForGN (CCTK_POINTER_TO_CONST const cctkGH_,
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_SymmetryTableHandleForGI (cctkGH_, group_index);
}
|