libsim Versione 7.2.0

◆ vol7d_timerange_init()

subroutine vol7d_timerange_init ( type(vol7d_timerange), intent(inout)  this,
integer, intent(in), optional  timerange,
integer, intent(in), optional  p1,
integer, intent(in), optional  p2 
)

Inizializza un oggetto vol7d_timerange con i parametri opzionali forniti.

Se non viene passato nessun parametro opzionale l'oggetto รจ inizializzato a valore mancante.

Parametri
[in,out]thisoggetto da inizializzare
[in]timerangetipo di intervallo temporale
[in]p1valore per il primo istante temporale
[in]p2valore per il secondo istante temporale

Definizione alla linea 522 del file vol7d_timerange_class.F90.

523! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
524! authors:
525! Davide Cesari <dcesari@arpa.emr.it>
526! Paolo Patruno <ppatruno@arpa.emr.it>
527
528! This program is free software; you can redistribute it and/or
529! modify it under the terms of the GNU General Public License as
530! published by the Free Software Foundation; either version 2 of
531! the License, or (at your option) any later version.
532
533! This program is distributed in the hope that it will be useful,
534! but WITHOUT ANY WARRANTY; without even the implied warranty of
535! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
536! GNU General Public License for more details.
537
538! You should have received a copy of the GNU General Public License
539! along with this program. If not, see <http://www.gnu.org/licenses/>.
540#include "config.h"
541
550USE kinds
553IMPLICIT NONE
554
560 INTEGER :: timerange
561 INTEGER :: p1
562 INTEGER :: p2
563END TYPE vol7d_timerange
564
566TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
567 vol7d_timerange(imiss,imiss,imiss)
568
572INTERFACE init
573 MODULE PROCEDURE vol7d_timerange_init
574END INTERFACE
575
578INTERFACE delete
579 MODULE PROCEDURE vol7d_timerange_delete
580END INTERFACE
581
585INTERFACE OPERATOR (==)
586 MODULE PROCEDURE vol7d_timerange_eq
587END INTERFACE
588
592INTERFACE OPERATOR (/=)
593 MODULE PROCEDURE vol7d_timerange_ne
594END INTERFACE
595
599INTERFACE OPERATOR (>)
600 MODULE PROCEDURE vol7d_timerange_gt
601END INTERFACE
602
606INTERFACE OPERATOR (<)
607 MODULE PROCEDURE vol7d_timerange_lt
608END INTERFACE
609
613INTERFACE OPERATOR (>=)
614 MODULE PROCEDURE vol7d_timerange_ge
615END INTERFACE
616
620INTERFACE OPERATOR (<=)
621 MODULE PROCEDURE vol7d_timerange_le
622END INTERFACE
623
626INTERFACE OPERATOR (.almosteq.)
627 MODULE PROCEDURE vol7d_timerange_almost_eq
628END INTERFACE
629
630
631! da documentare in inglese assieme al resto
633INTERFACE c_e
634 MODULE PROCEDURE vol7d_timerange_c_e
635END INTERFACE
636
637#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
638#define VOL7D_POLY_TYPES _timerange
639#define ENABLE_SORT
640#include "array_utilities_pre.F90"
641
643INTERFACE display
644 MODULE PROCEDURE display_timerange
645END INTERFACE
646
648INTERFACE to_char
649 MODULE PROCEDURE to_char_timerange
650END INTERFACE
651
652#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
653#define ARRAYOF_TYPE arrayof_vol7d_timerange
654#define ARRAYOF_ORIGEQ 1
655#include "arrayof_pre.F90"
656
657
658type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
659 vol7d_timerange(254,0,imiss),&
660 vol7d_timerange(3,0,3600)/)
661
662
663! from arrayof
665PUBLIC insert_unique, append_unique
666PUBLIC almost_equal_timeranges
667
668CONTAINS
669
670
676FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
677INTEGER,INTENT(IN),OPTIONAL :: timerange
678INTEGER,INTENT(IN),OPTIONAL :: p1
679INTEGER,INTENT(IN),OPTIONAL :: p2
680
681TYPE(vol7d_timerange) :: this
682
683CALL init(this, timerange, p1, p2)
684
685END FUNCTION vol7d_timerange_new
686
687
691SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
692TYPE(vol7d_timerange),INTENT(INOUT) :: this
693INTEGER,INTENT(IN),OPTIONAL :: timerange
694INTEGER,INTENT(IN),OPTIONAL :: p1
695INTEGER,INTENT(IN),OPTIONAL :: p2
696
697IF (PRESENT(timerange)) THEN
698 this%timerange = timerange
699ELSE
700 this%timerange = imiss
701 this%p1 = imiss
702 this%p2 = imiss
703 RETURN
704ENDIF
705!!$IF (timerange == 1) THEN ! p1 sempre 0
706!!$ this%p1 = 0
707!!$ this%p2 = imiss
708!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
709!!$ IF (PRESENT(p1)) THEN
710!!$ this%p1 = p1
711!!$ ELSE
712!!$ this%p1 = 0
713!!$ ENDIF
714!!$ this%p2 = imiss
715!!$ELSE ! tutti gli altri
716 IF (PRESENT(p1)) THEN
717 this%p1 = p1
718 ELSE
719 this%p1 = imiss
720 ENDIF
721 IF (PRESENT(p2)) THEN
722 this%p2 = p2
723 ELSE
724 this%p2 = imiss
725 ENDIF
726!!$END IF
727
728END SUBROUTINE vol7d_timerange_init
729
730
732SUBROUTINE vol7d_timerange_delete(this)
733TYPE(vol7d_timerange),INTENT(INOUT) :: this
734
735this%timerange = imiss
736this%p1 = imiss
737this%p2 = imiss
738
739END SUBROUTINE vol7d_timerange_delete
740
741
742SUBROUTINE display_timerange(this)
743TYPE(vol7d_timerange),INTENT(in) :: this
744
745print*,to_char_timerange(this)
746
747END SUBROUTINE display_timerange
748
749
750FUNCTION to_char_timerange(this)
751#ifdef HAVE_DBALLE
752USE dballef
753#endif
754TYPE(vol7d_timerange),INTENT(in) :: this
755CHARACTER(len=80) :: to_char_timerange
756
757#ifdef HAVE_DBALLE
758INTEGER :: handle, ier
759
760handle = 0
761ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
762ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
763ier = idba_fatto(handle)
764
765to_char_timerange="Timerange: "//to_char_timerange
766
767#else
768
769to_char_timerange="Timerange: "//trim(to_char(this%timerange))//" P1: "//&
770 trim(to_char(this%p1))//" P2: "//trim(to_char(this%p2))
771
772#endif
773
774END FUNCTION to_char_timerange
775
776
777ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
778TYPE(vol7d_timerange),INTENT(IN) :: this, that
779LOGICAL :: res
780
781
782res = &
783 this%timerange == that%timerange .AND. &
784 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
785 this%timerange == 254)
786
787END FUNCTION vol7d_timerange_eq
788
789
790ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
791TYPE(vol7d_timerange),INTENT(IN) :: this, that
792LOGICAL :: res
793
794IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
795 this%p1 == that%p1 .AND. &
796 this%p2 == that%p2) THEN
797 res = .true.
798ELSE
799 res = .false.
800ENDIF
801
802END FUNCTION vol7d_timerange_almost_eq
803
804
805ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
806TYPE(vol7d_timerange),INTENT(IN) :: this, that
807LOGICAL :: res
808
809res = .NOT.(this == that)
810
811END FUNCTION vol7d_timerange_ne
812
813
814ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
815TYPE(vol7d_timerange),INTENT(IN) :: this, that
816LOGICAL :: res
817
818IF (this%timerange > that%timerange .OR. &
819 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
820 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
821 this%p2 > that%p2)) THEN
822 res = .true.
823ELSE
824 res = .false.
825ENDIF
826
827END FUNCTION vol7d_timerange_gt
828
829
830ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
831TYPE(vol7d_timerange),INTENT(IN) :: this, that
832LOGICAL :: res
833
834IF (this%timerange < that%timerange .OR. &
835 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
836 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
837 this%p2 < that%p2)) THEN
838 res = .true.
839ELSE
840 res = .false.
841ENDIF
842
843END FUNCTION vol7d_timerange_lt
844
845
846ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
847TYPE(vol7d_timerange),INTENT(IN) :: this, that
848LOGICAL :: res
849
850IF (this == that) THEN
851 res = .true.
852ELSE IF (this > that) THEN
853 res = .true.
854ELSE
855 res = .false.
856ENDIF
857
858END FUNCTION vol7d_timerange_ge
859
860
861ELEMENTAL FUNCTION vol7d_timerange_le(this, that) RESULT(res)
862TYPE(vol7d_timerange),INTENT(IN) :: this, that
863LOGICAL :: res
864
865IF (this == that) THEN
866 res = .true.
867ELSE IF (this < that) THEN
868 res = .true.
869ELSE
870 res = .false.
871ENDIF
872
873END FUNCTION vol7d_timerange_le
874
875
876ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
877TYPE(vol7d_timerange),INTENT(IN) :: this
878LOGICAL :: c_e
879c_e = this /= vol7d_timerange_miss
880END FUNCTION vol7d_timerange_c_e
881
882
883#include "array_utilities_inc.F90"
884
885#include "arrayof_post.F90"
886
887
888END 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.