libsim Versione 7.1.11

◆ 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 528 del file vol7d_timerange_class.F90.

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