blob: 932aab2883802e7b0b6f64967c62a69d66af3e67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#include <assert.h>
#include <stdlib.h>
#include "cctk.h"
#include "ggf.hh"
#include "gh.hh"
#include "carpet.hh"
extern "C" {
static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Cycle.cc,v 1.15 2003/11/05 16:18:37 schnetter Exp $";
CCTK_FILEVERSION(Carpet_Carpet_Cycle_cc);
}
namespace Carpet {
using namespace std;
void CycleTimeLevels (const cGH* cgh)
{
Checkpoint ("%*sCycleTimeLevels", 2*reflevel, "");
for (int group=0; group<CCTK_NumGroups(); ++group) {
if (reflevel<arrdata[group].hh->reflevels()
&& 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);
}
}
}
}
}
void FlipTimeLevels (const cGH* cgh)
{
Checkpoint ("FlipTimeLevels");
for (int group=0; group<CCTK_NumGroups(); ++group) {
if (CCTK_QueryGroupStorageI(cgh, group)) {
const int var0 = CCTK_FirstVarIndexI(group);
assert (var0>=0);
const int num_tl = CCTK_NumTimeLevelsFromVarI(var0);
switch (num_tl) {
case 1:
// Do nothing
break;
case 3:
// Flip
for (int var=0; var<CCTK_NumVarsInGroupI(group); ++var) {
assert (group<(int)arrdata.size());
assert (var<(int)arrdata[group].data.size());
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);
}
}
}
break;
default:
// Error
assert (0);
} // switch
}
}
}
} // namespace Carpet
|