From 3c8cafa058889929160d7019304b99fab0656df8 Mon Sep 17 00:00:00 2001 From: schnetter <> Date: Mon, 23 Apr 2001 06:10:00 +0000 Subject: Modified the Carpet driver so that it uses the same new timelevel Modified the Carpet driver so that it uses the same new timelevel cycling as does PUGH. Modified the CarpetIOASCII and CarpetIOFlexIO output routines so that they always output the current time level. Found and fixed a bug in the time interpolation in CarpetLib. Fixed a bug where the necessary number of ghost zones for space interpolation was calculated incorrectly. Fixed bugs in the example parameter files that used an insufficient number of ghost zones. darcs-hash:20010423061011-07bb3-c69e59f7bc5f283d7632a663c0770578cdb73881.gz --- Carpet/Carpet/doc/TODO | 7 +- Carpet/Carpet/param.ccl | 8 +- Carpet/Carpet/src/carpet.cc | 410 ++++++++++++++++++++---------------- Carpet/Carpet/src/carpet.hh | 5 +- Carpet/CarpetIOASCII/src/ioascii.cc | 4 +- Carpet/CarpetLib/src/dh.cc | 28 ++- Carpet/CarpetLib/src/dh.hh | 10 +- Carpet/CarpetLib/src/ggf.cc | 14 +- Carpet/CarpetSlab/src/carpetslab.cc | 6 +- 9 files changed, 285 insertions(+), 207 deletions(-) (limited to 'Carpet') diff --git a/Carpet/Carpet/doc/TODO b/Carpet/Carpet/doc/TODO index 2f4cfbfe2..00eba8d0a 100644 --- a/Carpet/Carpet/doc/TODO +++ b/Carpet/Carpet/doc/TODO @@ -1,5 +1,5 @@ -*-Text-*- -$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/doc/TODO,v 1.4 2001/03/30 00:50:06 eschnett Exp $ +$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/doc/TODO,v 1.5 2001/04/23 08:10:11 schnetter Exp $ CarpetSlab: Add support for diagonal lines @@ -10,3 +10,8 @@ Carpet: Distribute processes in all directions, not only z Carpet: Test suite Carpet: Finish documentation + +CarpetIOASCII: put more information into output files + +Carpet: Allow en-/disabling storage for grid functions with one time +level diff --git a/Carpet/Carpet/param.ccl b/Carpet/Carpet/param.ccl index 142e17700..f777c7292 100644 --- a/Carpet/Carpet/param.ccl +++ b/Carpet/Carpet/param.ccl @@ -1,5 +1,5 @@ # Parameter definitions for thorn Carpet -# $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/param.ccl,v 1.8 2001/03/30 00:21:20 eschnett Exp $ +# $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/param.ccl,v 1.9 2001/04/23 08:10:11 schnetter Exp $ shares: Cactus @@ -86,6 +86,12 @@ CCTK_INT prolongation_order_time "Order of prolongation operator in time" +BOOLEAN enable_all_storage "Enable storage for all grid functions" +{ +} "no" + + + BOOLEAN poison_new_timelevels "Try to catch uninitialised grid elements by setting new timelevels to values that will catch your attention" { } "no" diff --git a/Carpet/Carpet/src/carpet.cc b/Carpet/Carpet/src/carpet.cc index 8a6d84b13..345a61e7f 100644 --- a/Carpet/Carpet/src/carpet.cc +++ b/Carpet/Carpet/src/carpet.cc @@ -4,7 +4,7 @@ // processors own the same number of components. // Scalar variables currently exist in one single incarnation for all -// refinement levels and all components. +// components. #include #include @@ -35,7 +35,7 @@ #include "carpet.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Attic/carpet.cc,v 1.23 2001/04/17 17:07:09 schnetter Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Attic/carpet.cc,v 1.24 2001/04/23 08:10:12 schnetter Exp $"; @@ -47,17 +47,21 @@ namespace Carpet { static void CycleTimeLevels (cGH* cgh); static void Restrict (cGH* cgh); - // where=0: all time levels but next time level - // where=1: only next time level - // but never if there is only one time level - // where=2: all time levels + enum checktimes { currenttime, + currenttimebutnotifonly, + allbutlasttime, + allbutcurrenttime, + alltimes }; - static void Poison (cGH* cgh, int where); - static void PoisonGroup (cGH* cgh, int group, int where); - static void PoisonCheck (cGH* cgh, int where); + static void Poison (cGH* cgh, checktimes where); + static void PoisonGroup (cGH* cgh, int group, checktimes where); + static void PoisonCheck (cGH* cgh, checktimes where); - static void CalculateChecksums (cGH* cgh, int where); - static void CheckChecksums (cGH* cgh, int where); + static void CalculateChecksums (cGH* cgh, checktimes where); + static void CheckChecksums (cGH* cgh, checktimes where); + + static int mintl (checktimes where, int num_tl); + static int maxtl (checktimes where, int num_tl); // Debugging output static void Checkpoint (const char* fmt, ...); @@ -76,9 +80,6 @@ namespace Carpet { // Refinement factor on finest grid int maxreflevelfact; - // Active time level - int activetimelevel; // 0 for current, 1 for next - // Current iteration per refinement level vector iteration; @@ -200,7 +201,7 @@ namespace Carpet { const int prolongation_stencil_size = dd->prolongation_stencil_size(); const int min_nghosts - = ((prolongation_stencil_size + refinement_factor - 2) + = ((prolongation_stencil_size + refinement_factor - 1) / (refinement_factor-1)); if (any(min(lghosts,ughosts) < min_nghosts)) { CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, @@ -226,8 +227,8 @@ namespace Carpet { scdata[group].data[var].resize(maxreflevels); for (int rl=0; rlcctk_delta_time; } else { // assert (abs(cgh->cctk_delta_time - base_delta_time / reflevelfactor) // < 1e-6 * base_delta_time); - // This fixes a bug in CactusBase/Time + // This circumvents a bug in CactusBase/Time cgh->cctk_delta_time = base_delta_time / reflevelfact; } // Set up the initial data + Checkpoint ("%*sScheduling INITIAL", 2*reflevel, ""); CCTK_ScheduleTraverse ("CCTK_INITIAL", cgh, CallFunction); + Checkpoint ("%*sScheduling POSTINITIAL", 2*reflevel, ""); CCTK_ScheduleTraverse ("CCTK_POSTINITIAL", cgh, CallFunction); // Recover + Checkpoint ("%*sScheduling RECOVER_VARIABLES", 2*reflevel, ""); CCTK_ScheduleTraverse ("CCTK_RECOVER_VARIABLES", cgh, CallFunction); + Checkpoint ("%*sScheduling CPINITIAL", 2*reflevel, ""); CCTK_ScheduleTraverse ("CCTK_CPINITIAL", cgh, CallFunction); + // Poststep + Checkpoint ("%*sScheduling POSTSTEP", 2*reflevel, ""); + CCTK_ScheduleTraverse ("CCTK_POSTSTEP", cgh, CallFunction); + + // Checking + PoisonCheck (cgh, allbutlasttime); + } END_REFLEVEL_LOOP(cgh); BEGIN_REVERSE_REFLEVEL_LOOP(cgh) { @@ -383,22 +403,20 @@ namespace Carpet { // Restrict Restrict (cgh); - } END_REVERSE_REFLEVEL_LOOP(cgh); - - BEGIN_REVERSE_REFLEVEL_LOOP(cgh) { - - // Poststep - CCTK_ScheduleTraverse ("CCTK_POSTSTEP", cgh, CallFunction); - - PoisonCheck (cgh, 0); - CalculateChecksums (cgh, 0); + // Checking + CalculateChecksums (cgh, allbutlasttime); // Analysis + Checkpoint ("%*sScheduling ANALYSIS", 2*reflevel, ""); CCTK_ScheduleTraverse ("CCTK_ANALYSIS", cgh, CallFunction); // Output + Checkpoint ("%*sOutputGH", 2*reflevel, ""); CCTK_OutputGH (cgh); + // Checking + CheckChecksums (cgh, allbutlasttime); + } END_REVERSE_REFLEVEL_LOOP(cgh); Checkpoint ("done with Initialise."); @@ -422,43 +440,17 @@ namespace Carpet { || (cctk_final_time >= cctk_initial_time && cgh->cctk_time < cctk_final_time)) { - // Next iteration + // Advance time ++cgh->cctk_iteration; + cgh->cctk_time += base_delta_time / maxreflevelfact; Checkpoint ("Evolving iteration %d...", cgh->cctk_iteration); BEGIN_REFLEVEL_LOOP(cgh) { if ((cgh->cctk_iteration-1) % (maxreflevelfact/reflevelfact) == 0) { - // Prestep - CCTK_ScheduleTraverse ("CCTK_PRESTEP", cgh, CallFunction); - - // Move activity to next time level - assert (activetimelevel == 0); - ++activetimelevel; - - // Evolve - CCTK_ScheduleTraverse ("CCTK_EVOL", cgh, CallFunction); - - // Move activity back to current time level - --activetimelevel; - assert (activetimelevel == 0); - - } - } END_REFLEVEL_LOOP(cgh); - - // Advance time - cgh->cctk_time += base_delta_time / maxreflevelfact; - - BEGIN_REVERSE_REFLEVEL_LOOP(cgh) { - if (cgh->cctk_iteration % (maxreflevelfact/reflevelfact) == 0) { - - CheckChecksums (cgh, 0); - // Cycle time levels - PoisonCheck (cgh, 1); CycleTimeLevels (cgh); - Poison (cgh, 1); // Advance level times tt->advance_time (reflevel, mglevel); @@ -476,29 +468,48 @@ namespace Carpet { } } - // Restrict - Restrict (cgh); + // Checking + CalculateChecksums (cgh, allbutcurrenttime); + Poison (cgh, currenttimebutnotifonly); + + // Evolve + Checkpoint ("%*sScheduling PRESTEP", 2*reflevel, ""); + CCTK_ScheduleTraverse ("CCTK_PRESTEP", cgh, CallFunction); + Checkpoint ("%*sScheduling EVOL", 2*reflevel, ""); + CCTK_ScheduleTraverse ("CCTK_EVOL", cgh, CallFunction); + Checkpoint ("%*sScheduling POSTSTEP", 2*reflevel, ""); + CCTK_ScheduleTraverse ("CCTK_POSTSTEP", cgh, CallFunction); - CalculateChecksums (cgh, 0); + // Checking + PoisonCheck (cgh, currenttimebutnotifonly); } - } END_REVERSE_REFLEVEL_LOOP(cgh); + } END_REFLEVEL_LOOP(cgh); BEGIN_REVERSE_REFLEVEL_LOOP(cgh) { if (cgh->cctk_iteration % (maxreflevelfact/reflevelfact) == 0) { - // Poststep - CCTK_ScheduleTraverse ("CCTK_POSTSTEP", cgh, CallFunction); + // Restrict + Restrict (cgh); + + // Checking + CalculateChecksums (cgh, currenttime); // Checkpoint + Checkpoint ("%*sScheduling CHECKPOINT", 2*reflevel, ""); CCTK_ScheduleTraverse ("CCTK_CHECKPOINT", cgh, CallFunction); // Analysis + Checkpoint ("%*sScheduling ANALYSIS", 2*reflevel, ""); CCTK_ScheduleTraverse ("CCTK_ANALYSIS", cgh, CallFunction); // Output + Checkpoint ("%*sOutputGH", 2*reflevel, ""); CCTK_OutputGH (cgh); + // Checking + CheckChecksums (cgh, alltimes); + } } END_REVERSE_REFLEVEL_LOOP(cgh); @@ -522,11 +533,13 @@ namespace Carpet { // Terminate BEGIN_REFLEVEL_LOOP(cgh) { + Checkpoint ("%*sScheduling TERMINATE", 2*reflevel, ""); CCTK_ScheduleTraverse ("CCTK_TERMINATE", cgh, CallFunction); } END_REFLEVEL_LOOP(cgh); // Shutdown BEGIN_REFLEVEL_LOOP(cgh) { + Checkpoint ("%*sScheduling SHUTDOWN", 2*reflevel, ""); CCTK_ScheduleTraverse ("CCTK_SHUTDOWN", cgh, CallFunction); } END_REFLEVEL_LOOP(cgh); @@ -551,7 +564,7 @@ namespace Carpet { assert (mglevel>=0); assert (reflevel>=0); -// Checkpoint ("%*sstarting CallFunction...", 2*reflevel, ""); +// Checkpoint ("%*sStarting CallFunction...", 2*reflevel, ""); cGH* cgh = (cGH*)data; @@ -607,12 +620,15 @@ namespace Carpet { } const int n0 = CCTK_FirstVarIndexI(group); + assert (n0>=0); const int num_tl = CCTK_NumTimeLevelsFromVarI(n0); - const int tl = min(activetimelevel, num_tl-1); + assert (num_tl>0); + const int tl = 0; switch (CCTK_GroupTypeI(group)) { case CCTK_SCALAR: + // TODO: Check whether the local values are consistent break; case CCTK_ARRAY: @@ -671,38 +687,38 @@ namespace Carpet { const int group = CCTK_GroupIndex(groupname); assert (group>=0 && group=0); const int num_tl = CCTK_NumTimeLevelsFromVarI(n0); - const int tmin = min(0, 2 - num_tl); - const int tmax = tmin + num_tl - 1; + assert (num_tl>0); + const int tmin = 1 - num_tl; + const int tmax = 0; switch (CCTK_GroupTypeI(group)) { case CCTK_SCALAR: - if (scdata[group].data.size()==0 - || scdata[group].data[0].size()==0 - || scdata[group].data[0][0].size()==0 - || scdata[group].data[0][0][0] != 0) { - // group already has storage - break; - } + assert (scdata[group].data.size()==0 + || scdata[group].data[0].size()==0 + || scdata[group].data[0][0].size()==0 + || scdata[group].data[0][0][0] == 0); for (int var=0; var<(int)scdata[group].data.size(); ++var) { for (int rl=0; rl<(int)scdata[group].data[var].size(); ++rl) { - for (int ti=0; ti<(int)scdata[group].data[var][rl].size(); ++ti) { + for (int tl=0; tl<(int)scdata[group].data[var][rl].size(); ++tl) { const int n = n0 + var; switch (CCTK_VarTypeI(n)) { #define TYPECASE(N,T) \ case N: \ - scdata[group].data[var][rl][ti] = new T; \ + scdata[group].data[var][rl][tl] = new T; \ break; #include "typecase" #undef TYPECASE @@ -715,11 +731,8 @@ namespace Carpet { break; case CCTK_ARRAY: - if (arrdata[group].data.size()==0 - || arrdata[group].data[0] != 0) { - // group already has storage - break; - } + assert (arrdata[group].data.size()==0 + || arrdata[group].data[0] == 0); for (int var=0; var<(int)arrdata[group].data.size(); ++var) { const int n = n0 + var; switch (CCTK_VarTypeI(n)) { @@ -738,11 +751,8 @@ namespace Carpet { break; case CCTK_GF: - if (gfdata[group].data.size()==0 - || gfdata[group].data[0] != 0) { - // group already has storage - break; - } + assert (gfdata[group].data.size()==0 + || gfdata[group].data[0] == 0); for (int var=0; var<(int)gfdata[group].data.size(); ++var) { const int n = n0 + var; switch (CCTK_VarTypeI(n)) { @@ -763,10 +773,12 @@ namespace Carpet { abort(); } + // Reinitialise Cactus variables set_component (cgh, component); - PoisonGroup (cgh, group, 2); + PoisonGroup (cgh, group, alltimes); - return retval; + // storage was not enabled previously + return 0; } @@ -778,11 +790,14 @@ namespace Carpet { const int group = CCTK_GroupIndex(groupname); assert (group>=0 && group0); void* tmpdata = scdata[group].data[var][reflevel][0]; - for (int ti=0; ti=0 && where<=2); - if (! poison_new_timelevels) return; - Checkpoint ("%*sPoison", 2*reflevel, ""); - for (int group=0; group=0 && group=0 && where<=2); if (! poison_new_timelevels) return; @@ -1230,23 +1243,9 @@ namespace Carpet { assert (sz>0); const int num_tl = CCTK_NumTimeLevelsFromVarI(n); - int min_tl, max_tl; - switch (where) { - case 0: - min_tl = 0; - max_tl = num_tl-2; - break; - case 1: - min_tl = max(num_tl-1,1); - max_tl = num_tl-1; - break; - case 2: - min_tl = 0; - max_tl = num_tl-1; - break; - default: - abort(); - } + 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) { @@ -1281,7 +1280,7 @@ namespace Carpet { - void PoisonCheck (cGH* cgh, const int where) + void PoisonCheck (cGH* cgh, const checktimes where) { DECLARE_CCTK_PARAMETERS; @@ -1296,8 +1295,10 @@ namespace Carpet { const int n = CCTK_FirstVarIndexI(group) + var; const int num_tl = CCTK_NumTimeLevelsFromVarI(n); - const int min_tl = where ? max(num_tl-1,1) : 0; - const int max_tl = where ? num_tl-1 : num_tl-2; + 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) { switch (CCTK_GroupTypeFromVarI(n)) { @@ -1320,8 +1321,8 @@ namespace Carpet { if (poisoned) { char* fullname = CCTK_FullName(n); CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "The variable \"%s\" contains poison", - fullname); + "The variable \"%s\" contains poison in timelevel %d", + fullname, tl); free (fullname); } break; @@ -1361,8 +1362,8 @@ namespace Carpet { if (numpoison<=10) { char* fullname = CCTK_FullName(n); CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "The variable \"%s\" contains poison at [%d,%d,%d]", - fullname, i,j,k); + "The variable \"%s\" contains poison at [%d,%d,%d] in timelevel %d", + fullname, i,j,k, tl); free (fullname); } } // if poisoned @@ -1372,8 +1373,8 @@ namespace Carpet { if (numpoison>10) { char* fullname = CCTK_FullName(n); CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "The variable \"%s\" contains poison at %d locations; not all were printed.", - fullname, numpoison); + "The variable \"%s\" contains poison at %d locations in timelevel %d; not all locations were printed.", + fullname, numpoison, tl); free (fullname); } } // if is local @@ -1394,7 +1395,7 @@ namespace Carpet { - void CalculateChecksums (cGH* cgh, int where) + void CalculateChecksums (cGH* cgh, const checktimes where) { DECLARE_CCTK_PARAMETERS; @@ -1405,10 +1406,13 @@ namespace Carpet { checksums.resize(CCTK_NumVars()); for (int group=0; group0); + 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) { @@ -1445,8 +1449,10 @@ namespace Carpet { const int sz = CCTK_VarTypeSize(CCTK_VarTypeI(n)); assert (sz>0); const int num_tl = CCTK_NumTimeLevelsFromVarI(n); - const int min_tl = where ? max(num_tl-1,1) : 0; - const int max_tl = where ? num_tl-1 : num_tl-2; + 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) { switch (CCTK_GroupTypeFromVarI(n)) { @@ -1494,7 +1500,7 @@ namespace Carpet { - void CheckChecksums (cGH* cgh, int where) + void CheckChecksums (cGH* cgh, const checktimes where) { DECLARE_CCTK_PARAMETERS; @@ -1511,15 +1517,17 @@ namespace Carpet { const int sz = CCTK_VarTypeSize(CCTK_VarTypeI(n)); assert (sz>0); const int num_tl = CCTK_NumTimeLevelsFromVarI(n); - const int min_tl = where ? max(num_tl-1,1) : 0; - const int max_tl = where ? num_tl-1 : num_tl-2; + 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); - bool unexpected_change = false; - for (int tl=min_tl; tl<=max_tl; ++tl) { + + bool unexpected_change = false; + switch (CCTK_GroupTypeFromVarI(n)) { case CCTK_SCALAR: { @@ -1541,7 +1549,7 @@ namespace Carpet { case CCTK_ARRAY: case CCTK_GF: { assert ((int)checksums[n][reflevel][tl].size() - ==hh->components(reflevel)); + == hh->components(reflevel)); BEGIN_COMPONENT_LOOP(cgh) { if (checksums[n][reflevel][tl][component].valid) { if (hh->is_local(reflevel,component)) { @@ -1567,16 +1575,16 @@ namespace Carpet { abort(); } + 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 - if (unexpected_change) { - char* fullname = CCTK_FullName(n); - CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Old timelevels of the variable \"%s\" have changed unexpectedly.", - fullname); - free (fullname); - } - } // for var } // if has storage } // for group @@ -1584,6 +1592,48 @@ namespace Carpet { + int mintl (const checktimes where, const int num_tl) + { + assert (num_tl>0); + switch (where) { + case currenttime: + return num_tl-1; + case currenttimebutnotifonly: + // don't include current time if there is only one time level + return max(1,num_tl-1); + case allbutlasttime: + // do include current time if there is only one time level + return min(1,num_tl-1); + case allbutcurrenttime: + return 0; + case alltimes: + return 0; + default: + abort(); + } + } + + int maxtl (const checktimes where, const int num_tl) + { + assert (num_tl>0); + switch (where) { + case currenttime: + return num_tl-1; + case currenttimebutnotifonly: + return num_tl-1; + case allbutlasttime: + return num_tl-1; + case allbutcurrenttime: + return num_tl-2; + case alltimes: + return num_tl-1; + default: + abort(); + } + } + + + void Checkpoint (const char* fmt, ...) { DECLARE_CCTK_PARAMETERS; @@ -1688,7 +1738,7 @@ namespace Carpet { // Set Cactus pointers to data for (int n=0; n=0); @@ -1705,14 +1755,14 @@ namespace Carpet { assert (group<(int)scdata.size()); assert (var<(int)scdata[group].data.size()); assert (reflevel<(int)scdata[group].data[var].size()); - assert (ti<(int)scdata[group].data[var][reflevel].size()); - cgh->data[n][ti] = scdata[group].data[var][reflevel][ti]; + assert (tl<(int)scdata[group].data[var][reflevel].size()); + cgh->data[n][tl] = scdata[group].data[var][reflevel][tl]; break; case CCTK_ARRAY: case CCTK_GF: // Arrays and grid functions cannot be accessed - cgh->data[n][ti] = 0; + cgh->data[n][tl] = 0; break; default: @@ -1722,11 +1772,11 @@ namespace Carpet { } else { // Group has no storage - cgh->data[n][ti] = 0; + cgh->data[n][tl] = 0; } - } // for ti + } // for tl } // for n } else { @@ -1790,14 +1840,14 @@ namespace Carpet { // Set Cactus pointers to data for (int n=0; n=0); const int var = n - CCTK_FirstVarIndexI(group); assert (var>=0); - const int tmin = min(0, 2 - CCTK_NumTimeLevelsFromVarI(n)); - const int tl = tmin + ti; + const int num_tl = CCTK_NumTimeLevelsFromVarI(n); + assert (num_tl>0); if (CCTK_QueryGroupStorageI(cgh, group)) { // Group has storage @@ -1808,24 +1858,24 @@ namespace Carpet { assert (group<(int)scdata.size()); assert (var<(int)scdata[group].data.size()); assert (reflevel<(int)scdata[group].data[var].size()); - assert (ti<(int)scdata[group].data[var][reflevel].size()); - cgh->data[n][ti] = scdata[group].data[var][reflevel][ti]; + assert (tl<(int)scdata[group].data[var][reflevel].size()); + cgh->data[n][tl] = scdata[group].data[var][reflevel][tl]; break; case CCTK_ARRAY: assert (group<(int)arrdata.size()); assert (var<(int)arrdata[group].data.size()); - cgh->data[n][ti] + cgh->data[n][tl] = ((*arrdata[group].data[var]) - (tl, reflevel, component, mglevel)->storage()); + (tl-num_tl+1, reflevel, component, mglevel)->storage()); break; case CCTK_GF: assert (group<(int)gfdata.size()); assert (var<(int)gfdata[group].data.size()); - cgh->data[n][ti] + cgh->data[n][tl] = ((*gfdata[group].data[var]) - (tl, reflevel, component, mglevel)->storage()); + (tl-num_tl+1, reflevel, component, mglevel)->storage()); break; default: @@ -1833,19 +1883,19 @@ namespace Carpet { } if (CCTK_GroupTypeFromVarI(n)==CCTK_SCALAR || hh->is_local(reflevel,component)) { - assert (cgh->data[n][ti]); + assert (cgh->data[n][tl]); } else { - assert (! cgh->data[n][ti]); + assert (! cgh->data[n][tl]); } } else { // Group has no storage - cgh->data[n][ti] = 0; + cgh->data[n][tl] = 0; } // if ! has storage - } // for ti + } // for tl } // for n } diff --git a/Carpet/Carpet/src/carpet.hh b/Carpet/Carpet/src/carpet.hh index 8b90ee00a..6b14c1589 100644 --- a/Carpet/Carpet/src/carpet.hh +++ b/Carpet/Carpet/src/carpet.hh @@ -1,4 +1,4 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/carpet.hh,v 1.7 2001/04/06 10:37:36 schnetter Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/carpet.hh,v 1.8 2001/04/23 08:10:13 schnetter Exp $ #include @@ -27,9 +27,6 @@ namespace Carpet { // Refinement factor on finest grid extern int maxreflevelfact; - // Active time level - extern int activetimelevel; // 0 for current, 1 for next - // Current iteration per refinement level extern vector iteration; diff --git a/Carpet/CarpetIOASCII/src/ioascii.cc b/Carpet/CarpetIOASCII/src/ioascii.cc index 99aa1491d..9957b7620 100644 --- a/Carpet/CarpetIOASCII/src/ioascii.cc +++ b/Carpet/CarpetIOASCII/src/ioascii.cc @@ -24,7 +24,7 @@ #include "ioascii.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.11 2001/03/22 18:42:05 eschnett Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.12 2001/04/23 08:10:13 schnetter Exp $"; @@ -134,7 +134,7 @@ int CarpetIOASCII assert (n0>=0 && n0=0 && var::~dh () { h.remove(this); } +// Helpers +template +int dh::prolongation_stencil_size () const { + assert (prolongation_order>=0); + return prolongation_order/2; +} + // Modifiers template void dh::recompose () { @@ -220,12 +227,14 @@ void dh::recompose () { for (int c=0; c::recompose () { for (iblist::const_iterator li=lvi->begin(); li!=lvi->end(); ++li) { sync_not -= *li; + recv_not -= *li; + } + } + + // Subtract all boxes received + const iblistvect& recv_ref_bnd_coarse + = boxes[rl][c][ml].recv_ref_bnd_coarse; + for (iblistvect::const_iterator lvi=recv_ref_bnd_coarse.begin(); + lvi!=recv_ref_bnd_coarse.end(); ++lvi) { + for (iblist::const_iterator li=lvi->begin(); + li!=lvi->end(); ++li) { + recv_not -= *li; } } @@ -287,6 +308,7 @@ void dh::recompose () { cout << "recv_sync=" << boxes[rl][c][ml].recv_sync << endl; cout << "recv_ref_bnd_coarse=" << boxes[rl][c][ml].recv_ref_bnd_coarse << endl; cout << "sync_not=" << boxes[rl][c][ml].sync_not << endl; + cout << "recv_not=" << boxes[rl][c][ml].recv_not << endl; } } } diff --git a/Carpet/CarpetLib/src/dh.hh b/Carpet/CarpetLib/src/dh.hh index 2267db505..70ffe3803 100644 --- a/Carpet/CarpetLib/src/dh.hh +++ b/Carpet/CarpetLib/src/dh.hh @@ -6,7 +6,7 @@ copyright : (C) 2000 by Erik Schnetter email : schnetter@astro.psu.edu - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/dh.hh,v 1.6 2001/03/28 18:56:09 eschnett Exp $ + $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/dh.hh,v 1.7 2001/04/23 08:10:15 schnetter Exp $ ***************************************************************************/ @@ -79,7 +79,8 @@ public: ibset boundaries; // boundaries iblistvect recv_sync; // received while syncing iblistvect recv_ref_bnd_coarse; // received from coarser grids - ibset sync_not; // not received while syncing (outer boundary) + ibset sync_not; // not received while syncing (outer boundary of that level) + ibset recv_not; // not received while syncing or prolongating (globally outer boundary) }; private: @@ -118,10 +119,7 @@ public: ~dh (); // Helpers - int prolongation_stencil_size () const { - assert (prolongation_order>=0); - return prolongation_order/2; - } + int prolongation_stencil_size () const; // Modifiers void recompose (); diff --git a/Carpet/CarpetLib/src/ggf.cc b/Carpet/CarpetLib/src/ggf.cc index 42f4098ba..e4c890497 100644 --- a/Carpet/CarpetLib/src/ggf.cc +++ b/Carpet/CarpetLib/src/ggf.cc @@ -6,7 +6,7 @@ copyright : (C) 2000 by Erik Schnetter email : schnetter@astro.psu.edu - $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/ggf.cc,v 1.8 2001/03/27 22:26:31 eschnett Exp $ + $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/ggf.cc,v 1.9 2001/04/23 08:10:15 schnetter Exp $ ***************************************************************************/ @@ -276,9 +276,9 @@ void generic_gf::intercat (int tl1, int rl1, int c1, int ml1, vector tls(tl2s.size()); for (int i=0; i<(int)gsrcs.size(); ++i) { gsrcs[i] = storage[tl2s[i]-tmin][rl2][c2][ml2]; - tls[i] = tl2s[i] * t.get_delta(rl2,ml2); + tls[i] = t.time(tl2s[i],rl2,ml2); } - const int tl = tl1 * t.get_delta(rl1,ml1); + const int tl = t.time(tl1,rl1,ml1); const ibbox recv = d.boxes[rl1][c1][ml1].*recv_list; const ibbox send = d.boxes[rl2][c2][ml2].*send_list; @@ -312,9 +312,9 @@ void generic_gf::intercat (int tl1, int rl1, int c1, int ml1, vector tls(tl2s.size()); for (int i=0; i<(int)gsrcs.size(); ++i) { gsrcs[i] = storage[tl2s[i]-tmin][rl2][c2][ml2]; - tls[i] = tl2s[i] * t.get_delta(rl2,ml2); + tls[i] = t.time(tl2s[i],rl2,ml2); } - const int tl = tl1 * t.get_delta(rl1,ml1); + const int tl = t.time(tl1,rl1,ml1); const iblist recv = d.boxes[rl1][c1][ml1].*recv_list; const iblist send = d.boxes[rl2][c2][ml2].*send_list; @@ -353,9 +353,9 @@ void generic_gf::intercat (int tl1, int rl1, int c1, int ml1, vector tls(tl2s.size()); for (int i=0; i<(int)gsrcs.size(); ++i) { gsrcs[i] = storage[tl2s[i]-tmin][rl2][c2][ml2]; - tls[i] = tl2s[i] * t.get_delta(rl2,ml2); + tls[i] = t.time(tl2s[i],rl2,ml2); } - const int tl = tl1 * t.get_delta(rl1,ml1); + const int tl = t.time(tl1,rl1,ml1); const iblist recv = (d.boxes[rl1][c1][ml1].*recv_listvect)[c2]; const iblist send = (d.boxes[rl2][c2][ml2].*send_listvect)[c1]; diff --git a/Carpet/CarpetSlab/src/carpetslab.cc b/Carpet/CarpetSlab/src/carpetslab.cc index 4d8141e0d..3461003c2 100644 --- a/Carpet/CarpetSlab/src/carpetslab.cc +++ b/Carpet/CarpetSlab/src/carpetslab.cc @@ -1,4 +1,4 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetSlab/src/Attic/carpetslab.cc,v 1.6 2001/03/22 18:42:06 eschnett Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetSlab/src/Attic/carpetslab.cc,v 1.7 2001/04/23 08:10:16 schnetter Exp $ #include #include @@ -18,7 +18,7 @@ #include "carpetslab.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetSlab/src/Attic/carpetslab.cc,v 1.6 2001/03/22 18:42:06 eschnett Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetSlab/src/Attic/carpetslab.cc,v 1.7 2001/04/23 08:10:16 schnetter Exp $"; @@ -77,7 +77,7 @@ namespace CarpetSlab { // Check timelevel const int num_tl = gp.numtimelevels; assert (ti>=0 && ti