2 !$$$ module documentation block
5 ! prgmmr: treadon org: np23 date: 2004-08-15
7 ! abstract: Module to hold specification kinds for variable declaration.
8 ! This module is based on (copied from) Paul vanDelst's
9 ! type_kinds module found in the community radiative transfer
15 ! Subroutines Included:
20 ! The numerical data types defined in this module are:
21 ! i_byte - specification kind for byte (1-byte) integer variable
22 ! i_short - specification kind for short (2-byte) integer variable
23 ! i_long - specification kind for long (4-byte) integer variable
24 ! i_llong - specification kind for double long (8-byte) integer variable
25 ! r_single - specification kind for single precision (4-byte) real variable
26 ! r_double - specification kind for double precision (8-byte) real variable
27 ! r_quad - specification kind for quad precision (16-byte) real variable
29 ! i_kind - generic specification kind for default integer
30 ! r_kind - generic specification kind for default floating point
35 ! machine: ibm RS/6000 SP
37 !$$$ end documentation block
41 ! Integer type definitions below
44 integer, parameter, public
:: i_byte
= selected_int_kind(1) ! byte integer
45 integer, parameter, public
:: i_short
= selected_int_kind(4) ! short integer
46 integer, parameter, public
:: i_long
= selected_int_kind(8) ! long integer
47 integer, parameter, private
:: llong_t
= selected_int_kind(16) ! llong integer
48 integer, parameter, public
:: i_llong
= max( llong_t
, i_long
)
50 ! Expected 8-bit byte sizes of the integer kinds
51 integer, parameter, public
:: num_bytes_for_i_byte
= 1
52 integer, parameter, public
:: num_bytes_for_i_short
= 2
53 integer, parameter, public
:: num_bytes_for_i_long
= 4
54 integer, parameter, public
:: num_bytes_for_i_llong
= 8
56 ! Define arrays for default definition
57 integer, parameter, private
:: num_i_kinds
= 4
58 integer, parameter, dimension( num_i_kinds
), private
:: integer_types
= (/ &
59 i_byte
, i_short
, i_long
, i_llong
/)
60 integer, parameter, dimension( num_i_kinds
), private
:: integer_byte_sizes
= (/ &
61 num_bytes_for_i_byte
, num_bytes_for_i_short
, &
62 num_bytes_for_i_long
, num_bytes_for_i_llong
/)
65 ! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND ***
66 integer, parameter, private
:: default_integer
= 3 ! 1=byte,
70 integer, parameter, public
:: i_kind
= integer_types( default_integer
)
71 integer, parameter, public
:: num_bytes_for_i_kind
= &
72 integer_byte_sizes( default_integer
)
75 ! Real definitions below
78 integer, parameter, public
:: r_single
= selected_real_kind(6) ! single precision
79 integer, parameter, public
:: r_double
= selected_real_kind(15) ! double precision
80 integer, parameter, private
:: quad_t
= selected_real_kind(20) ! quad precision
81 integer, parameter, public
:: r_quad
= max( quad_t
, r_double
)
83 ! Expected 8-bit byte sizes of the real kinds
84 integer, parameter, public
:: num_bytes_for_r_single
= 4
85 integer, parameter, public
:: num_bytes_for_r_double
= 8
86 integer, parameter, public
:: num_bytes_for_r_quad
= 16
88 ! Define arrays for default definition
89 integer, parameter, private
:: num_r_kinds
= 3
90 integer, parameter, dimension( num_r_kinds
), private
:: real_kinds
= (/ &
91 r_single
, r_double
, r_quad
/)
92 integer, parameter, dimension( num_r_kinds
), private
:: real_byte_sizes
= (/ &
93 num_bytes_for_r_single
, num_bytes_for_r_double
, &
94 num_bytes_for_r_quad
/)
97 ! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND ***
98 ! 1=single, 2=double, 3=quad
99 #
if ( RWORDSIZE
== 4 )
100 integer, parameter, private
:: default_real
= 1
102 integer, parameter, private
:: default_real
= 2
105 integer, parameter, public
:: r_kind
= real_kinds( default_real
)
106 integer, parameter, public
:: num_bytes_for_r_kind
= &
107 real_byte_sizes( default_real
)