libsim Versione 7.1.11
|
◆ count_distinct_timerange()
conta gli elementi distinti in vect Definizione alla linea 779 del file vol7d_timerange_class.F90. 780! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
781! authors:
782! Davide Cesari <dcesari@arpa.emr.it>
783! Paolo Patruno <ppatruno@arpa.emr.it>
784
785! This program is free software; you can redistribute it and/or
786! modify it under the terms of the GNU General Public License as
787! published by the Free Software Foundation; either version 2 of
788! the License, or (at your option) any later version.
789
790! This program is distributed in the hope that it will be useful,
791! but WITHOUT ANY WARRANTY; without even the implied warranty of
792! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
793! GNU General Public License for more details.
794
795! You should have received a copy of the GNU General Public License
796! along with this program. If not, see <http://www.gnu.org/licenses/>.
797#include "config.h"
798
810IMPLICIT NONE
811
817 INTEGER :: timerange
818 INTEGER :: p1
819 INTEGER :: p2
821
823TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
824 vol7d_timerange(imiss,imiss,imiss)
825
830 MODULE PROCEDURE vol7d_timerange_init
831END INTERFACE
832
836 MODULE PROCEDURE vol7d_timerange_delete
837END INTERFACE
838
842INTERFACE OPERATOR (==)
843 MODULE PROCEDURE vol7d_timerange_eq
844END INTERFACE
845
849INTERFACE OPERATOR (/=)
850 MODULE PROCEDURE vol7d_timerange_ne
851END INTERFACE
852
856INTERFACE OPERATOR (>)
857 MODULE PROCEDURE vol7d_timerange_gt
858END INTERFACE
859
863INTERFACE OPERATOR (<)
864 MODULE PROCEDURE vol7d_timerange_lt
865END INTERFACE
866
870INTERFACE OPERATOR (>=)
871 MODULE PROCEDURE vol7d_timerange_ge
872END INTERFACE
873
877INTERFACE OPERATOR (<=)
878 MODULE PROCEDURE vol7d_timerange_le
879END INTERFACE
880
883INTERFACE OPERATOR (.almosteq.)
884 MODULE PROCEDURE vol7d_timerange_almost_eq
885END INTERFACE
886
887
888! da documentare in inglese assieme al resto
891 MODULE PROCEDURE vol7d_timerange_c_e
892END INTERFACE
893
894#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
895#define VOL7D_POLY_TYPES _timerange
896#define ENABLE_SORT
897#include "array_utilities_pre.F90"
898
901 MODULE PROCEDURE display_timerange
902END INTERFACE
903
906 MODULE PROCEDURE to_char_timerange
907END INTERFACE
908
909#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
910#define ARRAYOF_TYPE arrayof_vol7d_timerange
911#define ARRAYOF_ORIGEQ 1
912#include "arrayof_pre.F90"
913
914
915type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
916 vol7d_timerange(254,0,imiss),&
917 vol7d_timerange(3,0,3600)/)
918
919
920! from arrayof
922PUBLIC insert_unique, append_unique
923PUBLIC almost_equal_timeranges
924
925CONTAINS
926
927
933FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
934INTEGER,INTENT(IN),OPTIONAL :: timerange
935INTEGER,INTENT(IN),OPTIONAL :: p1
936INTEGER,INTENT(IN),OPTIONAL :: p2
937
938TYPE(vol7d_timerange) :: this
939
941
942END FUNCTION vol7d_timerange_new
943
944
948SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
949TYPE(vol7d_timerange),INTENT(INOUT) :: this
950INTEGER,INTENT(IN),OPTIONAL :: timerange
951INTEGER,INTENT(IN),OPTIONAL :: p1
952INTEGER,INTENT(IN),OPTIONAL :: p2
953
954IF (PRESENT(timerange)) THEN
955 this%timerange = timerange
956ELSE
957 this%timerange = imiss
958 this%p1 = imiss
959 this%p2 = imiss
960 RETURN
961ENDIF
962!!$IF (timerange == 1) THEN ! p1 sempre 0
963!!$ this%p1 = 0
964!!$ this%p2 = imiss
965!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
966!!$ IF (PRESENT(p1)) THEN
967!!$ this%p1 = p1
968!!$ ELSE
969!!$ this%p1 = 0
970!!$ ENDIF
971!!$ this%p2 = imiss
972!!$ELSE ! tutti gli altri
973 IF (PRESENT(p1)) THEN
974 this%p1 = p1
975 ELSE
976 this%p1 = imiss
977 ENDIF
978 IF (PRESENT(p2)) THEN
979 this%p2 = p2
980 ELSE
981 this%p2 = imiss
982 ENDIF
983!!$END IF
984
985END SUBROUTINE vol7d_timerange_init
986
987
989SUBROUTINE vol7d_timerange_delete(this)
990TYPE(vol7d_timerange),INTENT(INOUT) :: this
991
992this%timerange = imiss
993this%p1 = imiss
994this%p2 = imiss
995
996END SUBROUTINE vol7d_timerange_delete
997
998
999SUBROUTINE display_timerange(this)
1000TYPE(vol7d_timerange),INTENT(in) :: this
1001
1002print*,to_char_timerange(this)
1003
1004END SUBROUTINE display_timerange
1005
1006
1007FUNCTION to_char_timerange(this)
1008#ifdef HAVE_DBALLE
1009USE dballef
1010#endif
1011TYPE(vol7d_timerange),INTENT(in) :: this
1012CHARACTER(len=80) :: to_char_timerange
1013
1014#ifdef HAVE_DBALLE
1015INTEGER :: handle, ier
1016
1017handle = 0
1018ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
1019ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
1020ier = idba_fatto(handle)
1021
1022to_char_timerange="Timerange: "//to_char_timerange
1023
1024#else
1025
1028
1029#endif
1030
1031END FUNCTION to_char_timerange
1032
1033
1034ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
1035TYPE(vol7d_timerange),INTENT(IN) :: this, that
1036LOGICAL :: res
1037
1038
1039res = &
1040 this%timerange == that%timerange .AND. &
1041 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
1042 this%timerange == 254)
1043
1044END FUNCTION vol7d_timerange_eq
1045
1046
1047ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
1048TYPE(vol7d_timerange),INTENT(IN) :: this, that
1049LOGICAL :: res
1050
1051IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
1052 this%p1 == that%p1 .AND. &
1053 this%p2 == that%p2) THEN
1054 res = .true.
1055ELSE
1056 res = .false.
1057ENDIF
1058
1059END FUNCTION vol7d_timerange_almost_eq
1060
1061
1062ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
1063TYPE(vol7d_timerange),INTENT(IN) :: this, that
1064LOGICAL :: res
1065
1066res = .NOT.(this == that)
1067
1068END FUNCTION vol7d_timerange_ne
1069
1070
1071ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
1072TYPE(vol7d_timerange),INTENT(IN) :: this, that
1073LOGICAL :: res
1074
1075IF (this%timerange > that%timerange .OR. &
1076 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
1077 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
1078 this%p2 > that%p2)) THEN
1079 res = .true.
1080ELSE
1081 res = .false.
1082ENDIF
1083
1084END FUNCTION vol7d_timerange_gt
1085
1086
1087ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
1088TYPE(vol7d_timerange),INTENT(IN) :: this, that
1089LOGICAL :: res
1090
1091IF (this%timerange < that%timerange .OR. &
1092 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
1093 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
1094 this%p2 < that%p2)) THEN
1095 res = .true.
1096ELSE
1097 res = .false.
1098ENDIF
1099
1100END FUNCTION vol7d_timerange_lt
1101
1102
1103ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
1104TYPE(vol7d_timerange),INTENT(IN) :: this, that
1105LOGICAL :: res
1106
1107IF (this == that) THEN
1108 res = .true.
1109ELSE IF (this > that) THEN
1110 res = .true.
1111ELSE
1112 res = .false.
1113ENDIF
1114
1115END FUNCTION vol7d_timerange_ge
1116
1117
1118ELEMENTAL FUNCTION vol7d_timerange_le(this, that) RESULT(res)
1119TYPE(vol7d_timerange),INTENT(IN) :: this, that
1120LOGICAL :: res
1121
1122IF (this == that) THEN
1123 res = .true.
1124ELSE IF (this < that) THEN
1125 res = .true.
1126ELSE
1127 res = .false.
1128ENDIF
1129
1130END FUNCTION vol7d_timerange_le
1131
1132
1133ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
1134TYPE(vol7d_timerange),INTENT(IN) :: this
1135LOGICAL :: c_e
1136c_e = this /= vol7d_timerange_miss
1137END FUNCTION vol7d_timerange_c_e
1138
1139
1140#include "array_utilities_inc.F90"
1141
1142#include "arrayof_post.F90"
1143
1144
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 |