aboutsummaryrefslogtreecommitdiff
path: root/src/ApplySymmetry.c
blob: a0b5ba3c6ef8cdc161c1fb11b19829e218e634b6 (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
/*@@
   @routine    FortranSym
   @date       Mon Mar 15 15:51:57 1999
   @author     Gerd Lanfermann
   @desc 
               Routine performs the symmetry boundary operations.
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 
@@*/

       subroutine FortranSym(nxyz,var,nghostzones,sym,doSym)

      implicit none

      INTEGER nxyz(3)
      CCTK_REAL    var(nxyz(1),nxyz(2),nxyz(3))
      INTEGER nghostzones
      INTEGER sym(3)
      INTEGER doSym(3)
      
      INTEGER sw
      
c      Apply symmetry if 
c       * the grid chunk has a physical boundary (bbox)
c       * its size in a direction is bigger than one (sh)
c       * we actually want a symmetry (sx.ne.ESYM_UNSET)

      if (doSym(1) == 1) then

         do sw=1, nghostzones
            var(sw,:,:) = sym(1)*var(nghostzones+sw,:,:)
         end do

      end if

      if (doSym(2) == 1) then

         do sw=1, nghostzones    
            var(:,sw,:) = sym(2)*var(:,nghostzones+sw,:) 
         end do

      end if

      if (doSym(3).eq.1) then

         do sw=1, nghostzones
            var(:,:,sw) = sym(3)*var(:,:,nghostzones+sw)
         end do

      end if

      end subroutine