EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gadapf.F
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file gadapf.F
1 
2 C **********************************************************************
3 
4 
5  FUNCTION gadapf(X,A0,B0,F,EPS)
6  IMPLICIT NONE
7  common/gadap1/ num,ifu
8  INTEGER num,ifu
9  SAVE /gadap1/
10 
11 
12  INTEGER n,l,i
13  REAL gadapf,x,a0,b0,f,eps,a,b,f1,f2,f3,s,red,c,w1,u2,ss,sold,sum
14  REAL dsum
15  REAL aa,bb,f1f,f2f,f3f
16 
17  EXTERNAL f
18  dimension a(300),b(300),f1(300),f2(300),f3(300),s(300),n(300)
19  1 FORMAT(16h gadap:i too big)
20  dsum(f1f,f2f,f3f,aa,bb)=5./18.*(bb-aa)*(f1f+1.6*f2f+f3f)
21  IF(eps.LT.1.0e-8) eps=1.0e-8
22  red=1.4
23  l=1
24  i=1
25  sum=0.
26  c=sqrt(15.)/5.
27  a(1)=a0
28  b(1)=b0
29  f1(1)=f(x,0.5*(1+c)*a0+0.5*(1-c)*b0)
30  f2(1)=f(x,0.5*(a0+b0))
31  f3(1)=f(x,0.5*(1-c)*a0+0.5*(1+c)*b0)
32  ifu=3
33  s(1)= dsum(f1(1),f2(1),f3(1),a0,b0)
34  100 CONTINUE
35  l=l+1
36  n(l)=3
37  eps=eps*red
38  a(i+1)=a(i)+c*(b(i)-a(i))
39  b(i+1)=b(i)
40  a(i+2)=a(i)+b(i)-a(i+1)
41  b(i+2)=a(i+1)
42  a(i+3)=a(i)
43  b(i+3)=a(i+2)
44  w1=a(i)+(b(i)-a(i))/5.
45  u2=2.*w1-(a(i)+a(i+2))/2.
46  f1(i+1)=f(x,a(i)+b(i)-w1)
47  f2(i+1)=f3(i)
48  f3(i+1)=f(x,b(i)-a(i+2)+w1)
49  f1(i+2)=f(x,u2)
50  f2(i+2)=f2(i)
51  f3(i+2)=f(x,b(i+2)+a(i+2)-u2)
52  f1(i+3)=f(x,a(i)+a(i+2)-w1)
53  f2(i+3)=f1(i)
54  f3(i+3)=f(x,w1)
55  ifu=ifu+6
56  IF(ifu.GT.5000) goto 130
57  s(i+1)= dsum(f1(i+1),f2(i+1),f3(i+1),a(i+1),b(i+1))
58  s(i+2)= dsum(f1(i+2),f2(i+2),f3(i+2),a(i+2),b(i+2))
59  s(i+3)= dsum(f1(i+3),f2(i+3),f3(i+3),a(i+3),b(i+3))
60  ss=s(i+1)+s(i+2)+s(i+3)
61  i=i+3
62  IF(i.GT.300)goto 120
63  sold=s(i-3)
64  IF(abs(sold-ss).GT.eps*(1.+abs(ss))/2.) goto 100
65  sum=sum+ss
66  i=i-4
67  n(l)=0
68  l=l-1
69  110 CONTINUE
70  IF(l.EQ.1) goto 130
71  n(l)=n(l)-1
72  eps=eps/red
73  IF(n(l).NE.0) goto 100
74  i=i-1
75  l=l-1
76  goto 110
77  120 WRITE(6,1)
78  130 gadapf=sum
79  eps=eps/red
80  RETURN
81  END