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
|
/*@@
@file Startup.c
@date Mon Mar 15 15:48:42 1999
@author Gerd Lanfermann
@desc
Startup file to register the GHextension and coordinates
@enddesc
@version $Id$
@@*/
#include <stdlib.h>
#include "cctk.h"
#include "Symmetry.h"
/* the rcs ID and its dummy function to use it */
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusBase_CartGrid3D_Startup_c)
/********************************************************************
******************** External Routines ************************
********************************************************************/
void SymmetryStartup (void);
int RegisterCartGrid3DCoords (void);
/********************************************************************
******************** Internal Routines ************************
********************************************************************/
static void *SetupGH (tFleshConfig *config, int convlevel, cGH *GH);
/*@@
@routine SymmetryStartup
@date Mon Mar 15 15:49:16 1999
@author Gerd Lanfermann
@desc
Routine registers the GH extension for CartGrid3D
along with its setup routine.
@enddesc
@calls CCTK_RegisterGHExtension
CCTK_RegisterGHExtensionSetupGH
@@*/
void SymmetryStartup (void)
{
CCTK_RegisterGHExtensionSetupGH (CCTK_RegisterGHExtension ("Symmetry"),
SetupGH);
}
/*@@
@routine RegisterCartGrid3DCoords
@date
@author Gabrielle Allen
@desc
Routine registers the coordinates provided by CartGrid3D
@enddesc
@calls CCTK_CoordRegisterSystem
CCTK_CoordRegisterData
@returntype int
@returndesc
0 for success, or negative in case of errors
@endreturndesc
@@*/
int RegisterCartGrid3DCoords (void)
{
int nerrors;
nerrors = 0;
CCTK_CoordRegisterSystem (3, "cart3d");
CCTK_CoordRegisterSystem (3, "spher3d");
if (CCTK_CoordRegisterData (1, "grid::x", "x", "cart3d") < 0)
{
CCTK_WARN (1, "Problem with registering coordinate x");
nerrors--;
}
if (CCTK_CoordRegisterData (2, "grid::y", "y", "cart3d") < 0)
{
CCTK_WARN (1, "Problem with registering coordinate y");
nerrors--;
}
if (CCTK_CoordRegisterData (3, "grid::z", "z", "cart3d") < 0)
{
CCTK_WARN (1, "Problem with registering coordinate z");
nerrors--;
}
if (CCTK_CoordRegisterData (1, "grid::r", "r", "spher3d") < 0)
{
CCTK_WARN (1, "Problem with registering coordinate r");
nerrors--;
}
return (nerrors);
}
/********************************************************************
******************** Internal Routines ************************
********************************************************************/
static void *SetupGH (tFleshConfig *config, int convlevel, cGH *GH)
{
int i, j, maxdim, numvars;
SymmetryGHex *myGH;
/* avoid compiler warnings about unused arguments */
(void) (config + 0);
(void) (convlevel + 0);
(void) (GH + 0);
maxdim = CCTK_MaxDim ();
numvars = CCTK_NumVars ();
/* allocate the GH extension */
myGH = (SymmetryGHex *) malloc (sizeof (SymmetryGHex));
if (myGH)
{
/* allocation for the number of grid functions */
myGH->GFSym = (int **) malloc (numvars * sizeof (int *));
/* allocation for the number of dimensions*/
for (i = 0; i < numvars; i++)
{
myGH->GFSym[i] = (int *) malloc (2 * maxdim * sizeof (int));
for (j = 0; j < 2 * maxdim; j++)
{
myGH->GFSym[i][j] = GFSYM_UNSET; /* not set */
}
}
}
return (myGH);
}
|