home *** CD-ROM | disk | FTP | other *** search
- c-----This program calculates the value of pi, using numerical integration
- c-----with parallel processing, and clocks the solution time.
- c-----The user selects the number of points of integration and the limits a & b.
-
- c-----PI program evaluates the integral of 4/(1+x*x) from a to b
- c-----by dividing the area under the curve [(b - a) / #points] slices.
- c-----Each processor will evaluate the area of the assigned slices
- c-----independently and simultaneously with other processors.
- c-----The sum of all the slices is calculated by calling the sum
- c-----reduction function
-
- c Variables:
- c
- c points Number of points used in the integration. Input by the user
- c a Lower limit of integration
- c b Upper limit of integration
- c
- c Calls:
- c
- c userinpt to get number of points of integration from user
- c pi calculate the value of pi
-
-
- PROGRAM MAIN
-
- integer userinpt
- external userinpt
-
- integer j, points
- double precision a, b
-
- c Receive points of integration from the user
- c
- 100 j = userinpt(a, b, points)
- if (j.le.0) goto 200
-
- call pi(a, b, points)
-
- goto 100
-
- 200 continue
-
- END
-