From 25bd6f5c57afe0a8e4d51dd987d385a6f4663cd3 Mon Sep 17 00:00:00 2001 From: schnetter Date: Sun, 11 Jun 2006 20:56:54 +0000 Subject: Replace the temporary solution, which checks whether PUGH is active, with a better way to determine which boundaries are outer boundaries, symmetry boundaries, interprocessor boundaries, or penalty boundaries. git-svn-id: https://svn.cct.lsu.edu/repos/numrel/LSUThorns/SummationByParts/trunk@73 f69c4107-0314-4c4f-9ad4-17e986b73f4a --- src/call_derivs.c | 73 ++++++++++++++++++++++++------------------------------- 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/src/call_derivs.c b/src/call_derivs.c index 53009a5..5dd4530 100644 --- a/src/call_derivs.c +++ b/src/call_derivs.c @@ -4,7 +4,31 @@ #include "util_ErrorCodes.h" #include "util_Table.h" -#include "cctk_DefineThorn.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. */ +static int is_regular_symbnd (int const symbnd, int const pen_sym_handle) +{ + /* On an outer boundary (which is not a symmetry boundary), symbnd < + 0. */ + if (symbnd < 0) return 0; + + 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 if thorn + MultiPatch is active, i.e., if pen_sym_handle >= 0. */ + if (symbnd == pen_sym_handle) return 0; + } + + /* This is a "regular" symmetry boundary. */ + return 1; +} + + void DiffGv ( const CCTK_POINTER_TO_CONST cctkGH_, const CCTK_INT dir, const CCTK_REAL *var, CCTK_REAL *dvar, @@ -137,60 +161,27 @@ void DiffGv ( const CCTK_POINTER_TO_CONST cctkGH_, const CCTK_INT dir, CCTK_WARN(0,"Util_TableGetIntArray returned error"); } - - pen_sym_handle = SymmetryHandleOfName ( "multipatch" ); - -#ifdef CACTUSPUGH_PUGH /* a little hack to make this work with - pugh (without reflection sym, though) */ - for (i=0; i<6; i++){ - symbnd[i] = 1; - pen_sym_handle=1; - } -#endif + pen_sym_handle = SymmetryHandleOfName ( "multipatch" ); switch(dir) { case 0: { delta = CCTK_DELTA_SPACE(0); - if ( symbnd[0] == pen_sym_handle && cctk_bbox[0] == 1 ) { - bb[0] = 1; - } else { - bb[0] = 0; - } - if ( symbnd[1] == pen_sym_handle && cctk_bbox[1] == 1 ) { - bb[1] = 1; - } else { - bb[1] = 0; - } + bb[0] = cctk_bbox[0] && ! is_regular_symbnd (symbnd[0], pen_sym_handle); + bb[1] = cctk_bbox[1] && ! is_regular_symbnd (symbnd[1], pen_sym_handle); gsize = cctk_nghostzones[0]; break; } case 1: { delta = CCTK_DELTA_SPACE(1); - if ( symbnd[2] == pen_sym_handle && cctk_bbox[2] == 1) { - bb[0] = 1; - } else { - bb[0] = 0; - } - if ( symbnd[3] == pen_sym_handle && cctk_bbox[3] == 1) { - bb[1] = 1; - } else { - bb[1] = 0; - } + bb[0] = cctk_bbox[2] && ! is_regular_symbnd (symbnd[2], pen_sym_handle); + bb[1] = cctk_bbox[3] && ! is_regular_symbnd (symbnd[3], pen_sym_handle); gsize = cctk_nghostzones[1]; break; } case 2: { delta = CCTK_DELTA_SPACE(2); - if ( symbnd[4] == pen_sym_handle && cctk_bbox[4] == 1) { - bb[0] = 1; - } else { - bb[0] = 0; - } - if ( symbnd[4] == pen_sym_handle && cctk_bbox[5] == 1) { - bb[1] = 1; - } else { - bb[1] = 0; - } + bb[0] = cctk_bbox[4] && ! is_regular_symbnd (symbnd[4], pen_sym_handle); + bb[1] = cctk_bbox[5] && ! is_regular_symbnd (symbnd[5], pen_sym_handle); gsize = cctk_nghostzones[2]; break; } -- cgit v1.2.3