diff options
author | tradke <tradke@c78560ca-4b45-4335-b268-5f3340f3cb52> | 2002-11-03 23:18:07 +0000 |
---|---|---|
committer | tradke <tradke@c78560ca-4b45-4335-b268-5f3340f3cb52> | 2002-11-03 23:18:07 +0000 |
commit | 1ad057c7403c47f4ce904e908d6c39df53f23559 (patch) | |
tree | f06a9428b2f47e0da91468febfb6ef10b52ed23b /src/Startup.c | |
parent | ea3a2774881627e701e4961605822e0372a5c6c9 (diff) |
Generalized set symmetry BC routines for arbitrary CCTK datatypes.
Some formatting, completed grdoc.
This closes PR CactusBase/1030.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CartGrid3D/trunk@174 c78560ca-4b45-4335-b268-5f3340f3cb52
Diffstat (limited to 'src/Startup.c')
-rw-r--r-- | src/Startup.c | 155 |
1 files changed, 93 insertions, 62 deletions
diff --git a/src/Startup.c b/src/Startup.c index c094bb1..6ec32df 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -2,106 +2,137 @@ @file Startup.c @date Mon Mar 15 15:48:42 1999 @author Gerd Lanfermann - @desc - Startup file to register the GHextension and coordinates - @enddesc + @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) -void *Symmetry_AllocGHex(tFleshConfig *config, int convlevel, cGH *GH); -int Symmetry_InitGHex(cGH *GH); -int SymmetryStartup(void); -int RegisterCartGrid3DCoords(void); + +/******************************************************************** + ******************** 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 Setup and Initialation routines for the - GHExtension, which holds the symmetry BCs. We name the - GHextension "Symmetry" and get an integer ("handle") - identifying the GHex. - @enddesc - @calls - @calledby - @history - - @endhistory - + @desc + Routine registers the GH extension for CartGrid3D + along with its setup routine. + @enddesc + @calls CCTK_RegisterGHExtension + CCTK_RegisterGHExtensionSetupGH @@*/ - -/* Store the handle in a global variable for the moment. */ -int Symmetry_handle; - - -int SymmetryStartup(void) +void SymmetryStartup (void) { - Symmetry_handle = CCTK_RegisterGHExtension("Symmetry"); - - /* Register the allocation and init routine */ - CCTK_RegisterGHExtensionSetupGH(Symmetry_handle,Symmetry_AllocGHex); - CCTK_RegisterGHExtensionInitGH(Symmetry_handle,Symmetry_InitGHex); - - return 0; + CCTK_RegisterGHExtensionSetupGH (CCTK_RegisterGHExtension ("Symmetry"), + SetupGH); } /*@@ @routine RegisterCartGrid3DCoords - @date + @date @author Gabrielle Allen - @desc - Routine registers the coordinates provided by CartGrid3D - @enddesc - @calls - @calledby - @history - - @endhistory - + @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 RegisterCartGrid3DCoords (void) { + int nerrors; - int ierr; - int nerrors=0; - ierr=CCTK_CoordRegisterSystem(3,"cart3d"); - ierr=CCTK_CoordRegisterSystem(3,"spher3d"); + nerrors = 0; + CCTK_CoordRegisterSystem (3, "cart3d"); + CCTK_CoordRegisterSystem (3, "spher3d"); - ierr=CCTK_CoordRegisterData(1,"grid::x","x","cart3d"); - if (ierr<0) + if (CCTK_CoordRegisterData (1, "grid::x", "x", "cart3d") < 0) { - CCTK_WARN(1,"Problem with registering coordinate x"); + CCTK_WARN (1, "Problem with registering coordinate x"); nerrors--; } - ierr=CCTK_CoordRegisterData(2,"grid::y","y","cart3d"); - if (ierr<0) + if (CCTK_CoordRegisterData (2, "grid::y", "y", "cart3d") < 0) { - CCTK_WARN(1,"Problem with registering coordinate y"); + CCTK_WARN (1, "Problem with registering coordinate y"); nerrors--; } - ierr=CCTK_CoordRegisterData(3,"grid::z","z","cart3d"); - if (ierr<0) + if (CCTK_CoordRegisterData (3, "grid::z", "z", "cart3d") < 0) { - CCTK_WARN(1,"Problem with registering coordinate z"); + CCTK_WARN (1, "Problem with registering coordinate z"); nerrors--; } - ierr=CCTK_CoordRegisterData(1,"grid::r","r","spher3d"); - if (ierr<0) + if (CCTK_CoordRegisterData (1, "grid::r", "r", "spher3d") < 0) { - CCTK_WARN(1,"Problem with registering coordinate r"); + CCTK_WARN (1, "Problem with registering coordinate r"); nerrors--; } - return 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); +} |