diff options
author | schnetter <schnetter@f69c4107-0314-4c4f-9ad4-17e986b73f4a> | 2006-07-05 19:05:46 +0000 |
---|---|---|
committer | schnetter <schnetter@f69c4107-0314-4c4f-9ad4-17e986b73f4a> | 2006-07-05 19:05:46 +0000 |
commit | 52a24adeead81157f5d205c6a94a3d4a8731c453 (patch) | |
tree | ec844495b86668525a75f4142cc3245c2d144dff /src/stencil.c | |
parent | 7409bb1a94ba40a8ff24896cc8a2e5ef3a096d96 (diff) |
Introduce a function SBP_determine_onesided_stencil which determines
which faces should use one-sided stencils, depending on which
boundaries are inter-processor boundaries, symmetry boundaries, and
multi-patch boundaries.
Use this function everywhere. Remove the previous mechinisms; some
were not in all cases correct.
git-svn-id: https://svn.cct.lsu.edu/repos/numrel/LSUThorns/SummationByParts/trunk@75 f69c4107-0314-4c4f-9ad4-17e986b73f4a
Diffstat (limited to 'src/stencil.c')
-rw-r--r-- | src/stencil.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/stencil.c b/src/stencil.c new file mode 100644 index 0000000..007a7c6 --- /dev/null +++ b/src/stencil.c @@ -0,0 +1,66 @@ +#include "cctk.h" + +#include "util_ErrorCodes.h" +#include "util_Table.h" + +#include "stencil.h" + + + +/* Determine whether a boundary with the symmetry handle symbnd is a + "regular" symmetry boundary (where the SBP stencils should not be + modified), or an outer boundary (or a multi-block boundary), where + the SBP stencils need to be modified. */ + +void SBP_determine_onesided_stencil (const cGH * cctkGH, int * onesided) +{ + int symtable; + int pen_sym_handle; + CCTK_INT symbnd[6]; + int ierr; + int d; + + symtable = SymmetryTableHandleForGrid (cctkGH); + if (symtable<0) { + CCTK_WARN(0,"Cannot get symmetry table handle -- maybe thorn SymBase is not active?"); + } + + ierr = Util_TableGetIntArray (symtable, 6, symbnd, "symmetry_handle"); + if (ierr!=6) { + CCTK_WARN(0,"Cannot get symmetry handles"); + } + + pen_sym_handle = SymmetryHandleOfName ( "multipatch" ); + + for (d=0; d<6; ++d) { + if (! cctkGH->cctk_bbox[d]) { + /* This is an inter-processor boundary */ + onesided[d] = 0; + } else { + /* On an outer boundary (which is not a symmetry boundary), + symbnd < 0. */ + if (symbnd[d] < 0) { + onesided[d] = 1; + } else { + if (pen_sym_handle >= 0) { + /* If the symmetry boundary is a multi-block boundary, then + symbnd = pen_sym_handle. However, we can only check that + thorn MultiPatch is active, i.e., whether pen_sym_handle + >= 0. */ + if (symbnd[d] == pen_sym_handle) { + onesided[d] = 1; + } else { + onesided[d] = 0; + } + } else { + onesided[d] = 0; + } + } + } + } +} + +CCTK_FCALL void CCTK_FNAME (SBP_determine_onesided_stencil) (CCTK_POINTER_TO_CONST cctkGH, int * onesided) +{ + SBP_determine_onesided_stencil (cctkGH, onesided); +} |