-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.f90
61 lines (49 loc) · 1.4 KB
/
test.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
program test
use Random
use Timers
use Sorting
use Kinds
use Cmdline
implicit none
integer(KINT4) :: i, j, idum=-234123512
integer(KINT4) :: n
real(KREAL4), dimension(:), allocatable :: a
integer(KINT4), dimension(:), allocatable :: indx
real(KREAL4) :: b
type(Timer) :: crono1, crono2, crono3
type(UGenerator) :: Uniform
type(NGenerator) :: Gausian
type(CommandLine) :: line
character(len=:), allocatable :: fnamein
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! EXAMPLE OF HOW TO USE THE ARGUMENTS MODULE
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
call line%ReadCommandLine()
do i=1, line%NArgs()
call line%RetrieveCommand(fnamein, i)
print*, fnamein
enddo
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
call Uniform%Randomize()
! call Uniform%Randomize(idum)
n=10000
allocate(a(n), indx(n))
print*, 'Generating', n, 'uniformly distributed numbers'
call crono1%Tic()
do i=1, n
a(i)=Uniform%Getnumber()
enddo
call Sort(a, indx, .false.)
print*, a(indx(1:3))
call crono1%Tac()
print*, 'Generating', n, 'normal distributed numbers'
call crono2%Tic()
do i=1, n
a(i)=Gausian%Getnumber()
enddo
call Sort(a, indx, .false.)
print*, a(indx(1:3))
call crono2%Tac()
print*,
print*, 'Finish Example Program'
end program test