aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src
diff options
context:
space:
mode:
authorschnetter <>2002-06-06 19:04:00 +0000
committerschnetter <>2002-06-06 19:04:00 +0000
commit911156a7bbc76aa1166c91d1f5d123e70640d211 (patch)
treec5bae15af6a072ba22230a5359aa0c7f9402c4e7 /Carpet/Carpet/src
parenta757b3b8472840d54c35744f685314b7d220d2f7 (diff)
Flip all timelevels instead of only the current one.
Flip all timelevels instead of only the current one. Add comments about what is left to do wrt. arrays when initialising 3 time levels. darcs-hash:20020606190456-07bb3-8bb306a0be588bcd19fe79ec5f46793210b58c29.gz
Diffstat (limited to 'Carpet/Carpet/src')
-rw-r--r--Carpet/Carpet/src/Cycle.cc10
-rw-r--r--Carpet/Carpet/src/Initialise.cc151
2 files changed, 85 insertions, 76 deletions
diff --git a/Carpet/Carpet/src/Cycle.cc b/Carpet/Carpet/src/Cycle.cc
index 46faba22f..dcece6f13 100644
--- a/Carpet/Carpet/src/Cycle.cc
+++ b/Carpet/Carpet/src/Cycle.cc
@@ -8,7 +8,7 @@
#include "carpet.hh"
-static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Cycle.cc,v 1.7 2002/06/06 14:20:15 schnetter Exp $";
+static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Cycle.cc,v 1.8 2002/06/06 21:04:56 schnetter Exp $";
CCTK_FILEVERSION(Carpet_Cycle_cc)
@@ -47,14 +47,16 @@ namespace Carpet {
Checkpoint ("%*sFlipTimeLevels", 2*reflevel, "");
for (int group=0; group<CCTK_NumGroups(); ++group) {
- if (reflevel<arrdata[group].hh->reflevels()
+ if (CCTK_GroupTypeI(group) == CCTK_GF
&& CCTK_QueryGroupStorageI(cgh, group)) {
for (int var=0; var<CCTK_NumVarsInGroupI(group); ++var) {
assert (group<(int)arrdata.size());
assert (var<(int)arrdata[group].data.size());
- for (int c=0; c<arrdata[group].hh->components(reflevel); ++c) {
- arrdata[group].data[var]->cycle (reflevel, c, mglevel);
+ for (int rl=0; rl<arrdata[group].hh->reflevels(); ++rl) {
+ for (int c=0; c<arrdata[group].hh->components(rl); ++c) {
+ arrdata[group].data[var]->flip (rl, c, mglevel);
+ }
}
}
diff --git a/Carpet/Carpet/src/Initialise.cc b/Carpet/Carpet/src/Initialise.cc
index 6fb1df78b..7ad522880 100644
--- a/Carpet/Carpet/src/Initialise.cc
+++ b/Carpet/Carpet/src/Initialise.cc
@@ -9,7 +9,7 @@
#include "carpet.hh"
-static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Initialise.cc,v 1.11 2002/06/06 19:48:29 shawley Exp $";
+static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Initialise.cc,v 1.12 2002/06/06 21:04:56 schnetter Exp $";
CCTK_FILEVERSION(Carpet_Initialise_cc)
@@ -91,79 +91,86 @@ namespace Carpet {
Regrid (cgh);
} END_REFLEVEL_LOOP(cgh);
-
-
+
+
+
// Scott's algorithm for getting two extra timelevels of data
if (init_3_timelevels) {
- int time_dir = 1; //Positive = forward (+t), Negative = backward (-t)
- CCTK_INFO("Initializing THREE timelevels");
-
- BEGIN_REFLEVEL_LOOP(cgh) {
- BEGIN_MGLEVEL_LOOP(cgh) {
- // Evolve "forward" (which may be backward for lev=1,3,5,7...)
- // Cycle time levels
- CycleTimeLevels (cgh);
-
- Waypoint ("%*sScheduling PRESTEP", 2*reflevel, "");
- CCTK_ScheduleTraverse ("CCTK_PRESTEP", cgh, CallFunction);
- Waypoint ("%*sScheduling EVOL", 2*reflevel, "");
- CCTK_ScheduleTraverse ("CCTK_EVOL", cgh, CallFunction);
- Waypoint ("%*sScheduling POSTSTEP", 2*reflevel, "");
- CCTK_ScheduleTraverse ("CCTK_POSTSTEP", cgh, CallFunction);
-
- FlipTimeLevels(cgh);
- cgh->cctk_delta_time *= -1;
- // Keep track of which direction (in time) we're integrating
- time_dir *= -1;
-
- // Evolve in the opposite time-direction
- // Cycle time levels
- CycleTimeLevels (cgh);
- Waypoint ("%*sScheduling PRESTEP", 2*reflevel, "");
- CCTK_ScheduleTraverse ("CCTK_PRESTEP", cgh, CallFunction);
- Waypoint ("%*sScheduling EVOL", 2*reflevel, "");
- CCTK_ScheduleTraverse ("CCTK_EVOL", cgh, CallFunction);
- Waypoint ("%*sScheduling POSTSTEP", 2*reflevel, "");
- CCTK_ScheduleTraverse ("CCTK_POSTSTEP", cgh, CallFunction);
-
- } END_MGLEVEL_LOOP(cgh);
- } END_REFLEVEL_LOOP(cgh);
-
-
- // Make sure we're pointed backwards, in order to get 2 "previous"
- // timelevels. We could change the if statement to
- // "if (mod(MaxLevels,2) == 0)", but I prefer to check time_dir
- // explicitly, because it's easier to follow and I don't have to
- // worry about having made a mistake
- if (time_dir > 0) {
- FlipTimeLevels(cgh);
- cgh->cctk_delta_time *= -1;
- time_dir *= -1;
- }
-
- // Evolve each level backwards one more timestep
- BEGIN_REVERSE_REFLEVEL_LOOP(cgh) {
- BEGIN_MGLEVEL_LOOP(cgh) {
-
- // Cycle time levels
- CycleTimeLevels (cgh);
- Waypoint ("%*sScheduling PRESTEP", 2*reflevel, "");
- CCTK_ScheduleTraverse ("CCTK_PRESTEP", cgh, CallFunction);
- Waypoint ("%*sScheduling EVOL", 2*reflevel, "");
- CCTK_ScheduleTraverse ("CCTK_EVOL", cgh, CallFunction);
- Waypoint ("%*sScheduling POSTSTEP", 2*reflevel, "");
- CCTK_ScheduleTraverse ("CCTK_POSTSTEP", cgh, CallFunction);
-
- // Restrict
- Restrict (cgh);
-
-
- } END_MGLEVEL_LOOP(cgh);
- } END_REVERSE_REFLEVEL_LOOP(cgh);
-
- CCTK_INFO("Finished initializing three timelevels");
- } // end of init_3_timelevels
-
+ int time_dir = 1; //Positive = forward (+t), Negative = backward (-t)
+ CCTK_INFO("Initializing THREE timelevels");
+
+ BEGIN_REFLEVEL_LOOP(cgh) {
+ BEGIN_MGLEVEL_LOOP(cgh) {
+ // Evolve "forward" (which may be backward for lev=1,3,5,7...)
+ // Cycle time levels
+ // erik: advance time here
+ // erik: what about arrays?
+ CycleTimeLevels (cgh);
+ Waypoint ("%*sScheduling PRESTEP", 2*reflevel, "");
+ CCTK_ScheduleTraverse ("CCTK_PRESTEP", cgh, CallFunction);
+ Waypoint ("%*sScheduling EVOL", 2*reflevel, "");
+ CCTK_ScheduleTraverse ("CCTK_EVOL", cgh, CallFunction);
+ Waypoint ("%*sScheduling POSTSTEP", 2*reflevel, "");
+ CCTK_ScheduleTraverse ("CCTK_POSTSTEP", cgh, CallFunction);
+
+ // erik: what about arrays?
+ FlipTimeLevels(cgh);
+ cgh->cctk_delta_time *= -1;
+ // Keep track of which direction (in time) we're integrating
+ time_dir *= -1;
+
+ // Evolve in the opposite time-direction
+ // Cycle time levels
+ // erik: advance time here
+ // erik: what about arrays?
+ CycleTimeLevels (cgh);
+ Waypoint ("%*sScheduling PRESTEP", 2*reflevel, "");
+ CCTK_ScheduleTraverse ("CCTK_PRESTEP", cgh, CallFunction);
+ Waypoint ("%*sScheduling EVOL", 2*reflevel, "");
+ CCTK_ScheduleTraverse ("CCTK_EVOL", cgh, CallFunction);
+ Waypoint ("%*sScheduling POSTSTEP", 2*reflevel, "");
+ CCTK_ScheduleTraverse ("CCTK_POSTSTEP", cgh, CallFunction);
+
+ } END_MGLEVEL_LOOP(cgh);
+ } END_REFLEVEL_LOOP(cgh);
+
+ // Make sure we're pointed backwards, in order to get 2 "previous"
+ // timelevels. We could change the if statement to
+ // "if (mod(MaxLevels,2) == 0)", but I prefer to check time_dir
+ // explicitly, because it's easier to follow and I don't have to
+ // worry about having made a mistake
+ if (time_dir > 0) {
+ // erik: what about arrays?
+ FlipTimeLevels(cgh);
+ cgh->cctk_delta_time *= -1;
+ time_dir *= -1;
+ }
+
+ // Evolve each level backwards one more timestep
+ BEGIN_REVERSE_REFLEVEL_LOOP(cgh) {
+ BEGIN_MGLEVEL_LOOP(cgh) {
+
+ // Cycle time levels
+ // erik: advance time here
+ // erik: what about arrays?
+ CycleTimeLevels (cgh);
+ Waypoint ("%*sScheduling PRESTEP", 2*reflevel, "");
+ CCTK_ScheduleTraverse ("CCTK_PRESTEP", cgh, CallFunction);
+ Waypoint ("%*sScheduling EVOL", 2*reflevel, "");
+ CCTK_ScheduleTraverse ("CCTK_EVOL", cgh, CallFunction);
+ Waypoint ("%*sScheduling POSTSTEP", 2*reflevel, "");
+ CCTK_ScheduleTraverse ("CCTK_POSTSTEP", cgh, CallFunction);
+
+ // Restrict
+ Restrict (cgh);
+
+ } END_MGLEVEL_LOOP(cgh);
+ } END_REVERSE_REFLEVEL_LOOP(cgh);
+
+ CCTK_INFO("Finished initializing three timelevels");
+ } // end of init_3_timelevels
+
+
BEGIN_REVERSE_REFLEVEL_LOOP(cgh) {