libsim  Versione6.3.0
missing_values.f90
1 ! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
2 ! authors:
3 ! Davide Cesari <dcesari@arpa.emr.it>
4 ! Paolo Patruno <ppatruno@arpa.emr.it>
5 
6 ! This program is free software; you can redistribute it and/or
7 ! modify it under the terms of the GNU General Public License as
8 ! published by the Free Software Foundation; either version 2 of
9 ! the License, or (at your option) any later version.
10 
11 ! This program is distributed in the hope that it will be useful,
12 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ! GNU General Public License for more details.
15 
16 ! You should have received a copy of the GNU General Public License
17 ! along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
51 USE kinds
52 IMPLICIT NONE
53 
54 REAL, PARAMETER :: rmiss = HUGE(1.0)
55 DOUBLE PRECISION, PARAMETER :: dmiss = HUGE(1.0D0)
56 REAL(kind=fp_s), PARAMETER :: rsmiss = HUGE(1.0_fp_s)
57 REAL(kind=fp_d), PARAMETER :: rdmiss = HUGE(1.0_fp_d)
58 INTEGER, PARAMETER :: imiss = HUGE(0)
59 INTEGER(kind=int_b), PARAMETER :: ibmiss = HUGE(0_int_b)
60 INTEGER(kind=int_b), PARAMETER :: bmiss = ibmiss
61 INTEGER(kind=int_s), PARAMETER :: ismiss = HUGE(0_int_s)
62 INTEGER(kind=int_l), PARAMETER :: ilmiss = HUGE(0_int_l)
63 INTEGER(kind=int_ll), PARAMETER :: illmiss = HUGE(0_int_ll)
64 CHARACTER(len=1), PARAMETER :: cmiss = char(0)
65 
66 
72 INTERFACE c_e
73  MODULE PROCEDURE c_e_b, c_e_s, c_e_l,c_e_ll, c_e_r, c_e_d, c_e_c
74 END INTERFACE
75 
76 PRIVATE c_e_b, c_e_s, c_e_l,c_e_ll, c_e_r, c_e_d, c_e_c
77 
78 CONTAINS
79 
81 ELEMENTAL LOGICAL FUNCTION c_e_b(var)
82 INTEGER(kind=int_b),INTENT(in) :: var
83 
84 c_e_b = var /= ibmiss
85 
86 END FUNCTION c_e_b
87 
88 
90 ELEMENTAL LOGICAL FUNCTION c_e_s(var)
91 INTEGER(kind=int_s),INTENT(in) :: var
92 
93 c_e_s = var /= ismiss
94 
95 END FUNCTION c_e_s
96 
97 
99 ELEMENTAL LOGICAL FUNCTION c_e_l(var)
100 INTEGER(kind=int_l),INTENT(in) :: var
101 
102 c_e_l = var /= ilmiss
103 
104 END FUNCTION c_e_l
105 
106 
107 ! This may not compile if long long is as long as long
109 ELEMENTAL LOGICAL FUNCTION c_e_ll(var)
110 INTEGER(kind=int_ll),INTENT(in) :: var
111 
112 c_e_ll = var /= illmiss
113 
114 END FUNCTION c_e_ll
115 
116 
118 ELEMENTAL LOGICAL FUNCTION c_e_r(var)
119 REAL,INTENT(in) :: var
120 
121 c_e_r = var /= rmiss
122 
123 END FUNCTION c_e_r
124 
125 
127 ELEMENTAL LOGICAL FUNCTION c_e_d(var)
128 DOUBLE PRECISION,INTENT(in) :: var
129 
130 c_e_d = var /= dmiss
131 
132 END FUNCTION c_e_d
133 ! cannot implement quad precision otherwise it may not compile if missing
134 
136 ELEMENTAL LOGICAL FUNCTION c_e_c(var)
137 CHARACTER(len=*),INTENT(in) :: var
138 
139 c_e_c = var /= cmiss
140 
141 END FUNCTION c_e_c
142 
143 
144 END MODULE missing_values
Function to check whether a value is missing or not.
Definitions of constants and functions for working with missing values.
Definition of constants to be used for declaring variables of a desired type.
Definition: kinds.F90:251

Generated with Doxygen.