libsim Versione 7.2.1
|
◆ arrayof_vol7d_timerange_append()
Quick method to append an element to the array. The return value is the position at which the element has been appended.
Definizione alla linea 1935 del file vol7d_timerange_class.F90. 1936! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
1937! authors:
1938! Davide Cesari <dcesari@arpa.emr.it>
1939! Paolo Patruno <ppatruno@arpa.emr.it>
1940
1941! This program is free software; you can redistribute it and/or
1942! modify it under the terms of the GNU General Public License as
1943! published by the Free Software Foundation; either version 2 of
1944! the License, or (at your option) any later version.
1945
1946! This program is distributed in the hope that it will be useful,
1947! but WITHOUT ANY WARRANTY; without even the implied warranty of
1948! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1949! GNU General Public License for more details.
1950
1951! You should have received a copy of the GNU General Public License
1952! along with this program. If not, see <http://www.gnu.org/licenses/>.
1953#include "config.h"
1954
1966IMPLICIT NONE
1967
1973 INTEGER :: timerange
1974 INTEGER :: p1
1975 INTEGER :: p2
1977
1979TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
1980 vol7d_timerange(imiss,imiss,imiss)
1981
1986 MODULE PROCEDURE vol7d_timerange_init
1987END INTERFACE
1988
1992 MODULE PROCEDURE vol7d_timerange_delete
1993END INTERFACE
1994
1998INTERFACE OPERATOR (==)
1999 MODULE PROCEDURE vol7d_timerange_eq
2000END INTERFACE
2001
2005INTERFACE OPERATOR (/=)
2006 MODULE PROCEDURE vol7d_timerange_ne
2007END INTERFACE
2008
2012INTERFACE OPERATOR (>)
2013 MODULE PROCEDURE vol7d_timerange_gt
2014END INTERFACE
2015
2019INTERFACE OPERATOR (<)
2020 MODULE PROCEDURE vol7d_timerange_lt
2021END INTERFACE
2022
2026INTERFACE OPERATOR (>=)
2027 MODULE PROCEDURE vol7d_timerange_ge
2028END INTERFACE
2029
2033INTERFACE OPERATOR (<=)
2034 MODULE PROCEDURE vol7d_timerange_le
2035END INTERFACE
2036
2039INTERFACE OPERATOR (.almosteq.)
2040 MODULE PROCEDURE vol7d_timerange_almost_eq
2041END INTERFACE
2042
2043
2044! da documentare in inglese assieme al resto
2047 MODULE PROCEDURE vol7d_timerange_c_e
2048END INTERFACE
2049
2050#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
2051#define VOL7D_POLY_TYPES _timerange
2052#define ENABLE_SORT
2053#include "array_utilities_pre.F90"
2054
2057 MODULE PROCEDURE display_timerange
2058END INTERFACE
2059
2062 MODULE PROCEDURE to_char_timerange
2063END INTERFACE
2064
2065#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
2066#define ARRAYOF_TYPE arrayof_vol7d_timerange
2067#define ARRAYOF_ORIGEQ 1
2068#include "arrayof_pre.F90"
2069
2070
2071type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
2072 vol7d_timerange(254,0,imiss),&
2073 vol7d_timerange(3,0,3600)/)
2074
2075
2076! from arrayof
2078PUBLIC insert_unique, append_unique
2079PUBLIC almost_equal_timeranges
2080
2081CONTAINS
2082
2083
2089FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
2090INTEGER,INTENT(IN),OPTIONAL :: timerange
2091INTEGER,INTENT(IN),OPTIONAL :: p1
2092INTEGER,INTENT(IN),OPTIONAL :: p2
2093
2094TYPE(vol7d_timerange) :: this
2095
2097
2098END FUNCTION vol7d_timerange_new
2099
2100
2104SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
2105TYPE(vol7d_timerange),INTENT(INOUT) :: this
2106INTEGER,INTENT(IN),OPTIONAL :: timerange
2107INTEGER,INTENT(IN),OPTIONAL :: p1
2108INTEGER,INTENT(IN),OPTIONAL :: p2
2109
2110IF (PRESENT(timerange)) THEN
2111 this%timerange = timerange
2112ELSE
2113 this%timerange = imiss
2114 this%p1 = imiss
2115 this%p2 = imiss
2116 RETURN
2117ENDIF
2118!!$IF (timerange == 1) THEN ! p1 sempre 0
2119!!$ this%p1 = 0
2120!!$ this%p2 = imiss
2121!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
2122!!$ IF (PRESENT(p1)) THEN
2123!!$ this%p1 = p1
2124!!$ ELSE
2125!!$ this%p1 = 0
2126!!$ ENDIF
2127!!$ this%p2 = imiss
2128!!$ELSE ! tutti gli altri
2129 IF (PRESENT(p1)) THEN
2130 this%p1 = p1
2131 ELSE
2132 this%p1 = imiss
2133 ENDIF
2134 IF (PRESENT(p2)) THEN
2135 this%p2 = p2
2136 ELSE
2137 this%p2 = imiss
2138 ENDIF
2139!!$END IF
2140
2141END SUBROUTINE vol7d_timerange_init
2142
2143
2145SUBROUTINE vol7d_timerange_delete(this)
2146TYPE(vol7d_timerange),INTENT(INOUT) :: this
2147
2148this%timerange = imiss
2149this%p1 = imiss
2150this%p2 = imiss
2151
2152END SUBROUTINE vol7d_timerange_delete
2153
2154
2155SUBROUTINE display_timerange(this)
2156TYPE(vol7d_timerange),INTENT(in) :: this
2157
2158print*,to_char_timerange(this)
2159
2160END SUBROUTINE display_timerange
2161
2162
2163FUNCTION to_char_timerange(this)
2164#ifdef HAVE_DBALLE
2165USE dballef
2166#endif
2167TYPE(vol7d_timerange),INTENT(in) :: this
2168CHARACTER(len=80) :: to_char_timerange
2169
2170#ifdef HAVE_DBALLE
2171INTEGER :: handle, ier
2172
2173handle = 0
2174ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
2175ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
2176ier = idba_fatto(handle)
2177
2178to_char_timerange="Timerange: "//to_char_timerange
2179
2180#else
2181
2184
2185#endif
2186
2187END FUNCTION to_char_timerange
2188
2189
2190ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
2191TYPE(vol7d_timerange),INTENT(IN) :: this, that
2192LOGICAL :: res
2193
2194
2195res = &
2196 this%timerange == that%timerange .AND. &
2197 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
2198 this%timerange == 254)
2199
2200END FUNCTION vol7d_timerange_eq
2201
2202
2203ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
2204TYPE(vol7d_timerange),INTENT(IN) :: this, that
2205LOGICAL :: res
2206
2207IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
2208 this%p1 == that%p1 .AND. &
2209 this%p2 == that%p2) THEN
2210 res = .true.
2211ELSE
2212 res = .false.
2213ENDIF
2214
2215END FUNCTION vol7d_timerange_almost_eq
2216
2217
2218ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
2219TYPE(vol7d_timerange),INTENT(IN) :: this, that
2220LOGICAL :: res
2221
2222res = .NOT.(this == that)
2223
2224END FUNCTION vol7d_timerange_ne
2225
2226
2227ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
2228TYPE(vol7d_timerange),INTENT(IN) :: this, that
2229LOGICAL :: res
2230
2231IF (this%timerange > that%timerange .OR. &
2232 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
2233 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
2234 this%p2 > that%p2)) THEN
2235 res = .true.
2236ELSE
2237 res = .false.
2238ENDIF
2239
2240END FUNCTION vol7d_timerange_gt
2241
2242
2243ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
2244TYPE(vol7d_timerange),INTENT(IN) :: this, that
2245LOGICAL :: res
2246
2247IF (this%timerange < that%timerange .OR. &
2248 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
2249 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
2250 this%p2 < that%p2)) THEN
2251 res = .true.
2252ELSE
2253 res = .false.
2254ENDIF
2255
2256END FUNCTION vol7d_timerange_lt
2257
2258
2259ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
2260TYPE(vol7d_timerange),INTENT(IN) :: this, that
2261LOGICAL :: res
2262
2263IF (this == that) THEN
2264 res = .true.
2265ELSE IF (this > that) THEN
2266 res = .true.
2267ELSE
2268 res = .false.
2269ENDIF
2270
2271END FUNCTION vol7d_timerange_ge
2272
2273
2274ELEMENTAL FUNCTION vol7d_timerange_le(this, that) RESULT(res)
2275TYPE(vol7d_timerange),INTENT(IN) :: this, that
2276LOGICAL :: res
2277
2278IF (this == that) THEN
2279 res = .true.
2280ELSE IF (this < that) THEN
2281 res = .true.
2282ELSE
2283 res = .false.
2284ENDIF
2285
2286END FUNCTION vol7d_timerange_le
2287
2288
2289ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
2290TYPE(vol7d_timerange),INTENT(IN) :: this
2291LOGICAL :: c_e
2292c_e = this /= vol7d_timerange_miss
2293END FUNCTION vol7d_timerange_c_e
2294
2295
2296#include "array_utilities_inc.F90"
2297
2298#include "arrayof_post.F90"
2299
2300
Quick method to append an element to the array. Definition: vol7d_timerange_class.F90:425 Distruttore per la classe vol7d_timerange. Definition: vol7d_timerange_class.F90:244 Costruttore per la classe vol7d_timerange. Definition: vol7d_timerange_class.F90:238 Method for inserting elements of the array at a desired position. Definition: vol7d_timerange_class.F90:416 Method for packing the array object reducing at a minimum the memory occupation, without destroying i... Definition: vol7d_timerange_class.F90:448 Method for removing elements of the array at a desired position. Definition: vol7d_timerange_class.F90:431 Represent timerange object in a pretty string. Definition: vol7d_timerange_class.F90:369 Definition of constants to be used for declaring variables of a desired type. Definition: kinds.F90:245 Definitions of constants and functions for working with missing values. Definition: missing_values.f90:50 Classe per la gestione degli intervalli temporali di osservazioni meteo e affini. Definition: vol7d_timerange_class.F90:215 Definisce l'intervallo temporale di un'osservazione meteo. Definition: vol7d_timerange_class.F90:225 |