libsim Versione 7.2.6
|
◆ overalloc
overallocation factor, values close to 1 determine more calls to the system alloc function (decreased performances) at the advantage of less memory consumption, the default is 2; the results are not affected by the value of this member Definizione alla linea 411 del file vol7d_timerange_class.F90. 411! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
412! authors:
413! Davide Cesari <dcesari@arpa.emr.it>
414! Paolo Patruno <ppatruno@arpa.emr.it>
415
416! This program is free software; you can redistribute it and/or
417! modify it under the terms of the GNU General Public License as
418! published by the Free Software Foundation; either version 2 of
419! the License, or (at your option) any later version.
420
421! This program is distributed in the hope that it will be useful,
422! but WITHOUT ANY WARRANTY; without even the implied warranty of
423! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
424! GNU General Public License for more details.
425
426! You should have received a copy of the GNU General Public License
427! along with this program. If not, see <http://www.gnu.org/licenses/>.
428#include "config.h"
429
430!> Classe per la gestione degli intervalli temporali di osservazioni
431!! meteo e affini.
432!! Questo modulo definisce una classe in grado di rappresentare
433!! l'intervallo di tempo a cui si riferisce un'osservazione meteo,
434!! ad es. valore istantaneo, cumulato, medio, ecc., prendendo in prestito
435!! concetti dal formato grib.
436!! \ingroup vol7d
441IMPLICIT NONE
442
443!> Definisce l'intervallo temporale di un'osservazione meteo.
444!! I membri di \a vol7d_timerange sono pubblici e quindi liberamente
445!! accessibili e scrivibili, ma è comunque consigliato assegnarli tramite
446!! il costruttore ::init.
448 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
449 INTEGER :: p1 !< termine del periodo di validità del dato, in secondi, a partire dall'istante di riferimento (0 per dati osservati o analizzati)
450 INTEGER :: p2 !< durata del periodo di validità del dato, in secondi (0 per dati istantanei)
452
453!> Valore mancante per vol7d_timerange.
454TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
455 vol7d_timerange(imiss,imiss,imiss)
456
457!> Costruttore per la classe vol7d_timerange.
458!! Deve essere richiamato
459!! per tutti gli oggetti di questo tipo definiti in un programma.
461 MODULE PROCEDURE vol7d_timerange_init
462END INTERFACE
463
464!> Distruttore per la classe vol7d_timerange.
465!! Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
467 MODULE PROCEDURE vol7d_timerange_delete
468END INTERFACE
469
470!> Logical equality operator for objects of \a vol7d_timerange class.
471!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
472!! of any shape.
473INTERFACE OPERATOR (==)
474 MODULE PROCEDURE vol7d_timerange_eq
475END INTERFACE
476
477!> Logical inequality operator for objects of \a vol7d_timerange class.
478!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
479!! of any shape.
480INTERFACE OPERATOR (/=)
481 MODULE PROCEDURE vol7d_timerange_ne
482END INTERFACE
483
484!> Logical greater-than operator for objects of \a vol7d_timerange class.
485!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
486!! of any shape.
487INTERFACE OPERATOR (>)
488 MODULE PROCEDURE vol7d_timerange_gt
489END INTERFACE
490
491!> Logical less-than operator for objects of \a vol7d_timerange class.
492!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
493!! of any shape.
494INTERFACE OPERATOR (<)
495 MODULE PROCEDURE vol7d_timerange_lt
496END INTERFACE
497
498!> Logical greater-equal operator for objects of \a vol7d_timerange class.
499!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
500!! of any shape.
501INTERFACE OPERATOR (>=)
502 MODULE PROCEDURE vol7d_timerange_ge
503END INTERFACE
504
505!> Logical less-equal operator for objects of \a vol7d_timerange class.
506!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
507!! of any shape.
508INTERFACE OPERATOR (<=)
509 MODULE PROCEDURE vol7d_timerange_le
510END INTERFACE
511
512!> Logical almost equality operator for objects of \a vol7d_timerange class.
513!! If one component is missing it is not used in comparison.
514INTERFACE OPERATOR (.almosteq.)
515 MODULE PROCEDURE vol7d_timerange_almost_eq
516END INTERFACE
517
518
519! da documentare in inglese assieme al resto
520!> to be documented
522 MODULE PROCEDURE vol7d_timerange_c_e
523END INTERFACE
524
525#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
526#define VOL7D_POLY_TYPES _timerange
527#define ENABLE_SORT
528#include "array_utilities_pre.F90"
529
530!>Print object
532 MODULE PROCEDURE display_timerange
533END INTERFACE
534
535!>Represent timerange object in a pretty string
537 MODULE PROCEDURE to_char_timerange
538END INTERFACE
539
540#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
541#define ARRAYOF_TYPE arrayof_vol7d_timerange
542#define ARRAYOF_ORIGEQ 1
543#include "arrayof_pre.F90"
544
545
546type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
547 vol7d_timerange(254,0,imiss),&
548 vol7d_timerange(3,0,3600)/)
549
550
551! from arrayof
553PUBLIC insert_unique, append_unique
554PUBLIC almost_equal_timeranges
555
556CONTAINS
557
558
559!> Inizializza un oggetto \a vol7d_timerange con i parametri opzionali forniti.
560!! Questa è la versione \c FUNCTION, in stile F2003, del costruttore, da preferire
561!! rispetto alla versione \c SUBROUTINE \c init.
562!! Se non viene passato nessun parametro opzionale l'oggetto è
563!! inizializzato a valore mancante.
564FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
565INTEGER,INTENT(IN),OPTIONAL :: timerange !< tipo di intervallo temporale
566INTEGER,INTENT(IN),OPTIONAL :: p1 !< valore per il primo istante temporale
567INTEGER,INTENT(IN),OPTIONAL :: p2 !< valore per il secondo istante temporale
568
569TYPE(vol7d_timerange) :: this !< oggetto da inizializzare
570
572
573END FUNCTION vol7d_timerange_new
574
575
576!> Inizializza un oggetto \a vol7d_timerange con i parametri opzionali forniti.
577!! Se non viene passato nessun parametro opzionale l'oggetto è
578!! inizializzato a valore mancante.
579SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
580TYPE(vol7d_timerange),INTENT(INOUT) :: this !< oggetto da inizializzare
581INTEGER,INTENT(IN),OPTIONAL :: timerange !< tipo di intervallo temporale
582INTEGER,INTENT(IN),OPTIONAL :: p1 !< valore per il primo istante temporale
583INTEGER,INTENT(IN),OPTIONAL :: p2 !< valore per il secondo istante temporale
584
585IF (PRESENT(timerange)) THEN
586 this%timerange = timerange
587ELSE
588 this%timerange = imiss
589 this%p1 = imiss
590 this%p2 = imiss
591 RETURN
592ENDIF
593!!$IF (timerange == 1) THEN ! p1 sempre 0
594!!$ this%p1 = 0
595!!$ this%p2 = imiss
596!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
597!!$ IF (PRESENT(p1)) THEN
598!!$ this%p1 = p1
599!!$ ELSE
600!!$ this%p1 = 0
601!!$ ENDIF
602!!$ this%p2 = imiss
603!!$ELSE ! tutti gli altri
604 IF (PRESENT(p1)) THEN
605 this%p1 = p1
606 ELSE
607 this%p1 = imiss
608 ENDIF
609 IF (PRESENT(p2)) THEN
610 this%p2 = p2
611 ELSE
612 this%p2 = imiss
613 ENDIF
614!!$END IF
615
616END SUBROUTINE vol7d_timerange_init
617
618
619!> Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
620SUBROUTINE vol7d_timerange_delete(this)
621TYPE(vol7d_timerange),INTENT(INOUT) :: this
622
623this%timerange = imiss
624this%p1 = imiss
625this%p2 = imiss
626
627END SUBROUTINE vol7d_timerange_delete
628
629
630SUBROUTINE display_timerange(this)
631TYPE(vol7d_timerange),INTENT(in) :: this
632
633print*,to_char_timerange(this)
634
635END SUBROUTINE display_timerange
636
637
638FUNCTION to_char_timerange(this)
639#ifdef HAVE_DBALLE
640USE dballef
641#endif
642TYPE(vol7d_timerange),INTENT(in) :: this
643CHARACTER(len=80) :: to_char_timerange
644
645#ifdef HAVE_DBALLE
646INTEGER :: handle, ier
647
648handle = 0
649ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
650ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
651ier = idba_fatto(handle)
652
653to_char_timerange="Timerange: "//to_char_timerange
654
655#else
656
659
660#endif
661
662END FUNCTION to_char_timerange
663
664
665ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
666TYPE(vol7d_timerange),INTENT(IN) :: this, that
667LOGICAL :: res
668
669
670res = &
671 this%timerange == that%timerange .AND. &
672 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
673 this%timerange == 254)
674
675END FUNCTION vol7d_timerange_eq
676
677
678ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
679TYPE(vol7d_timerange),INTENT(IN) :: this, that
680LOGICAL :: res
681
682IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
683 this%p1 == that%p1 .AND. &
684 this%p2 == that%p2) THEN
685 res = .true.
686ELSE
687 res = .false.
688ENDIF
689
690END FUNCTION vol7d_timerange_almost_eq
691
692
693ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
694TYPE(vol7d_timerange),INTENT(IN) :: this, that
695LOGICAL :: res
696
697res = .NOT.(this == that)
698
699END FUNCTION vol7d_timerange_ne
700
701
702ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
703TYPE(vol7d_timerange),INTENT(IN) :: this, that
704LOGICAL :: res
705
706IF (this%timerange > that%timerange .OR. &
707 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
708 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
709 this%p2 > that%p2)) THEN
710 res = .true.
711ELSE
712 res = .false.
713ENDIF
714
715END FUNCTION vol7d_timerange_gt
716
717
718ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
719TYPE(vol7d_timerange),INTENT(IN) :: this, that
720LOGICAL :: res
721
722IF (this%timerange < that%timerange .OR. &
723 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
724 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
725 this%p2 < that%p2)) THEN
726 res = .true.
727ELSE
728 res = .false.
729ENDIF
730
731END FUNCTION vol7d_timerange_lt
732
733
734ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
735TYPE(vol7d_timerange),INTENT(IN) :: this, that
736LOGICAL :: res
737
738IF (this == that) THEN
739 res = .true.
740ELSE IF (this > that) THEN
741 res = .true.
742ELSE
743 res = .false.
744ENDIF
745
746END FUNCTION vol7d_timerange_ge
747
748
749ELEMENTAL FUNCTION vol7d_timerange_le(this, that) RESULT(res)
750TYPE(vol7d_timerange),INTENT(IN) :: this, that
751LOGICAL :: res
752
753IF (this == that) THEN
754 res = .true.
755ELSE IF (this < that) THEN
756 res = .true.
757ELSE
758 res = .false.
759ENDIF
760
761END FUNCTION vol7d_timerange_le
762
763
764ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
765TYPE(vol7d_timerange),INTENT(IN) :: this
766LOGICAL :: c_e
767c_e = this /= vol7d_timerange_miss
768END FUNCTION vol7d_timerange_c_e
769
770
771#include "array_utilities_inc.F90"
772
773#include "arrayof_post.F90"
774
775
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 |