libsim Versione 7.1.11
|
◆ index_timerange()
Cerca l'indice del primo o ultimo elemento di vect uguale a search. Definizione alla linea 1220 del file vol7d_timerange_class.F90. 1222! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
1223! authors:
1224! Davide Cesari <dcesari@arpa.emr.it>
1225! Paolo Patruno <ppatruno@arpa.emr.it>
1226
1227! This program is free software; you can redistribute it and/or
1228! modify it under the terms of the GNU General Public License as
1229! published by the Free Software Foundation; either version 2 of
1230! the License, or (at your option) any later version.
1231
1232! This program is distributed in the hope that it will be useful,
1233! but WITHOUT ANY WARRANTY; without even the implied warranty of
1234! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1235! GNU General Public License for more details.
1236
1237! You should have received a copy of the GNU General Public License
1238! along with this program. If not, see <http://www.gnu.org/licenses/>.
1239#include "config.h"
1240
1252IMPLICIT NONE
1253
1259 INTEGER :: timerange
1260 INTEGER :: p1
1261 INTEGER :: p2
1263
1265TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
1266 vol7d_timerange(imiss,imiss,imiss)
1267
1272 MODULE PROCEDURE vol7d_timerange_init
1273END INTERFACE
1274
1278 MODULE PROCEDURE vol7d_timerange_delete
1279END INTERFACE
1280
1284INTERFACE OPERATOR (==)
1285 MODULE PROCEDURE vol7d_timerange_eq
1286END INTERFACE
1287
1291INTERFACE OPERATOR (/=)
1292 MODULE PROCEDURE vol7d_timerange_ne
1293END INTERFACE
1294
1298INTERFACE OPERATOR (>)
1299 MODULE PROCEDURE vol7d_timerange_gt
1300END INTERFACE
1301
1305INTERFACE OPERATOR (<)
1306 MODULE PROCEDURE vol7d_timerange_lt
1307END INTERFACE
1308
1312INTERFACE OPERATOR (>=)
1313 MODULE PROCEDURE vol7d_timerange_ge
1314END INTERFACE
1315
1319INTERFACE OPERATOR (<=)
1320 MODULE PROCEDURE vol7d_timerange_le
1321END INTERFACE
1322
1325INTERFACE OPERATOR (.almosteq.)
1326 MODULE PROCEDURE vol7d_timerange_almost_eq
1327END INTERFACE
1328
1329
1330! da documentare in inglese assieme al resto
1333 MODULE PROCEDURE vol7d_timerange_c_e
1334END INTERFACE
1335
1336#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
1337#define VOL7D_POLY_TYPES _timerange
1338#define ENABLE_SORT
1339#include "array_utilities_pre.F90"
1340
1343 MODULE PROCEDURE display_timerange
1344END INTERFACE
1345
1348 MODULE PROCEDURE to_char_timerange
1349END INTERFACE
1350
1351#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
1352#define ARRAYOF_TYPE arrayof_vol7d_timerange
1353#define ARRAYOF_ORIGEQ 1
1354#include "arrayof_pre.F90"
1355
1356
1357type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
1358 vol7d_timerange(254,0,imiss),&
1359 vol7d_timerange(3,0,3600)/)
1360
1361
1362! from arrayof
1364PUBLIC insert_unique, append_unique
1365PUBLIC almost_equal_timeranges
1366
1367CONTAINS
1368
1369
1375FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
1376INTEGER,INTENT(IN),OPTIONAL :: timerange
1377INTEGER,INTENT(IN),OPTIONAL :: p1
1378INTEGER,INTENT(IN),OPTIONAL :: p2
1379
1380TYPE(vol7d_timerange) :: this
1381
1383
1384END FUNCTION vol7d_timerange_new
1385
1386
1390SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
1391TYPE(vol7d_timerange),INTENT(INOUT) :: this
1392INTEGER,INTENT(IN),OPTIONAL :: timerange
1393INTEGER,INTENT(IN),OPTIONAL :: p1
1394INTEGER,INTENT(IN),OPTIONAL :: p2
1395
1396IF (PRESENT(timerange)) THEN
1397 this%timerange = timerange
1398ELSE
1399 this%timerange = imiss
1400 this%p1 = imiss
1401 this%p2 = imiss
1402 RETURN
1403ENDIF
1404!!$IF (timerange == 1) THEN ! p1 sempre 0
1405!!$ this%p1 = 0
1406!!$ this%p2 = imiss
1407!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
1408!!$ IF (PRESENT(p1)) THEN
1409!!$ this%p1 = p1
1410!!$ ELSE
1411!!$ this%p1 = 0
1412!!$ ENDIF
1413!!$ this%p2 = imiss
1414!!$ELSE ! tutti gli altri
1415 IF (PRESENT(p1)) THEN
1416 this%p1 = p1
1417 ELSE
1418 this%p1 = imiss
1419 ENDIF
1420 IF (PRESENT(p2)) THEN
1421 this%p2 = p2
1422 ELSE
1423 this%p2 = imiss
1424 ENDIF
1425!!$END IF
1426
1427END SUBROUTINE vol7d_timerange_init
1428
1429
1431SUBROUTINE vol7d_timerange_delete(this)
1432TYPE(vol7d_timerange),INTENT(INOUT) :: this
1433
1434this%timerange = imiss
1435this%p1 = imiss
1436this%p2 = imiss
1437
1438END SUBROUTINE vol7d_timerange_delete
1439
1440
1441SUBROUTINE display_timerange(this)
1442TYPE(vol7d_timerange),INTENT(in) :: this
1443
1444print*,to_char_timerange(this)
1445
1446END SUBROUTINE display_timerange
1447
1448
1449FUNCTION to_char_timerange(this)
1450#ifdef HAVE_DBALLE
1451USE dballef
1452#endif
1453TYPE(vol7d_timerange),INTENT(in) :: this
1454CHARACTER(len=80) :: to_char_timerange
1455
1456#ifdef HAVE_DBALLE
1457INTEGER :: handle, ier
1458
1459handle = 0
1460ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
1461ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
1462ier = idba_fatto(handle)
1463
1464to_char_timerange="Timerange: "//to_char_timerange
1465
1466#else
1467
1470
1471#endif
1472
1473END FUNCTION to_char_timerange
1474
1475
1476ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
1477TYPE(vol7d_timerange),INTENT(IN) :: this, that
1478LOGICAL :: res
1479
1480
1481res = &
1482 this%timerange == that%timerange .AND. &
1483 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
1484 this%timerange == 254)
1485
1486END FUNCTION vol7d_timerange_eq
1487
1488
1489ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
1490TYPE(vol7d_timerange),INTENT(IN) :: this, that
1491LOGICAL :: res
1492
1493IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
1494 this%p1 == that%p1 .AND. &
1495 this%p2 == that%p2) THEN
1496 res = .true.
1497ELSE
1498 res = .false.
1499ENDIF
1500
1501END FUNCTION vol7d_timerange_almost_eq
1502
1503
1504ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
1505TYPE(vol7d_timerange),INTENT(IN) :: this, that
1506LOGICAL :: res
1507
1508res = .NOT.(this == that)
1509
1510END FUNCTION vol7d_timerange_ne
1511
1512
1513ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
1514TYPE(vol7d_timerange),INTENT(IN) :: this, that
1515LOGICAL :: res
1516
1517IF (this%timerange > that%timerange .OR. &
1518 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
1519 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
1520 this%p2 > that%p2)) THEN
1521 res = .true.
1522ELSE
1523 res = .false.
1524ENDIF
1525
1526END FUNCTION vol7d_timerange_gt
1527
1528
1529ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
1530TYPE(vol7d_timerange),INTENT(IN) :: this, that
1531LOGICAL :: res
1532
1533IF (this%timerange < that%timerange .OR. &
1534 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
1535 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
1536 this%p2 < that%p2)) THEN
1537 res = .true.
1538ELSE
1539 res = .false.
1540ENDIF
1541
1542END FUNCTION vol7d_timerange_lt
1543
1544
1545ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
1546TYPE(vol7d_timerange),INTENT(IN) :: this, that
1547LOGICAL :: res
1548
1549IF (this == that) THEN
1550 res = .true.
1551ELSE IF (this > that) THEN
1552 res = .true.
1553ELSE
1554 res = .false.
1555ENDIF
1556
1557END FUNCTION vol7d_timerange_ge
1558
1559
1560ELEMENTAL FUNCTION vol7d_timerange_le(this, that) RESULT(res)
1561TYPE(vol7d_timerange),INTENT(IN) :: this, that
1562LOGICAL :: res
1563
1564IF (this == that) THEN
1565 res = .true.
1566ELSE IF (this < that) THEN
1567 res = .true.
1568ELSE
1569 res = .false.
1570ENDIF
1571
1572END FUNCTION vol7d_timerange_le
1573
1574
1575ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
1576TYPE(vol7d_timerange),INTENT(IN) :: this
1577LOGICAL :: c_e
1578c_e = this /= vol7d_timerange_miss
1579END FUNCTION vol7d_timerange_c_e
1580
1581
1582#include "array_utilities_inc.F90"
1583
1584#include "arrayof_post.F90"
1585
1586
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 |