Index: src/LinearExtrapBnd.c =================================================================== RCS file: /cactusdevcvs/CactusExamples/SampleBoundary/src/LinearExtrapBnd.c,v retrieving revision 1.10 diff -u -r1.10 LinearExtrapBnd.c --- src/LinearExtrapBnd.c 3 Jun 2004 15:17:23 -0000 1.10 +++ src/LinearExtrapBnd.c 2 Nov 2005 00:51:24 -0000 @@ -116,6 +116,7 @@ -8 potentially valid table handle -16 dimension is not supported -32 possibly called with a grid scalar + -64 not enough local grid points @endreturndesc @@*/ @@ -124,7 +125,7 @@ { int i, j, gi, gtype, dim, retval, err; int doBC[6]; - const int *lsh, *bbox; + const int *lsh, *bbox, *ghosts; CCTK_INT symtable; CCTK_INT symbnd[6]; CCTK_INT is_physical[6]; @@ -178,6 +179,7 @@ dim = GH->cctk_dim; bbox = GH->cctk_bbox; lsh = GH->cctk_lsh; + ghosts = GH->cctk_nghostzones; } else { @@ -192,6 +194,7 @@ dim = group_data.dim; bbox = group_data.bbox; lsh = group_data.lsh; + ghosts = group_data.nghostzones; } var_ptr = GH->data[vars[i]][0]; #ifdef DEBUG @@ -220,7 +223,7 @@ /* Decide on which faces the bc should be applied */ for (j=0; j<2*dim; ++j) { - doBC[j] = lsh[j/2] > widths[i]+2 && bbox[j]; + doBC[j] = bbox[j]; } /* see if we have a physical boundary */ @@ -239,8 +242,24 @@ doBC[j] &= is_physical[i]; } + /* Check whether there are enough grid points */ + for (j=0; j<2*dim; ++j) + { + if (doBC[j]) + { + if (lsh[j/2] - ghosts[j/2] < widths[j/2] + 2) + { + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Not enough local grid points. " + "Not applying bc."); + retval |= 64; + } + } + } + + /* Apply the boundary condition */ - if( !( retval & ( 1 | 16 ) ) ) /* unless particularly bad errors */ + if( !( retval & ( 1 | 16 | 64 ) ) ) /* unless particularly bad errors */ CCTK_FNAME(Linear_extrap_one_bndry)(doBC, lsh, var_ptr); }