File: invalid_IDf.F

package info (click to toggle)
sprng 2.0a-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,076 kB
  • ctags: 2,031
  • sloc: ansic: 30,361; fortran: 1,618; makefile: 566; cpp: 58; sh: 5
file content (52 lines) | stat: -rw-r--r-- 1,334 bytes parent folder | download | duplicates (9)
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
C
C   Demonstrates invalid ID handling in inteface with pointer checking  
C This prorgam prints a few random numbers, frees the stream, and then 
C tries to use the stream again.                                       
C

C do not uncomment the following line 
#ifndef CHECK_POINTERS
#define CHECK_POINTERS		
#endif

       program invalid_IDf
       implicit none

#include "sprng_f.h"

       integer streamnum, nstreams, seed, i, junk
       SPRNG_POINTER stream
       real*8 rn

C--- reading in a generator type
       integer gtype
#include "genf_types_menu.h"
       print *,'Type in a generator type (integers: 0,1,2,3,4,5):  '
       read *, gtype
C---

       streamnum = 0
       nstreams = 1
       seed = 985456376
       
C  initialize stream
       stream = init_sprng(gtype,streamnum,nstreams,seed,SPRNG_DEFAULT)
       print *, 'Printing information about new stream'
       junk = print_sprng(stream)

       print *, 'Printing 3 double precision numbers [0,1): '
       do 100 i = 1, 3
          rn = sprng(stream)
          print *, rn
 100   continue

       junk = free_sprng(stream)

      print *, ' Expect a SPRNG error message on the use'
      print *, '  of an invalid stream ID '
       rn = sprng(stream)
       print *, ' sprng returns ', rn,
     &  ' on being given an invalid stream ID'


       end