aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src/Poison.cc
diff options
context:
space:
mode:
authorschnetter <>2003-08-10 19:59:00 +0000
committerschnetter <>2003-08-10 19:59:00 +0000
commitb8ed9935ab73be68264d06f930a2a9f633e43ad8 (patch)
treec054927b2519398c8fa0c1f59804905846f4f3ec /Carpet/Carpet/src/Poison.cc
parentab069047323b363e2696b57161a930fefa81bb97 (diff)
Make checksumming and poisoning work again.
Make checksumming and poisoning work again. Modify Scott's three timelevel scheme to work again. darcs-hash:20030810195951-07bb3-b9e99cfe4858b00978f925172c062abd4524a1ba.gz
Diffstat (limited to 'Carpet/Carpet/src/Poison.cc')
-rw-r--r--Carpet/Carpet/src/Poison.cc129
1 files changed, 70 insertions, 59 deletions
diff --git a/Carpet/Carpet/src/Poison.cc b/Carpet/Carpet/src/Poison.cc
index 2e3c019f1..a151db081 100644
--- a/Carpet/Carpet/src/Poison.cc
+++ b/Carpet/Carpet/src/Poison.cc
@@ -8,7 +8,7 @@
#include "carpet.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Poison.cc,v 1.13 2003/07/14 15:45:37 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Poison.cc,v 1.14 2003/08/10 21:59:51 schnetter Exp $";
CCTK_FILEVERSION(Carpet_Carpet_Poison_cc);
}
@@ -38,14 +38,11 @@ namespace Carpet {
void PoisonGroup (const cGH* cgh, const int group, const checktimes where)
{
DECLARE_CCTK_PARAMETERS;
- int ierr;
assert (group>=0 && group<CCTK_NumGroups());
if (! poison_new_timelevels) return;
- Checkpoint ("%*sPoisonGroup %s", 2*reflevel, "", CCTK_GroupName(group));
-
if (! CCTK_QueryGroupStorageI(cgh, group)) {
CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
"Cannot poison group \"%s\" because it has no storage",
@@ -53,39 +50,42 @@ namespace Carpet {
return;
}
- const int var0 = CCTK_FirstVarIndexI(group);
- assert (var0>=0);
+ const int n0 = CCTK_FirstVarIndexI(group);
+ assert (n0>=0);
const int nvar = CCTK_NumVarsInGroupI(group);
- const int sz = CCTK_VarTypeSize(CCTK_VarTypeI(var0));
+ const int sz = CCTK_VarTypeSize(CCTK_VarTypeI(n0));
assert (sz>0);
- const int num_tl = CCTK_NumTimeLevelsFromVarI(var0);
+ const int num_tl = CCTK_NumTimeLevelsFromVarI(n0);
assert (num_tl>0);
const int min_tl = mintl(where, num_tl);
const int max_tl = maxtl(where, num_tl);
- const int gpdim = CCTK_GroupDimI(group);
-
- const int grouptype = CCTK_GroupTypeI(group);
-
- BEGIN_LOCAL_COMPONENT_LOOP(cgh, grouptype) {
+ if (min_tl <= max_tl) {
- vector<int> lsh(gpdim);
- ierr = CCTK_GrouplshGI (cgh, gpdim, &lsh[0], group);
- assert (!ierr);
+ Checkpoint ("%*sPoisonGroup %s", 2*reflevel, "", CCTK_GroupName(group));
- int np = 1;
- for (int d=0; d<gpdim; ++d) {
- np *= lsh[d];
- }
+ const int grouptype = CCTK_GroupTypeI(group);
- for (int n=var0; n<var0+nvar; ++n) {
- for (int tl=min_tl; tl<=max_tl; ++tl) {
- memset (cgh->data[n][tl], poison_value, np*sz);
- } // for tl
- } // for var
+ BEGIN_LOCAL_COMPONENT_LOOP(cgh, grouptype) {
+
+ vect<int,dim> size(1);
+ const int gpdim = arrdata[group].info.dim;
+ for (int d=0; d<gpdim; ++d) {
+ size[d] = arrdata[group].info.lsh[d];
+ }
+ const int np = prod(size);
+
+ for (int var=0; var<nvar; ++var) {
+ const int n = n0 + var;
+ for (int tl=min_tl; tl<=max_tl; ++tl) {
+ memset (cgh->data[n][tl], poison_value, np*sz);
+ } // for tl
+ } // for var
+
+ } END_LOCAL_COMPONENT_LOOP;
- } END_LOCAL_COMPONENT_LOOP;
+ } // if tl
}
@@ -100,32 +100,38 @@ namespace Carpet {
for (int group=0; group<CCTK_NumGroups(); ++group) {
if (CCTK_QueryGroupStorageI(cgh, group)) {
- for (int var=0; var<CCTK_NumVarsInGroupI(group); ++var) {
-
- const int grouptype = CCTK_GroupTypeI(group);
+
+ const int grouptype = CCTK_GroupTypeI(group);
+ const int n0 = CCTK_FirstVarIndexI(group);
+ assert (n0>=0);
+ const int nvar = CCTK_NumVarsInGroupI(group);
+ const int tp = CCTK_VarTypeI(n0);
+ const int gpdim = arrdata[group].info.dim;
+
+ const int num_tl = CCTK_NumTimeLevelsFromVarI(n0);
+ assert (num_tl>0);
+ const int min_tl = mintl(where, num_tl);
+ const int max_tl = maxtl(where, num_tl);
+
+ BEGIN_LOCAL_COMPONENT_LOOP(cgh, grouptype) {
- const int n = CCTK_FirstVarIndexI(group) + var;
-
- const int num_tl = CCTK_NumTimeLevelsFromVarI(n);
- assert (num_tl>0);
- const int min_tl = mintl(where, num_tl);
- const int max_tl = maxtl(where, num_tl);
-
- for (int tl=min_tl; tl<=max_tl; ++tl) {
-
- BEGIN_LOCAL_COMPONENT_LOOP(cgh, grouptype) {
- vect<int,dim> size(1);
- const int gpdim = arrdata[group].info.dim;
- for (int d=0; d<gpdim; ++d) {
- size[d] = *CCTK_ArrayGroupSizeI(cgh, d, group);
- }
- const int tp = CCTK_VarTypeI(n);
+ vect<int,dim> size(1);
+ for (int d=0; d<gpdim; ++d) {
+ size[d] = arrdata[group].info.lsh[d];
+ }
+ const int np = prod(size);
+
+ for (int var=0; var<nvar; ++var) {
+ const int n = n0 + var;
+
+ for (int tl=min_tl; tl<=max_tl; ++tl) {
+
const void* const data = cgh->data[n][tl];
int numpoison=0;
for (int k=0; k<size[2]; ++k) {
for (int j=0; j<size[1]; ++j) {
for (int i=0; i<size[0]; ++i) {
- const int idx = CCTK_GFINDEX3D(cgh,i,j,k);
+ const int idx = i + size[0] * (j + size[1] * k);
bool poisoned=false;
switch (tp) {
#define TYPECASE(N,T) \
@@ -143,29 +149,34 @@ namespace Carpet {
}
if (poisoned) {
++numpoison;
- if (numpoison<=10) {
+ if (max_poison_locations==-1
+ || numpoison<=max_poison_locations) {
char* fullname = CCTK_FullName(n);
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "The variable \"%s\" contains poison at [%d,%d,%d] in timelevel %d",
- fullname, i,j,k, tl);
+ "Timelevel %d, component %d, refinement level %d of the variable \"%s\" contains poison at [%d,%d,%d]",
+ tl, component, reflevel, fullname, i,j,k);
free (fullname);
- }
+ }
} // if poisoned
} // for i
} // for j
} // for k
- if (numpoison>10) {
+ if (max_poison_locations!=-1 && numpoison>max_poison_locations) {
char* fullname = CCTK_FullName(n);
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "The variable \"%s\" contains poison at %d locations in timelevel %d; not all locations were printed.",
- fullname, numpoison, tl);
+ "Timelevel %d, component %d, refinement level %d of the variable \"%s\" contains poison at %d of %d locations; not all locations were printed",
+ tl, component, reflevel, fullname, numpoison, np);
free (fullname);
- }
- } END_LOCAL_COMPONENT_LOOP;
-
- } // for tl
-
- } // for var
+ } else if (numpoison>0) {
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Found poison at %d of %d locations",
+ numpoison, np);
+ }
+
+ } // for tl
+ } // for var
+ } END_LOCAL_COMPONENT_LOOP;
+
} // if has storage
} // for group
}