/*@@ @file FlatBoundary.c @date Mon Mar 15 15:09:00 1999 @author Gerd Lanfermann, Gabrielle Allen @desc Flat boundary conditions for a given GF group or single GF @enddesc @@*/ /*#define DEBUG_BOUND*/ #include #include #include #include #include #include #include "cctk.h" #include "cctk_Parameters.h" #include "cctk_FortranString.h" #include "Boundary.h" #include "Symmetry.h" /*@@ @routine BndApplyFlat3Di @date Thu Mar 2 11:14:08 2000 @author Gerd Lanfermann @desc Apply flat boudnary conditions top 3d variables @enddesc @calls @calledby @history @endhistory @@*/ int BndApplyFlat3Di(cGH *GH, int gdim, int *doBC, int *lssh, int *stencil, CCTK_REAL *var) { int i,j,k,sw; /* lower x */ if (doBC[0] == 1) { for (k=0;kcctk_lsh[2];k++) { for (j=0;jcctk_lsh[1];j++) { for (sw=0;swcctk_lsh[2];k++) { for (j=0;jcctk_lsh[1];j++) { for (sw=0;swcctk_lsh[0]-sw-1,j,k)] = var[CCTK_GFINDEX3D(GH,GH->cctk_lsh[0]-stencil[0]-1,j,k)]; } } } } /*lower y */ if (doBC[2] == 1) { for (k=0;kcctk_lsh[2];k++) { for (i=0;icctk_lsh[0];i++) { for (sw=0;swcctk_lsh[2];k++) { for (i=0;icctk_lsh[0];i++) { for (sw=0;swcctk_lsh[1]-sw-1,k)] = var[CCTK_GFINDEX3D(GH,i,GH->cctk_lsh[1]-stencil[1]-1,k)]; } } } } /* lower z */ if (doBC[4] == 1) { for (j=0;jcctk_lsh[1];j++) { for (i=0;icctk_lsh[0];i++) { for (sw=0;swcctk_lsh[1];j++) { for (i=0;icctk_lsh[0];i++) { for (sw=0;swcctk_lsh[2]-sw-1)] = var[CCTK_GFINDEX3D(GH,i,j,GH->cctk_lsh[2]-stencil[2]-1)]; } } } } return(0); } /*@@ @routine BndApplyFlat2Di @date Thu Mar 2 11:14:08 2000 @author Gerd Lanfermann @desc Apply flat boudnary conditions to 2d variables @enddesc @calls @calledby @history @endhistory @@*/ int BndApplyFlat2Di(cGH *GH, int gdim, int *doBC, int *lssh, int *stencil, CCTK_REAL *var) { int i,j,k,sw; /* lower x */ if (doBC[0] == 1) { for (j=0;jcctk_lsh[1];j++) { for (sw=0;swcctk_lsh[1];j++) { for (sw=0;swcctk_lsh[0]-sw-1,j)] = var[CCTK_GFINDEX2D(GH,GH->cctk_lsh[0]-stencil[0]-1,j)]; } } } /* lower y */ if (doBC[2] == 1) { for (i=0;icctk_lsh[0];i++) { for (sw=0;swcctk_lsh[0];i++) { for (sw=0;swcctk_lsh[1]-sw-1)] = var[CCTK_GFINDEX2D(GH,i,GH->cctk_lsh[1]-stencil[1]-1)]; } } } return(0); } /*@@ @routine BndApplyFlat1Di @date Thu Mar 2 11:14:08 2000 @author Gerd Lanfermann @desc Apply flat boudnary conditions to 1d variables @enddesc @calls @calledby @history @endhistory @@*/ int BndApplyFlat1Di(cGH *GH, int gdim, int *doBC, int *lssh, int *stencil, CCTK_REAL *var) { int sw; /* lower x */ if (doBC[0] == 1) { for (sw=0;swcctk_lsh[0]-sw-1)] = var[CCTK_GFINDEX1D(GH,GH->cctk_lsh[0]-stencil[0]-1)]; } } return(0); }