aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ApplySymmetry.c58
-rw-r--r--src/CartGrid3D.F98
-rw-r--r--src/GHExtension.c68
-rw-r--r--src/ParamCheck.F47
-rw-r--r--src/Startup.c61
-rw-r--r--src/Symmetry.c238
-rw-r--r--src/Symmetry.h32
-rw-r--r--src/SymmetryCondition.F62
-rw-r--r--src/make.code.defn5
9 files changed, 616 insertions, 53 deletions
diff --git a/src/ApplySymmetry.c b/src/ApplySymmetry.c
new file mode 100644
index 0000000..a0b5ba3
--- /dev/null
+++ b/src/ApplySymmetry.c
@@ -0,0 +1,58 @@
+
+/*@@
+ @routine FortranSym
+ @date Mon Mar 15 15:51:57 1999
+ @author Gerd Lanfermann
+ @desc
+ Routine performs the symmetry boundary operations.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+@@*/
+
+ subroutine FortranSym(nxyz,var,nghostzones,sym,doSym)
+
+ implicit none
+
+ INTEGER nxyz(3)
+ CCTK_REAL var(nxyz(1),nxyz(2),nxyz(3))
+ INTEGER nghostzones
+ INTEGER sym(3)
+ INTEGER doSym(3)
+
+ INTEGER sw
+
+c Apply symmetry if
+c * the grid chunk has a physical boundary (bbox)
+c * its size in a direction is bigger than one (sh)
+c * we actually want a symmetry (sx.ne.ESYM_UNSET)
+
+ if (doSym(1) == 1) then
+
+ do sw=1, nghostzones
+ var(sw,:,:) = sym(1)*var(nghostzones+sw,:,:)
+ end do
+
+ end if
+
+ if (doSym(2) == 1) then
+
+ do sw=1, nghostzones
+ var(:,sw,:) = sym(2)*var(:,nghostzones+sw,:)
+ end do
+
+ end if
+
+ if (doSym(3).eq.1) then
+
+ do sw=1, nghostzones
+ var(:,:,sw) = sym(3)*var(:,:,nghostzones+sw)
+ end do
+
+ end if
+
+ end subroutine
+
diff --git a/src/CartGrid3D.F b/src/CartGrid3D.F
index 2b77a9e..3b98f95 100644
--- a/src/CartGrid3D.F
+++ b/src/CartGrid3D.F
@@ -22,13 +22,11 @@
DECLARE_PARAMETERS
integer :: CCTK_Equals
- integer :: iflag, iconv, i, j, k
+ integer :: iconv, i, j, k
CCTK_REAL :: x_origin,y_origin,z_origin
CCTK_REAL :: this_dx,this_dy,this_dz
CCTK_REAL :: xmax1,ymax1,zmax1
- iflag = 0 ! Gets set to one if we set a grid
-
iconv = 2**(cctk_convlevel-1)
c --------------------------------------------------------------
@@ -57,12 +55,18 @@ c --------------------------------------------------------------
if (CCTK_Equals(symmetry,'octant') == 1) then
call CCTK_Info("Octant symmetry")
- iflag = iflag +1
c Grid spacing on coarsest grid
- coarse_dx = xmax/(DBLE(cctk_gsh(1))-1.5d0)
- coarse_dy = ymax/(DBLE(cctk_gsh(2))-1.5d0)
- coarse_dz = zmax/(DBLE(cctk_gsh(3))-1.5d0)
+
+ if (no_origin==1) then
+ coarse_dx = xmax/(DBLE(cctk_gsh(1))-1.5d0)
+ coarse_dy = ymax/(DBLE(cctk_gsh(2))-1.5d0)
+ coarse_dz = zmax/(DBLE(cctk_gsh(3))-1.5d0)
+ else
+ coarse_dx = xmax/(DBLE(cctk_gsh(1))-1.0d0)
+ coarse_dy = ymax/(DBLE(cctk_gsh(2))-1.0d0)
+ coarse_dz = zmax/(DBLE(cctk_gsh(3))-1.0d0)
+ end if
c Grid spacing on this grid
this_dx = coarse_dx/cctk_levfac(1)
@@ -70,24 +74,26 @@ c Grid spacing on this grid
this_dz = coarse_dz/cctk_levfac(3)
c Minimum coordinate values on this grid
- x_origin = (0.5-dble(cctk_nghostzones(1)))*this_dx
- y_origin = (0.5-dble(cctk_nghostzones(2)))*this_dy
- z_origin = (0.5-dble(cctk_nghostzones(3)))*this_dz
+ if (no_origin==1) then
+ x_origin = (0.5-dble(cctk_nghostzones(1)))*this_dx
+ y_origin = (0.5-dble(cctk_nghostzones(2)))*this_dy
+ z_origin = (0.5-dble(cctk_nghostzones(3)))*this_dz
+ else
+ x_origin = (-dble(cctk_nghostzones(1)))*this_dx
+ y_origin = (-dble(cctk_nghostzones(2)))*this_dy
+ z_origin = (-dble(cctk_nghostzones(3)))*this_dz
+ end if
else if (CCTK_Equals(symmetry,'quadrant') == 1) then
- iflag = iflag +1
print *,"FIXME"
else if (CCTK_Equals(symmetry,'bitant') == 1) then
- iflag = iflag +1
print *,"FIXME"
else if (CCTK_Equals(symmetry,'full') == 1) then
- iflag = iflag +1
-
c Set minimum values of coordinates
x_origin = xmin
y_origin = ymin
@@ -140,34 +146,51 @@ c dx, dy, dz on the grid we are on
if (CCTK_Equals(symmetry,'bitant') == 1) then
- iflag = iflag + 1
- x_origin = (0.5 - cctk_gsh(1)/2)*this_dx
- y_origin = (0.5 - cctk_gsh(2)/2)*this_dy
- z_origin = (-dble(cctk_nghostzones(3))+0.5d0)*this_dz
+ if (no_origin==1) then
+ x_origin = (0.5 - cctk_gsh(1)/2)*this_dx
+ y_origin = (0.5 - cctk_gsh(2)/2)*this_dy
+ z_origin = (-dble(cctk_nghostzones(3))+0.5d0)*this_dz
+ else
+ x_origin = (- cctk_gsh(1)/2)*this_dx
+ y_origin = (- cctk_gsh(2)/2)*this_dy
+ z_origin = (-dble(cctk_nghostzones(3)))*this_dz
+ end if
else if (CCTK_Equals(symmetry,'quadrant') == 1) then
- iflag = iflag + 1
+ if (no_origin==1) then
+ x_origin = (-dble(cctk_nghostzones(1))+0.5d0)*this_dx
+ y_origin = (-dble(cctk_nghostzones(2))+0.5d0)*this_dy
+ z_origin = (0.5D0 - cctk_gsh(3)/2)*this_dz
+ else
+ x_origin = (-dble(cctk_nghostzones(1)))*this_dx
+ y_origin = (-dble(cctk_nghostzones(2)))*this_dy
+ z_origin = (- cctk_gsh(3)/2)*this_dz
+ end if
- x_origin = (-dble(cctk_nghostzones(1))+0.5d0)*this_dx
- y_origin = (-dble(cctk_nghostzones(2))+0.5d0)*this_dy
- z_origin = (0.5D0 - cctk_gsh(3)/2)*this_dz
-
else if (CCTK_Equals(symmetry,'octant') == 1) then
- iflag = iflag + 1
-
- x_origin = (-dble(cctk_nghostzones(1))+0.5d0)*this_dx
- y_origin = (-dble(cctk_nghostzones(2))+0.5d0)*this_dy
- z_origin = (-dble(cctk_nghostzones(3))+0.5d0)*this_dz
+ if (no_origin==1) then
+ x_origin = (-dble(cctk_nghostzones(1))+0.5d0)*this_dx
+ y_origin = (-dble(cctk_nghostzones(2))+0.5d0)*this_dy
+ z_origin = (-dble(cctk_nghostzones(3))+0.5d0)*this_dz
+ else
+ x_origin = (-dble(cctk_nghostzones(1)))*this_dx
+ y_origin = (-dble(cctk_nghostzones(2)))*this_dy
+ z_origin = (-dble(cctk_nghostzones(3)))*this_dz
+ end if
else if (CCTK_Equals(symmetry,'full')==1) then
- iflag = iflag + 1
-
- x_origin = (0.5 - cctk_gsh(1)/2)*this_dx
- y_origin = (0.5 - cctk_gsh(2)/2)*this_dy
- z_origin = (0.5 - cctk_gsh(3)/2)*this_dz
+ if (no_origin==1) then
+ x_origin = (0.5 - cctk_gsh(1)/2)*this_dx
+ y_origin = (0.5 - cctk_gsh(2)/2)*this_dy
+ z_origin = (0.5 - cctk_gsh(3)/2)*this_dz
+ else
+ x_origin = (- cctk_gsh(1)/2)*this_dx
+ y_origin = (- cctk_gsh(2)/2)*this_dy
+ z_origin = (- cctk_gsh(3)/2)*this_dz
+ end if
end if
@@ -182,8 +205,6 @@ c --------------------------------------------------------------
elseif (CCTK_Equals(type,'box') == 1) then
- iflag = iflag + 1
-
c Coordinates are all -0.5 to 0.5
x_origin = -0.5
y_origin = -0.5
@@ -212,13 +233,6 @@ c Special cases
end if
-c No grid was set up
-c ------------------
- if (iflag.ne.1) then
- call CCTK_WARN(0,"No grid set up in CartGrid3D")
- end if
-
-
c Set spatial coordinates
c -----------------------
do i=1,cctk_lsh(1)
diff --git a/src/GHExtension.c b/src/GHExtension.c
new file mode 100644
index 0000000..5177424
--- /dev/null
+++ b/src/GHExtension.c
@@ -0,0 +1,68 @@
+
+#include <stdlib.h>
+
+#include "cctk.h"
+#include "flesh.h"
+#include "Symmetry.h"
+#include "Groups.h"
+#include "Comm.h"
+#include "GHExtensions.h"
+
+
+void *Symmetry_AllocGHex(tFleshConfig *config, int convlevel, cGH *GH) {
+
+ int gf,grid_dim,NumVars; /* Number of dimensions, grid functions */
+ SymmetryGHex *newGHex; /* Type of GHextension is EinsteinBoundGHex */
+
+ printf("Setting up GH extension\n");
+ NumVars = CCTK_GetNumVars(); /* Get number of grid functions */
+ grid_dim = CCTK_GetMaxDim(); /* Get maximal dimension of the grid */
+
+ /* allocate the GHextension */
+ newGHex = (SymmetryGHex*)malloc(sizeof(SymmetryGHex));
+
+ /* allocation for the number of grid functions*/
+ newGHex->GFSym = (int **)malloc(NumVars*sizeof(int *));
+
+ /* allocation for the number of dimensions*/
+ for (gf=0;gf<NumVars;gf++) {
+ newGHex->GFSym[gf] = (int *)malloc(grid_dim*sizeof(int));
+ }
+
+ /* Now we have something, that looks like [0..NumVars-1][0..grid_dim-1]
+ and we return that. For the progammer (that's me): This will be merged into
+ the GH and can be referenced in the following manner:
+ int handle = CCTK_GetGHExtensionHandle("Symmetry");
+ ..... which returns a pointer the GHextension
+ BoundGHEx = ((pGH *)GH->extensions[handle]);
+ ..... BoundGHex can now be used as:
+ BoundGHex->GFSym[3][2] = 1 ;
+ */
+
+ return newGHex;
+
+}
+
+void Symmetry_InitGHex(cGH *GH) {
+ SymmetryGHex *newGHex;
+ int handle;
+ int gf,d;
+ int NumVars =CCTK_GetNumVars();
+ int grid_dim;
+
+ grid_dim = CCTK_GetMaxDim();
+ handle = CCTK_GetGHExtensionHandle("Symmetry");
+ newGHex = (SymmetryGHex*) GH->extensions[handle];
+
+ /* ... and initialize them: */
+ for (gf=0;gf<NumVars;gf++) {
+ for(d=0;d<grid_dim;d++) {
+ newGHex->GFSym[gf][d] = GFSYM_UNSET; /* not set */
+ }
+ }
+}
+
+
+
+
+
diff --git a/src/ParamCheck.F b/src/ParamCheck.F
index 9495a90..4fbbc7b 100644
--- a/src/ParamCheck.F
+++ b/src/ParamCheck.F
@@ -19,20 +19,47 @@
DECLARE_CCTK_FARGUMENTS
DECLARE_PARAMETERS
- integer :: CCTK_Equals
+ integer :: CCTK_Equals,iflag=0
- if (CCTK_Equals(type,"box")==1 .and.
- & CCTK_Equals(symmetry,"full")==0) then
+ if (CCTK_Equals(type,'byrange') == 1) then
- write(*,*)
- ! CHAR(34) is a speechmark
- write(*,*) "No symmetries can be used with grid = "//
- & CHAR(34)//"box"//CHAR(34)
- write(*,*) "In par file set symmetry = "//CHAR(34)//"full"//CHAR(34)
+ if (CCTK_Equals(symmetry,'octant') == 1) then
+ iflag = iflag +1
+ else if (CCTK_Equals(symmetry,'quadrant') == 1) then
+ iflag = iflag +1
+ else if (CCTK_Equals(symmetry,'bitant') == 1) then
+ iflag = iflag +1
+ else if (CCTK_Equals(symmetry,'full') == 1) then
+ iflag = iflag +1
+ end if
- end if
+ else if (CCTK_Equals(type,'byspacing') == 1) then
+
+ if (CCTK_Equals(symmetry,'bitant') == 1) then
+ iflag = iflag + 1
+ else if (CCTK_Equals(symmetry,'quadrant') == 1) then
+ iflag = iflag + 1
+ else if (CCTK_Equals(symmetry,'octant') == 1) then
+ iflag = iflag + 1
+ else if (CCTK_Equals(symmetry,'full')==1) then
+ iflag = iflag + 1
+ end if
+
+ elseif (CCTK_Equals(type,'box') == 1) then
+
+ iflag = iflag + 1
+
+ if (CCTK_Equals(symmetry,"full")==0)
+ & call CCTK_PARAMWARN("No symmetries can be used with box grid")
+
+ end if
+
+c No grid was set up
+c ------------------
+ if (iflag.ne.1) then
+ call CCTK_PARAMWARN("No grid set up in CartGrid3D")
+ end if
- return
end subroutine ParamCheck_CartGrid3D
diff --git a/src/Startup.c b/src/Startup.c
index 8b25f4d..9baebfd 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -1,6 +1,67 @@
+ /*@@
+ @file Startup.c
+ @date Mon Mar 15 15:48:42 1999
+ @author Gerd Lanfermann
+ @desc
+ Startup file to register the GHextension and coordinates
+ @enddesc
+ @@*/
#include "cctk.h"
+#include "flesh.h"
#include "Coord.h"
+#include "GHExtensions.h"
+
+void *Symmetry_AllocGHex(tFleshConfig *, int, cGH *);
+int Symmetry_InitGHex(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.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+
+/* Store the handle in a global variable for the moment. */
+int Symmetry_handle;
+
+int SymmetryStartup(void) {
+
+ /* we name the GHextension "Symmetry" and get an
+ integer identifying the GHex */
+ 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;
+}
+
+
+ /*@@
+ @routine RegisterCartGrid3DCoords
+ @date
+ @author Gabrielle Allen
+ @desc
+ Routine registers the coordinates provided by CartGrid3D
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
int RegisterCartGrid3DCoords()
{
diff --git a/src/Symmetry.c b/src/Symmetry.c
new file mode 100644
index 0000000..4246559
--- /dev/null
+++ b/src/Symmetry.c
@@ -0,0 +1,238 @@
+ /*@@
+ @file Symmetry.c
+ @date Mon Mar 15 15:09:00 1999
+ @author Gerd Lanfermann
+ @desc
+ This file contains the routines for registering and applying symmetry
+ boundary conditions
+ @enddesc
+ @@*/
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "cctk.h"
+#include "declare_parameters.h"
+#include "flesh.h"
+#include "Symmetry.h"
+#include "GHExtensions.h"
+#include "Groups.h"
+#include "WarnLevel.h"
+#include "Misc.h"
+#include "FortranString.h"
+
+#define DEBUG_BOUND
+
+ /*@@
+ @routine SetSymmetry
+ @date Mon Mar 15 15:10:58 1999
+ @author Gerd Lanfermann
+ @desc
+ This routine sets the GH extension (EinsteinBoundGHex *bGHex),
+ which describes the symmetry boundary type of each GF. Takes
+ the name of the GF ("implementation::gfname") and the symmetry operators
+ sx,sy,sz and inserts them in the array bGHex.
+ These values will looked up by ApplySym
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+
+void SetSymmetry(cGH *GH, int sx, int sy, int sz, const char *imp_gf) {
+
+ DECLARE_PARAMETERS
+
+ SymmetryGHex *sGHex;
+ int index;
+
+ printf("Why am i here\n");
+ /* Pointer to the SymmetryGHextension */
+ sGHex = (SymmetryGHex *)GH->extensions[CCTK_GetGHExtensionHandle("Symmetry")];
+
+ /* now that we have the same, get the index to the GFs */
+ index = CCTK_GetVarIndex(imp_gf);
+ if (index<0) {
+ CCTK_WARN(0,"Grid function has no index");
+ };
+
+ /* Reference the hash table in the GHex and tell it what kind of
+ symmetry is being applied
+ (depending on sym and the grid layout)
+ If there is no symmetry necessary,set ESYM_NOSYM
+ When we apply a symmetry and find ESYM_UNSET, something went wrong!
+ */
+
+ if (CCTK_Equals(symmetry,"full")) {
+
+#ifdef DEBUG_BOUND
+ printf(" Registered full grid symmetries for -%s- in SetSymmetry\n",imp_gf);
+#endif
+
+ sGHex->GFSym[index][0] = GFSYM_NOSYM;
+ sGHex->GFSym[index][1] = GFSYM_NOSYM;
+ sGHex->GFSym[index][2] = GFSYM_NOSYM;
+
+ } else if (CCTK_Equals(symmetry,"octant")) {
+
+#ifdef DEBUG_BOUND
+ printf(" Registered octant symmetries for -%s- in SetSymmetry\n",imp_gf);
+#endif
+
+ sGHex->GFSym[index][0] = sx;
+ sGHex->GFSym[index][1] = sy;
+ sGHex->GFSym[index][2] = sz;
+
+ } else if (CCTK_Equals(symmetry,"quadrant")) {
+
+#ifdef DEBUG_BOUND
+ printf("Registered quadrant symmetries for -%s- in SetSymmetry\n",imp_gf);
+#endif
+
+ sGHex->GFSym[index][0] = sx;
+ sGHex->GFSym[index][1] = sy;
+ sGHex->GFSym[index][2] = GFSYM_NOSYM;
+
+ } else if (CCTK_Equals(symmetry,"bitant")) {
+
+#ifdef DEBUG_BOUND
+ printf("Registered bitant symmetries for -%s- in SetSymmetry\n",imp_gf);
+#endif
+
+ sGHex->GFSym[index][2] = sz;
+ sGHex->GFSym[index][0] = GFSYM_NOSYM;
+ sGHex->GFSym[index][1] = GFSYM_NOSYM;
+ }
+
+ /* All untouched GFSym[][] will hold GFSYM_UNSET */
+
+}
+
+void FMODIFIER FORTRAN_NAME(SetSymmetry)(cGH *GH, int *sx, int *sy, int *sz, ONE_FORTSTRING_ARG) {
+
+ ONE_FORTSTRING_CREATE(imp_gf)
+
+ SetSymmetry(GH, *sx, *sy, *sz, imp_gf);
+
+ free(imp_gf);
+}
+
+
+
+
+ /*@@
+ @routine ApplySymmetry
+ @date Mon Mar 15 15:16:28 1999
+ @author Gerd Lanfermann
+ @desc
+ Routine applies the symmetry BC to the GF is a group as set by SetSym
+ in GHExtension. It is called by C or Fortran (via a wrapper) by
+ passing the group name. The assignment of the symmetries is carried out
+ by the F routine FortranSym
+ @enddesc
+ @calls FortranSym
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+
+void ApplySymmetry(cGH *GH, char *imp_group) {
+
+ void FORTRAN_NAME(SymmetryCondition)(int *, CCTK_REAL *, int *, int *, int *);
+
+ DECLARE_PARAMETERS
+
+ SymmetryGHex *sGHex;
+ int groupnum;
+ int first,last,index,j;
+ int doSym[3];
+
+ /* Get out if we are sure no symmetries should be applied */
+ if (CCTK_Equals(symmetry,"full")) return;
+
+ /* Get the pointer to the Symmetry GH extension */
+ sGHex = (SymmetryGHex*)GH->extensions[CCTK_GetGHExtensionHandle("Symmetry")];
+
+#ifdef DEBUG_BOUND
+ printf("\n In ApplySymmetry\n -----------\n");
+ printf(" Applying boundary conditions to -%s-\n",imp_group);
+#endif
+
+ /* Get the group number */
+ groupnum = CCTK_GetGroupIndex(imp_group);
+ if (groupnum < 0)
+ {
+ char *message=NULL;
+ message = (char *)malloc(300*sizeof(char)+sizeof(imp_group));
+ sprintf(message,"Invalid group number decomposing -%s",imp_group);
+ CCTK_WARN(0,message);
+ free(message);
+ }
+
+ /*get the index of the first GF in the group and how many Vars there are*/
+ first = CCTK_GetFirstVarIndex_ByIndex(groupnum);
+ last = first+CCTK_GetNumVarsInGroup_ByIndex(groupnum)-1;
+
+ /* loop over the variables in the group */
+ for (index=first; index<=last; index++) {
+
+ /* and check that we actually have a grid function (and not a scalar)*/
+ if (CCTK_GetVarGType(index) == GROUP_GF) {
+
+ /*at this point, there should be NO ESYM_UNSET anymore
+ if there is, we forgot to register the symmetries for a GF */
+ if ((sGHex->GFSym[index][0]==GFSYM_UNSET)||
+ (sGHex->GFSym[index][1]==GFSYM_UNSET)||
+ (sGHex->GFSym[index][2]==GFSYM_UNSET)) {
+ char *message=NULL;
+ message = (char *)malloc(300*sizeof(char)+sizeof(imp_group));
+ sprintf(message,"Cannot apply symmetry to -%s- without registered symmetries",imp_group);
+ CCTK_WARN(1,message);
+ free(message);
+ }
+
+ /* whether we want to apply sym depends on several things: */
+ for (j=0;j<3;j++)
+ if ((GH->cctk_lsh[j]>1) &&
+ (sGHex->GFSym[index][j] != GFSYM_UNSET) &&
+ (sGHex->GFSym[index][j] != GFSYM_NOSYM))
+ doSym[j] = 1;
+ else
+ doSym[j] = 0;
+
+
+ /* Call the Fortran Symmetry Routine */
+ FORTRAN_NAME(SymmetryCondition)(
+ GH->cctk_lsh,
+ /* xyz-size of PE local grid */
+ GH->data[index][0],
+ /* pointer to start of data array for GF[index]*/
+ GH->cctk_nghostzones,
+ /* number of ghost zones */
+ sGHex->GFSym[index],
+ /* the symmetries for this GF */
+ doSym
+ /* flags whether to apply syms */
+ );
+ }
+ }
+}
+
+
+void FMODIFIER FORTRAN_NAME(ApplySymmetry)(cGH *GH, ONE_FORTSTRING_ARG) {
+
+ ONE_FORTSTRING_CREATE(imp_group)
+
+ ApplySymmetry(GH,imp_group);
+
+ free(imp_group);
+}
+
+
+
+
diff --git a/src/Symmetry.h b/src/Symmetry.h
new file mode 100644
index 0000000..6c7eadc
--- /dev/null
+++ b/src/Symmetry.h
@@ -0,0 +1,32 @@
+/*@@
+ @header Symmetry.h
+ @date Sun 7th Mar 1999
+ @author Gerd Lanfermann
+ @desc
+ The extensions to the GH structure for 3D grid symmetry Treatment
+ We'll have six int array for every GF, which holds a flag for which symmetry or
+ (physical) bnd-condition to apply at the grid faces.
+
+ * These tables are set by SetSymmetry(GF,int,int,int)
+ during initialization.
+ * Default values ?
+ * The information is used during evolution by Einstein_DoBound(GF),
+ Einstein_DoSym(GF)
+
+ @endhistory
+ @version
+ @@*/
+
+
+#define GFSYM_UNSET -42
+#define GFSYM_NOSYM -41
+
+typedef struct Symmetry {
+
+ /* Symmetry[0..GF-1][0..dim-1] */
+ /* in each direction [0,..dim-1], this will hold the symmetry
+ operation across that plane, iff the grid layout requires this.
+ this compares to the {sx,sy,sz} of Cactus3.2 */
+ int **GFSym;
+
+} SymmetryGHex;
diff --git a/src/SymmetryCondition.F b/src/SymmetryCondition.F
new file mode 100644
index 0000000..0a53ffe
--- /dev/null
+++ b/src/SymmetryCondition.F
@@ -0,0 +1,62 @@
+
+#include "cctk.h"
+
+/*@@
+ @routine SymmetryCondition
+ @date Mon Mar 15 15:51:57 1999
+ @author Gerd Lanfermann
+ @desc
+ Routine performs the symmetry boundary operations.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+@@*/
+
+
+ subroutine SymmetryCondition(nxyz,var,nghostzones,sym,doSym)
+
+ implicit none
+
+ INTEGER nxyz(3)
+ CCTK_REAL var(nxyz(1),nxyz(2),nxyz(3))
+ INTEGER nghostzones
+ INTEGER sym(3)
+ INTEGER doSym(3)
+
+ INTEGER sw
+
+c Apply symmetry if
+c * the grid chunk has a physical boundary (bbox)
+c * its size in a direction is bigger than one (sh)
+c * we actually want a symmetry (sx.ne.ESYM_UNSET)
+
+ if (doSym(1) == 1) then
+
+ do sw=1, nghostzones
+ var(sw,:,:) = sym(1)*var(nghostzones+sw,:,:)
+ end do
+
+ end if
+
+ if (doSym(2) == 1) then
+
+ do sw=1, nghostzones
+ var(:,sw,:) = sym(2)*var(:,nghostzones+sw,:)
+ end do
+
+ end if
+
+ if (doSym(3).eq.1) then
+
+ do sw=1, nghostzones
+ var(:,:,sw) = sym(3)*var(:,:,nghostzones+sw)
+ end do
+
+ end if
+
+ end subroutine
+
+
diff --git a/src/make.code.defn b/src/make.code.defn
index a29247e..6d823eb 100644
--- a/src/make.code.defn
+++ b/src/make.code.defn
@@ -3,8 +3,11 @@
# Source files in this directory
SRCS = CartGrid3D.F\
+ GHExtension.c\
ParamCheck.F\
- Startup.c
+ Startup.c\
+ Symmetry.c\
+ SymmetryCondition.F
# Subdirectories containing source files
SUBDIRS =