libsim Versione 7.1.11
|
◆ vol7d_timerange_new()
Inizializza un oggetto vol7d_timerange con i parametri opzionali forniti. Questa è la versione
Definizione alla linea 513 del file vol7d_timerange_class.F90. 514! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
515! authors:
516! Davide Cesari <dcesari@arpa.emr.it>
517! Paolo Patruno <ppatruno@arpa.emr.it>
518
519! This program is free software; you can redistribute it and/or
520! modify it under the terms of the GNU General Public License as
521! published by the Free Software Foundation; either version 2 of
522! the License, or (at your option) any later version.
523
524! This program is distributed in the hope that it will be useful,
525! but WITHOUT ANY WARRANTY; without even the implied warranty of
526! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
527! GNU General Public License for more details.
528
529! You should have received a copy of the GNU General Public License
530! along with this program. If not, see <http://www.gnu.org/licenses/>.
531#include "config.h"
532
544IMPLICIT NONE
545
551 INTEGER :: timerange
552 INTEGER :: p1
553 INTEGER :: p2
555
557TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
558 vol7d_timerange(imiss,imiss,imiss)
559
564 MODULE PROCEDURE vol7d_timerange_init
565END INTERFACE
566
570 MODULE PROCEDURE vol7d_timerange_delete
571END INTERFACE
572
576INTERFACE OPERATOR (==)
577 MODULE PROCEDURE vol7d_timerange_eq
578END INTERFACE
579
583INTERFACE OPERATOR (/=)
584 MODULE PROCEDURE vol7d_timerange_ne
585END INTERFACE
586
590INTERFACE OPERATOR (>)
591 MODULE PROCEDURE vol7d_timerange_gt
592END INTERFACE
593
597INTERFACE OPERATOR (<)
598 MODULE PROCEDURE vol7d_timerange_lt
599END INTERFACE
600
604INTERFACE OPERATOR (>=)
605 MODULE PROCEDURE vol7d_timerange_ge
606END INTERFACE
607
611INTERFACE OPERATOR (<=)
612 MODULE PROCEDURE vol7d_timerange_le
613END INTERFACE
614
617INTERFACE OPERATOR (.almosteq.)
618 MODULE PROCEDURE vol7d_timerange_almost_eq
619END INTERFACE
620
621
622! da documentare in inglese assieme al resto
625 MODULE PROCEDURE vol7d_timerange_c_e
626END INTERFACE
627
628#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
629#define VOL7D_POLY_TYPES _timerange
630#define ENABLE_SORT
631#include "array_utilities_pre.F90"
632
635 MODULE PROCEDURE display_timerange
636END INTERFACE
637
640 MODULE PROCEDURE to_char_timerange
641END INTERFACE
642
643#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
644#define ARRAYOF_TYPE arrayof_vol7d_timerange
645#define ARRAYOF_ORIGEQ 1
646#include "arrayof_pre.F90"
647
648
649type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
650 vol7d_timerange(254,0,imiss),&
651 vol7d_timerange(3,0,3600)/)
652
653
654! from arrayof
656PUBLIC insert_unique, append_unique
657PUBLIC almost_equal_timeranges
658
659CONTAINS
660
661
667FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
668INTEGER,INTENT(IN),OPTIONAL :: timerange
669INTEGER,INTENT(IN),OPTIONAL :: p1
670INTEGER,INTENT(IN),OPTIONAL :: p2
671
672TYPE(vol7d_timerange) :: this
673
675
676END FUNCTION vol7d_timerange_new
677
678
682SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
683TYPE(vol7d_timerange),INTENT(INOUT) :: this
684INTEGER,INTENT(IN),OPTIONAL :: timerange
685INTEGER,INTENT(IN),OPTIONAL :: p1
686INTEGER,INTENT(IN),OPTIONAL :: p2
687
688IF (PRESENT(timerange)) THEN
689 this%timerange = timerange
690ELSE
691 this%timerange = imiss
692 this%p1 = imiss
693 this%p2 = imiss
694 RETURN
695ENDIF
696!!$IF (timerange == 1) THEN ! p1 sempre 0
697!!$ this%p1 = 0
698!!$ this%p2 = imiss
699!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
700!!$ IF (PRESENT(p1)) THEN
701!!$ this%p1 = p1
702!!$ ELSE
703!!$ this%p1 = 0
704!!$ ENDIF
705!!$ this%p2 = imiss
706!!$ELSE ! tutti gli altri
707 IF (PRESENT(p1)) THEN
708 this%p1 = p1
709 ELSE
710 this%p1 = imiss
711 ENDIF
712 IF (PRESENT(p2)) THEN
713 this%p2 = p2
714 ELSE
715 this%p2 = imiss
716 ENDIF
717!!$END IF
718
719END SUBROUTINE vol7d_timerange_init
720
721
723SUBROUTINE vol7d_timerange_delete(this)
724TYPE(vol7d_timerange),INTENT(INOUT) :: this
725
726this%timerange = imiss
727this%p1 = imiss
728this%p2 = imiss
729
730END SUBROUTINE vol7d_timerange_delete
731
732
733SUBROUTINE display_timerange(this)
734TYPE(vol7d_timerange),INTENT(in) :: this
735
736print*,to_char_timerange(this)
737
738END SUBROUTINE display_timerange
739
740
741FUNCTION to_char_timerange(this)
742#ifdef HAVE_DBALLE
743USE dballef
744#endif
745TYPE(vol7d_timerange),INTENT(in) :: this
746CHARACTER(len=80) :: to_char_timerange
747
748#ifdef HAVE_DBALLE
749INTEGER :: handle, ier
750
751handle = 0
752ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
753ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
754ier = idba_fatto(handle)
755
756to_char_timerange="Timerange: "//to_char_timerange
757
758#else
759
762
763#endif
764
765END FUNCTION to_char_timerange
766
767
768ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
769TYPE(vol7d_timerange),INTENT(IN) :: this, that
770LOGICAL :: res
771
772
773res = &
774 this%timerange == that%timerange .AND. &
775 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
776 this%timerange == 254)
777
778END FUNCTION vol7d_timerange_eq
779
780
781ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
782TYPE(vol7d_timerange),INTENT(IN) :: this, that
783LOGICAL :: res
784
785IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
786 this%p1 == that%p1 .AND. &
787 this%p2 == that%p2) THEN
788 res = .true.
789ELSE
790 res = .false.
791ENDIF
792
793END FUNCTION vol7d_timerange_almost_eq
794
795
796ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
797TYPE(vol7d_timerange),INTENT(IN) :: this, that
798LOGICAL :: res
799
800res = .NOT.(this == that)
801
802END FUNCTION vol7d_timerange_ne
803
804
805ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
806TYPE(vol7d_timerange),INTENT(IN) :: this, that
807LOGICAL :: res
808
809IF (this%timerange > that%timerange .OR. &
810 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
811 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
812 this%p2 > that%p2)) THEN
813 res = .true.
814ELSE
815 res = .false.
816ENDIF
817
818END FUNCTION vol7d_timerange_gt
819
820
821ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
822TYPE(vol7d_timerange),INTENT(IN) :: this, that
823LOGICAL :: res
824
825IF (this%timerange < that%timerange .OR. &
826 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
827 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
828 this%p2 < that%p2)) THEN
829 res = .true.
830ELSE
831 res = .false.
832ENDIF
833
834END FUNCTION vol7d_timerange_lt
835
836
837ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
838TYPE(vol7d_timerange),INTENT(IN) :: this, that
839LOGICAL :: res
840
841IF (this == that) THEN
842 res = .true.
843ELSE IF (this > that) THEN
844 res = .true.
845ELSE
846 res = .false.
847ENDIF
848
849END FUNCTION vol7d_timerange_ge
850
851
852ELEMENTAL FUNCTION vol7d_timerange_le(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_le
865
866
867ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
868TYPE(vol7d_timerange),INTENT(IN) :: this
869LOGICAL :: c_e
870c_e = this /= vol7d_timerange_miss
871END FUNCTION vol7d_timerange_c_e
872
873
874#include "array_utilities_inc.F90"
875
876#include "arrayof_post.F90"
877
878
Quick method to append an element to the array. Definition: vol7d_timerange_class.F90:431 Distruttore per la classe vol7d_timerange. Definition: vol7d_timerange_class.F90:250 Costruttore per la classe vol7d_timerange. Definition: vol7d_timerange_class.F90:244 Method for inserting elements of the array at a desired position. Definition: vol7d_timerange_class.F90:422 Method for packing the array object reducing at a minimum the memory occupation, without destroying i... Definition: vol7d_timerange_class.F90:454 Method for removing elements of the array at a desired position. Definition: vol7d_timerange_class.F90:437 Represent timerange object in a pretty string. Definition: vol7d_timerange_class.F90:375 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. Definition: missing_values.f90:50 Classe per la gestione degli intervalli temporali di osservazioni meteo e affini. Definition: vol7d_timerange_class.F90:221 Definisce l'intervallo temporale di un'osservazione meteo. Definition: vol7d_timerange_class.F90:231 |