aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryye00 <yye00@c78560ca-4b45-4335-b268-5f3340f3cb52>2008-05-25 19:56:01 +0000
committeryye00 <yye00@c78560ca-4b45-4335-b268-5f3340f3cb52>2008-05-25 19:56:01 +0000
commit59dd64865df3df3f62be4f9e6f89f56cb75597af (patch)
tree0e1e0ca4c0e8124f62e2ddcbcbb55893e587fc5a
parent92c5b1c45844bfab148c77f74201e03d5341e560 (diff)
fixing wrong commit
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CartGrid3D/trunk@242 c78560ca-4b45-4335-b268-5f3340f3cb52
-rw-r--r--schedule.ccl63
-rw-r--r--src/Startup.c139
2 files changed, 186 insertions, 16 deletions
diff --git a/schedule.ccl b/schedule.ccl
index 40ecd15..4d543d4 100644
--- a/schedule.ccl
+++ b/schedule.ccl
@@ -1,21 +1,70 @@
-# Schedule definitions for thorn CartGrid2D
+# Schedule definitions for thorn CartGrid3D
# $Header$
STORAGE: coordinates gridspacings
-schedule RegisterCartGrid2DCoords at CCTK_WRAGH
+schedule SymmetryStartup at CCTK_STARTUP
+{
+ LANG: C
+} "Register GH Extension for GridSymmetry"
+
+schedule RegisterCartGrid3DCoords at CCTK_WRAGH
{
LANG:C
-}"register coordinates for the cartesian grid"
+ OPTIONS: meta
+} "Register coordinates for the Cartesian grid"
-schedule CartGrid2D_SetRanges at CCTK_BASEGRID before SpatialCoordinates
+schedule RegisterSymmetryBoundaries in SymmetryRegister
{
LANG:C
-} "Set up ranges for spatial 2D Cartesian coordinates (on all grids)"
+ OPTIONS: meta
+} "Register symmetry boundaries"
+schedule ParamCheck_CartGrid3D at CCTK_PARAMCHECK
+{
+ LANG:C
+} "Check coordinates for CartGrid3D"
-schedule CartGrid2D_SetCoordinates as SpatialCoordinates at CCTK_BASEGRID
+if (CCTK_EQUALS (set_coordinate_ranges_on, "all grids"))
+{
+ schedule CartGrid3D_SetRanges at CCTK_BASEGRID before SpatialCoordinates
+ {
+ LANG:C
+ } "Set up ranges for spatial 3D Cartesian coordinates (on all grids)"
+}
+else if (CCTK_EQUALS (set_coordinate_ranges_on, "all maps"))
+{
+ schedule CartGrid3D_SetRanges at CCTK_BASEGRID before SpatialCoordinates
+ {
+ LANG:C
+ OPTIONS: singlemap
+ } "Set up ranges for spatial 3D Cartesian coordinates (on all maps)"
+}
+else if (CCTK_EQUALS (set_coordinate_ranges_on, "first level"))
+{
+ schedule CartGrid3D_SetRanges at CCTK_BASEGRID before SpatialCoordinates
+ {
+ LANG:C
+ OPTIONS: level
+ } "Set up ranges for spatial 3D Cartesian coordinates (on first level)"
+}
+
+schedule CartGrid3D_SetCoordinates as SpatialCoordinates at CCTK_BASEGRID
{
LANG:C
-} "Set up spatial 2D Cartesian coordinates on the GH"
+} "Set up spatial 3D Cartesian coordinates on the GH"
+
+schedule CartGrid3D_SetCoordinates as SpatialCoordinates at CCTK_POSTREGRIDINITIAL
+{
+ LANG: C
+} "Set Coordinates after regridding"
+schedule CartGrid3D_SetCoordinates as SpatialCoordinates at CCTK_POSTREGRID
+{
+ LANG: C
+} "Set Coordinates after regridding"
+
+schedule CartGrid3D_ApplyBC in BoundaryConditions
+{
+ LANG: C
+} "Apply symmetry boundary conditions"
diff --git a/src/Startup.c b/src/Startup.c
index a4a7822..bbb6753 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -16,6 +16,7 @@
#include "util_Table.h"
#include "CoordBase.h"
+#include "Symmetry.h"
/* the rcs ID and its dummy function to use it */
static const char *rcsid = "$Header$";
@@ -25,7 +26,8 @@ CCTK_FILEVERSION(CactusBase_CartGrid3D_Startup_c);
/********************************************************************
******************** External Prototypes **********************
********************************************************************/
-void RegisterCartGrid2DCoords (CCTK_ARGUMENTS);
+int SymmetryStartup (void);
+void RegisterCartGrid3DCoords (CCTK_ARGUMENTS);
/********************************************************************
******************** Internal Prototypes **********************
@@ -35,7 +37,30 @@ static void *SetupGH (tFleshConfig *config, int convlevel, cGH *GH);
/********************************************************************
******************** External Routines ************************
********************************************************************/
- /*@@
+ /*@@
+ @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
+ @history
+ @endhistory
+
+ @returntype void
+@@*/
+int SymmetryStartup (void)
+{
+ CCTK_RegisterGHExtensionSetupGH (CCTK_RegisterGHExtension ("Symmetry"),
+ SetupGH);
+ return 0;
+}
+
+
+ /*@@
@routine RegisterCartGrid3DCoords
@date
@author Gabrielle Allen
@@ -52,7 +77,7 @@ static void *SetupGH (tFleshConfig *config, int convlevel, cGH *GH);
0 for success, or negative in case of errors
@endreturndesc
@@*/
-void RegisterCartGrid2DCoords (CCTK_ARGUMENTS)
+void RegisterCartGrid3DCoords (CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;
@@ -60,13 +85,38 @@ void RegisterCartGrid2DCoords (CCTK_ARGUMENTS)
int ierr, coord_system_handle;
/* Register coordinate systems */
- ierr = Coord_SystemRegister(cctkGH, 2, "cart2d");
+ ierr = Coord_SystemRegister(cctkGH, 3, "cart3d");
+ ierr += Coord_SystemRegister(cctkGH, 2, "cart2d");
+ ierr += Coord_SystemRegister(cctkGH, 1, "cart1d");
if (ierr < 0)
{
CCTK_WARN(0, "Error registering cartnd coordinate systems");
}
else
{
+
+ /* Register coordinates for cart3d */
+ coord_system_handle = Coord_SystemHandle(cctkGH, "cart3d");
+ if (coord_system_handle<0)
+ {
+ CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,
+ "Error obtaining system handle for cart3d");
+ }
+ ierr = Coord_CoordRegister(cctkGH, coord_system_handle, 1, "x");
+ ierr += Coord_CoordRegister(cctkGH, coord_system_handle, 2, "y");
+ ierr += Coord_CoordRegister(cctkGH, coord_system_handle, 3, "z");
+ if (ierr < 0)
+ {
+ CCTK_WARN(0, "Error registering cart3d coordinates");
+ }
+
+ /* Fill out rest of coordinate system table for cart3d */
+ ierr = Util_TableSetString(coord_system_handle, "uniform", "TYPE");
+ if (ierr < 0)
+ {
+ CCTK_WARN(1, "Error registering cart3d type");
+ }
+
/* Register coordinates for cart2d */
coord_system_handle = Coord_SystemHandle(cctkGH, "cart2d");
if (coord_system_handle<0)
@@ -88,10 +138,32 @@ void RegisterCartGrid2DCoords (CCTK_ARGUMENTS)
CCTK_WARN(1, "Error registering cart2d type");
}
+ /* Register coordinate for cart1d */
+ coord_system_handle = Coord_SystemHandle(cctkGH, "cart1d");
+ if (coord_system_handle<0)
+ {
+ CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,
+ "Error obtaining system handle for cart1d");
+ }
+ ierr = Coord_CoordRegister(cctkGH, coord_system_handle, 1, "x");
+ if (ierr < 0)
+ {
+ CCTK_WARN(0, "Error registering cart1d coordinate");
+ }
+
+ /* Fill out rest of coordinate system table for cart1d */
+ ierr = Util_TableSetString(coord_system_handle, "uniform", "TYPE");
+ if (ierr < 0)
+ {
+ CCTK_WARN(1, "Error registering cart1d type");
+ }
+
/* Register cartnd as the default coordinate systems */
-// if (register_default_coordinate_systems)
+ if (register_default_coordinate_systems)
{
- ierr = Coord_SetDefaultSystem(cctkGH, "cart2d");
+ ierr = Coord_SetDefaultSystem(cctkGH, "cart3d");
+ ierr += Coord_SetDefaultSystem(cctkGH, "cart2d");
+ ierr += Coord_SetDefaultSystem(cctkGH, "cart1d");
if (ierr < 0)
{
CCTK_WARN(1, "Error registering cartnd as default coordinate systems");
@@ -100,14 +172,63 @@ void RegisterCartGrid2DCoords (CCTK_ARGUMENTS)
}
/* Register coordinates under the old API */
- CCTK_CoordRegisterSystem(2,"cart2d");
+ CCTK_CoordRegisterSystem(3,"cart3d");
+ CCTK_CoordRegisterSystem(3,"spher3d");
- if (CCTK_CoordRegisterData (1, "grid::x", "x", "cart2d") < 0)
+ if (CCTK_CoordRegisterData (1, "grid::x", "x", "cart3d") < 0)
{
CCTK_WARN (1, "Problem with registering coordinate x");
}
- if (CCTK_CoordRegisterData (2, "grid::y", "y", "cart2d") < 0)
+ if (CCTK_CoordRegisterData (2, "grid::y", "y", "cart3d") < 0)
{
CCTK_WARN (1, "Problem with registering coordinate y");
}
+ if (CCTK_CoordRegisterData (3, "grid::z", "z", "cart3d") < 0)
+ {
+ CCTK_WARN (1, "Problem with registering coordinate z");
+ }
+ if (CCTK_CoordRegisterData (1, "grid::r", "r", "spher3d") < 0)
+ {
+ CCTK_WARN (1, "Problem with registering coordinate r");
+ }
+}
+
+
+/********************************************************************
+ ******************** 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);
}