UPP  001
 All Data Structures Files Functions Pages
kinds_mod.F
Go to the documentation of this file.
1 
27 
28  module kinds
29 
30  implicit none
31  private
32 
33 ! Integer type definitions below
34 
35 ! Integer types
36  integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer
37  integer, parameter, public :: i_short = selected_int_kind(4) ! short integer
38  integer, parameter, public :: i_long = selected_int_kind(8) ! long integer
39  integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer
40  integer, parameter, public :: i_llong = max( llong_t, i_long )
41 
42 ! Expected 8-bit byte sizes of the integer kinds
43  integer, parameter, public :: num_bytes_for_i_byte = 1
44  integer, parameter, public :: num_bytes_for_i_short = 2
45  integer, parameter, public :: num_bytes_for_i_long = 4
46  integer, parameter, public :: num_bytes_for_i_llong = 8
47 
48 ! Define arrays for default definition
49  integer, parameter, private :: num_i_kinds = 4
50  integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ &
51  i_byte, i_short, i_long, i_llong /)
52  integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ &
53  num_bytes_for_i_byte, num_bytes_for_i_short, &
54  num_bytes_for_i_long, num_bytes_for_i_llong /)
55 
56 ! Default values
57 ! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND ***
58 #if defined(GSDRAPR) || defined(COMMCODE)
59  integer, parameter, private :: default_integer = 3 ! 1=byte,
60 #else
61  integer, parameter, private :: default_integer = 2 ! 1=byte,
62 #endif
63  ! 2=short,
64  ! 3=long,
65  ! 4=llong
66  integer, parameter, public :: i_kind = integer_types( default_integer )
67  integer, parameter, public :: num_bytes_for_i_kind = &
68  integer_byte_sizes( default_integer )
69 
70 
71 ! Real definitions below
72 
73 ! Real types
74  integer, parameter, public :: r_single = selected_real_kind(6) ! single precision
75  integer, parameter, public :: r_double = selected_real_kind(15) ! double precision
76  integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision
77  integer, parameter, public :: r_quad = max( quad_t, r_double )
78 
79 ! Expected 8-bit byte sizes of the real kinds
80  integer, parameter, public :: num_bytes_for_r_single = 4
81  integer, parameter, public :: num_bytes_for_r_double = 8
82  integer, parameter, public :: num_bytes_for_r_quad = 16
83 
84 ! Define arrays for default definition
85  integer, parameter, private :: num_r_kinds = 3
86  integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ &
87  r_single, r_double, r_quad /)
88  integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ &
89  num_bytes_for_r_single, num_bytes_for_r_double, &
90  num_bytes_for_r_quad /)
91 
92 ! Default values
93 ! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND ***
94  integer, parameter, private :: default_real = 1 ! 1=single,
95  ! 2=double,
96  ! 3=quad
97  integer, parameter, public :: r_kind = real_kinds( default_real )
98  integer, parameter, public :: num_bytes_for_r_kind = &
99  real_byte_sizes( default_real )
100 
101 end module kinds