From 59b159bdb44d7a42d122aefc079775b9fbea86ae Mon Sep 17 00:00:00 2001 From: eschnett Date: Mon, 14 Jan 2013 17:40:55 +0000 Subject: Support array padding (take cctk_ash into account) git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/NaNChecker/trunk@113 ff385933-4943-42dc-877b-ffc776028de6 --- src/NaNCheck.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/NaNCheck.cc b/src/NaNCheck.cc index 3203cab..cc98b2c 100644 --- a/src/NaNCheck.cc +++ b/src/NaNCheck.cc @@ -174,7 +174,7 @@ void NaNChecker_NaNCheck_Prepare (CCTK_ARGUMENTS) /* zero out the NaN mask */ for (i = 0, nelems = 1; i < cctk_dim; i++) { - nelems *= cctk_lsh[i]; + nelems *= cctk_ash[i]; } memset (info.NaNmask, 0, nelems * sizeof (CCTK_INT)); } @@ -632,12 +632,12 @@ void PrintWarning (const char *error_type, coord_buf << ", "; } } - index_buf << /* "%d" */ (amended_index % gdata->lsh[i]) + gdata->lbnd[i] + 1; + index_buf << (amended_index % gdata->ash[i]) + gdata->lbnd[i] + 1; if (coords) { coord_buf << /* "%5.3e" */ coords[i][linear_index]; } - amended_index /= gdata->lsh[i]; + amended_index /= gdata->ash[i]; } if (coords) @@ -685,7 +685,14 @@ CHECK_DATA(const cctk_type *_data, int nelems, const CCTK_REAL *CarpetWeights, #pragma omp parallel for schedule(dynamic) for (int _i = 0; _i < nelems; _i++) { - if (!CarpetWeights || CarpetWeights[_i] > 0.0) + bool is_inside = true; + int amended_index = _i; + for (int d=0; d 0.0)) { /* We call the C wrapper functions instead of the autoconfigured @@ -1088,7 +1095,7 @@ void SetToNaN (int vindex, const char *optstring, void *_info) CCTK_GroupDynamicData (info->GH, gindex, &gdata); for (i = 0; i < gdata.dim; i++) { - nelems *= gdata.lsh[i]; + nelems *= gdata.ash[i]; } } -- cgit v1.2.3