aboutsummaryrefslogtreecommitdiff
path: root/src/register.c
blob: 7a9bc175ea6b16bc26dc65ec41649a7edb509734 (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
#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"

#include "reflection.h"



static const char rcsid[] = "$Header$";
CCTK_FILEVERSION(AEIDevelopment_ReflectionSymmetry_register_c);



void
ReflectionSymmetry_Register (CCTK_ARGUMENTS)
{
  DECLARE_CCTK_ARGUMENTS;
  DECLARE_CCTK_PARAMETERS;
  
  int do_reflection[6];
  CCTK_INT handle;
  CCTK_INT faces[6];
  CCTK_INT width[6];
  int f;
  CCTK_INT ierr;
  
  do_reflection[0] = reflection_x;
  do_reflection[1] = reflection_upper_x;
  do_reflection[2] = reflection_y;
  do_reflection[3] = reflection_upper_y;
  do_reflection[4] = reflection_z;
  do_reflection[5] = reflection_upper_z;
  
  for (f=0; f<6; ++f)
  {
    if (do_reflection[f])
    {
      faces[f] = 1;
      width[f] = cctk_nghostzones[f/2];
    }
    else
    {
      faces[f] = 0;
      width[f] = 0;
    }
  }
  
  handle = SymmetryRegister ("reflection_symmetry_thorn");
  if (handle < 0)
  {
    CCTK_WARN (0, "Could not register symmetry boundary condition");
  }
  
  ierr = SymmetryRegisterGrid (cctkGH, handle, faces, width);
  if (ierr < 0)
  {
    CCTK_WARN (0, "Could not register the symmetry boundaries -- probably some other thorn has already registered the same boundary faces for a different symmetry");
  }
  
  ierr = SymmetryRegisterGridInterpolator
    (cctkGH, handle, ReflectionSymmetry_Interpolate);
  if (ierr < 0)
  {
    CCTK_WARN (0, "Could not register the symmetry interpolator");
  }
}