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

#include <assert.h>

#define THORN_ML_BSSN           // "ML_BSSN" will be replaced
#ifdef THORN_ML_CCZ4
#  define HAVE_THETA
#endif

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;
  
  int const checkpoint = timelevels > 1;
  set_group_tags (checkpoint, checkpoint, 1, "ADMBase::metric");
  set_group_tags (checkpoint, checkpoint, 1, "ADMBase::curv");
  set_group_tags (checkpoint, checkpoint, 1, "ADMBase::lapse");
  set_group_tags (checkpoint, checkpoint, 1, "ADMBase::shift");
  set_group_tags (checkpoint, checkpoint, 1, "ADMBase::dtlapse");
  set_group_tags (checkpoint, checkpoint, 1, "ADMBase::dtshift");
  
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_cons_detg");
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_cons_Gamma");
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_cons_traceA");
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_Ham");
  set_group_tags (checkpoint, checkpoint, 0, "ML_BSSN::ML_mom");
  
  int const rhs_checkpoint = rhs_timelevels > 1;
  set_group_tags (rhs_checkpoint, rhs_checkpoint, 0, "ML_BSSN::ML_log_confacrhs");
  set_group_tags (rhs_checkpoint, rhs_checkpoint, 0, "ML_BSSN::ML_metricrhs");
  set_group_tags (rhs_checkpoint, rhs_checkpoint, 0, "ML_BSSN::ML_Gammarhs");
  
#ifdef HAVE_THETA
  set_group_tags (rhs_checkpoint, rhs_checkpoint, 0, "ML_BSSN::ML_Thetarhs");
#endif
  set_group_tags (rhs_checkpoint, rhs_checkpoint, 0, "ML_BSSN::ML_trace_curvrhs");
  set_group_tags (rhs_checkpoint, rhs_checkpoint, 0, "ML_BSSN::ML_curvrhs");
  set_group_tags (rhs_checkpoint, rhs_checkpoint, 0, "ML_BSSN::ML_lapserhs");
  set_group_tags (rhs_checkpoint, rhs_checkpoint, 0, "ML_BSSN::ML_dtlapserhs");
  set_group_tags (rhs_checkpoint, rhs_checkpoint, 0, "ML_BSSN::ML_shiftrhs");
  set_group_tags (rhs_checkpoint, rhs_checkpoint, 0, "ML_BSSN::ML_dtshiftrhs");
  
  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 == 0 || ierr == 1); /* 0 means key did not exist before.  1 means key existed before and has now been reset */
  }
}