aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetRegrid2/src/paramcheck.cc
blob: 5cc897883e377384dab51da95daa8718781a516f (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
86
87
88
89
90
91
92
93
94
#include <cctk.h>
#include <cctk_Arguments.h>
#include <cctk_Parameters.h>

#include <carpet.hh>



namespace CarpetRegrid2 {
  
  using namespace Carpet;
  
  
  
  extern "C" {
    void
    CarpetRegrid2_ParamCheck (CCTK_ARGUMENTS);
  }
  
  
  
  void
  CarpetRegrid2_ParamCheck (CCTK_ARGUMENTS)
  {
    DECLARE_CCTK_ARGUMENTS;
    DECLARE_CCTK_PARAMETERS;
    
    enum sym_t { sym_unknown, sym_90, sym_180 };
    
    int num_params = 0;
    sym_t params = sym_unknown;
    char const* param = "";
    if (symmetry_rotating90) {
      ++num_params;
      params = sym_90;
      param = "symmetry_rotating90";
    }
    if (symmetry_rotating180) {
      ++num_params;
      params = sym_180;
      param = "symmetry_rotating180";
    }
    
    int num_thorns = 0;
    sym_t thorns = sym_unknown;
    char const* thorn = "";
    if (CCTK_IsThornActive ("RotatingSymmetry90")) {
      ++num_thorns;
      thorns = sym_90;
      thorn = "RotatingSymmetry90";
    }
    if (CCTK_IsThornActive ("RotatingSymmetry90r")) {
      ++num_thorns;
      thorns = sym_90;
      thorn = "RotatingSymmetry90r";
    }
    if (CCTK_IsThornActive ("RotatingSymmetry180")) {
      ++num_thorns;
      thorns = sym_180;
      thorn = "RotatingSymmetry180";
    }
    
    if (num_params > 1) {
      CCTK_PARAMWARN ("Too many of the symmetry parameters symmetry_rotating90 and symmetry_rotating180 are specified.  (At most one of these can be specified.)");
    }
    
    if (num_thorns > 1) {
      CCTK_PARAMWARN ("Too many of the symmetry thorns RotatingSymmetry90, RotatingSymmetry90r, and RotatingSymmetry180 are active.  (At most one of these can be active.)");
    }
    
    if (params != sym_unknown and thorns != sym_unknown and params != thorns) {
      CCTK_VParamWarn (CCTK_THORNSTRING,
                       "The symmetry parameters and the active thorns do not agree.  The symmetry parameter \"%s\" and the active thorn \"%s\" cannot be used together.",
                       param, thorn);
    }
    
    
    
    if ((num_centres >= 1 and num_levels_1 > maxreflevels) or
        (num_centres >= 2 and num_levels_2 > maxreflevels) or
        (num_centres >= 3 and num_levels_3 > maxreflevels) or
        (num_centres >= 4 and num_levels_4 > maxreflevels) or
        (num_centres >= 5 and num_levels_5 > maxreflevels) or
        (num_centres >= 6 and num_levels_6 > maxreflevels) or
        (num_centres >= 7 and num_levels_7 > maxreflevels) or
        (num_centres >= 8 and num_levels_8 > maxreflevels) or
        (num_centres >= 9 and num_levels_9 > maxreflevels) or
        (num_centres >= 10 and num_levels_10 > maxreflevels))
    {
      CCTK_PARAMWARN ("The number of requested refinement levels is larger than the maximum number of levels specified by Carpet::max_refinement_levels");
    }
  }
  
} // namespace CarpetRegrid2