-
Notifications
You must be signed in to change notification settings - Fork 0
/
slug.f90
65 lines (64 loc) · 2.28 KB
/
slug.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
! last edited November 2, 1995
subroutine slug(i, j, varmax, varupp, varned, ansats, org, lock, dubbel, &
low, start, stopp)
!...Translated by Pacific-Sierra Research 77to90 4.3E 14:44:54 12/27/06
!...Switches:
implicit none
!-----------------------------------------------
! D u m m y A r g u m e n t s
!-----------------------------------------------
integer , intent(in) :: i
integer , intent(in) :: j
integer , intent(in) :: varmax
integer , intent(out) :: start
integer , intent(out) :: stopp
logical , intent(in) :: lock
integer , intent(inout) :: varupp(15,0:10)
integer , intent(inout) :: varned(15,0:10)
integer , intent(in) :: ansats(15,0:10,0:1)
integer , intent(in) :: org(15,0:10)
integer , intent(in) :: low(15,0:10)
logical , intent(in) :: dubbel(15,0:10)
!-----------------------------------------------
! L o c a l V a r i a b l e s
!-----------------------------------------------
integer :: minmax, iold, jold
!-----------------------------------------------
if (i == 1) then
varupp(1,0) = 0
varned(1,0) = 0
else
if (j == 0) then
iold = i - 1
jold = min(10,iold - 1)
else
iold = i
jold = j - 1
endif
if (jold == 0) then
varupp(i,j) = varupp(iold,jold) + max(0,ansats(iold,jold,0)-org(&
iold,jold))
varned(i,j) = varned(iold,jold) + max(0,org(iold,jold)-ansats(iold,&
jold,0))
else
varupp(i,j) = varupp(iold,jold) + max(0,ansats(iold,jold,0)+ansats(&
iold,jold,1)-org(iold,jold))
varned(i,j) = varned(iold,jold) + max(0,org(iold,jold)-ansats(iold,&
jold,0)-ansats(iold,jold,1))
endif
endif
if (lock) then
start = org(i,j)
stopp = org(i,j)
return
endif
if (j >= 5) then
minmax = 4
else
minmax = 4*j + 2
endif
start = min(minmax,org(i,j)+(varmax-varupp(i,j)))
if (dubbel(i,j)) start = 2*(start/2)
stopp = max(low(i,j),org(i,j)-(varmax-varned(i,j)))
return
end subroutine slug