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
|
/*@@
@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 "cctk_Arguments.h"
#include "cctk_Parameters.h"
#include "util_Table.h"
#include "CoordBase.h"
/* the rcs ID and its dummy function to use it */
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusBase_CartGrid3D_Startup_c);
/********************************************************************
******************** External Prototypes **********************
********************************************************************/
void RegisterCartGrid2DCoords (CCTK_ARGUMENTS);
/********************************************************************
******************** Internal Prototypes **********************
********************************************************************/
static void *SetupGH (tFleshConfig *config, int convlevel, cGH *GH);
/********************************************************************
******************** External Routines ************************
********************************************************************/
/*@@
@routine RegisterCartGrid3DCoords
@date
@author Gabrielle Allen
@desc
Routine registers the coordinates provided by
CartGrid3D, using both the new and old APIs. The old
CCTK_ API is deprecated.
@enddesc
@calls CCTK_CoordRegisterSystem
CCTK_CoordRegisterData
@returntype int
@returndesc
0 for success, or negative in case of errors
@endreturndesc
@@*/
void RegisterCartGrid2DCoords (CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;
int ierr, coord_system_handle;
/* Register coordinate systems */
ierr = Coord_SystemRegister(cctkGH, 2, "cart2d");
if (ierr < 0)
{
CCTK_WARN(0, "Error registering cartnd coordinate systems");
}
else
{
/* Register coordinates for cart2d */
coord_system_handle = Coord_SystemHandle(cctkGH, "cart2d");
if (coord_system_handle<0)
{
CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,
"Error obtaining system handle for cart2d");
}
ierr = Coord_CoordRegister(cctkGH, coord_system_handle, 1, "x");
ierr += Coord_CoordRegister(cctkGH, coord_system_handle, 2, "y");
if (ierr < 0)
{
CCTK_WARN(0, "Error registering cart2d coordinates");
}
/* Fill out rest of coordinate system table for cart2d */
ierr = Util_TableSetString(coord_system_handle, "uniform", "TYPE");
if (ierr < 0)
{
CCTK_WARN(1, "Error registering cart2d type");
}
/* Register cartnd as the default coordinate systems */
// if (register_default_coordinate_systems)
{
ierr = Coord_SetDefaultSystem(cctkGH, "cart2d");
if (ierr < 0)
{
CCTK_WARN(1, "Error registering cartnd as default coordinate systems");
}
}
}
/* Register coordinates under the old API */
CCTK_CoordRegisterSystem(2,"cart2d");
if (CCTK_CoordRegisterData (1, "grid::x", "x", "cart2d") < 0)
{
CCTK_WARN (1, "Problem with registering coordinate x");
}
if (CCTK_CoordRegisterData (2, "grid::y", "y", "cart2d") < 0)
{
CCTK_WARN (1, "Problem with registering coordinate y");
}
}
|