aboutsummaryrefslogtreecommitdiff
path: root/ML_BSSN_Helper/src/SetGroupTags.c
blob: 0666c1b2943ffcafe86e188de56930d1acb25abd (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
#include <cctk.h>
#include <cctk_Parameters.h>
#include <util_Table.h>

#include <assert.h>

static void
set_group_tags (int const checkpoint,
                int const persistent,
                int const prolongate,
                char const * restrict const gn);

int
ML_BSSN_SetGroupTags (void)
{
  DECLARE_CCTK_PARAMETERS;
  
  set_group_tags (0, 0, 1, "ADMBase::metric");
  set_group_tags (0, 0, 1, "ADMBase::curv");
  set_group_tags (0, 0, 1, "ADMBase::lapse");
  set_group_tags (0, 0, 1, "ADMBase::shift");
  set_group_tags (0, 0, 1, "ADMBase::dtlapse");
  set_group_tags (0, 0, 1, "ADMBase::dtshift");
  
  set_group_tags (0, 0, 0, "ML_BSSN::ML_cons_detg");
  set_group_tags (0, 0, 0, "ML_BSSN::ML_cons_Gamma");
  set_group_tags (0, 0, 0, "ML_BSSN::ML_cons_traceA");
  set_group_tags (0, 0, 0, "ML_BSSN::ML_Ham");
  set_group_tags (0, 0, 0, "ML_BSSN::ML_mom");
  
  int const checkpoint = rhs_timelevels > 1;
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_dtlapserhs");
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_dtshiftrhs");
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_Gammarhs");
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_lapserhs");
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_log_confacrhs");
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_metricrhs");
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_shiftrhs");
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_trace_curvrhs");
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_curvrhs");
  
  return 0;
}

static void
set_group_tags (int const checkpoint,
                int const persistent,
                int const prolongate,
                char const * restrict const gn)
{
  assert (gn);
  
  int const gi = CCTK_GroupIndex (gn);
  assert (gi >= 0);
  
  int const table = CCTK_GroupTagsTableI (gi);
  assert (table >= 0);
  
  if (! checkpoint) {
    int const ierr = Util_TableSetString (table, "no", "Checkpoint");
    assert (! ierr);
  }
  
  if (! persistent) {
    int const ierr = Util_TableSetString (table, "no", "Persistent");
    assert (! ierr);
  }
  
  if (! prolongate) {
    int const iret = Util_TableDeleteKey (table, "ProlongationParameter");
    assert (iret == 0 || iret == UTIL_ERROR_TABLE_NO_SUCH_KEY);
    int const ierr = Util_TableSetString (table, "none", "Prolongation");
    assert (! ierr);
  }
}