47 PROGRAM test_idxstripes_f
48 USE ftest_common
, ONLY: init_mpi, finish_mpi, test_abort
50 USE test_idxlist_utils
, ONLY: check_idxlist, test_err_count, &
51 idxlist_pack_unpack_copy
62 USE iso_c_binding
, ONLY: c_int
64 INTEGER,
PARAMETER :: xi = xt_int_kind
65 CHARACTER(len=32) :: envval
66 INTEGER :: envlen, envstat
67 LOGICAL :: fully_random_tests
71 CALL stripe_test_general1
72 CALL stripe_test_general2
73 CALL stripe_test_general3
74 CALL stripe_test_general4
75 CALL stripe_test_general5
76 CALL test_intersection1
77 CALL test_intersection2
78 CALL test_intersection3
79 CALL test_intersection4
80 CALL test_intersection5
81 CALL test_intersection6
82 CALL test_intersection7
83 CALL test_intersection8
84 CALL test_intersection9
85 CALL test_intersection10
86 CALL test_intersection11
87 CALL test_intersection12
88 CALL test_intersection13
89 CALL test_intersection14
90 CALL test_intersection15
91 CALL test_intersection_stripe2vec
92 CALL test_idxlist_stripes_pos_ext1
93 CALL test_idxlist_stripes_pos_ext2
94 CALL test_idxlist_stripes_pos_ext3
96 CALL test_idxlist_stripes_pos_ext4
97 CALL test_idxlist_stripes_pos_ext5
99 CALL test_idxlist_stripes_pos_ext_randomized1(.false.)
100 CALL get_environment_variable(
"YAXT_FULLY_RANDOM_TESTS", envval, envlen, &
102 IF (envstat == 0 .AND. (envlen == 1 .OR. envlen == 3))
THEN 103 IF (envlen == 1 .AND. (envval(1:1) ==
'y' .OR. envval(1:1) ==
'Y' &
104 & .OR. envval(1:1) ==
'1'))
THEN 105 fully_random_tests = .true.
106 ELSE IF (str2lower(envval(1:3)) ==
'yes')
THEN 107 fully_random_tests = .true.
109 fully_random_tests = .false.
112 fully_random_tests = .false.
115 IF (fully_random_tests) &
116 CALL test_idxlist_stripes_pos_ext_randomized1(.true.)
121 CALL test_stripe_overlap
132 IF (test_err_count() /= 0) &
133 CALL test_abort(
"non-zero error count!", &
140 SUBROUTINE stripe_test_general(stripes, ref_indices)
141 TYPE(
xt_stripe),
INTENT(in) :: stripes(:)
142 INTEGER(xt_int_kind),
INTENT(in) :: ref_indices(:)
144 TYPE(xt_idxlist) :: idxstripes, idxvec
145 INTEGER :: num_ext, num_unmatched, num_pos, i
146 INTEGER(c_int) :: ext_size
150 CALL do_tests(idxstripes, ref_indices)
153 stripes, pos_ext, .true.)
154 IF (num_unmatched /= 0) &
155 CALL test_abort(
"stripes not found", &
160 num_ext =
SIZE(pos_ext)
162 ext_size = pos_ext(i)%size
163 IF (num_pos /= pos_ext(i)%start) &
164 CALL test_abort(
"position/start mismatch", &
167 num_pos = num_pos + ext_size
170 CALL test_abort(
"index list length/positions overlap mismatch", &
180 CALL check_idxlist(idxstripes, ref_indices)
183 END SUBROUTINE stripe_test_general
185 SUBROUTINE stripe_test_general1
188 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(15) &
189 = (/ 0_xi, 1_xi, 2_xi, 3_xi, 4_xi, &
190 & 10_xi, 11_xi, 12_xi, 13_xi, 14_xi, &
191 & 20_xi, 21_xi, 22_xi, 23_xi, 24_xi /)
192 CALL stripe_test_general(stripes, ref_indices)
193 END SUBROUTINE stripe_test_general1
195 SUBROUTINE stripe_test_general2
198 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(15) &
199 = (/ 0_xi, 1_xi, 2_xi, 3_xi, 4_xi, &
200 & 10_xi, 12_xi, 14_xi, 16_xi, 18_xi, &
201 & 20_xi, 23_xi, 26_xi, 29_xi, 32_xi /)
202 CALL stripe_test_general(stripes, ref_indices)
203 END SUBROUTINE stripe_test_general2
205 SUBROUTINE stripe_test_general3
208 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(10) &
209 = (/ 0_xi, 6_xi, 12_xi, 18_xi, 24_xi, &
210 & 1_xi, 4_xi, 7_xi, 10_xi, 13_xi /)
211 CALL stripe_test_general(stripes, ref_indices)
212 END SUBROUTINE stripe_test_general3
214 SUBROUTINE stripe_test_general4
217 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(10) &
218 = (/ 0_xi, -1_xi, -2_xi, -3_xi, -4_xi, &
219 & 1_xi, 2_xi, 3_xi, 4_xi, 5_xi /)
220 CALL stripe_test_general(stripes, ref_indices)
221 END SUBROUTINE stripe_test_general4
223 SUBROUTINE stripe_test_general5
226 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(10) &
227 = (/ 9_xi, 7_xi, 5_xi, 3_xi, 1_xi, &
228 & 0_xi, 2_xi, 4_xi, 6_xi, 8_xi /)
229 CALL stripe_test_general(stripes, ref_indices)
230 END SUBROUTINE stripe_test_general5
232 SUBROUTINE test_intersection(stripes_a, stripes_b, ref_indices_a, ref_indices_b)
233 TYPE(
xt_stripe),
INTENT(in) :: stripes_a(:), stripes_b(:)
234 INTEGER(xt_int_kind),
INTENT(in) :: ref_indices_a(:)
235 INTEGER(xt_int_kind),
OPTIONAL,
INTENT(in) :: ref_indices_b(:)
236 TYPE(xt_idxlist) :: idxstripes_a, idxstripes_b, intersection(2)
242 CALL do_tests(intersection(1), ref_indices_a)
243 IF (
PRESENT(ref_indices_b))
THEN 244 CALL do_tests(intersection(2), ref_indices_b)
246 CALL do_tests(intersection(2), ref_indices_a)
252 END SUBROUTINE test_intersection
254 SUBROUTINE test_intersection1
258 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(6) &
259 = (/ 1_xi, 2_xi, 3_xi, 6_xi, 7_xi, 8_xi /)
260 CALL test_intersection(stripes_a, stripes_b, ref_indices)
261 END SUBROUTINE test_intersection1
263 SUBROUTINE test_intersection2
267 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(9) &
268 = (/ 1_xi, 2_xi, 3_xi, 6_xi, 7_xi, 9_xi, 11_xi, 12_xi, 13_xi /)
269 CALL test_intersection(stripes_a, stripes_b, ref_indices)
270 END SUBROUTINE test_intersection2
272 SUBROUTINE test_intersection3
276 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(1) = (/ -1_xi /)
277 CALL test_intersection(stripes_a, stripes_b, ref_indices(1:0))
278 END SUBROUTINE test_intersection3
280 SUBROUTINE test_intersection4
283 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(10) &
284 = (/ 0_xi, 1_xi, 2_xi, 3_xi, 4_xi, 5_xi, 6_xi, 7_xi, 8_xi, 9_xi /)
285 CALL test_intersection(stripes_a, stripes_b, ref_indices)
286 END SUBROUTINE test_intersection4
288 SUBROUTINE test_intersection5
292 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(6) &
293 = (/ 0_xi, 6_xi, 8_xi, 12_xi, 15_xi, 22_xi /)
294 CALL test_intersection(stripes_a, stripes_b, ref_indices)
295 END SUBROUTINE test_intersection5
297 SUBROUTINE test_intersection6
300 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(10) &
301 = (/ 0_xi, 1_xi, 2_xi, 3_xi, 4_xi, 5_xi, 6_xi, 7_xi, 8_xi, 9_xi /)
302 CALL test_intersection(stripes_a, stripes_b, ref_indices)
303 END SUBROUTINE test_intersection6
305 SUBROUTINE test_intersection7
309 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(7) &
310 = (/ 3_xi, 4_xi, 5_xi, 6_xi, 7_xi, 20_xi, 21_xi /)
311 CALL test_intersection(stripes_a, stripes_b, ref_indices)
312 END SUBROUTINE test_intersection7
314 SUBROUTINE test_intersection8
321 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(6) &
322 = (/ 5_xi, 6_xi, 8_xi, 9_xi, 20_xi, 21_xi /)
323 CALL test_intersection(stripes_a, stripes_b, ref_indices)
324 END SUBROUTINE test_intersection8
326 SUBROUTINE test_intersection9
329 stripes_b(1) = (/
xt_stripe(-2, 1, 10) /)
332 INTEGER(xt_int_kind),
PARAMETER :: ref_indices_a(7) &
333 = (/ (i, i=0_xi,6_xi) /), &
336 INTEGER(xt_int_kind),
PARAMETER :: ref_indices_a(7) &
337 = (/ (int(i, xi), i=0_xi,6_xi) /), &
339 ref_indices_b(15) = (/ 0_xi, 1_xi, 1_xi, 2_xi, 2_xi, 2_xi, 3_xi, &
340 & 3_xi, 3_xi, 4_xi, 4_xi, 4_xi, 5_xi, 5_xi, 6_xi /)
341 CALL test_intersection(stripes_a, stripes_b, ref_indices_a, ref_indices_b)
342 END SUBROUTINE test_intersection9
344 SUBROUTINE test_intersection10
347 INTEGER(xt_int_kind),
PARAMETER :: dummy(1) = (/ -1_xi /)
348 CALL test_intersection(stripes_a, stripes_b, dummy(1:0))
349 END SUBROUTINE test_intersection10
351 SUBROUTINE test_intersection11
354 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(3) = (/ 15_xi, 50_xi, 85_xi /)
355 CALL test_intersection(stripes_a, stripes_b, ref_indices)
356 END SUBROUTINE test_intersection11
360 SUBROUTINE test_intersection12
363 INTEGER(xt_int_kind),
PARAMETER :: dummy(1) = (/ -1_xi /)
365 CALL test_intersection(stripes_a, stripes_b, dummy(1:0))
366 END SUBROUTINE test_intersection12
369 SUBROUTINE test_intersection13
371 stripes_a(1) = (/
xt_stripe(353, -29, 12) /), &
373 INTEGER(xt_int_kind),
PARAMETER :: dummy(1) = (/ -1_xi /)
375 CALL test_intersection(stripes_a, stripes_b, dummy(1:0))
376 END SUBROUTINE test_intersection13
378 SUBROUTINE test_intersection14
380 stripes_a(1) = (/
xt_stripe(95, -29, 2) /), &
381 stripes_b(1) = (/
xt_stripe(81, 14, 2) /)
382 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(1) = (/ 95_xi /)
384 CALL test_intersection(stripes_a, stripes_b, ref_indices)
385 END SUBROUTINE test_intersection14
387 SUBROUTINE test_intersection15
389 stripes_a(1) = (/
xt_stripe(546, 14, 2) /), &
390 stripes_b(1) = (/
xt_stripe(354, 206, 2) /)
391 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(1) = (/ 560_xi /)
393 CALL test_intersection(stripes_a, stripes_b, ref_indices)
394 END SUBROUTINE test_intersection15
396 SUBROUTINE test_intersection_stripe2vec
397 INTEGER,
PARAMETER :: num_stripes = 3
398 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) &
400 TYPE(xt_idxlist) :: idxvec_a, idxvec_b, intersection
401 INTEGER(xt_int_kind),
PARAMETER :: index_vector(1) = (/ 5_xi /)
402 INTEGER(xt_int_kind) :: intersection_idx
408 CALL test_abort(
"unexpected number of indices in intersection!", &
413 IF (not_found .OR. intersection_idx /= index_vector(1)) &
414 CALL test_abort(
"unexpected index in intersection!", &
420 END SUBROUTINE test_intersection_stripe2vec
422 SUBROUTINE test_idxlist_stripes_pos_ext1
423 INTEGER,
PARAMETER :: num_indices = 223
424 INTEGER(xt_int_kind),
PARAMETER :: index_vector(num_indices) = (/ &
425 3375_xi, 3376_xi, 3379_xi, 3380_xi, 3381_xi, 3387_xi, 3388_xi, &
426 3389_xi, 3390_xi, 3391_xi, 3392_xi, 3393_xi, 3421_xi, 3422_xi, &
427 3423_xi, 3424_xi, 3425_xi, 3426_xi, 3427_xi, 3444_xi, 3458_xi, &
428 3459_xi, 3461_xi, 3462_xi, 3463_xi, 3464_xi, 3465_xi, 3466_xi, &
429 3467_xi, 3468_xi, 3469_xi, 3470_xi, 3471_xi, 3472_xi, 3473_xi, &
430 3474_xi, 3475_xi, 3476_xi, 3477_xi, 3478_xi, 3479_xi, 3480_xi, &
431 3529_xi, 3606_xi, 3607_xi, 3608_xi, 3611_xi, 3612_xi, 3613_xi, &
432 3614_xi, 3617_xi, 3620_xi, 3621_xi, 3622_xi, 3623_xi, 3624_xi, &
433 3625_xi, 3626_xi, 3627_xi, 3628_xi, 3629_xi, 3630_xi, 3631_xi, &
434 3684_xi, 3685_xi, 3686_xi, 3687_xi, 3688_xi, 3689_xi, 3690_xi, &
435 3691_xi, 3692_xi, 3693_xi, 3694_xi, 3695_xi, 3696_xi, 3697_xi, &
436 3698_xi, 3699_xi, 3700_xi, 3701_xi, 3702_xi, 3703_xi, 3704_xi, &
437 3705_xi, 3706_xi, 3707_xi, 3708_xi, 3709_xi, 3713_xi, 3714_xi, &
438 3715_xi, 3716_xi, 3717_xi, 3718_xi, 3719_xi, 3720_xi, 3721_xi, &
439 3722_xi, 3723_xi, 3724_xi, 3725_xi, 3726_xi, 3727_xi, 3728_xi, &
440 3729_xi, 3730_xi, 3731_xi, 3741_xi, 3742_xi, 3931_xi, 3932_xi, &
441 3374_xi, 3382_xi, 3385_xi, 3394_xi, 3404_xi, 3408_xi, 3412_xi, &
442 3440_xi, 3443_xi, 3457_xi, 3481_xi, 3483_xi, 3527_xi, 3619_xi, &
443 3735_xi, 3743_xi, 3925_xi, 3930_xi, 3377_xi, 3378_xi, 3383_xi, &
444 3384_xi, 3386_xi, 3395_xi, 3397_xi, 3398_xi, 3400_xi, 3402_xi, &
445 3403_xi, 3407_xi, 3409_xi, 3410_xi, 3413_xi, 3420_xi, 3441_xi, &
446 3442_xi, 3445_xi, 3448_xi, 3449_xi, 3451_xi, 3460_xi, 3482_xi, &
447 3519_xi, 3520_xi, 3526_xi, 3528_xi, 3530_xi, 3592_xi, 3593_xi, &
448 3595_xi, 3596_xi, 3597_xi, 3609_xi, 3610_xi, 3615_xi, 3616_xi, &
449 3618_xi, 3644_xi, 3710_xi, 3711_xi, 3712_xi, 3732_xi, 3733_xi, &
450 3736_xi, 3737_xi, 3748_xi, 3749_xi, 3753_xi, 3754_xi, 3759_xi, &
451 3760_xi, 3766_xi, 3767_xi, 3919_xi, 3920_xi, 3924_xi, 3926_xi, &
452 3933_xi, 3934_xi, 2589_xi, 2602_xi, 2680_xi, 3326_xi, 3340_xi, &
453 3341_xi, 3396_xi, 3401_xi, 3411_xi, 3414_xi, 3418_xi, 3446_xi, &
454 3447_xi, 3450_xi, 3515_xi, 3521_xi, 3525_xi, 3582_xi, 3590_xi, &
455 3591_xi, 3594_xi, 3642_xi, 3734_xi, 3738_xi, 3747_xi, 3750_xi, &
456 3761_xi, 3765_xi, 3865_xi, 3918_xi, 3923_xi, 3935_xi /)
457 INTEGER,
PARAMETER :: num_stripes = 26
458 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) = (/ &
472 TYPE(xt_idxlist) :: idxlist
475 CALL check_idxlist_stripes_pos_ext(idxlist, stripes)
477 END SUBROUTINE test_idxlist_stripes_pos_ext1
479 SUBROUTINE test_idxlist_stripes_pos_ext2
480 INTEGER,
PARAMETER :: num_indices = 201
481 INTEGER(xt_int_kind),
PARAMETER :: index_vector(num_indices) = (/ &
482 & 178_xi, 179_xi, 180_xi, 181_xi, 182_xi, 183_xi, 184_xi, &
483 & 186_xi, 187_xi, 188_xi, 189_xi, 190_xi, 194_xi, 195_xi, &
484 & 196_xi, 197_xi, 198_xi, 199_xi, 200_xi, 201_xi, 202_xi, &
485 & 203_xi, 204_xi, 205_xi, 206_xi, 207_xi, 208_xi, 209_xi, &
486 & 210_xi, 211_xi, 212_xi, 217_xi, 223_xi, 426_xi, 428_xi, &
487 & 429_xi, 430_xi, 434_xi, 435_xi, 436_xi, 437_xi, 438_xi, &
488 & 439_xi, 440_xi, 442_xi, 443_xi, 444_xi, 445_xi, 446_xi, &
489 & 447_xi, 448_xi, 449_xi, 450_xi, 451_xi, 452_xi, 453_xi, &
490 & 454_xi, 455_xi, 456_xi, 457_xi, 458_xi, 670_xi, 671_xi, &
491 & 672_xi, 673_xi, 674_xi, 675_xi, 676_xi, 677_xi, 682_xi, &
492 & 684_xi, 685_xi, 686_xi, 687_xi, 688_xi, 689_xi, 690_xi, &
493 & 692_xi, 695_xi, 703_xi, 704_xi, 705_xi, 706_xi, 707_xi, &
494 & 894_xi, 895_xi, 896_xi, 897_xi, 898_xi, 899_xi, 900_xi, &
495 & 901_xi, 906_xi, 907_xi, 908_xi, 913_xi, 915_xi, 921_xi, &
496 & 922_xi, 923_xi, 924_xi, 925_xi, 926_xi, 927_xi, 1096_xi, &
497 & 1097_xi, 1098_xi, 1099_xi, 1100_xi, 1101_xi, 1102_xi, 1103_xi, &
498 & 1107_xi, 1108_xi, 1109_xi, 1110_xi, 1111_xi, 1113_xi, 1114_xi, &
499 & 1119_xi, 1120_xi, 1121_xi, 2095_xi, 2096_xi, 2097_xi, 2098_xi, &
500 & 2100_xi, 2102_xi, 2103_xi, 2104_xi, 2105_xi, 2107_xi, 2108_xi, &
501 & 2109_xi, 2110_xi, 2112_xi, 2118_xi, 2120_xi, 2121_xi, 2122_xi, &
502 & 2123_xi, 2124_xi, 2125_xi, 2127_xi, 2128_xi, 2129_xi, 2130_xi, &
503 & 2134_xi, 2140_xi, 2141_xi, 2142_xi, 2143_xi, 2145_xi, 2148_xi, &
504 & 2149_xi, 2151_xi, 2152_xi, 2153_xi, 2154_xi, 2155_xi, 2156_xi, &
505 & 683_xi, 691_xi, 903_xi, 914_xi, 1105_xi, 1115_xi, 2099_xi, &
506 & 2106_xi, 2111_xi, 2115_xi, 2126_xi, 2132_xi, 2139_xi, 2144_xi, &
507 & 2147_xi, 2150_xi, 2305_xi, 427_xi, 465_xi, 466_xi, 678_xi, &
508 & 693_xi, 902_xi, 909_xi, 1104_xi, 1112_xi, 2101_xi, 2113_xi, &
509 & 2114_xi, 2116_xi, 2117_xi, 2119_xi, 2131_xi, 2136_xi, 2138_xi, &
510 & 2146_xi, 2297_xi, 2302_xi, 2304_xi, 2307_xi /)
511 integer,
PARAMETER :: num_stripes = 8
512 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) = (/ &
517 TYPE(xt_idxlist) :: idxlist
520 CALL check_idxlist_stripes_pos_ext(idxlist, stripes)
522 END SUBROUTINE test_idxlist_stripes_pos_ext2
524 SUBROUTINE test_idxlist_stripes_pos_ext3
525 INTEGER,
PARAMETER :: num_indices = 1144
526 INTEGER(xt_int_kind),
PARAMETER :: index_vector(num_indices) = (/ &
527 2055, 2056, 2060, 2193, 2199, 2203, 2211, 2212, 2278, 2281, 2311, &
528 2312, 2316, 2317, 2322, 2332, 2447, 2448, 2452, 2585, 2591, 2595, &
529 2603, 2604, 2670, 2673, 2703, 2704, 2708, 2709, 2714, 2724, 2839, &
530 2840, 2844, 2977, 2983, 2987, 2995, 2996, 3062, 3065, 3095, 3096, &
531 3100, 3101, 3106, 3116, 3231, 3232, 3236, 3369, 3375, 3379, 3387, &
532 3388, 3454, 3457, 3487, 3488, 3492, 3493, 3498, 3508, 3623, 3624, &
533 3628, 3761, 3767, 3771, 3779, 3780, 3846, 3849, 3879, 3880, 3884, &
534 3885, 3890, 3900, 3997, 4001, 4002, 4053, 4057, 4084, 4085, 4092, &
535 4102, 4188, 4192, 4201, 4373, 4377, 4378, 4429, 4433, 4460, 4461, &
536 4468, 4478, 4564, 4568, 4577, 4749, 4753, 4754, 4805, 4809, 4836, &
537 4837, 4844, 4854, 4945, 4953, 5125, 5129, 5130, 5181, 5185, 5212, &
538 5213, 5220, 5230, 5321, 5329, 5501, 5505, 5506, 5557, 5561, 5588, &
539 5589, 5596, 5606, 5697, 5705, 162, 163, 166, 168, 171, 172, &
540 173, 177, 181, 362, 363, 367, 369, 375, 378, 382, 383, &
541 386, 570, 571, 574, 576, 579, 580, 581, 585, 589, 758, &
542 759, 763, 765, 769, 774, 775, 778, 962, 963, 966, 968, &
543 971, 972, 973, 977, 981, 1150, 1151, 1155, 1157, 1161, 1166, &
544 1167, 1170, 1354, 1355, 1358, 1360, 1363, 1364, 1365, 1369, 1373, &
545 1542, 1543, 1547, 1549, 1553, 1558, 1559, 1562, 1746, 1747, 1750, &
546 1752, 1755, 1756, 1757, 1761, 1918, 1919, 1923, 1925, 1929, 1934, &
547 1935, 1938, 1988, 1989, 2024, 2025, 2032, 2033, 2036, 2038, 2039, &
548 2048, 2049, 2053, 2054, 2057, 2058, 2061, 2076, 2077, 2091, 2092, &
549 2093, 2095, 2097, 2126, 2127, 2144, 2145, 2149, 2150, 2156, 2198, &
550 2204, 2205, 2207, 2245, 2253, 2254, 2256, 2268, 2269, 2277, 2279, &
551 2280, 2283, 2287, 2298, 2299, 2307, 2308, 2309, 2310, 2333, 2334, &
552 2380, 2381, 2416, 2417, 2424, 2425, 2428, 2430, 2431, 2440, 2441, &
553 2445, 2446, 2449, 2450, 2453, 2468, 2469, 2483, 2484, 2485, 2487, &
554 2489, 2518, 2519, 2536, 2537, 2541, 2542, 2548, 2590, 2596, 2597, &
555 2599, 2637, 2645, 2646, 2648, 2660, 2661, 2669, 2671, 2672, 2675, &
556 2679, 2690, 2691, 2699, 2700, 2701, 2702, 2725, 2726, 2772, 2773, &
557 2808, 2809, 2816, 2817, 2820, 2822, 2823, 2832, 2833, 2837, 2838, &
558 2841, 2842, 2845, 2860, 2861, 2875, 2876, 2877, 2879, 2881, 2910, &
559 2911, 2928, 2929, 2933, 2934, 2940, 2982, 2988, 2989, 2991, 3029, &
560 3037, 3038, 3040, 3052, 3053, 3061, 3063, 3064, 3067, 3071, 3082, &
561 3083, 3091, 3092, 3093, 3094, 3117, 3118, 3164, 3165, 3200, 3201, &
562 3208, 3209, 3212, 3214, 3215, 3224, 3225, 3229, 3230, 3233, 3234, &
563 3237, 3252, 3253, 3267, 3268, 3269, 3271, 3273, 3302, 3303, 3320, &
564 3321, 3325, 3326, 3332, 3374, 3380, 3381, 3383, 3421, 3429, 3430, &
565 3432, 3444, 3445, 3453, 3455, 3456, 3459, 3463, 3474, 3475, 3483, &
566 3484, 3485, 3486, 3509, 3510, 3556, 3557, 3592, 3593, 3600, 3601, &
567 3604, 3606, 3607, 3616, 3617, 3621, 3622, 3625, 3626, 3629, 3644, &
568 3645, 3659, 3660, 3661, 3663, 3665, 3694, 3695, 3712, 3713, 3717, &
569 3718, 3724, 3766, 3772, 3773, 3775, 3813, 3821, 3822, 3824, 3836, &
570 3837, 3845, 3847, 3848, 3851, 3855, 3866, 3867, 3875, 3876, 3877, &
571 3878, 3901, 3902, 3948, 3949, 3984, 3985, 3992, 3993, 3996, 3998, &
572 3999, 4008, 4009, 4013, 4014, 4017, 4018, 4021, 4036, 4037, 4051, &
573 4052, 4054, 4055, 4058, 4090, 4091, 4093, 4108, 4109, 4112, 4113, &
574 4114, 4158, 4164, 4165, 4193, 4199, 4200, 4212, 4213, 4222, 4223, &
575 4225, 4227, 4231, 4242, 4243, 4250, 4251, 4271, 4272, 4274, 4324, &
576 4325, 4360, 4361, 4368, 4369, 4372, 4374, 4375, 4384, 4385, 4389, &
577 4390, 4393, 4394, 4397, 4412, 4413, 4427, 4428, 4430, 4431, 4434, &
578 4466, 4467, 4469, 4484, 4485, 4488, 4489, 4490, 4534, 4540, 4541, &
579 4569, 4575, 4576, 4588, 4589, 4598, 4599, 4601, 4603, 4607, 4618, &
580 4619, 4626, 4627, 4647, 4648, 4650, 4700, 4701, 4736, 4737, 4744, &
581 4745, 4748, 4750, 4751, 4760, 4761, 4765, 4766, 4769, 4770, 4773, &
582 4788, 4789, 4803, 4804, 4806, 4807, 4810, 4842, 4843, 4845, 4860, &
583 4861, 4864, 4865, 4866, 4910, 4916, 4917, 4951, 4952, 4964, 4965, &
584 4974, 4975, 4977, 4979, 4983, 4994, 4995, 5002, 5003, 5023, 5024, &
585 5026, 5076, 5077, 5112, 5113, 5120, 5121, 5124, 5126, 5127, 5136, &
586 5137, 5141, 5142, 5145, 5146, 5149, 5164, 5165, 5179, 5180, 5182, &
587 5183, 5186, 5218, 5219, 5221, 5236, 5237, 5240, 5241, 5242, 5286, &
588 5292, 5293, 5327, 5328, 5340, 5341, 5350, 5351, 5353, 5355, 5359, &
589 5370, 5371, 5378, 5379, 5399, 5400, 5402, 5452, 5453, 5488, 5489, &
590 5496, 5497, 5500, 5502, 5503, 5512, 5513, 5517, 5518, 5521, 5522, &
591 5525, 5540, 5541, 5555, 5556, 5558, 5559, 5562, 5594, 5595, 5597, &
592 5612, 5613, 5616, 5617, 5618, 5662, 5668, 5669, 5703, 5704, 5716, &
593 5717, 5726, 5727, 5729, 5731, 5735, 5746, 5747, 5754, 5755, 5775, &
594 5776, 5778, 5958, 5959, 5962, 5964, 5967, 5968, 5971, 5973, 6154, &
595 6155, 6159, 6161, 6167, 6170, 6172, 6173, 6350, 6351, 6354, 6356, &
596 6359, 6360, 6363, 6530, 6531, 6535, 6537, 6543, 6546, 6548, 6549, &
597 6726, 6727, 6730, 6732, 6735, 6736, 6739, 6906, 6907, 6911, 6913, &
598 6919, 6922, 6924, 6925, 7102, 7103, 7106, 7108, 7111, 7112, 7115, &
599 7282, 7283, 7287, 7289, 7295, 7298, 7300, 7301, 7478, 7479, 7482, &
600 7484, 7487, 7488, 7491, 7646, 7647, 7651, 7653, 7657, 7660, 7661, &
601 130, 161, 169, 170, 336, 361, 366, 384, 538, 569, 577, &
602 578, 736, 757, 762, 776, 930, 961, 969, 970, 1128, 1149, &
603 1154, 1168, 1322, 1353, 1361, 1362, 1520, 1541, 1546, 1560, 1714, &
604 1745, 1753, 1754, 1896, 1917, 1922, 1936, 1985, 2019, 2031, 2035, &
605 2040, 2044, 2052, 2059, 2062, 2071, 2087, 2090, 2094, 2140, 2148, &
606 2153, 2157, 2206, 2257, 2263, 2267, 2284, 2288, 2293, 2295, 2305, &
607 2306, 2377, 2411, 2423, 2427, 2432, 2436, 2444, 2451, 2454, 2463, &
608 2479, 2482, 2486, 2532, 2540, 2545, 2549, 2598, 2649, 2655, 2659, &
609 2676, 2680, 2685, 2687, 2697, 2698, 2769, 2803, 2815, 2819, 2824, &
610 2828, 2836, 2843, 2846, 2855, 2871, 2874, 2878, 2924, 2932, 2937, &
611 2941, 2990, 3041, 3047, 3051, 3068, 3072, 3077, 3079, 3089, 3090, &
612 3161, 3195, 3207, 3211, 3216, 3220, 3228, 3235, 3238, 3247, 3263, &
613 3266, 3270, 3316, 3324, 3329, 3333, 3382, 3433, 3439, 3443, 3460, &
614 3464, 3469, 3471, 3481, 3482, 3553, 3587, 3599, 3603, 3608, 3612, &
615 3620, 3627, 3630, 3639, 3655, 3658, 3662, 3708, 3716, 3721, 3725, &
616 3774, 3825, 3831, 3835, 3852, 3856, 3861, 3863, 3873, 3874, 3945, &
617 3979, 3991, 3995, 4000, 4004, 4012, 4019, 4022, 4031, 4033, 4047, &
618 4050, 4104, 4106, 4115, 4207, 4221, 4228, 4232, 4237, 4249, 4252, &
619 4321, 4355, 4367, 4371, 4376, 4380, 4388, 4395, 4398, 4407, 4409, &
620 4423, 4426, 4480, 4482, 4491, 4583, 4597, 4604, 4608, 4613, 4625, &
621 4628, 4697, 4731, 4743, 4747, 4752, 4756, 4764, 4771, 4774, 4783, &
622 4785, 4799, 4802, 4856, 4858, 4867, 4959, 4973, 4980, 4984, 4989, &
623 5001, 5004, 5073, 5107, 5119, 5123, 5128, 5132, 5140, 5147, 5150, &
624 5159, 5161, 5175, 5178, 5232, 5234, 5243, 5335, 5349, 5356, 5360, &
625 5365, 5377, 5380, 5449, 5483, 5495, 5499, 5504, 5508, 5516, 5523, &
626 5526, 5535, 5537, 5551, 5554, 5608, 5610, 5619, 5711, 5725, 5732, &
627 5736, 5741, 5753, 5756, 5930, 5957, 5965, 5966, 6128, 6153, 6158, &
628 6174, 6322, 6349, 6357, 6358, 6504, 6529, 6534, 6550, 6698, 6725, &
629 6733, 6734, 6880, 6905, 6910, 6926, 7074, 7101, 7109, 7110, 7256, &
630 7281, 7286, 7302, 7450, 7477, 7485, 7486, 7624, 7645, 7650, 7662 /)
631 INTEGER,
PARAMETER :: num_stripes = 187
632 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) = (/ &
696 TYPE(xt_idxlist) :: idxlist
699 CALL check_idxlist_stripes_pos_ext(idxlist, stripes)
701 END SUBROUTINE test_idxlist_stripes_pos_ext3
703 #if SIZEOF_XT_INT > 2 704 SUBROUTINE test_idxlist_stripes_pos_ext4
705 INTEGER,
PARAMETER :: num_indices = 3
706 INTEGER(xt_int_kind),
PARAMETER :: index_vector(num_indices) &
707 = (/ 328669_xi, 30608_xi, 38403_xi /)
708 INTEGER,
PARAMETER :: num_stripes = 1
709 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) = (/ &
711 TYPE(xt_idxlist) :: idxlist
714 CALL check_idxlist_stripes_pos_ext(idxlist, stripes)
716 END SUBROUTINE test_idxlist_stripes_pos_ext4
718 SUBROUTINE test_idxlist_stripes_pos_ext5
719 INTEGER,
PARAMETER :: num_indices = 3
720 INTEGER(xt_int_kind),
PARAMETER :: index_vector(num_indices) &
721 = (/ 679605_xi, 726349_xi, 726346_xi /)
722 INTEGER,
PARAMETER :: num_stripes = 1
723 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) = (/ &
725 TYPE(xt_idxlist) :: idxlist
728 CALL check_idxlist_stripes_pos_ext(idxlist, stripes)
730 END SUBROUTINE test_idxlist_stripes_pos_ext5
733 SUBROUTINE test_idxlist_stripes_pos_ext_randomized1(full_random)
734 LOGICAL,
INTENT(in) :: full_random
735 INTEGER,
PARAMETER :: num_iterations=128, &
736 max_num_indices=1024, max_index=1024
738 INTEGER,
ALLOCATABLE :: rseed(:)
739 INTEGER :: rseed_size, i, iteration, num_indices
740 INTEGER(xt_int_kind),
ALLOCATABLE :: indices(:)
741 REAL,
ALLOCATABLE :: rvals(:)
742 TYPE(xt_idxlist) :: idxlist
743 TYPE(
xt_stripe),
ALLOCATABLE :: stripes(:)
745 INTEGER :: tparts(8), timeseed
746 INTEGER :: days_per_month(12), days_prefix
747 INTEGER,
PARAMETER :: tparts_mult(7) = (/ &
748 365 * 24 * 60 * 60, &
756 CALL random_seed(size=rseed_size)
757 ALLOCATE(rseed(rseed_size))
761 IF (full_random)
THEN 763 CALL date_and_time(values=tparts)
764 days_per_month( 1) = 31
765 days_per_month( 2) = merge(28, 29, &
766 mod(tparts(1), 4) == 0 .AND. ( mod(tparts(1), 100) /= 0 &
767 & .OR. mod(tparts(1), 400) == 0))
768 days_per_month( 3) = 31
769 days_per_month( 4) = 30
770 days_per_month( 5) = 31
771 days_per_month( 6) = 30
772 days_per_month( 7) = 31
773 days_per_month( 8) = 31
774 days_per_month( 9) = 30
775 days_per_month(10) = 31
776 days_per_month(11) = 30
777 days_per_month(12) = 31
778 tparts(1) = tparts(1) - 1970
779 days_prefix = sum(days_per_month(1:tparts(2)-1))
780 tparts(3) = tparts(3) + days_prefix - 1
782 timeseed = sum(tparts(1:7) * tparts_mult)
783 timeseed = ieor(tparts(8), timeseed)
785 WRITE(0,
'(a,i0)')
'used extra seed=', rseed(1)
788 CALL random_seed(put=rseed)
789 ALLOCATE(indices(max_num_indices), rvals(max_num_indices))
790 DO iteration = 1, num_iterations
791 CALL random_number(rvals(1))
792 num_indices = nint(rvals(1) *
REAL(max_num_indices))
794 CALL random_number(rvals(1:num_indices))
795 DO i = 1, num_indices
796 indices(i) = nint(rvals(i)*
REAL((2*max_index)-max_index), xt_int_kind)
801 IF (
ALLOCATED(stripes) .EQV. num_indices == 0) &
802 CALL test_abort(
"get index stripes returned values for empty list", &
805 IF (num_indices > 0)
THEN 806 CALL check_idxlist_stripes_pos_ext(idxlist, stripes)
808 CALL check_idxlist_stripes_pos_ext(idxlist, stripes_dummy(1:0))
813 END SUBROUTINE test_idxlist_stripes_pos_ext_randomized1
815 SUBROUTINE check_idxlist_stripes_pos_ext(idxlist, stripes)
816 TYPE(xt_idxlist),
INTENT(in) :: idxlist
817 TYPE(
xt_stripe),
INTENT(in) :: stripes(:)
820 INTEGER :: num_stripes, num_ext, num_unmatched
821 INTEGER :: abs_pos_ext_size, jsign, i, j, k, send_pos
822 INTEGER(xt_int_kind) :: intersection_index, orig_index
823 LOGICAL,
PARAMETER :: single_match_only = .true.
824 LOGICAL :: unmatched_in_intersection, unmatched_in_idxlist
825 TYPE(xt_idxlist) :: intersection
826 num_stripes =
SIZE(stripes)
829 idxlist, num_stripes, stripes, num_ext, pos_ext, single_match_only)
832 IF (num_unmatched /= 0) &
833 CALL test_abort(
"error in xt_idxlist_get_pos_exts_of_index_stripes", &
839 abs_pos_ext_size = int(abs(pos_ext(i)%size))
840 jsign = merge(1, -1, pos_ext(i)%size >= 0)
841 DO j = 0, abs_pos_ext_size-1
842 unmatched_in_intersection &
845 send_pos = pos_ext(i)%start + jsign * j
846 unmatched_in_idxlist &
848 IF (unmatched_in_intersection .OR. unmatched_in_idxlist &
849 .OR. intersection_index /= orig_index)
THEN 850 WRITE (0,
'(4(a,i0))')
"intersection pos ", k, &
851 " index ", intersection_index, &
852 " orig pos ", send_pos, &
853 " index ", orig_index
854 CALL test_abort(
"error in xt_idxlist_get_pos_exts_of_index_stripes", &
862 END SUBROUTINE check_idxlist_stripes_pos_ext
864 SUBROUTINE test_get_pos(stripes, pos)
865 TYPE(
xt_stripe),
INTENT(in) :: stripes(:)
866 INTEGER,
INTENT(in) :: pos(:)
867 INTEGER(xt_int_kind),
PARAMETER :: dummy = 1_xi
868 INTEGER(xt_int_kind) :: ref_sel_idx(size(pos)), sel_idx(size(pos))
869 INTEGER(xt_int_kind),
PARAMETER :: undef_idx = -huge(dummy)
870 INTEGER :: num_pos, ip, p, ref_undef_count, undef_count
871 TYPE(xt_idxlist) :: idxlist
878 ref_sel_idx(ip) = undef_idx
879 ref_undef_count = ref_undef_count + 1
884 IF (undef_count /= ref_undef_count) &
885 CALL test_abort(
"inequal undef count!", &
888 IF (any(sel_idx /= ref_sel_idx)) &
889 CALL test_abort(
"incorrect index returned for position!", &
893 END SUBROUTINE test_get_pos
895 SUBROUTINE test_get_pos1
898 INTEGER,
PARAMETER :: pos(13) = &
900 & 100, 11, 200, 9, 300, &
902 call test_get_pos(stripes, pos)
903 END SUBROUTINE test_get_pos1
905 SUBROUTINE test_get_pos2
908 INTEGER,
PARAMETER :: pos(19) = &
909 (/ -1, 0, 1, 2, 3, 4, 23, 5, 6, 7, &
910 & 8, 9, 10, 11, 12, 0, 2, 100, 2000 /)
911 call test_get_pos(stripes, pos)
912 END SUBROUTINE test_get_pos2
914 SUBROUTINE test_get_pos3
917 INTEGER,
PARAMETER :: pos(13) = &
918 (/ 4, 7, 2, 5, 9, 0, 10, 6, 11, 8, &
920 call test_get_pos(stripes, pos)
921 END SUBROUTINE test_get_pos3
923 SUBROUTINE test_get_pos4
926 INTEGER,
PARAMETER :: pos(7) = &
927 (/ -10, 200, 700, 90, 90, 18, 141 /)
928 CALL test_get_pos(stripes, pos)
929 END SUBROUTINE test_get_pos4
931 SUBROUTINE test_stripe_overlap
936 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(10) &
937 = (/ ((i + j, i=0,4), j = 0, 1) /)
940 INTEGER(xt_int_kind),
PARAMETER :: ref_indices(10) &
941 = (/ ((int(i + j, xi), i=0,4), j = 0, 1) /)
943 CALL stripe_test_general(stripes, ref_indices)
944 END SUBROUTINE test_stripe_overlap
946 SUBROUTINE test_stripe_bb(stripes, global_size, global_start_index, bounds_ref)
947 TYPE(
xt_stripe),
INTENT(in) :: stripes(:)
948 INTEGER(xt_int_kind),
INTENT(in) :: global_size(:), global_start_index
949 TYPE(
xt_bounds),
INTENT(in) :: bounds_ref(:)
951 TYPE(
xt_bounds) :: bounds(size(global_size))
952 TYPE(xt_idxlist) :: idxstripes
954 IF (
SIZE(global_size) /=
SIZE(bounds_ref)) &
955 CALL test_abort(
"size mismatch for bounding-box", &
962 IF (any(bounds /= bounds_ref)) &
963 CALL test_abort(
"boundary box doesn't match reference", &
967 END SUBROUTINE test_stripe_bb
969 SUBROUTINE test_stripe_bb1
971 INTEGER(xt_int_kind),
PARAMETER :: global_size(3) = 4_xi, &
972 global_start_index = 0
974 CALL test_stripe_bb(stripes(1:0), global_size, global_start_index, bounds_ref)
975 END SUBROUTINE test_stripe_bb1
977 SUBROUTINE test_stripe_bb2
980 INTEGER(xt_int_kind),
PARAMETER :: global_size(3) = (/ 5_xi, 4_xi, 3_xi /), &
981 global_start_index = 1
984 CALL test_stripe_bb(stripes, global_size, global_start_index, bounds_ref)
985 END SUBROUTINE test_stripe_bb2
987 SUBROUTINE do_tests(idxlist, ref_indices)
988 TYPE(xt_idxlist),
INTENT(in) :: idxlist
989 INTEGER(xt_int_kind),
INTENT(in) :: ref_indices(:)
991 TYPE(
xt_stripe),
ALLOCATABLE :: stripes(:)
993 INTEGER :: num_stripes
994 TYPE(xt_idxlist) :: temp_idxlist, idxlist_copy
996 CALL check_idxlist(idxlist, ref_indices)
998 IF (
ALLOCATED(stripes))
THEN 999 num_stripes =
SIZE(stripes)
1005 CALL check_idxlist(temp_idxlist, ref_indices)
1009 IF (
ALLOCATED(stripes))
DEALLOCATE(stripes)
1012 idxlist_copy = idxlist_pack_unpack_copy(idxlist)
1015 CALL check_idxlist(idxlist_copy, ref_indices)
1023 CALL check_idxlist(idxlist_copy, ref_indices)
1027 END SUBROUTINE do_tests
1029 SUBROUTINE check_pos_ext(stripes, search_stripes, ref_pos_ext, &
1030 single_match_only, ref_unmatched, test_desc)
1031 TYPE(
xt_stripe),
INTENT(in) :: stripes(:), search_stripes(:)
1032 TYPE(
xt_pos_ext),
intent(in) :: ref_pos_ext(:)
1033 LOGICAL,
INTENT(in) :: single_match_only
1034 INTEGER,
INTENT(in) :: ref_unmatched
1035 CHARACTER(len=*) :: test_desc
1037 INTEGER :: num_search_stripes, num_ref_pos_ext, num_ext, &
1039 TYPE(xt_idxlist) :: idxstripes
1042 num_search_stripes =
SIZE(search_stripes)
1043 num_ref_pos_ext =
SIZE(ref_pos_ext)
1047 num_search_stripes, search_stripes, &
1048 num_ext, pos_ext, single_match_only)
1049 IF (unmatched /= ref_unmatched) &
1050 CALL test_abort(
"error in number of unmatched indices for " &
1054 IF (num_ext < 0 .OR. num_ext /= num_ref_pos_ext) &
1055 CALL test_abort(
"error finding " // test_desc, &
1058 IF (any(pos_ext /= ref_pos_ext)) &
1059 CALL test_abort(
"incorrect position extent length found in "&
1065 END SUBROUTINE check_pos_ext
1067 SUBROUTINE check_pos_ext1
1068 INTEGER,
PARAMETER :: num_stripes = 1, num_ref_pos_ext = 1, &
1069 num_ref_unmatched = 0
1071 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) &
1073 search_stripes(1) = (/
xt_stripe(10_xi, -1_xi, 5) /)
1075 TYPE(
xt_pos_ext),
PARAMETER :: ref_pos_ext(num_ref_pos_ext) &
1078 CALL check_pos_ext(stripes, search_stripes, ref_pos_ext, .true., &
1079 num_ref_unmatched,
"simple inverted stripe")
1080 END SUBROUTINE check_pos_ext1
1082 SUBROUTINE check_pos_ext2
1083 INTEGER,
PARAMETER :: num_stripes = 1, num_ref_pos_ext = 1, &
1084 num_ref_unmatched = 5
1086 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) &
1088 search_stripes(2) =
xt_stripe(10_xi, -1_xi, 5)
1090 TYPE(
xt_pos_ext),
PARAMETER :: ref_pos_ext(num_ref_pos_ext) &
1093 CALL check_pos_ext(stripes, search_stripes, ref_pos_ext, .true., &
1094 num_ref_unmatched,
"simple inverted stripe")
1095 END SUBROUTINE check_pos_ext2
1097 SUBROUTINE check_pos_ext3
1098 INTEGER,
PARAMETER :: num_stripes = 2, num_ref_pos_ext = 1, &
1099 num_ref_unmatched = 4
1101 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) &
1103 search_stripes(1) =
xt_stripe(10_xi, 1_xi, 6)
1105 TYPE(
xt_pos_ext),
PARAMETER :: ref_pos_ext(num_ref_pos_ext) &
1108 CALL check_pos_ext(stripes, search_stripes, ref_pos_ext, .true., &
1109 num_ref_unmatched,
"search inc stripe over inc gap")
1110 END SUBROUTINE check_pos_ext3
1112 SUBROUTINE check_pos_ext4
1113 INTEGER,
PARAMETER :: num_stripes = 2, num_ref_pos_ext = 1, &
1114 num_ref_unmatched = 4
1116 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) &
1118 search_stripes(1) =
xt_stripe(10_xi, 1_xi, 6)
1120 TYPE(
xt_pos_ext),
PARAMETER :: ref_pos_ext(num_ref_pos_ext) &
1123 CALL check_pos_ext(stripes, search_stripes, ref_pos_ext, .true., &
1124 num_ref_unmatched,
"search inc stripe over dec gap")
1125 END SUBROUTINE check_pos_ext4
1127 SUBROUTINE check_pos_ext5
1128 INTEGER,
PARAMETER :: num_stripes = 2, num_ref_pos_ext = 1, &
1129 num_ref_unmatched = 4
1131 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) &
1133 search_stripes(1) =
xt_stripe(15_xi, -1_xi, 6)
1135 TYPE(
xt_pos_ext),
PARAMETER :: ref_pos_ext(num_ref_pos_ext) &
1138 CALL check_pos_ext(stripes, search_stripes, ref_pos_ext, .true., &
1139 num_ref_unmatched,
"search dec stripe over dec gap")
1140 END SUBROUTINE check_pos_ext5
1142 SUBROUTINE check_pos_ext6
1143 INTEGER,
PARAMETER :: num_stripes = 2, num_ref_pos_ext = 1, &
1144 num_ref_unmatched = 4
1146 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) &
1148 search_stripes(1) =
xt_stripe(15_xi, -1_xi, 6)
1150 TYPE(
xt_pos_ext),
PARAMETER :: ref_pos_ext(num_ref_pos_ext) &
1153 CALL check_pos_ext(stripes, search_stripes, ref_pos_ext, .true., &
1154 num_ref_unmatched,
"search dec stripe over inc gap")
1155 END SUBROUTINE check_pos_ext6
1157 SUBROUTINE check_pos_ext7
1158 INTEGER,
PARAMETER :: num_stripes = 3, num_ref_pos_ext = 1, &
1159 num_ref_unmatched = 8
1161 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) &
1164 search_stripes(1) =
xt_stripe(32_xi, -1_xi, 30)
1166 TYPE(
xt_pos_ext),
PARAMETER :: ref_pos_ext(num_ref_pos_ext) &
1169 CALL check_pos_ext(stripes, search_stripes, ref_pos_ext, .true., &
1170 num_ref_unmatched,
"search dec stripe over 2 inc gap")
1171 END SUBROUTINE check_pos_ext7
1173 SUBROUTINE check_pos_ext8
1174 INTEGER,
PARAMETER :: num_stripes = 5, num_ref_pos_ext = 5, &
1175 num_ref_unmatched = 0
1177 TYPE(
xt_stripe),
PARAMETER :: stripes(num_stripes) &
1181 search_stripes(1) =
xt_stripe(32_xi, -1_xi, 30)
1183 TYPE(
xt_pos_ext),
PARAMETER :: ref_pos_ext(num_ref_pos_ext) &
1187 CALL check_pos_ext(stripes, search_stripes, ref_pos_ext, .true., &
1188 num_ref_unmatched,
"search dec stripe over jumbled stripes")
1189 END SUBROUTINE check_pos_ext8
1191 FUNCTION str2lower(s)
RESULT(t)
1192 CHARACTER(len=*),
INTENT(in) :: s
1193 CHARACTER(len=LEN(s)) :: t
1194 INTEGER,
PARAMETER :: idel = ichar(
'a')-ichar(
'A')
1196 DO i = 1, len_trim(s)
1197 t(i:i) = char( ichar(s(i:i)) &
1198 + merge(idel, 0, ichar(s(i:i)) >= ichar(
'A') &
1199 & .AND. ichar(s(i:i)) <= ichar(
'Z')))
1201 END FUNCTION str2lower
1202 END PROGRAM test_idxstripes_f