libsim Versione 7.1.11

◆ arrayof_vol7d_timerange_remove()

subroutine, private arrayof_vol7d_timerange_remove ( type(arrayof_vol7d_timerange this,
integer, intent(in), optional  nelem,
integer, intent(in), optional  pos 
)
private

Method for removing elements of the array at a desired position.

If necessary, the array is reallocated to reduce space.

Parametri
thisarray object in which an element has to be removed
[in]nelemnumber of elements to remove, if not provided, a single element is removed
[in]posposition of the element to be removed, if it is out of range, it is clipped, if it is not provided, objects are removed at the end

Definizione alla linea 2000 del file vol7d_timerange_class.F90.

2005! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
2006! authors:
2007! Davide Cesari <dcesari@arpa.emr.it>
2008! Paolo Patruno <ppatruno@arpa.emr.it>
2009
2010! This program is free software; you can redistribute it and/or
2011! modify it under the terms of the GNU General Public License as
2012! published by the Free Software Foundation; either version 2 of
2013! the License, or (at your option) any later version.
2014
2015! This program is distributed in the hope that it will be useful,
2016! but WITHOUT ANY WARRANTY; without even the implied warranty of
2017! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2018! GNU General Public License for more details.
2019
2020! You should have received a copy of the GNU General Public License
2021! along with this program. If not, see <http://www.gnu.org/licenses/>.
2022#include "config.h"
2023
2032USE kinds
2035IMPLICIT NONE
2036
2041TYPE vol7d_timerange
2042 INTEGER :: timerange
2043 INTEGER :: p1
2044 INTEGER :: p2
2045END TYPE vol7d_timerange
2046
2048TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
2049 vol7d_timerange(imiss,imiss,imiss)
2050
2054INTERFACE init
2055 MODULE PROCEDURE vol7d_timerange_init
2056END INTERFACE
2057
2060INTERFACE delete
2061 MODULE PROCEDURE vol7d_timerange_delete
2062END INTERFACE
2063
2067INTERFACE OPERATOR (==)
2068 MODULE PROCEDURE vol7d_timerange_eq
2069END INTERFACE
2070
2074INTERFACE OPERATOR (/=)
2075 MODULE PROCEDURE vol7d_timerange_ne
2076END INTERFACE
2077
2081INTERFACE OPERATOR (>)
2082 MODULE PROCEDURE vol7d_timerange_gt
2083END INTERFACE
2084
2088INTERFACE OPERATOR (<)
2089 MODULE PROCEDURE vol7d_timerange_lt
2090END INTERFACE
2091
2095INTERFACE OPERATOR (>=)
2096 MODULE PROCEDURE vol7d_timerange_ge
2097END INTERFACE
2098
2102INTERFACE OPERATOR (<=)
2103 MODULE PROCEDURE vol7d_timerange_le
2104END INTERFACE
2105
2108INTERFACE OPERATOR (.almosteq.)
2109 MODULE PROCEDURE vol7d_timerange_almost_eq
2110END INTERFACE
2111
2112
2113! da documentare in inglese assieme al resto
2115INTERFACE c_e
2116 MODULE PROCEDURE vol7d_timerange_c_e
2117END INTERFACE
2118
2119#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
2120#define VOL7D_POLY_TYPES _timerange
2121#define ENABLE_SORT
2122#include "array_utilities_pre.F90"
2123
2125INTERFACE display
2126 MODULE PROCEDURE display_timerange
2127END INTERFACE
2128
2130INTERFACE to_char
2131 MODULE PROCEDURE to_char_timerange
2132END INTERFACE
2133
2134#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
2135#define ARRAYOF_TYPE arrayof_vol7d_timerange
2136#define ARRAYOF_ORIGEQ 1
2137#include "arrayof_pre.F90"
2138
2139
2140type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
2141 vol7d_timerange(254,0,imiss),&
2142 vol7d_timerange(3,0,3600)/)
2143
2144
2145! from arrayof
2146PUBLIC insert, append, remove, packarray
2147PUBLIC insert_unique, append_unique
2148PUBLIC almost_equal_timeranges
2149
2150CONTAINS
2151
2152
2158FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
2159INTEGER,INTENT(IN),OPTIONAL :: timerange
2160INTEGER,INTENT(IN),OPTIONAL :: p1
2161INTEGER,INTENT(IN),OPTIONAL :: p2
2162
2163TYPE(vol7d_timerange) :: this
2164
2165CALL init(this, timerange, p1, p2)
2166
2167END FUNCTION vol7d_timerange_new
2168
2169
2173SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
2174TYPE(vol7d_timerange),INTENT(INOUT) :: this
2175INTEGER,INTENT(IN),OPTIONAL :: timerange
2176INTEGER,INTENT(IN),OPTIONAL :: p1
2177INTEGER,INTENT(IN),OPTIONAL :: p2
2178
2179IF (PRESENT(timerange)) THEN
2180 this%timerange = timerange
2181ELSE
2182 this%timerange = imiss
2183 this%p1 = imiss
2184 this%p2 = imiss
2185 RETURN
2186ENDIF
2187!!$IF (timerange == 1) THEN ! p1 sempre 0
2188!!$ this%p1 = 0
2189!!$ this%p2 = imiss
2190!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
2191!!$ IF (PRESENT(p1)) THEN
2192!!$ this%p1 = p1
2193!!$ ELSE
2194!!$ this%p1 = 0
2195!!$ ENDIF
2196!!$ this%p2 = imiss
2197!!$ELSE ! tutti gli altri
2198 IF (PRESENT(p1)) THEN
2199 this%p1 = p1
2200 ELSE
2201 this%p1 = imiss
2202 ENDIF
2203 IF (PRESENT(p2)) THEN
2204 this%p2 = p2
2205 ELSE
2206 this%p2 = imiss
2207 ENDIF
2208!!$END IF
2209
2210END SUBROUTINE vol7d_timerange_init
2211
2212
2214SUBROUTINE vol7d_timerange_delete(this)
2215TYPE(vol7d_timerange),INTENT(INOUT) :: this
2216
2217this%timerange = imiss
2218this%p1 = imiss
2219this%p2 = imiss
2220
2221END SUBROUTINE vol7d_timerange_delete
2222
2223
2224SUBROUTINE display_timerange(this)
2225TYPE(vol7d_timerange),INTENT(in) :: this
2226
2227print*,to_char_timerange(this)
2228
2229END SUBROUTINE display_timerange
2230
2231
2232FUNCTION to_char_timerange(this)
2233#ifdef HAVE_DBALLE
2234USE dballef
2235#endif
2236TYPE(vol7d_timerange),INTENT(in) :: this
2237CHARACTER(len=80) :: to_char_timerange
2238
2239#ifdef HAVE_DBALLE
2240INTEGER :: handle, ier
2241
2242handle = 0
2243ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
2244ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
2245ier = idba_fatto(handle)
2246
2247to_char_timerange="Timerange: "//to_char_timerange
2248
2249#else
2250
2251to_char_timerange="Timerange: "//trim(to_char(this%timerange))//" P1: "//&
2252 trim(to_char(this%p1))//" P2: "//trim(to_char(this%p2))
2253
2254#endif
2255
2256END FUNCTION to_char_timerange
2257
2258
2259ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
2260TYPE(vol7d_timerange),INTENT(IN) :: this, that
2261LOGICAL :: res
2262
2263
2264res = &
2265 this%timerange == that%timerange .AND. &
2266 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
2267 this%timerange == 254)
2268
2269END FUNCTION vol7d_timerange_eq
2270
2271
2272ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
2273TYPE(vol7d_timerange),INTENT(IN) :: this, that
2274LOGICAL :: res
2275
2276IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
2277 this%p1 == that%p1 .AND. &
2278 this%p2 == that%p2) THEN
2279 res = .true.
2280ELSE
2281 res = .false.
2282ENDIF
2283
2284END FUNCTION vol7d_timerange_almost_eq
2285
2286
2287ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
2288TYPE(vol7d_timerange),INTENT(IN) :: this, that
2289LOGICAL :: res
2290
2291res = .NOT.(this == that)
2292
2293END FUNCTION vol7d_timerange_ne
2294
2295
2296ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
2297TYPE(vol7d_timerange),INTENT(IN) :: this, that
2298LOGICAL :: res
2299
2300IF (this%timerange > that%timerange .OR. &
2301 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
2302 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
2303 this%p2 > that%p2)) THEN
2304 res = .true.
2305ELSE
2306 res = .false.
2307ENDIF
2308
2309END FUNCTION vol7d_timerange_gt
2310
2311
2312ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
2313TYPE(vol7d_timerange),INTENT(IN) :: this, that
2314LOGICAL :: res
2315
2316IF (this%timerange < that%timerange .OR. &
2317 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
2318 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
2319 this%p2 < that%p2)) THEN
2320 res = .true.
2321ELSE
2322 res = .false.
2323ENDIF
2324
2325END FUNCTION vol7d_timerange_lt
2326
2327
2328ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
2329TYPE(vol7d_timerange),INTENT(IN) :: this, that
2330LOGICAL :: res
2331
2332IF (this == that) THEN
2333 res = .true.
2334ELSE IF (this > that) THEN
2335 res = .true.
2336ELSE
2337 res = .false.
2338ENDIF
2339
2340END FUNCTION vol7d_timerange_ge
2341
2342
2343ELEMENTAL FUNCTION vol7d_timerange_le(this, that) RESULT(res)
2344TYPE(vol7d_timerange),INTENT(IN) :: this, that
2345LOGICAL :: res
2346
2347IF (this == that) THEN
2348 res = .true.
2349ELSE IF (this < that) THEN
2350 res = .true.
2351ELSE
2352 res = .false.
2353ENDIF
2354
2355END FUNCTION vol7d_timerange_le
2356
2357
2358ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
2359TYPE(vol7d_timerange),INTENT(IN) :: this
2360LOGICAL :: c_e
2361c_e = this /= vol7d_timerange_miss
2362END FUNCTION vol7d_timerange_c_e
2363
2364
2365#include "array_utilities_inc.F90"
2366
2367#include "arrayof_post.F90"
2368
2369
2370END 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:251
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.