2 ! Take cshift through its paces to make sure no boundary
6 integer, parameter :: sp
= selected_real_kind(6) ! Single precision
12 subroutine cshift_sp_3_v1 (array
, shift
, dim
, res
)
13 integer, parameter :: wp
= sp
14 real(kind
=wp
), dimension(:,:,:), intent(in
) :: array
15 integer, intent(in
) :: shift
, dim
16 real(kind
=wp
), dimension(:,:,:), intent(out
) :: res
32 res(i
,j
,k
) = array(i
+sh
,j
,k
)
35 res(i
,j
,k
) = array(i
-rsh
,j
,k
)
39 else if (dim
== 2) then
46 res(i
,j
,k
) = array(i
,j
+sh
, k
)
51 res(i
,j
,k
) = array(i
,j
-rsh
, k
)
55 else if (dim
== 3) then
62 res(i
,j
,k
) = array(i
, j
, k
+sh
)
69 res(i
,j
, k
) = array(i
, j
, k
-rsh
)
74 stop "Wrong argument to dim"
76 end subroutine cshift_sp_3_v1
77 end module replacements
83 integer, parameter :: wp
= sp
! Working precision
84 INTEGER, PARAMETER :: n
= 7
85 real(kind
=wp
), dimension(:,:,:), allocatable
:: a
,b
,c
88 integer, parameter :: nrep
= 20
90 allocate (a(n
,n
,n
), b(n
,n
,n
),c(n
,n
,n
))
94 call cshift_sp_3_v1 (a
, i
, k
, b
)
96 if (any (c
/= b
)) call abort
100 allocate (b(n
-1,n
-1,n
-1),c(n
-1,n
-1,n
-1))
103 call cshift_sp_3_v1 (a(1:n
-1,1:n
-1,1:n
-1), i
, k
, b
)
104 c
= cshift(a(1:n
-1,1:n
-1,1:n
-1), i
, k
)
105 if (any (c
/= b
)) call abort