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 >
Wrap
Text File
|
1993-03-23
|
2KB
|
91 lines
program move3a
c same as 3, but more irregula dimensions
real a(11,9,8), ha(11,9,8), ha1(11,9,8)
cmf$ layout ha(:host), ha1(:host)
real b(11,9), hb(11,9), hb1(11,9)
cmf$ layout hb(:host), hb1(:host)
integer i, j, k, errors, switch
call cmf_random (a)
call cmf_random (b)
ha = a
hb = b
print *, 'Initialisation is ready'
print *, 'Chosse switch (1-6) : '
read *, switch
c now operate on distributed arrays, make the same with host
if (switch .eq. 1) then
print * , 'one -> one'
b(3:6,4) = a(2:5,5,7)
hb(3:6,4) = ha(2:5,5,7)
end if
c
if (switch .eq. 2) then
print * , 'many -> many'
b(2:5,2:5) = a(3:6,4,3:6)
hb(2:5,2:5) = ha(3:6,4,3:6)
end if
if (switch .eq. 3) then
print *, 'many -> one'
a(4:8,4:8,3) = b(5:9,2:6)
ha(4:8,4:8,3) = hb(5:9,2:6)
end if
if (switch .eq. 4) then
print *, 'one -> many'
b(5:9,2:6) = a(6:10,1:5,3)
hb(5:9,2:6) = ha(6:10,1:5,3)
end if
if (switch .eq. 5) then
print *, 'full continguous'
b(1:10,2:8) = a(1:10,3:9,4)
hb(1:10,2:8) = ha(1:10,3:9,4)
end if
if (switch .eq. 6) then
print *, 'shifting in dim1'
a(2:9,2:8,1:7) = a(2:9,2:8,2:8)
ha(2:9,2:8,1:7) = ha(2:9,2:8,2:8)
end if
c now compare distributed arrays with host arrays
print *,'Operations are finished'
ha1 = a
hb1 = b
c
c ha1 == ha ?, hb1 == b ?
print *,'Now checking'
errors = 0
do k = 1, 11
do j = 1, 9
do i = 1, 8
if (ha(i,j,k) .ne. ha1(i,j,k)) then
print *, 'HA for i, j, k = ', i, j, k
errors = errors + 1
end if
end do
if (hb(j,k) .ne. hb1(j,k)) then
print *, 'HB for j, k = ', j, k
errors = errors + 1
end if
end do
end do
print *, 'Errors = ', errors
end