31 #undef VOL7D_POLY_TYPE_AUTO 33 #undef VOL7D_POLY_TYPE 34 #undef VOL7D_POLY_TYPES 35 #define VOL7D_POLY_TYPE INTEGER 36 #define VOL7D_POLY_TYPES _i 38 #include "array_utilities_pre.F90" 41 #undef VOL7D_POLY_TYPE 42 #undef VOL7D_POLY_TYPES 43 #define VOL7D_POLY_TYPE REAL 44 #define VOL7D_POLY_TYPES _r 46 #include "array_utilities_pre.F90" 49 #undef VOL7D_POLY_TYPE 50 #undef VOL7D_POLY_TYPES 51 #define VOL7D_POLY_TYPE DOUBLEPRECISION 52 #define VOL7D_POLY_TYPES _d 54 #include "array_utilities_pre.F90" 58 #undef VOL7D_POLY_TYPE 59 #undef VOL7D_POLY_TYPES 60 #define VOL7D_POLY_TYPE CHARACTER(len=*) 61 #define VOL7D_POLY_TYPE_AUTO(var) CHARACTER(len=LEN(var)) 62 #define VOL7D_POLY_TYPES _c 64 #include "array_utilities_pre.F90" 65 #undef VOL7D_POLY_TYPE_AUTO 69 #define ARRAYOF_ORIGEQ 1 71 #define ARRAYOF_ORIGTYPE INTEGER 72 #define ARRAYOF_TYPE arrayof_integer 73 #include "arrayof_pre.F90" 75 #undef ARRAYOF_ORIGTYPE 77 #define ARRAYOF_ORIGTYPE REAL 78 #define ARRAYOF_TYPE arrayof_real 79 #include "arrayof_pre.F90" 81 #undef ARRAYOF_ORIGTYPE 83 #define ARRAYOF_ORIGTYPE DOUBLEPRECISION 84 #define ARRAYOF_TYPE arrayof_doubleprecision 85 #include "arrayof_pre.F90" 89 #undef ARRAYOF_ORIGTYPE 91 #define ARRAYOF_ORIGTYPE LOGICAL 92 #define ARRAYOF_TYPE arrayof_logical 93 #include "arrayof_pre.F90" 98 PUBLIC insert_unique, append_unique
101 count_distinct_sorted, pack_distinct_sorted, &
102 count_distinct, pack_distinct, count_and_pack_distinct, &
103 map_distinct, map_inv_distinct, &
104 firsttrue, lasttrue, pack_distinct_c, map
111 FUNCTION firsttrue(v)
RESULT(i)
112 LOGICAL,
INTENT(in) :: v(:)
120 END FUNCTION firsttrue
125 FUNCTION lasttrue(v)
RESULT(i)
126 LOGICAL,
INTENT(in) :: v(:)
129 DO i =
SIZE(v), 1, -1
133 END FUNCTION lasttrue
137 #undef VOL7D_POLY_TYPE_AUTO 140 #undef VOL7D_POLY_TYPE 141 #undef VOL7D_POLY_TYPES 142 #define VOL7D_POLY_TYPE INTEGER 143 #define VOL7D_POLY_TYPES _i 145 #include "array_utilities_inc.F90" 148 #undef VOL7D_POLY_TYPE 149 #undef VOL7D_POLY_TYPES 150 #define VOL7D_POLY_TYPE REAL 151 #define VOL7D_POLY_TYPES _r 153 #include "array_utilities_inc.F90" 156 #undef VOL7D_POLY_TYPE 157 #undef VOL7D_POLY_TYPES 158 #define VOL7D_POLY_TYPE DOUBLEPRECISION 159 #define VOL7D_POLY_TYPES _d 161 #include "array_utilities_inc.F90" 164 #define VOL7D_NO_PACK 165 #undef VOL7D_POLY_TYPE 166 #undef VOL7D_POLY_TYPES 167 #define VOL7D_POLY_TYPE CHARACTER(len=*) 168 #define VOL7D_POLY_TYPE_AUTO(var) CHARACTER(len=LEN(var)) 169 #define VOL7D_POLY_TYPES _c 171 #include "array_utilities_inc.F90" 172 #undef VOL7D_POLY_TYPE_AUTO 175 SUBROUTINE pack_distinct_c(vect, pack_distinct, mask, back)
176 CHARACTER(len=*),
INTENT(in) :: vect(:)
177 LOGICAL,
INTENT(in),
OPTIONAL :: mask(:), back
178 CHARACTER(len=LEN(vect)) :: pack_distinct(:)
180 INTEGER :: count_distinct
184 dim =
SIZE(pack_distinct)
185 IF (
PRESENT(back))
THEN 192 IF (
PRESENT (mask))
THEN 194 vectm1:
DO i = 1,
SIZE(vect)
195 IF (.NOT.mask(i)) cycle vectm1
198 DO j = count_distinct, 1, -1
199 IF (pack_distinct(j) == vect(i)) cycle vectm1
201 count_distinct = count_distinct + 1
202 IF (count_distinct > dim)
EXIT 203 pack_distinct(count_distinct) = vect(i)
206 vectm2:
DO i = 1,
SIZE(vect)
207 IF (.NOT.mask(i)) cycle vectm2
210 DO j = 1, count_distinct
211 IF (pack_distinct(j) == vect(i)) cycle vectm2
213 count_distinct = count_distinct + 1
214 IF (count_distinct > dim)
EXIT 215 pack_distinct(count_distinct) = vect(i)
220 vect1:
DO i = 1,
SIZE(vect)
223 DO j = count_distinct, 1, -1
224 IF (pack_distinct(j) == vect(i)) cycle vect1
226 count_distinct = count_distinct + 1
227 IF (count_distinct > dim)
EXIT 228 pack_distinct(count_distinct) = vect(i)
231 vect2:
DO i = 1,
SIZE(vect)
234 DO j = 1, count_distinct
235 IF (pack_distinct(j) == vect(i)) cycle vect2
237 count_distinct = count_distinct + 1
238 IF (count_distinct > dim)
EXIT 239 pack_distinct(count_distinct) = vect(i)
244 END SUBROUTINE pack_distinct_c
247 FUNCTION map(mask)
RESULT(mapidx)
248 LOGICAL,
INTENT(in) :: mask(:)
249 INTEGER :: mapidx(count(mask))
256 IF (mask(i)) mapidx(j)=i
261 #define ARRAYOF_ORIGEQ 1 263 #undef ARRAYOF_ORIGTYPE 265 #define ARRAYOF_ORIGTYPE INTEGER 266 #define ARRAYOF_TYPE arrayof_integer 267 #include "arrayof_post.F90" 269 #undef ARRAYOF_ORIGTYPE 271 #define ARRAYOF_ORIGTYPE REAL 272 #define ARRAYOF_TYPE arrayof_real 273 #include "arrayof_post.F90" 275 #undef ARRAYOF_ORIGTYPE 277 #define ARRAYOF_ORIGTYPE DOUBLEPRECISION 278 #define ARRAYOF_TYPE arrayof_doubleprecision 279 #include "arrayof_post.F90" 281 #undef ARRAYOF_ORIGEQ 283 #undef ARRAYOF_ORIGTYPE 285 #define ARRAYOF_ORIGTYPE LOGICAL 286 #define ARRAYOF_TYPE arrayof_logical 287 #include "arrayof_post.F90" Method for removing elements of the array at a desired position.
Quick method to append an element to the array.
This module defines usefull general purpose function and subroutine.
Destructor for finalizing an array object.
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...