UPP (develop)
Loading...
Searching...
No Matches
kinds_mod.F
Go to the documentation of this file.
1
27!
28! ----------------------------------------------------------------------
29!
30
31 module kinds
32
33 implicit none
34 private
35
36! Integer type definitions below
37
38! Integer types
40 integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer
42 integer, parameter, public :: i_short = selected_int_kind(4) ! short integer
44 integer, parameter, public :: i_long = selected_int_kind(8) ! long integer
45 integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer
47 integer, parameter, public :: i_llong = max( llong_t, i_long )
48
49! Expected 8-bit byte sizes of the integer kinds
51 integer, parameter, public :: num_bytes_for_i_byte = 1
53 integer, parameter, public :: num_bytes_for_i_short = 2
55 integer, parameter, public :: num_bytes_for_i_long = 4
57 integer, parameter, public :: num_bytes_for_i_llong = 8
58
59! Define arrays for default definition
60 integer, parameter, private :: num_i_kinds = 4
61 integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ &
62 i_byte, i_short, i_long, i_llong /)
63 integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ &
64 num_bytes_for_i_byte, num_bytes_for_i_short, &
65 num_bytes_for_i_long, num_bytes_for_i_llong /)
66
67! Default values
68! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND ***
69#if defined(GSDRAPR) || defined(COMMCODE)
70 integer, parameter, private :: default_integer = 3 ! 1=byte,
71#else
72 integer, parameter, private :: default_integer = 2 ! 1=byte,
73#endif
74 ! 2=short,
75 ! 3=long,
76 ! 4=llong
78 integer, parameter, public :: i_kind = integer_types( default_integer )
80 integer, parameter, public :: num_bytes_for_i_kind = &
81 integer_byte_sizes( default_integer )
82
83! Real definitions below
84
85! Real types
87 integer, parameter, public :: r_single = selected_real_kind(6) ! single precision
89 integer, parameter, public :: r_double = selected_real_kind(15) ! double precision
90 integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision
92 integer, parameter, public :: r_quad = max( quad_t, r_double )
93
94! Expected 8-bit byte sizes of the real kinds
96 integer, parameter, public :: num_bytes_for_r_single = 4
98 integer, parameter, public :: num_bytes_for_r_double = 8
100 integer, parameter, public :: num_bytes_for_r_quad = 16
101
102! Define arrays for default definition
103 integer, parameter, private :: num_r_kinds = 3
104 integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ &
105 r_single, r_double, r_quad /)
106 integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ &
107 num_bytes_for_r_single, num_bytes_for_r_double, &
108 num_bytes_for_r_quad /)
109
110! Default values
111! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND ***
112 integer, parameter, private :: default_real = 1 ! 1=single,
113 ! 2=double,
114 ! 3=quad
116 integer, parameter, public :: r_kind = real_kinds( default_real )
118 integer, parameter, public :: num_bytes_for_r_kind = &
119 real_byte_sizes( default_real )
120
121end module kinds