libsim Versione 7.2.0
|
◆ vol7d_timerange_new()
Inizializza un oggetto vol7d_timerange con i parametri opzionali forniti. Questa è la versione
Definizione alla linea 507 del file vol7d_timerange_class.F90. 508! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
509! authors:
510! Davide Cesari <dcesari@arpa.emr.it>
511! Paolo Patruno <ppatruno@arpa.emr.it>
512
513! This program is free software; you can redistribute it and/or
514! modify it under the terms of the GNU General Public License as
515! published by the Free Software Foundation; either version 2 of
516! the License, or (at your option) any later version.
517
518! This program is distributed in the hope that it will be useful,
519! but WITHOUT ANY WARRANTY; without even the implied warranty of
520! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
521! GNU General Public License for more details.
522
523! You should have received a copy of the GNU General Public License
524! along with this program. If not, see <http://www.gnu.org/licenses/>.
525#include "config.h"
526
538IMPLICIT NONE
539
545 INTEGER :: timerange
546 INTEGER :: p1
547 INTEGER :: p2
549
551TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
552 vol7d_timerange(imiss,imiss,imiss)
553
558 MODULE PROCEDURE vol7d_timerange_init
559END INTERFACE
560
564 MODULE PROCEDURE vol7d_timerange_delete
565END INTERFACE
566
570INTERFACE OPERATOR (==)
571 MODULE PROCEDURE vol7d_timerange_eq
572END INTERFACE
573
577INTERFACE OPERATOR (/=)
578 MODULE PROCEDURE vol7d_timerange_ne
579END INTERFACE
580
584INTERFACE OPERATOR (>)
585 MODULE PROCEDURE vol7d_timerange_gt
586END INTERFACE
587
591INTERFACE OPERATOR (<)
592 MODULE PROCEDURE vol7d_timerange_lt
593END INTERFACE
594
598INTERFACE OPERATOR (>=)
599 MODULE PROCEDURE vol7d_timerange_ge
600END INTERFACE
601
605INTERFACE OPERATOR (<=)
606 MODULE PROCEDURE vol7d_timerange_le
607END INTERFACE
608
611INTERFACE OPERATOR (.almosteq.)
612 MODULE PROCEDURE vol7d_timerange_almost_eq
613END INTERFACE
614
615
616! da documentare in inglese assieme al resto
619 MODULE PROCEDURE vol7d_timerange_c_e
620END INTERFACE
621
622#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
623#define VOL7D_POLY_TYPES _timerange
624#define ENABLE_SORT
625#include "array_utilities_pre.F90"
626
629 MODULE PROCEDURE display_timerange
630END INTERFACE
631
634 MODULE PROCEDURE to_char_timerange
635END INTERFACE
636
637#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
638#define ARRAYOF_TYPE arrayof_vol7d_timerange
639#define ARRAYOF_ORIGEQ 1
640#include "arrayof_pre.F90"
641
642
643type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
644 vol7d_timerange(254,0,imiss),&
645 vol7d_timerange(3,0,3600)/)
646
647
648! from arrayof
650PUBLIC insert_unique, append_unique
651PUBLIC almost_equal_timeranges
652
653CONTAINS
654
655
661FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
662INTEGER,INTENT(IN),OPTIONAL :: timerange
663INTEGER,INTENT(IN),OPTIONAL :: p1
664INTEGER,INTENT(IN),OPTIONAL :: p2
665
666TYPE(vol7d_timerange) :: this
667
669
670END FUNCTION vol7d_timerange_new
671
672
676SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
677TYPE(vol7d_timerange),INTENT(INOUT) :: this
678INTEGER,INTENT(IN),OPTIONAL :: timerange
679INTEGER,INTENT(IN),OPTIONAL :: p1
680INTEGER,INTENT(IN),OPTIONAL :: p2
681
682IF (PRESENT(timerange)) THEN
683 this%timerange = timerange
684ELSE
685 this%timerange = imiss
686 this%p1 = imiss
687 this%p2 = imiss
688 RETURN
689ENDIF
690!!$IF (timerange == 1) THEN ! p1 sempre 0
691!!$ this%p1 = 0
692!!$ this%p2 = imiss
693!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
694!!$ IF (PRESENT(p1)) THEN
695!!$ this%p1 = p1
696!!$ ELSE
697!!$ this%p1 = 0
698!!$ ENDIF
699!!$ this%p2 = imiss
700!!$ELSE ! tutti gli altri
701 IF (PRESENT(p1)) THEN
702 this%p1 = p1
703 ELSE
704 this%p1 = imiss
705 ENDIF
706 IF (PRESENT(p2)) THEN
707 this%p2 = p2
708 ELSE
709 this%p2 = imiss
710 ENDIF
711!!$END IF
712
713END SUBROUTINE vol7d_timerange_init
714
715
717SUBROUTINE vol7d_timerange_delete(this)
718TYPE(vol7d_timerange),INTENT(INOUT) :: this
719
720this%timerange = imiss
721this%p1 = imiss
722this%p2 = imiss
723
724END SUBROUTINE vol7d_timerange_delete
725
726
727SUBROUTINE display_timerange(this)
728TYPE(vol7d_timerange),INTENT(in) :: this
729
730print*,to_char_timerange(this)
731
732END SUBROUTINE display_timerange
733
734
735FUNCTION to_char_timerange(this)
736#ifdef HAVE_DBALLE
737USE dballef
738#endif
739TYPE(vol7d_timerange),INTENT(in) :: this
740CHARACTER(len=80) :: to_char_timerange
741
742#ifdef HAVE_DBALLE
743INTEGER :: handle, ier
744
745handle = 0
746ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
747ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
748ier = idba_fatto(handle)
749
750to_char_timerange="Timerange: "//to_char_timerange
751
752#else
753
756
757#endif
758
759END FUNCTION to_char_timerange
760
761
762ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
763TYPE(vol7d_timerange),INTENT(IN) :: this, that
764LOGICAL :: res
765
766
767res = &
768 this%timerange == that%timerange .AND. &
769 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
770 this%timerange == 254)
771
772END FUNCTION vol7d_timerange_eq
773
774
775ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
776TYPE(vol7d_timerange),INTENT(IN) :: this, that
777LOGICAL :: res
778
779IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
780 this%p1 == that%p1 .AND. &
781 this%p2 == that%p2) THEN
782 res = .true.
783ELSE
784 res = .false.
785ENDIF
786
787END FUNCTION vol7d_timerange_almost_eq
788
789
790ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
791TYPE(vol7d_timerange),INTENT(IN) :: this, that
792LOGICAL :: res
793
794res = .NOT.(this == that)
795
796END FUNCTION vol7d_timerange_ne
797
798
799ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
800TYPE(vol7d_timerange),INTENT(IN) :: this, that
801LOGICAL :: res
802
803IF (this%timerange > that%timerange .OR. &
804 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
805 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
806 this%p2 > that%p2)) THEN
807 res = .true.
808ELSE
809 res = .false.
810ENDIF
811
812END FUNCTION vol7d_timerange_gt
813
814
815ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
816TYPE(vol7d_timerange),INTENT(IN) :: this, that
817LOGICAL :: res
818
819IF (this%timerange < that%timerange .OR. &
820 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
821 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
822 this%p2 < that%p2)) THEN
823 res = .true.
824ELSE
825 res = .false.
826ENDIF
827
828END FUNCTION vol7d_timerange_lt
829
830
831ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
832TYPE(vol7d_timerange),INTENT(IN) :: this, that
833LOGICAL :: res
834
835IF (this == that) THEN
836 res = .true.
837ELSE IF (this > that) THEN
838 res = .true.
839ELSE
840 res = .false.
841ENDIF
842
843END FUNCTION vol7d_timerange_ge
844
845
846ELEMENTAL FUNCTION vol7d_timerange_le(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_le
859
860
861ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
862TYPE(vol7d_timerange),INTENT(IN) :: this
863LOGICAL :: c_e
864c_e = this /= vol7d_timerange_miss
865END FUNCTION vol7d_timerange_c_e
866
867
868#include "array_utilities_inc.F90"
869
870#include "arrayof_post.F90"
871
872
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 |