libsim Versione 7.2.6
|
◆ vol7d_timerange_delete()
Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante. Definizione alla linea 563 del file vol7d_timerange_class.F90. 564! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
565! authors:
566! Davide Cesari <dcesari@arpa.emr.it>
567! Paolo Patruno <ppatruno@arpa.emr.it>
568
569! This program is free software; you can redistribute it and/or
570! modify it under the terms of the GNU General Public License as
571! published by the Free Software Foundation; either version 2 of
572! the License, or (at your option) any later version.
573
574! This program is distributed in the hope that it will be useful,
575! but WITHOUT ANY WARRANTY; without even the implied warranty of
576! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
577! GNU General Public License for more details.
578
579! You should have received a copy of the GNU General Public License
580! along with this program. If not, see <http://www.gnu.org/licenses/>.
581#include "config.h"
582
583!> Classe per la gestione degli intervalli temporali di osservazioni
584!! meteo e affini.
585!! Questo modulo definisce una classe in grado di rappresentare
586!! l'intervallo di tempo a cui si riferisce un'osservazione meteo,
587!! ad es. valore istantaneo, cumulato, medio, ecc., prendendo in prestito
588!! concetti dal formato grib.
589!! \ingroup vol7d
594IMPLICIT NONE
595
596!> Definisce l'intervallo temporale di un'osservazione meteo.
597!! I membri di \a vol7d_timerange sono pubblici e quindi liberamente
598!! accessibili e scrivibili, ma è comunque consigliato assegnarli tramite
599!! il costruttore ::init.
601 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
602 INTEGER :: p1 !< termine del periodo di validità del dato, in secondi, a partire dall'istante di riferimento (0 per dati osservati o analizzati)
603 INTEGER :: p2 !< durata del periodo di validità del dato, in secondi (0 per dati istantanei)
605
606!> Valore mancante per vol7d_timerange.
607TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
608 vol7d_timerange(imiss,imiss,imiss)
609
610!> Costruttore per la classe vol7d_timerange.
611!! Deve essere richiamato
612!! per tutti gli oggetti di questo tipo definiti in un programma.
614 MODULE PROCEDURE vol7d_timerange_init
615END INTERFACE
616
617!> Distruttore per la classe vol7d_timerange.
618!! Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
620 MODULE PROCEDURE vol7d_timerange_delete
621END INTERFACE
622
623!> Logical equality operator for objects of \a vol7d_timerange class.
624!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
625!! of any shape.
626INTERFACE OPERATOR (==)
627 MODULE PROCEDURE vol7d_timerange_eq
628END INTERFACE
629
630!> Logical inequality operator for objects of \a vol7d_timerange class.
631!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
632!! of any shape.
633INTERFACE OPERATOR (/=)
634 MODULE PROCEDURE vol7d_timerange_ne
635END INTERFACE
636
637!> Logical greater-than operator for objects of \a vol7d_timerange class.
638!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
639!! of any shape.
640INTERFACE OPERATOR (>)
641 MODULE PROCEDURE vol7d_timerange_gt
642END INTERFACE
643
644!> Logical less-than operator for objects of \a vol7d_timerange class.
645!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
646!! of any shape.
647INTERFACE OPERATOR (<)
648 MODULE PROCEDURE vol7d_timerange_lt
649END INTERFACE
650
651!> Logical greater-equal operator for objects of \a vol7d_timerange class.
652!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
653!! of any shape.
654INTERFACE OPERATOR (>=)
655 MODULE PROCEDURE vol7d_timerange_ge
656END INTERFACE
657
658!> Logical less-equal operator for objects of \a vol7d_timerange class.
659!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
660!! of any shape.
661INTERFACE OPERATOR (<=)
662 MODULE PROCEDURE vol7d_timerange_le
663END INTERFACE
664
665!> Logical almost equality operator for objects of \a vol7d_timerange class.
666!! If one component is missing it is not used in comparison.
667INTERFACE OPERATOR (.almosteq.)
668 MODULE PROCEDURE vol7d_timerange_almost_eq
669END INTERFACE
670
671
672! da documentare in inglese assieme al resto
673!> to be documented
675 MODULE PROCEDURE vol7d_timerange_c_e
676END INTERFACE
677
678#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
679#define VOL7D_POLY_TYPES _timerange
680#define ENABLE_SORT
681#include "array_utilities_pre.F90"
682
683!>Print object
685 MODULE PROCEDURE display_timerange
686END INTERFACE
687
688!>Represent timerange object in a pretty string
690 MODULE PROCEDURE to_char_timerange
691END INTERFACE
692
693#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
694#define ARRAYOF_TYPE arrayof_vol7d_timerange
695#define ARRAYOF_ORIGEQ 1
696#include "arrayof_pre.F90"
697
698
699type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
700 vol7d_timerange(254,0,imiss),&
701 vol7d_timerange(3,0,3600)/)
702
703
704! from arrayof
706PUBLIC insert_unique, append_unique
707PUBLIC almost_equal_timeranges
708
709CONTAINS
710
711
712!> Inizializza un oggetto \a vol7d_timerange con i parametri opzionali forniti.
713!! Questa è la versione \c FUNCTION, in stile F2003, del costruttore, da preferire
714!! rispetto alla versione \c SUBROUTINE \c init.
715!! Se non viene passato nessun parametro opzionale l'oggetto è
716!! inizializzato a valore mancante.
717FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
718INTEGER,INTENT(IN),OPTIONAL :: timerange !< tipo di intervallo temporale
719INTEGER,INTENT(IN),OPTIONAL :: p1 !< valore per il primo istante temporale
720INTEGER,INTENT(IN),OPTIONAL :: p2 !< valore per il secondo istante temporale
721
722TYPE(vol7d_timerange) :: this !< oggetto da inizializzare
723
725
726END FUNCTION vol7d_timerange_new
727
728
729!> Inizializza un oggetto \a vol7d_timerange con i parametri opzionali forniti.
730!! Se non viene passato nessun parametro opzionale l'oggetto è
731!! inizializzato a valore mancante.
732SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
733TYPE(vol7d_timerange),INTENT(INOUT) :: this !< oggetto da inizializzare
734INTEGER,INTENT(IN),OPTIONAL :: timerange !< tipo di intervallo temporale
735INTEGER,INTENT(IN),OPTIONAL :: p1 !< valore per il primo istante temporale
736INTEGER,INTENT(IN),OPTIONAL :: p2 !< valore per il secondo istante temporale
737
738IF (PRESENT(timerange)) THEN
739 this%timerange = timerange
740ELSE
741 this%timerange = imiss
742 this%p1 = imiss
743 this%p2 = imiss
744 RETURN
745ENDIF
746!!$IF (timerange == 1) THEN ! p1 sempre 0
747!!$ this%p1 = 0
748!!$ this%p2 = imiss
749!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
750!!$ IF (PRESENT(p1)) THEN
751!!$ this%p1 = p1
752!!$ ELSE
753!!$ this%p1 = 0
754!!$ ENDIF
755!!$ this%p2 = imiss
756!!$ELSE ! tutti gli altri
757 IF (PRESENT(p1)) THEN
758 this%p1 = p1
759 ELSE
760 this%p1 = imiss
761 ENDIF
762 IF (PRESENT(p2)) THEN
763 this%p2 = p2
764 ELSE
765 this%p2 = imiss
766 ENDIF
767!!$END IF
768
769END SUBROUTINE vol7d_timerange_init
770
771
772!> Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
773SUBROUTINE vol7d_timerange_delete(this)
774TYPE(vol7d_timerange),INTENT(INOUT) :: this
775
776this%timerange = imiss
777this%p1 = imiss
778this%p2 = imiss
779
780END SUBROUTINE vol7d_timerange_delete
781
782
783SUBROUTINE display_timerange(this)
784TYPE(vol7d_timerange),INTENT(in) :: this
785
786print*,to_char_timerange(this)
787
788END SUBROUTINE display_timerange
789
790
791FUNCTION to_char_timerange(this)
792#ifdef HAVE_DBALLE
793USE dballef
794#endif
795TYPE(vol7d_timerange),INTENT(in) :: this
796CHARACTER(len=80) :: to_char_timerange
797
798#ifdef HAVE_DBALLE
799INTEGER :: handle, ier
800
801handle = 0
802ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
803ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
804ier = idba_fatto(handle)
805
806to_char_timerange="Timerange: "//to_char_timerange
807
808#else
809
812
813#endif
814
815END FUNCTION to_char_timerange
816
817
818ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
819TYPE(vol7d_timerange),INTENT(IN) :: this, that
820LOGICAL :: res
821
822
823res = &
824 this%timerange == that%timerange .AND. &
825 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
826 this%timerange == 254)
827
828END FUNCTION vol7d_timerange_eq
829
830
831ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
832TYPE(vol7d_timerange),INTENT(IN) :: this, that
833LOGICAL :: res
834
835IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
836 this%p1 == that%p1 .AND. &
837 this%p2 == that%p2) THEN
838 res = .true.
839ELSE
840 res = .false.
841ENDIF
842
843END FUNCTION vol7d_timerange_almost_eq
844
845
846ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
847TYPE(vol7d_timerange),INTENT(IN) :: this, that
848LOGICAL :: res
849
850res = .NOT.(this == that)
851
852END FUNCTION vol7d_timerange_ne
853
854
855ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
856TYPE(vol7d_timerange),INTENT(IN) :: this, that
857LOGICAL :: res
858
859IF (this%timerange > that%timerange .OR. &
860 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
861 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
862 this%p2 > that%p2)) THEN
863 res = .true.
864ELSE
865 res = .false.
866ENDIF
867
868END FUNCTION vol7d_timerange_gt
869
870
871ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
872TYPE(vol7d_timerange),INTENT(IN) :: this, that
873LOGICAL :: res
874
875IF (this%timerange < that%timerange .OR. &
876 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
877 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
878 this%p2 < that%p2)) THEN
879 res = .true.
880ELSE
881 res = .false.
882ENDIF
883
884END FUNCTION vol7d_timerange_lt
885
886
887ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
888TYPE(vol7d_timerange),INTENT(IN) :: this, that
889LOGICAL :: res
890
891IF (this == that) THEN
892 res = .true.
893ELSE IF (this > that) THEN
894 res = .true.
895ELSE
896 res = .false.
897ENDIF
898
899END FUNCTION vol7d_timerange_ge
900
901
902ELEMENTAL FUNCTION vol7d_timerange_le(this, that) RESULT(res)
903TYPE(vol7d_timerange),INTENT(IN) :: this, that
904LOGICAL :: res
905
906IF (this == that) THEN
907 res = .true.
908ELSE IF (this < that) THEN
909 res = .true.
910ELSE
911 res = .false.
912ENDIF
913
914END FUNCTION vol7d_timerange_le
915
916
917ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
918TYPE(vol7d_timerange),INTENT(IN) :: this
919LOGICAL :: c_e
920c_e = this /= vol7d_timerange_miss
921END FUNCTION vol7d_timerange_c_e
922
923
924#include "array_utilities_inc.F90"
925
926#include "arrayof_post.F90"
927
928
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 |