aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src/Checksum.cc
diff options
context:
space:
mode:
authorschnetter <>2003-06-18 16:24:00 +0000
committerschnetter <>2003-06-18 16:24:00 +0000
commitea0d204e9bfe5daa6123970f2c1c323bd7e75b36 (patch)
treec48a4a122dfec847afa10475dd19ac1b94617e39 /Carpet/Carpet/src/Checksum.cc
parent343af5d6432feecd65a217c3cb1731394b55d315 (diff)
Major update after a quiet time.
Major update after a quiet time. Carpet: The flesh now has new cGH fields cctk_levoff[], cctk_levoffdenom[], and cctk_timefac that describe the spatial offset and temporal refinement factor between the base and the current refinement level. These fields are now set and used; they change how coordinates are handled. CarpetIOASCII: Fix bugs regarding choosing the output hyperslab and the output coordinates. ID*, *Toy*: New WaveToy examples with various formulations and different integrations methods. Currently, none of them converge to second order except the standard WaveToy formulation. These updates require the recent flesh, base thorn (and MoL) updates. darcs-hash:20030618162427-07bb3-70761f74bce6ae246b5a2943a385647657d46d34.gz
Diffstat (limited to 'Carpet/Carpet/src/Checksum.cc')
-rw-r--r--Carpet/Carpet/src/Checksum.cc201
1 files changed, 105 insertions, 96 deletions
diff --git a/Carpet/Carpet/src/Checksum.cc b/Carpet/Carpet/src/Checksum.cc
index 78b59cde6..ad3972a35 100644
--- a/Carpet/Carpet/src/Checksum.cc
+++ b/Carpet/Carpet/src/Checksum.cc
@@ -9,7 +9,7 @@
#include "carpet.hh"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Checksum.cc,v 1.8 2002/10/24 10:39:38 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Checksum.cc,v 1.9 2003/06/18 18:24:27 schnetter Exp $";
CCTK_FILEVERSION(Carpet_Carpet_Checksum_cc);
}
@@ -31,55 +31,61 @@ namespace Carpet {
checksums.resize(CCTK_NumVars());
for (int group=0; group<CCTK_NumGroups(); ++group) {
- for (int var=0; var<CCTK_NumVarsInGroupI(group); ++var) {
-
- 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);
-
- checksums[n].resize(maxreflevels);
- checksums[n][reflevel].resize(num_tl);
- for (int tl=min_tl; tl<=max_tl; ++tl) {
- checksums[n][reflevel][tl].resize(hh->components(reflevel));
- BEGIN_COMPONENT_LOOP(cgh) {
- checksums[n][reflevel][tl][component].valid = false;
- } END_COMPONENT_LOOP(cgh);
- }
+ const int grouptype = CCTK_GroupTypeI(group);
+ if (grouptype == CCTK_GF || reflevel==0) {
+ for (int var=0; var<CCTK_NumVarsInGroupI(group); ++var) {
+
+ 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);
+
+ checksums[n].resize(maxreflevels);
+ checksums[n][reflevel].resize(num_tl);
+ for (int tl=min_tl; tl<=max_tl; ++tl) {
+ checksums[n][reflevel][tl].resize(hh->components(reflevel));
+ BEGIN_COMPONENT_LOOP(cgh, grouptype) {
+ checksums[n][reflevel][tl][component].valid = false;
+ } END_COMPONENT_LOOP;
+ }
+ }
}
}
for (int group=0; group<CCTK_NumGroups(); ++group) {
- if (CCTK_QueryGroupStorageI(cgh, group)) {
- for (int var=0; var<CCTK_NumVarsInGroupI(group); ++var) {
-
- const int n = CCTK_FirstVarIndexI(group) + var;
- const int sz = CCTK_VarTypeSize(CCTK_VarTypeI(n));
- assert (sz>0);
- 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) {
- const int gpdim = arrdata[group].info.dim;
- int np = 1;
- for (int d=0; d<gpdim; ++d) {
- np *= *CCTK_ArrayGroupSizeI(cgh, d, group);
- }
- const void* data = cgh->data[n][tl];
- int chk = 0;
- for (int i=0; i<np*sz/(int)sizeof chk; ++i) {
- chk += ((const int*)data)[i];
- }
- checksums[n][reflevel][tl][component].sum = chk;
- checksums[n][reflevel][tl][component].valid = true;
- } END_LOCAL_COMPONENT_LOOP(cgh);
- } // for tl
- } // for var
- } // if has storage
+ const int grouptype = CCTK_GroupTypeI(group);
+ if (grouptype == CCTK_GF || reflevel==0) {
+ if (CCTK_QueryGroupStorageI(cgh, group)) {
+ for (int var=0; var<CCTK_NumVarsInGroupI(group); ++var) {
+
+ const int n = CCTK_FirstVarIndexI(group) + var;
+ const int sz = CCTK_VarTypeSize(CCTK_VarTypeI(n));
+ assert (sz>0);
+ 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) {
+ const int gpdim = arrdata[group].info.dim;
+ int np = 1;
+ for (int d=0; d<gpdim; ++d) {
+ np *= *CCTK_ArrayGroupSizeI(cgh, d, group);
+ }
+ const void* data = cgh->data[n][tl];
+ int chk = 0;
+ for (int i=0; i<np*sz/(int)sizeof chk; ++i) {
+ chk += ((const int*)data)[i];
+ }
+ checksums[n][reflevel][tl][component].sum = chk;
+ checksums[n][reflevel][tl][component].valid = true;
+ } END_LOCAL_COMPONENT_LOOP;
+ } // for tl
+ } // for var
+ } // if has storage
+ } // if reflevel
} // for group
}
@@ -95,56 +101,59 @@ namespace Carpet {
assert ((int)checksums.size()==CCTK_NumVars());
for (int group=0; group<CCTK_NumGroups(); ++group) {
- if (CCTK_QueryGroupStorageI(cgh, group)) {
- for (int var=0; var<CCTK_NumVarsInGroupI(group); ++var) {
-
- const int n = CCTK_FirstVarIndexI(group) + var;
- const int sz = CCTK_VarTypeSize(CCTK_VarTypeI(n));
- assert (sz>0);
- 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);
-
- assert ((int)checksums[n].size()==maxreflevels);
- assert ((int)checksums[n][reflevel].size()==num_tl);
-
- for (int tl=min_tl; tl<=max_tl; ++tl) {
-
- bool unexpected_change = false;
-
- assert ((int)checksums[n][reflevel][tl].size()
- == hh->components(reflevel));
- BEGIN_LOCAL_COMPONENT_LOOP(cgh) {
- if (checksums[n][reflevel][tl][component].valid) {
- const int gpdim = arrdata[group].info.dim;
- int np = 1;
- for (int d=0; d<gpdim; ++d) {
- np *= *CCTK_ArrayGroupSizeI(cgh, d, group);
- }
- const void* data = cgh->data[n][tl];
- int chk = 0;
- for (int i=0; i<np*sz/(int)sizeof chk; ++i) {
- chk += ((const int*)data)[i];
- }
- unexpected_change
- = (unexpected_change
- || chk != checksums[n][reflevel][tl][component].sum);
- }
- } END_LOCAL_COMPONENT_LOOP(cgh);
-
- if (unexpected_change) {
- char* fullname = CCTK_FullName(n);
- CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Timelevel %d of the variable \"%s\" has changed unexpectedly.",
- tl, fullname);
- free (fullname);
- }
-
- } // for tl
-
- } // for var
- } // if has storage
+ const int grouptype = CCTK_GroupTypeI(group);
+ if (grouptype == CCTK_GF || reflevel==0) {
+ if (CCTK_QueryGroupStorageI(cgh, group)) {
+ for (int var=0; var<CCTK_NumVarsInGroupI(group); ++var) {
+
+ const int n = CCTK_FirstVarIndexI(group) + var;
+ const int sz = CCTK_VarTypeSize(CCTK_VarTypeI(n));
+ assert (sz>0);
+ 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);
+
+ assert ((int)checksums[n].size()==maxreflevels);
+ assert ((int)checksums[n][reflevel].size()==num_tl);
+
+ for (int tl=min_tl; tl<=max_tl; ++tl) {
+
+ bool unexpected_change = false;
+
+ assert ((int)checksums[n][reflevel][tl].size()
+ == hh->components(reflevel));
+ BEGIN_LOCAL_COMPONENT_LOOP(cgh, grouptype) {
+ if (checksums[n][reflevel][tl][component].valid) {
+ const int gpdim = arrdata[group].info.dim;
+ int np = 1;
+ for (int d=0; d<gpdim; ++d) {
+ np *= *CCTK_ArrayGroupSizeI(cgh, d, group);
+ }
+ const void* data = cgh->data[n][tl];
+ int chk = 0;
+ for (int i=0; i<np*sz/(int)sizeof chk; ++i) {
+ chk += ((const int*)data)[i];
+ }
+ unexpected_change
+ = (unexpected_change
+ || chk != checksums[n][reflevel][tl][component].sum);
+ }
+ } END_LOCAL_COMPONENT_LOOP;
+
+ if (unexpected_change) {
+ char* fullname = CCTK_FullName(n);
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Timelevel %d of the variable \"%s\" has changed unexpectedly.",
+ tl, fullname);
+ free (fullname);
+ }
+
+ } // for tl
+
+ } // for var
+ } // if has storage
+ } // if reflevel
} // for group
}