libsim Versione 7.2.6

◆ arraysize

integer arraysize =0

current logical size of the array; it may be different from the physical size SIZE(thisarray), and it should be used instead of SIZE() intrinsic function in order to evaluate the number of elements assigned to array

Definizione alla linea 408 del file vol7d_timerange_class.F90.

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