libsim Versione 7.1.11

◆ count_distinct_sorted_timerange()

integer function count_distinct_sorted_timerange ( type(vol7d_timerange), dimension(:), intent(in)  vect,
logical, dimension(:), intent(in), optional  mask 
)

conta gli elementi distinti in un sorted array

Definizione alla linea 745 del file vol7d_timerange_class.F90.

746! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
747! authors:
748! Davide Cesari <dcesari@arpa.emr.it>
749! Paolo Patruno <ppatruno@arpa.emr.it>
750
751! This program is free software; you can redistribute it and/or
752! modify it under the terms of the GNU General Public License as
753! published by the Free Software Foundation; either version 2 of
754! the License, or (at your option) any later version.
755
756! This program is distributed in the hope that it will be useful,
757! but WITHOUT ANY WARRANTY; without even the implied warranty of
758! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
759! GNU General Public License for more details.
760
761! You should have received a copy of the GNU General Public License
762! along with this program. If not, see <http://www.gnu.org/licenses/>.
763#include "config.h"
764
773USE kinds
776IMPLICIT NONE
777
783 INTEGER :: timerange
784 INTEGER :: p1
785 INTEGER :: p2
786END TYPE vol7d_timerange
787
789TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
790 vol7d_timerange(imiss,imiss,imiss)
791
795INTERFACE init
796 MODULE PROCEDURE vol7d_timerange_init
797END INTERFACE
798
801INTERFACE delete
802 MODULE PROCEDURE vol7d_timerange_delete
803END INTERFACE
804
808INTERFACE OPERATOR (==)
809 MODULE PROCEDURE vol7d_timerange_eq
810END INTERFACE
811
815INTERFACE OPERATOR (/=)
816 MODULE PROCEDURE vol7d_timerange_ne
817END INTERFACE
818
822INTERFACE OPERATOR (>)
823 MODULE PROCEDURE vol7d_timerange_gt
824END INTERFACE
825
829INTERFACE OPERATOR (<)
830 MODULE PROCEDURE vol7d_timerange_lt
831END INTERFACE
832
836INTERFACE OPERATOR (>=)
837 MODULE PROCEDURE vol7d_timerange_ge
838END INTERFACE
839
843INTERFACE OPERATOR (<=)
844 MODULE PROCEDURE vol7d_timerange_le
845END INTERFACE
846
849INTERFACE OPERATOR (.almosteq.)
850 MODULE PROCEDURE vol7d_timerange_almost_eq
851END INTERFACE
852
853
854! da documentare in inglese assieme al resto
856INTERFACE c_e
857 MODULE PROCEDURE vol7d_timerange_c_e
858END INTERFACE
859
860#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
861#define VOL7D_POLY_TYPES _timerange
862#define ENABLE_SORT
863#include "array_utilities_pre.F90"
864
866INTERFACE display
867 MODULE PROCEDURE display_timerange
868END INTERFACE
869
871INTERFACE to_char
872 MODULE PROCEDURE to_char_timerange
873END INTERFACE
874
875#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
876#define ARRAYOF_TYPE arrayof_vol7d_timerange
877#define ARRAYOF_ORIGEQ 1
878#include "arrayof_pre.F90"
879
880
881type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
882 vol7d_timerange(254,0,imiss),&
883 vol7d_timerange(3,0,3600)/)
884
885
886! from arrayof
888PUBLIC insert_unique, append_unique
889PUBLIC almost_equal_timeranges
890
891CONTAINS
892
893
899FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
900INTEGER,INTENT(IN),OPTIONAL :: timerange
901INTEGER,INTENT(IN),OPTIONAL :: p1
902INTEGER,INTENT(IN),OPTIONAL :: p2
903
904TYPE(vol7d_timerange) :: this
905
906CALL init(this, timerange, p1, p2)
907
908END FUNCTION vol7d_timerange_new
909
910
914SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
915TYPE(vol7d_timerange),INTENT(INOUT) :: this
916INTEGER,INTENT(IN),OPTIONAL :: timerange
917INTEGER,INTENT(IN),OPTIONAL :: p1
918INTEGER,INTENT(IN),OPTIONAL :: p2
919
920IF (PRESENT(timerange)) THEN
921 this%timerange = timerange
922ELSE
923 this%timerange = imiss
924 this%p1 = imiss
925 this%p2 = imiss
926 RETURN
927ENDIF
928!!$IF (timerange == 1) THEN ! p1 sempre 0
929!!$ this%p1 = 0
930!!$ this%p2 = imiss
931!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
932!!$ IF (PRESENT(p1)) THEN
933!!$ this%p1 = p1
934!!$ ELSE
935!!$ this%p1 = 0
936!!$ ENDIF
937!!$ this%p2 = imiss
938!!$ELSE ! tutti gli altri
939 IF (PRESENT(p1)) THEN
940 this%p1 = p1
941 ELSE
942 this%p1 = imiss
943 ENDIF
944 IF (PRESENT(p2)) THEN
945 this%p2 = p2
946 ELSE
947 this%p2 = imiss
948 ENDIF
949!!$END IF
950
951END SUBROUTINE vol7d_timerange_init
952
953
955SUBROUTINE vol7d_timerange_delete(this)
956TYPE(vol7d_timerange),INTENT(INOUT) :: this
957
958this%timerange = imiss
959this%p1 = imiss
960this%p2 = imiss
961
962END SUBROUTINE vol7d_timerange_delete
963
964
965SUBROUTINE display_timerange(this)
966TYPE(vol7d_timerange),INTENT(in) :: this
967
968print*,to_char_timerange(this)
969
970END SUBROUTINE display_timerange
971
972
973FUNCTION to_char_timerange(this)
974#ifdef HAVE_DBALLE
975USE dballef
976#endif
977TYPE(vol7d_timerange),INTENT(in) :: this
978CHARACTER(len=80) :: to_char_timerange
979
980#ifdef HAVE_DBALLE
981INTEGER :: handle, ier
982
983handle = 0
984ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
985ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
986ier = idba_fatto(handle)
987
988to_char_timerange="Timerange: "//to_char_timerange
989
990#else
991
992to_char_timerange="Timerange: "//trim(to_char(this%timerange))//" P1: "//&
993 trim(to_char(this%p1))//" P2: "//trim(to_char(this%p2))
994
995#endif
996
997END FUNCTION to_char_timerange
998
999
1000ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
1001TYPE(vol7d_timerange),INTENT(IN) :: this, that
1002LOGICAL :: res
1003
1004
1005res = &
1006 this%timerange == that%timerange .AND. &
1007 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
1008 this%timerange == 254)
1009
1010END FUNCTION vol7d_timerange_eq
1011
1012
1013ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
1014TYPE(vol7d_timerange),INTENT(IN) :: this, that
1015LOGICAL :: res
1016
1017IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
1018 this%p1 == that%p1 .AND. &
1019 this%p2 == that%p2) THEN
1020 res = .true.
1021ELSE
1022 res = .false.
1023ENDIF
1024
1025END FUNCTION vol7d_timerange_almost_eq
1026
1027
1028ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
1029TYPE(vol7d_timerange),INTENT(IN) :: this, that
1030LOGICAL :: res
1031
1032res = .NOT.(this == that)
1033
1034END FUNCTION vol7d_timerange_ne
1035
1036
1037ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
1038TYPE(vol7d_timerange),INTENT(IN) :: this, that
1039LOGICAL :: res
1040
1041IF (this%timerange > that%timerange .OR. &
1042 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
1043 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
1044 this%p2 > that%p2)) THEN
1045 res = .true.
1046ELSE
1047 res = .false.
1048ENDIF
1049
1050END FUNCTION vol7d_timerange_gt
1051
1052
1053ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
1054TYPE(vol7d_timerange),INTENT(IN) :: this, that
1055LOGICAL :: res
1056
1057IF (this%timerange < that%timerange .OR. &
1058 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
1059 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
1060 this%p2 < that%p2)) THEN
1061 res = .true.
1062ELSE
1063 res = .false.
1064ENDIF
1065
1066END FUNCTION vol7d_timerange_lt
1067
1068
1069ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
1070TYPE(vol7d_timerange),INTENT(IN) :: this, that
1071LOGICAL :: res
1072
1073IF (this == that) THEN
1074 res = .true.
1075ELSE IF (this > that) THEN
1076 res = .true.
1077ELSE
1078 res = .false.
1079ENDIF
1080
1081END FUNCTION vol7d_timerange_ge
1082
1083
1084ELEMENTAL FUNCTION vol7d_timerange_le(this, that) RESULT(res)
1085TYPE(vol7d_timerange),INTENT(IN) :: this, that
1086LOGICAL :: res
1087
1088IF (this == that) THEN
1089 res = .true.
1090ELSE IF (this < that) THEN
1091 res = .true.
1092ELSE
1093 res = .false.
1094ENDIF
1095
1096END FUNCTION vol7d_timerange_le
1097
1098
1099ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
1100TYPE(vol7d_timerange),INTENT(IN) :: this
1101LOGICAL :: c_e
1102c_e = this /= vol7d_timerange_miss
1103END FUNCTION vol7d_timerange_c_e
1104
1105
1106#include "array_utilities_inc.F90"
1107
1108#include "arrayof_post.F90"
1109
1110
1111END MODULE vol7d_timerange_class
Quick method to append an element to the array.
Distruttore per la classe vol7d_timerange.
Costruttore per la classe vol7d_timerange.
Method for inserting elements of the array at a desired position.
Method for packing the array object reducing at a minimum the memory occupation, without destroying i...
Method for removing elements of the array at a desired position.
Represent timerange object in a pretty string.
Utilities for CHARACTER variables.
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.
Classe per la gestione degli intervalli temporali di osservazioni meteo e affini.
Definisce l'intervallo temporale di un'osservazione meteo.

Generated with Doxygen.