home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / adaptor.zip / adapt.zip / adaptor / examples / dalib / move / move3a.f < prev    next >
Text File  |  1993-03-23  |  2KB  |  91 lines

  1.       program move3a
  2.  
  3. c     same as 3, but more irregula dimensions
  4.  
  5.       real a(11,9,8), ha(11,9,8), ha1(11,9,8)
  6. cmf$  layout ha(:host), ha1(:host)
  7.  
  8.       real b(11,9), hb(11,9), hb1(11,9)
  9. cmf$  layout hb(:host), hb1(:host)
  10.  
  11.       integer i, j, k, errors, switch
  12.  
  13.       call cmf_random (a)
  14.       call cmf_random (b)
  15.  
  16.       ha = a
  17.       hb = b
  18.  
  19.       print *, 'Initialisation is ready'
  20.       print *, 'Chosse switch (1-6) : '
  21.       read  *, switch
  22.  
  23. c     now operate on distributed arrays, make the same with host
  24.  
  25.       if (switch .eq. 1) then
  26.          print * , 'one -> one'
  27.          b(3:6,4) = a(2:5,5,7)
  28.          hb(3:6,4) = ha(2:5,5,7)
  29.       end if
  30. c
  31.       if (switch .eq. 2) then
  32.          print * , 'many -> many'
  33.          b(2:5,2:5) = a(3:6,4,3:6)
  34.          hb(2:5,2:5) = ha(3:6,4,3:6)
  35.       end if
  36.  
  37.       if (switch .eq. 3) then
  38.          print *, 'many -> one'
  39.          a(4:8,4:8,3) = b(5:9,2:6)
  40.          ha(4:8,4:8,3) = hb(5:9,2:6)
  41.       end if
  42.  
  43.       if (switch .eq. 4) then
  44.          print *, 'one -> many'
  45.          b(5:9,2:6) = a(6:10,1:5,3)
  46.          hb(5:9,2:6) = ha(6:10,1:5,3)
  47.       end if
  48.  
  49.       if (switch .eq. 5) then
  50.          print *, 'full continguous'
  51.          b(1:10,2:8) = a(1:10,3:9,4)
  52.          hb(1:10,2:8) = ha(1:10,3:9,4)
  53.       end if
  54.  
  55.       if (switch .eq. 6) then
  56.          print *, 'shifting in dim1'
  57.          a(2:9,2:8,1:7) = a(2:9,2:8,2:8)
  58.          ha(2:9,2:8,1:7) = ha(2:9,2:8,2:8)
  59.       end if
  60.  
  61. c     now compare distributed arrays with host arrays
  62.  
  63.       print *,'Operations are finished'
  64.  
  65.       ha1 = a
  66.       hb1 = b
  67. c
  68. c     ha1 == ha ?,  hb1 == b ?
  69.  
  70.       print *,'Now checking'
  71.  
  72.       errors = 0
  73.       do k = 1, 11
  74.        do j = 1, 9
  75.         do i = 1, 8
  76.           if (ha(i,j,k) .ne. ha1(i,j,k)) then
  77.              print *, 'HA for i, j, k = ', i, j, k
  78.              errors = errors + 1
  79.           end if
  80.         end do
  81.         if (hb(j,k) .ne. hb1(j,k)) then
  82.              print *, 'HB for j, k = ', j, k
  83.              errors = errors + 1
  84.         end if
  85.        end do
  86.       end do
  87.  
  88.       print *, 'Errors = ', errors
  89.  
  90.       end
  91.