xref: /libCEED/tests/t124-vector-f.f90 (revision 9c774eddf8c0b4f5416196d32c5355c9591a7190)
1*9c774eddSJeremy L Thompson!-----------------------------------------------------------------------
2*9c774eddSJeremy L Thompson      program test
3*9c774eddSJeremy L Thompson      implicit none
4*9c774eddSJeremy L Thompson      include 'ceed/fortran.h'
5*9c774eddSJeremy L Thompson
6*9c774eddSJeremy L Thompson      integer ceed,err
7*9c774eddSJeremy L Thompson      integer i,x,n
8*9c774eddSJeremy L Thompson      real*8 a(10)
9*9c774eddSJeremy L Thompson      real*8 diff
10*9c774eddSJeremy L Thompson      integer*8 aoffset
11*9c774eddSJeremy L Thompson      character arg*32
12*9c774eddSJeremy L Thompson
13*9c774eddSJeremy L Thompson      call getarg(1,arg)
14*9c774eddSJeremy L Thompson
15*9c774eddSJeremy L Thompson      call ceedinit(trim(arg)//char(0),ceed,err)
16*9c774eddSJeremy L Thompson
17*9c774eddSJeremy L Thompson      n=10
18*9c774eddSJeremy L Thompson
19*9c774eddSJeremy L Thompson      call ceedvectorcreate(ceed,n,x,err)
20*9c774eddSJeremy L Thompson
21*9c774eddSJeremy L Thompson      aoffset=0
22*9c774eddSJeremy L Thompson      call ceedvectorgetarraywrite(x,ceed_mem_host,a,aoffset,err)
23*9c774eddSJeremy L Thompson      do i=1,10
24*9c774eddSJeremy L Thompson        a(i+aoffset)=3*i
25*9c774eddSJeremy L Thompson      enddo
26*9c774eddSJeremy L Thompson      call ceedvectorrestorearray(x,a,aoffset,err)
27*9c774eddSJeremy L Thompson
28*9c774eddSJeremy L Thompson      call ceedvectorgetarrayread(x,ceed_mem_host,a,aoffset,err)
29*9c774eddSJeremy L Thompson      do i=1,10
30*9c774eddSJeremy L Thompson        diff=a(i+aoffset)-3*i
31*9c774eddSJeremy L Thompson        if (abs(diff)>1.0D-15) then
32*9c774eddSJeremy L Thompson! LCOV_EXCL_START
33*9c774eddSJeremy L Thompson          write(*,*) 'Error writing array a(',i,')=',a(i+aoffset)
34*9c774eddSJeremy L Thompson! LCOV_EXCL_STOP
35*9c774eddSJeremy L Thompson        endif
36*9c774eddSJeremy L Thompson      enddo
37*9c774eddSJeremy L Thompson      call ceedvectorrestorearrayread(x,a,aoffset,err)
38*9c774eddSJeremy L Thompson
39*9c774eddSJeremy L Thompson      call ceedvectordestroy(x,err)
40*9c774eddSJeremy L Thompson      call ceeddestroy(ceed,err)
41*9c774eddSJeremy L Thompson
42*9c774eddSJeremy L Thompson      end
43*9c774eddSJeremy L Thompson!-----------------------------------------------------------------------
44