aboutsummaryrefslogtreecommitdiff
path: root/src/DecodeSymParameters.c
blob: a72dfc5dc38bca1184491eba15cf69bc7259c0e1 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
 /*@@
   @file      DecodeSymParameters.c
   @date      Wed May 10 18:58:00 EST 2000
   @author    Erik Schnetter
   @desc
   Decode the symmetry parameters.
   @enddesc
   @version $Header$
 @@*/

#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
#include "Symmetry.h"

static const char *rcsid = "$Header$"; 

CCTK_FILEVERSION(CactusBase_CartGrid3D_DecodeSymParameters_c)

void DecodeSymParameters3D(int sym[6]);

/*@@
   @routine    DecodeSymParameters3D
   @date       Thu May 11 11:49:08 2000
   @author     Erik Schnetter
   @desc 
      Decode the Symmetry parameters. 
      returns the symmetry flags (yes/no=1/0) 
      in the array sym
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/

void DecodeSymParameters3D(int sym[6])
{
  DECLARE_CCTK_PARAMETERS

  /* The default is as set by the explicit symmetry parameters */
  /* lower faces */
  sym[0] = symmetry_xmin;
  sym[2] = symmetry_ymin;
  sym[4] = symmetry_zmin;

  /* upper faces */
  sym[1] = symmetry_xmax;
  sym[3] = symmetry_ymax;
  sym[5] = symmetry_zmax;

  /* The default can be overridden by bitant, quadrant, and octant mode */
  if (CCTK_Equals(domain, "bitant")) 
  {
    if (CCTK_Equals(bitant_plane, "xy")) 
    {
      sym[4] = GFSYM_REFLECTION;
    } 
    else if (CCTK_Equals(bitant_plane, "xz")) 
    {
      sym[2] = GFSYM_REFLECTION;
    } 
    else if (CCTK_Equals(bitant_plane, "yz")) 
    {
      sym[0] = GFSYM_REFLECTION;
    }
  } 
  else if (CCTK_Equals(domain, "bitant_rotate")) 
  {
    if (CCTK_Equals(bitant_plane, "xy")) 
    {
      if (CCTK_Equals(rotation_axis, "y"))
	sym[4] = GFSYM_ROTATION_Y;
      else if (CCTK_Equals(rotation_axis, "x"))
        sym[4] = GFSYM_ROTATION_X;
    } 
    else if (CCTK_Equals(bitant_plane, "xz")) 
    {
      if (CCTK_Equals(rotation_axis, "x"))
	sym[2] = GFSYM_ROTATION_X;
      else if (CCTK_Equals(rotation_axis, "z"))
        sym[2] = GFSYM_ROTATION_Z;
    } 
    else if (CCTK_Equals(bitant_plane, "yz")) 
    {
      if (CCTK_Equals(rotation_axis, "y"))
	sym[0] = GFSYM_ROTATION_Y;
      else if (CCTK_Equals(rotation_axis, "z"))
        sym[0] = GFSYM_ROTATION_Z;
    }
  } 
  else if (CCTK_Equals(domain, "quadrant")) 
  {
    if (CCTK_Equals(quadrant_direction, "x")) 
    {
      sym[2] = GFSYM_REFLECTION;
      sym[4] = GFSYM_REFLECTION;
    } 
    else if (CCTK_Equals(quadrant_direction, "y")) 
    {
      sym[0] = GFSYM_REFLECTION;
      sym[4] = GFSYM_REFLECTION;
    } 
    else if (CCTK_Equals(quadrant_direction, "z")) 
    {
      sym[0] = GFSYM_REFLECTION;
      sym[2] = GFSYM_REFLECTION;
    }
  } 
  else if (CCTK_Equals(domain, "quadrant_reflect_rotate")) 
  {
    if (CCTK_Equals(quadrant_direction, "x")) 
    {
      if (CCTK_Equals(rotation_axis, "y"))
      {
        sym[2] = GFSYM_REFLECTION;
	sym[4] = GFSYM_ROTATION_Y;
      }
      else if (CCTK_Equals(rotation_axis, "z"))
      {
        sym[2] = GFSYM_ROTATION_Z;
	sym[4] = GFSYM_REFLECTION;
      }
    } 
    else if (CCTK_Equals(quadrant_direction, "y")) 
    {
      if (CCTK_Equals(rotation_axis, "x"))
      {
	sym[0] = GFSYM_REFLECTION;
	sym[4] = GFSYM_ROTATION_X;
      }
      if (CCTK_Equals(rotation_axis, "z"))
      {
	sym[0] = GFSYM_ROTATION_Z;
	sym[4] = GFSYM_REFLECTION;
      }
    } 
    else if (CCTK_Equals(quadrant_direction, "z")) 
    {
      if (CCTK_Equals(rotation_axis, "x"))
      {
        sym[0] = GFSYM_REFLECTION;
        sym[2] = GFSYM_ROTATION_X;
      }
      if (CCTK_Equals(rotation_axis, "y"))
      {
        sym[0] = GFSYM_ROTATION_Y;
        sym[2] = GFSYM_REFLECTION;
      }
    }
  } 
  else if (CCTK_Equals(domain, "octant")) 
  {
    sym[0] = GFSYM_REFLECTION;
    sym[2] = GFSYM_REFLECTION;
    sym[4] = GFSYM_REFLECTION;
  }
}



void CCTK_FCALL CCTK_FNAME(DecodeSymParameters3D) (int sym[6])
{
  DecodeSymParameters3D(sym);
}