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