1! Copyright (c) 2004, NVIDIA CORPORATION.  All rights reserved.
2!
3! Licensed under the Apache License, Version 2.0 (the "License");
4! you may not use this file except in compliance with the License.
5! You may obtain a copy of the License at
6!
7!     http://www.apache.org/licenses/LICENSE-2.0
8!
9! Unless required by applicable law or agreed to in writing, software
10! distributed under the License is distributed on an "AS IS" BASIS,
11! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12! See the License for the specific language governing permissions and
13! limitations under the License.
14!
15! test EOSHIFT and CSHIFT
16! one dimension
17	program p
18	 implicit none
19	 integer, parameter :: N=5
20	 integer, dimension(N) :: src
21	 integer, dimension(N) :: eopc,eopv,cpc,cpv
22	 integer, dimension(N) :: eomc,eomv,cmc,cmv
23	 integer, dimension(N) :: eopcres,eopvres,cpcres,cpvres
24	 integer, dimension(N) :: eomcres,eomvres,cmcres,cmvres
25        data eopcres/   3,   4,   5,   0,   0/
26        data eopvres/   3,   4,   5,   0,   0/
27        data eomcres/   0,   0,   1,   2,   3/
28        data eomvres/   0,   0,   1,   2,   3/
29        data  cpcres/   3,   4,   5,   1,   2/
30        data  cpvres/   3,   4,   5,   1,   2/
31        data  cmcres/   4,   5,   1,   2,   3/
32        data  cmvres/   4,   5,   1,   2,   3/
33	logical,parameter :: doprint = .false.
34
35	 integer :: i,j,k
36	 eopc = -10	! fill in with garbage
37	 eopv = -10
38	 eomc = -10
39	 eomv = -10
40	 cpc = -10
41	 cpv = -10
42	 cmc = -10
43	 cmv = -10
44	 call sub(j,k)	! j is positive, k is negative
45	 src=(/(i,i=1,N)/)	! initialize
46	 eopc=eoshift(src, 2)	! eoshift, positive, constant
47	 eopv=eoshift(src, j)	! eoshift, positive, variable
48	 eomc=eoshift(src,-2)	! eoshift, negative, constant
49	 eomv=eoshift(src, k)	! eoshift, negative, variable
50	  cpc= cshift(src, 2)	!  cshift, positive, constant
51	  cpv= cshift(src, j)	!  cshift, positive, variable
52	  cmc= cshift(src,-2)	!  cshift, negative, constant
53	  cmv= cshift(src, k)	!  cshift, negative, variable
54	 if( doprint )then
55	  print 10, 'eopc',eopc
56	  print 10, 'eopv',eopv
57	  print 10, 'eomc',eomc
58	  print 10, 'eomv',eomv
59	  print 10, ' cpc', cpc
60	  print 10, ' cpv', cpv
61	  print 10, ' cmc', cmc
62	  print 10, ' cmv', cmv
6310	  format( '        data ',a,'res/',4(i4,','),i4,'/')
64	 else
65	  call check(eopc,eopcres,N)
66	  call check(eopv,eopvres,N)
67	  call check(eomc,eomcres,N)
68	  call check(eomv,eomvres,N)
69	  call check(cpc,cpcres,N)
70	  call check(cpv,cpvres,N)
71	  call check(cmc,cmcres,N)
72	  call check(cmv,cmvres,N)
73	 endif
74	end
75	subroutine sub(j,k)
76	 j = 2
77	 k = -2
78	end
79