libsim Versione 7.2.6

◆ arrayof_vol7d_timerange_delete()

subroutine, private arrayof_vol7d_timerange_delete ( type(arrayof_vol7d_timerange) this,
logical, intent(in), optional nodealloc )
private

Destructor for finalizing an array object.

If defined, calls the destructor for every element of the array object; finally it deallocates all the space occupied.

Parametri
thisarray object to be destroyed
[in]nodeallocif provided and .TRUE. , the space reserved for the array is not deallocated, thus the values are retained, while the array pointer is nullified, this means that the caller must have previously assigned the pointer contents thisarray to another pointer to prevent memory leaks

Definizione alla linea 2047 del file vol7d_timerange_class.F90.

2052! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
2053! authors:
2054! Davide Cesari <dcesari@arpa.emr.it>
2055! Paolo Patruno <ppatruno@arpa.emr.it>
2056
2057! This program is free software; you can redistribute it and/or
2058! modify it under the terms of the GNU General Public License as
2059! published by the Free Software Foundation; either version 2 of
2060! the License, or (at your option) any later version.
2061
2062! This program is distributed in the hope that it will be useful,
2063! but WITHOUT ANY WARRANTY; without even the implied warranty of
2064! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2065! GNU General Public License for more details.
2066
2067! You should have received a copy of the GNU General Public License
2068! along with this program. If not, see <http://www.gnu.org/licenses/>.
2069#include "config.h"
2070
2071!> Classe per la gestione degli intervalli temporali di osservazioni
2072!! meteo e affini.
2073!! Questo modulo definisce una classe in grado di rappresentare
2074!! l'intervallo di tempo a cui si riferisce un'osservazione meteo,
2075!! ad es. valore istantaneo, cumulato, medio, ecc., prendendo in prestito
2076!! concetti dal formato grib.
2077!! \ingroup vol7d
2079USE kinds
2082IMPLICIT NONE
2083
2084!> Definisce l'intervallo temporale di un'osservazione meteo.
2085!! I membri di \a vol7d_timerange sono pubblici e quindi liberamente
2086!! accessibili e scrivibili, ma è comunque consigliato assegnarli tramite
2087!! il costruttore ::init.
2088TYPE vol7d_timerange
2089 INTEGER :: timerange !< proprietà statistiche del dato (es. 0=media, 1=cumulazione, 2=massimo, 3=minimo, 4=differenza... 254=dato istantaneo) tratte dalla code table 4.10 del formato WMO grib edizione 2, vedi http://www.wmo.int/pages/prog/www/WMOCodes/WMO306_vI2/LatestVERSION/WMO306_vI2_GRIB2_CodeFlag_en.pdf
2090 INTEGER :: p1 !< termine del periodo di validità del dato, in secondi, a partire dall'istante di riferimento (0 per dati osservati o analizzati)
2091 INTEGER :: p2 !< durata del periodo di validità del dato, in secondi (0 per dati istantanei)
2092END TYPE vol7d_timerange
2093
2094!> Valore mancante per vol7d_timerange.
2095TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
2096 vol7d_timerange(imiss,imiss,imiss)
2097
2098!> Costruttore per la classe vol7d_timerange.
2099!! Deve essere richiamato
2100!! per tutti gli oggetti di questo tipo definiti in un programma.
2101INTERFACE init
2102 MODULE PROCEDURE vol7d_timerange_init
2103END INTERFACE
2104
2105!> Distruttore per la classe vol7d_timerange.
2106!! Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
2107INTERFACE delete
2108 MODULE PROCEDURE vol7d_timerange_delete
2109END INTERFACE
2110
2111!> Logical equality operator for objects of \a vol7d_timerange class.
2112!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
2113!! of any shape.
2114INTERFACE OPERATOR (==)
2115 MODULE PROCEDURE vol7d_timerange_eq
2116END INTERFACE
2117
2118!> Logical inequality operator for objects of \a vol7d_timerange class.
2119!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
2120!! of any shape.
2121INTERFACE OPERATOR (/=)
2122 MODULE PROCEDURE vol7d_timerange_ne
2123END INTERFACE
2124
2125!> Logical greater-than operator for objects of \a vol7d_timerange class.
2126!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
2127!! of any shape.
2128INTERFACE OPERATOR (>)
2129 MODULE PROCEDURE vol7d_timerange_gt
2130END INTERFACE
2131
2132!> Logical less-than operator for objects of \a vol7d_timerange class.
2133!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
2134!! of any shape.
2135INTERFACE OPERATOR (<)
2136 MODULE PROCEDURE vol7d_timerange_lt
2137END INTERFACE
2138
2139!> Logical greater-equal operator for objects of \a vol7d_timerange class.
2140!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
2141!! of any shape.
2142INTERFACE OPERATOR (>=)
2143 MODULE PROCEDURE vol7d_timerange_ge
2144END INTERFACE
2145
2146!> Logical less-equal operator for objects of \a vol7d_timerange class.
2147!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
2148!! of any shape.
2149INTERFACE OPERATOR (<=)
2150 MODULE PROCEDURE vol7d_timerange_le
2151END INTERFACE
2152
2153!> Logical almost equality operator for objects of \a vol7d_timerange class.
2154!! If one component is missing it is not used in comparison.
2155INTERFACE OPERATOR (.almosteq.)
2156 MODULE PROCEDURE vol7d_timerange_almost_eq
2157END INTERFACE
2158
2159
2160! da documentare in inglese assieme al resto
2161!> to be documented
2162INTERFACE c_e
2163 MODULE PROCEDURE vol7d_timerange_c_e
2164END INTERFACE
2165
2166#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
2167#define VOL7D_POLY_TYPES _timerange
2168#define ENABLE_SORT
2169#include "array_utilities_pre.F90"
2170
2171!>Print object
2172INTERFACE display
2173 MODULE PROCEDURE display_timerange
2174END INTERFACE
2175
2176!>Represent timerange object in a pretty string
2177INTERFACE to_char
2178 MODULE PROCEDURE to_char_timerange
2179END INTERFACE
2180
2181#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
2182#define ARRAYOF_TYPE arrayof_vol7d_timerange
2183#define ARRAYOF_ORIGEQ 1
2184#include "arrayof_pre.F90"
2185
2186
2187type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
2188 vol7d_timerange(254,0,imiss),&
2189 vol7d_timerange(3,0,3600)/)
2190
2191
2192! from arrayof
2193PUBLIC insert, append, remove, packarray
2194PUBLIC insert_unique, append_unique
2195PUBLIC almost_equal_timeranges
2196
2197CONTAINS
2198
2199
2200!> Inizializza un oggetto \a vol7d_timerange con i parametri opzionali forniti.
2201!! Questa è la versione \c FUNCTION, in stile F2003, del costruttore, da preferire
2202!! rispetto alla versione \c SUBROUTINE \c init.
2203!! Se non viene passato nessun parametro opzionale l'oggetto è
2204!! inizializzato a valore mancante.
2205FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
2206INTEGER,INTENT(IN),OPTIONAL :: timerange !< tipo di intervallo temporale
2207INTEGER,INTENT(IN),OPTIONAL :: p1 !< valore per il primo istante temporale
2208INTEGER,INTENT(IN),OPTIONAL :: p2 !< valore per il secondo istante temporale
2209
2210TYPE(vol7d_timerange) :: this !< oggetto da inizializzare
2211
2212CALL init(this, timerange, p1, p2)
2213
2214END FUNCTION vol7d_timerange_new
2215
2216
2217!> Inizializza un oggetto \a vol7d_timerange con i parametri opzionali forniti.
2218!! Se non viene passato nessun parametro opzionale l'oggetto è
2219!! inizializzato a valore mancante.
2220SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
2221TYPE(vol7d_timerange),INTENT(INOUT) :: this !< oggetto da inizializzare
2222INTEGER,INTENT(IN),OPTIONAL :: timerange !< tipo di intervallo temporale
2223INTEGER,INTENT(IN),OPTIONAL :: p1 !< valore per il primo istante temporale
2224INTEGER,INTENT(IN),OPTIONAL :: p2 !< valore per il secondo istante temporale
2225
2226IF (PRESENT(timerange)) THEN
2227 this%timerange = timerange
2228ELSE
2229 this%timerange = imiss
2230 this%p1 = imiss
2231 this%p2 = imiss
2232 RETURN
2233ENDIF
2234!!$IF (timerange == 1) THEN ! p1 sempre 0
2235!!$ this%p1 = 0
2236!!$ this%p2 = imiss
2237!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
2238!!$ IF (PRESENT(p1)) THEN
2239!!$ this%p1 = p1
2240!!$ ELSE
2241!!$ this%p1 = 0
2242!!$ ENDIF
2243!!$ this%p2 = imiss
2244!!$ELSE ! tutti gli altri
2245 IF (PRESENT(p1)) THEN
2246 this%p1 = p1
2247 ELSE
2248 this%p1 = imiss
2249 ENDIF
2250 IF (PRESENT(p2)) THEN
2251 this%p2 = p2
2252 ELSE
2253 this%p2 = imiss
2254 ENDIF
2255!!$END IF
2256
2257END SUBROUTINE vol7d_timerange_init
2258
2259
2260!> Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
2261SUBROUTINE vol7d_timerange_delete(this)
2262TYPE(vol7d_timerange),INTENT(INOUT) :: this
2263
2264this%timerange = imiss
2265this%p1 = imiss
2266this%p2 = imiss
2267
2268END SUBROUTINE vol7d_timerange_delete
2269
2270
2271SUBROUTINE display_timerange(this)
2272TYPE(vol7d_timerange),INTENT(in) :: this
2273
2274print*,to_char_timerange(this)
2275
2276END SUBROUTINE display_timerange
2277
2278
2279FUNCTION to_char_timerange(this)
2280#ifdef HAVE_DBALLE
2281USE dballef
2282#endif
2283TYPE(vol7d_timerange),INTENT(in) :: this
2284CHARACTER(len=80) :: to_char_timerange
2285
2286#ifdef HAVE_DBALLE
2287INTEGER :: handle, ier
2288
2289handle = 0
2290ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
2291ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
2292ier = idba_fatto(handle)
2293
2294to_char_timerange="Timerange: "//to_char_timerange
2295
2296#else
2297
2298to_char_timerange="Timerange: "//trim(to_char(this%timerange))//" P1: "//&
2299 trim(to_char(this%p1))//" P2: "//trim(to_char(this%p2))
2300
2301#endif
2302
2303END FUNCTION to_char_timerange
2304
2305
2306ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
2307TYPE(vol7d_timerange),INTENT(IN) :: this, that
2308LOGICAL :: res
2309
2310
2311res = &
2312 this%timerange == that%timerange .AND. &
2313 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
2314 this%timerange == 254)
2315
2316END FUNCTION vol7d_timerange_eq
2317
2318
2319ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
2320TYPE(vol7d_timerange),INTENT(IN) :: this, that
2321LOGICAL :: res
2322
2323IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
2324 this%p1 == that%p1 .AND. &
2325 this%p2 == that%p2) THEN
2326 res = .true.
2327ELSE
2328 res = .false.
2329ENDIF
2330
2331END FUNCTION vol7d_timerange_almost_eq
2332
2333
2334ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
2335TYPE(vol7d_timerange),INTENT(IN) :: this, that
2336LOGICAL :: res
2337
2338res = .NOT.(this == that)
2339
2340END FUNCTION vol7d_timerange_ne
2341
2342
2343ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
2344TYPE(vol7d_timerange),INTENT(IN) :: this, that
2345LOGICAL :: res
2346
2347IF (this%timerange > that%timerange .OR. &
2348 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
2349 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
2350 this%p2 > that%p2)) THEN
2351 res = .true.
2352ELSE
2353 res = .false.
2354ENDIF
2355
2356END FUNCTION vol7d_timerange_gt
2357
2358
2359ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
2360TYPE(vol7d_timerange),INTENT(IN) :: this, that
2361LOGICAL :: res
2362
2363IF (this%timerange < that%timerange .OR. &
2364 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
2365 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
2366 this%p2 < that%p2)) THEN
2367 res = .true.
2368ELSE
2369 res = .false.
2370ENDIF
2371
2372END FUNCTION vol7d_timerange_lt
2373
2374
2375ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
2376TYPE(vol7d_timerange),INTENT(IN) :: this, that
2377LOGICAL :: res
2378
2379IF (this == that) THEN
2380 res = .true.
2381ELSE IF (this > that) THEN
2382 res = .true.
2383ELSE
2384 res = .false.
2385ENDIF
2386
2387END FUNCTION vol7d_timerange_ge
2388
2389
2390ELEMENTAL FUNCTION vol7d_timerange_le(this, that) RESULT(res)
2391TYPE(vol7d_timerange),INTENT(IN) :: this, that
2392LOGICAL :: res
2393
2394IF (this == that) THEN
2395 res = .true.
2396ELSE IF (this < that) THEN
2397 res = .true.
2398ELSE
2399 res = .false.
2400ENDIF
2401
2402END FUNCTION vol7d_timerange_le
2403
2404
2405ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
2406TYPE(vol7d_timerange),INTENT(IN) :: this
2407LOGICAL :: c_e
2408c_e = this /= vol7d_timerange_miss
2409END FUNCTION vol7d_timerange_c_e
2410
2411
2412#include "array_utilities_inc.F90"
2413
2414#include "arrayof_post.F90"
2415
2416
2417END MODULE vol7d_timerange_class
Quick method to append an element to the array.
Distruttore per la classe vol7d_timerange.
Costruttore per la classe vol7d_timerange.
Method for inserting elements of the array at a desired position.
Method for packing the array object reducing at a minimum the memory occupation, without destroying i...
Method for removing elements of the array at a desired position.
Represent timerange object in a pretty string.
Utilities for CHARACTER variables.
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.
Classe per la gestione degli intervalli temporali di osservazioni meteo e affini.
Definisce l'intervallo temporale di un'osservazione meteo.

Generated with Doxygen.