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