libsim Versione 7.1.11
|
◆ arraysize
current logical size of the array; it may be different from the physical size Definizione alla linea 414 del file vol7d_timerange_class.F90. 414! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
415! authors:
416! Davide Cesari <dcesari@arpa.emr.it>
417! Paolo Patruno <ppatruno@arpa.emr.it>
418
419! This program is free software; you can redistribute it and/or
420! modify it under the terms of the GNU General Public License as
421! published by the Free Software Foundation; either version 2 of
422! the License, or (at your option) any later version.
423
424! This program is distributed in the hope that it will be useful,
425! but WITHOUT ANY WARRANTY; without even the implied warranty of
426! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
427! GNU General Public License for more details.
428
429! You should have received a copy of the GNU General Public License
430! along with this program. If not, see <http://www.gnu.org/licenses/>.
431#include "config.h"
432
444IMPLICIT NONE
445
451 INTEGER :: timerange
452 INTEGER :: p1
453 INTEGER :: p2
455
457TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
458 vol7d_timerange(imiss,imiss,imiss)
459
464 MODULE PROCEDURE vol7d_timerange_init
465END INTERFACE
466
470 MODULE PROCEDURE vol7d_timerange_delete
471END INTERFACE
472
476INTERFACE OPERATOR (==)
477 MODULE PROCEDURE vol7d_timerange_eq
478END INTERFACE
479
483INTERFACE OPERATOR (/=)
484 MODULE PROCEDURE vol7d_timerange_ne
485END INTERFACE
486
490INTERFACE OPERATOR (>)
491 MODULE PROCEDURE vol7d_timerange_gt
492END INTERFACE
493
497INTERFACE OPERATOR (<)
498 MODULE PROCEDURE vol7d_timerange_lt
499END INTERFACE
500
504INTERFACE OPERATOR (>=)
505 MODULE PROCEDURE vol7d_timerange_ge
506END INTERFACE
507
511INTERFACE OPERATOR (<=)
512 MODULE PROCEDURE vol7d_timerange_le
513END INTERFACE
514
517INTERFACE OPERATOR (.almosteq.)
518 MODULE PROCEDURE vol7d_timerange_almost_eq
519END INTERFACE
520
521
522! da documentare in inglese assieme al resto
525 MODULE PROCEDURE vol7d_timerange_c_e
526END INTERFACE
527
528#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
529#define VOL7D_POLY_TYPES _timerange
530#define ENABLE_SORT
531#include "array_utilities_pre.F90"
532
535 MODULE PROCEDURE display_timerange
536END INTERFACE
537
540 MODULE PROCEDURE to_char_timerange
541END INTERFACE
542
543#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
544#define ARRAYOF_TYPE arrayof_vol7d_timerange
545#define ARRAYOF_ORIGEQ 1
546#include "arrayof_pre.F90"
547
548
549type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
550 vol7d_timerange(254,0,imiss),&
551 vol7d_timerange(3,0,3600)/)
552
553
554! from arrayof
556PUBLIC insert_unique, append_unique
557PUBLIC almost_equal_timeranges
558
559CONTAINS
560
561
567FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
568INTEGER,INTENT(IN),OPTIONAL :: timerange
569INTEGER,INTENT(IN),OPTIONAL :: p1
570INTEGER,INTENT(IN),OPTIONAL :: p2
571
572TYPE(vol7d_timerange) :: this
573
575
576END FUNCTION vol7d_timerange_new
577
578
582SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
583TYPE(vol7d_timerange),INTENT(INOUT) :: this
584INTEGER,INTENT(IN),OPTIONAL :: timerange
585INTEGER,INTENT(IN),OPTIONAL :: p1
586INTEGER,INTENT(IN),OPTIONAL :: p2
587
588IF (PRESENT(timerange)) THEN
589 this%timerange = timerange
590ELSE
591 this%timerange = imiss
592 this%p1 = imiss
593 this%p2 = imiss
594 RETURN
595ENDIF
596!!$IF (timerange == 1) THEN ! p1 sempre 0
597!!$ this%p1 = 0
598!!$ this%p2 = imiss
599!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
600!!$ IF (PRESENT(p1)) THEN
601!!$ this%p1 = p1
602!!$ ELSE
603!!$ this%p1 = 0
604!!$ ENDIF
605!!$ this%p2 = imiss
606!!$ELSE ! tutti gli altri
607 IF (PRESENT(p1)) THEN
608 this%p1 = p1
609 ELSE
610 this%p1 = imiss
611 ENDIF
612 IF (PRESENT(p2)) THEN
613 this%p2 = p2
614 ELSE
615 this%p2 = imiss
616 ENDIF
617!!$END IF
618
619END SUBROUTINE vol7d_timerange_init
620
621
623SUBROUTINE vol7d_timerange_delete(this)
624TYPE(vol7d_timerange),INTENT(INOUT) :: this
625
626this%timerange = imiss
627this%p1 = imiss
628this%p2 = imiss
629
630END SUBROUTINE vol7d_timerange_delete
631
632
633SUBROUTINE display_timerange(this)
634TYPE(vol7d_timerange),INTENT(in) :: this
635
636print*,to_char_timerange(this)
637
638END SUBROUTINE display_timerange
639
640
641FUNCTION to_char_timerange(this)
642#ifdef HAVE_DBALLE
643USE dballef
644#endif
645TYPE(vol7d_timerange),INTENT(in) :: this
646CHARACTER(len=80) :: to_char_timerange
647
648#ifdef HAVE_DBALLE
649INTEGER :: handle, ier
650
651handle = 0
652ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
653ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
654ier = idba_fatto(handle)
655
656to_char_timerange="Timerange: "//to_char_timerange
657
658#else
659
662
663#endif
664
665END FUNCTION to_char_timerange
666
667
668ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
669TYPE(vol7d_timerange),INTENT(IN) :: this, that
670LOGICAL :: res
671
672
673res = &
674 this%timerange == that%timerange .AND. &
675 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
676 this%timerange == 254)
677
678END FUNCTION vol7d_timerange_eq
679
680
681ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
682TYPE(vol7d_timerange),INTENT(IN) :: this, that
683LOGICAL :: res
684
685IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
686 this%p1 == that%p1 .AND. &
687 this%p2 == that%p2) THEN
688 res = .true.
689ELSE
690 res = .false.
691ENDIF
692
693END FUNCTION vol7d_timerange_almost_eq
694
695
696ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
697TYPE(vol7d_timerange),INTENT(IN) :: this, that
698LOGICAL :: res
699
700res = .NOT.(this == that)
701
702END FUNCTION vol7d_timerange_ne
703
704
705ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
706TYPE(vol7d_timerange),INTENT(IN) :: this, that
707LOGICAL :: res
708
709IF (this%timerange > that%timerange .OR. &
710 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
711 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
712 this%p2 > that%p2)) THEN
713 res = .true.
714ELSE
715 res = .false.
716ENDIF
717
718END FUNCTION vol7d_timerange_gt
719
720
721ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
722TYPE(vol7d_timerange),INTENT(IN) :: this, that
723LOGICAL :: res
724
725IF (this%timerange < that%timerange .OR. &
726 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
727 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
728 this%p2 < that%p2)) THEN
729 res = .true.
730ELSE
731 res = .false.
732ENDIF
733
734END FUNCTION vol7d_timerange_lt
735
736
737ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
738TYPE(vol7d_timerange),INTENT(IN) :: this, that
739LOGICAL :: res
740
741IF (this == that) THEN
742 res = .true.
743ELSE IF (this > that) THEN
744 res = .true.
745ELSE
746 res = .false.
747ENDIF
748
749END FUNCTION vol7d_timerange_ge
750
751
752ELEMENTAL FUNCTION vol7d_timerange_le(this, that) RESULT(res)
753TYPE(vol7d_timerange),INTENT(IN) :: this, that
754LOGICAL :: res
755
756IF (this == that) THEN
757 res = .true.
758ELSE IF (this < that) THEN
759 res = .true.
760ELSE
761 res = .false.
762ENDIF
763
764END FUNCTION vol7d_timerange_le
765
766
767ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
768TYPE(vol7d_timerange),INTENT(IN) :: this
769LOGICAL :: c_e
770c_e = this /= vol7d_timerange_miss
771END FUNCTION vol7d_timerange_c_e
772
773
774#include "array_utilities_inc.F90"
775
776#include "arrayof_post.F90"
777
778
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 |