26#include "../base/base_uses.f90"
30 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'dct'
33 INTEGER,
DIMENSION(:),
POINTER :: dests_expand => null()
34 INTEGER,
DIMENSION(:),
POINTER :: srcs_expand => null()
35 INTEGER,
DIMENSION(:),
POINTER :: flipg_stat => null()
36 INTEGER,
DIMENSION(:),
POINTER :: dests_shrink => null()
37 INTEGER :: srcs_shrink = 0
38 INTEGER,
DIMENSION(:, :, :),
POINTER :: recv_msgs_bnds => null()
39 INTEGER,
DIMENSION(2, 3) :: dct_bounds = 0
40 INTEGER,
DIMENSION(2, 3) :: dct_bounds_local = 0
41 INTEGER,
DIMENSION(2, 3) :: bounds_shftd = 0
42 INTEGER,
DIMENSION(2, 3) :: bounds_local_shftd = 0
47 REAL(
dp),
DIMENSION(:, :, :),
ALLOCATABLE :: msg
57 INTEGER,
PARAMETER,
PRIVATE :: not_flipped = 0, &
85 INTEGER,
INTENT(IN) :: neumann_directions
86 TYPE(
dct_type),
INTENT(INOUT) :: dct_env
88 CHARACTER(len=*),
PARAMETER :: routinen =
'dct_type_init'
90 INTEGER :: handle, maxn_sendrecv
92 CALL timeset(routinen, handle)
94 SELECT CASE (neumann_directions)
102 cpabort(
"Invalid combination of Neumann and periodic conditions.")
105 ALLOCATE (dct_env%flipg_stat(maxn_sendrecv))
106 ALLOCATE (dct_env%dests_expand(maxn_sendrecv), dct_env%srcs_expand(maxn_sendrecv))
107 ALLOCATE (dct_env%dests_shrink(maxn_sendrecv))
108 ALLOCATE (dct_env%recv_msgs_bnds(2, 3, maxn_sendrecv))
110 CALL set_dests_srcs_pid(pw_grid, neumann_directions, &
111 dct_env%dests_expand, dct_env%srcs_expand, dct_env%flipg_stat, &
112 dct_env%dests_shrink, dct_env%srcs_shrink)
113 CALL expansion_bounds(pw_grid, neumann_directions, &
114 dct_env%srcs_expand, dct_env%flipg_stat, &
115 dct_env%bounds_shftd, dct_env%bounds_local_shftd, &
116 dct_env%recv_msgs_bnds, dct_env%dct_bounds, &
117 dct_env%dct_bounds_local)
119 CALL timestop(handle)
132 TYPE(
dct_type),
INTENT(INOUT) :: dct_env
134 CHARACTER(len=*),
PARAMETER :: routinen =
'dct_type_release'
138 CALL timeset(routinen, handle)
140 IF (
ASSOCIATED(dct_env%dests_shrink))
DEALLOCATE (dct_env%dests_shrink)
141 IF (
ASSOCIATED(dct_env%dests_expand))
DEALLOCATE (dct_env%dests_expand)
142 IF (
ASSOCIATED(dct_env%srcs_expand))
DEALLOCATE (dct_env%srcs_expand)
143 IF (
ASSOCIATED(dct_env%flipg_stat))
DEALLOCATE (dct_env%flipg_stat)
144 IF (
ASSOCIATED(dct_env%recv_msgs_bnds))
DEALLOCATE (dct_env%recv_msgs_bnds)
146 CALL timestop(handle)
164 REAL(
dp),
DIMENSION(3, 3),
INTENT(IN) :: cell_hmat
165 INTEGER,
INTENT(IN) :: neumann_directions
166 TYPE(
pw_grid_type),
INTENT(INOUT),
POINTER :: dct_pw_grid
168 CHARACTER(LEN=*),
PARAMETER :: routinen =
'setup_dct_pw_grids'
170 INTEGER :: blocked, handle, maxn_sendrecv, &
172 INTEGER,
DIMENSION(2, 3) :: bounds_local_new, bounds_local_shftd, &
173 bounds_new, bounds_shftd
174 INTEGER,
DIMENSION(:),
POINTER :: dests_expand, dests_shrink, flipg_stat, &
176 INTEGER,
DIMENSION(:, :, :),
POINTER :: recv_msgs_bnds
177 REAL(kind=
dp),
DIMENSION(3) :: scfac
178 REAL(kind=
dp),
DIMENSION(3, 3) :: hmat2
180 CALL timeset(routinen, handle)
182 SELECT CASE (neumann_directions)
185 scfac = (/2.0_dp, 2.0_dp, 2.0_dp/)
188 scfac = (/2.0_dp, 2.0_dp, 1.0_dp/)
191 scfac = (/2.0_dp, 1.0_dp, 2.0_dp/)
194 scfac = (/1.0_dp, 2.0_dp, 2.0_dp/)
197 scfac = (/2.0_dp, 1.0_dp, 1.0_dp/)
200 scfac = (/1.0_dp, 2.0_dp, 1.0_dp/)
203 scfac = (/1.0_dp, 1.0_dp, 2.0_dp/)
205 cpabort(
"Invalid combination of Neumann and periodic conditions.")
208 ALLOCATE (flipg_stat(maxn_sendrecv))
209 ALLOCATE (dests_expand(maxn_sendrecv), srcs_expand(maxn_sendrecv), dests_shrink(maxn_sendrecv))
210 ALLOCATE (recv_msgs_bnds(2, 3, maxn_sendrecv))
212 CALL set_dests_srcs_pid(pw_grid, neumann_directions, dests_expand, srcs_expand, flipg_stat, &
213 dests_shrink, srcs_shrink)
214 CALL expansion_bounds(pw_grid, neumann_directions, srcs_expand, flipg_stat, &
215 bounds_shftd, bounds_local_shftd, recv_msgs_bnds, bounds_new, bounds_local_new)
218 hmat2(1, 1) = scfac(1)*cell_hmat(1, 1)
219 hmat2(2, 2) = scfac(2)*cell_hmat(2, 2)
220 hmat2(3, 3) = scfac(3)*cell_hmat(3, 3)
225 IF (pw_grid%para%blocked)
THEN
227 ELSE IF (pw_grid%para%ray_distribution)
THEN
233 rs_dims=pw_grid%para%group%num_pe_cart, &
235 bounds_local=bounds_local_new)
237 DEALLOCATE (flipg_stat, dests_expand, srcs_expand, dests_shrink, recv_msgs_bnds)
239 CALL timestop(handle)
257 SUBROUTINE set_dests_srcs_pid(pw_grid, neumann_directions, dests_expand, srcs_expand, &
258 flipg_stat, dests_shrink, srcs_shrink)
261 INTEGER,
INTENT(IN) :: neumann_directions
262 INTEGER,
DIMENSION(:),
INTENT(INOUT),
POINTER :: dests_expand, srcs_expand, flipg_stat, &
264 INTEGER,
INTENT(OUT) :: srcs_shrink
266 CHARACTER(LEN=*),
PARAMETER :: routinen =
'set_dests_srcs_pid'
268 INTEGER :: group_size, handle, i, j, k, &
269 maxn_sendrecv, rs_dim1, rs_dim2, &
270 rs_mpo, tmp_size1, tmp_size2
271 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: src_pos1_onesdd, src_pos2_onesdd, &
273 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: dests_shrink_all, src_pos1, src_pos2, &
274 srcs_coord, srcs_expand_all
275 INTEGER,
DIMENSION(2) :: rs_dims, rs_pos
278 CALL timeset(routinen, handle)
323 rs_group = pw_grid%para%group
324 rs_mpo = pw_grid%para%group%mepos
325 group_size = pw_grid%para%group%num_pe
326 rs_dims = pw_grid%para%group%num_pe_cart
328 rs_pos = pw_grid%para%group%mepos_cart
329 rs_dim1 = rs_dims(1); rs_dim2 = rs_dims(2)
332 SELECT CASE (neumann_directions)
335 ALLOCATE (srcs_coord(2, maxn_sendrecv))
337 IF (mod(rs_dim1, 2) .EQ. 0)
THEN
340 tmp_size1 = rs_dim1 + 1
342 ALLOCATE (tmp1_arr(tmp_size1), src_pos1(2, 0:rs_dim1 - 1))
344 IF (mod(rs_dim1, 2) .EQ. 0)
THEN
345 tmp1_arr(:) = (/(i, i=1, rs_dim1)/)
346 src_pos1(:, :) = reshape((/tmp1_arr, -tmp1_arr(tmp_size1:1:-1)/), (/2, rs_dim1/))
348 tmp1_arr(:) = (/(i, i=1, rs_dim1), -rs_dim1/)
349 src_pos1(:, :) = reshape((/tmp1_arr, -tmp1_arr(tmp_size1 - 2:1:-1)/), (/2, rs_dim1/))
352 IF (mod(rs_dim2, 2) .EQ. 0)
THEN
355 tmp_size2 = rs_dim2 + 1
357 ALLOCATE (tmp2_arr(tmp_size2), src_pos2(2, 0:rs_dim2 - 1))
359 IF (mod(rs_dim2, 2) .EQ. 0)
THEN
360 tmp2_arr(:) = (/(i, i=1, rs_dim2)/)
361 src_pos2(:, :) = reshape((/tmp2_arr, -tmp2_arr(tmp_size2:1:-1)/), (/2, rs_dim2/))
363 tmp2_arr(:) = (/(i, i=1, rs_dim2), -rs_dim2/)
364 src_pos2(:, :) = reshape((/tmp2_arr, -tmp2_arr(tmp_size2 - 2:1:-1)/), (/2, rs_dim2/))
367 srcs_coord(:, 1) = (/src_pos1(1, rs_pos(1)), src_pos2(1, rs_pos(2))/)
368 srcs_coord(:, 2) = (/src_pos1(1, rs_pos(1)), src_pos2(2, rs_pos(2))/)
369 srcs_coord(:, 3) = (/src_pos1(2, rs_pos(1)), src_pos2(1, rs_pos(2))/)
370 srcs_coord(:, 4) = (/src_pos1(2, rs_pos(1)), src_pos2(2, rs_pos(2))/)
373 ALLOCATE (srcs_coord(2, maxn_sendrecv))
375 IF (mod(rs_dim1, 2) .EQ. 0)
THEN
378 tmp_size1 = rs_dim1 + 1
380 ALLOCATE (tmp1_arr(tmp_size1), src_pos1(2, 0:rs_dim1 - 1))
382 IF (mod(rs_dim1, 2) .EQ. 0)
THEN
383 tmp1_arr(:) = (/(i, i=1, rs_dim1)/)
384 src_pos1(:, :) = reshape((/tmp1_arr, -tmp1_arr(tmp_size1:1:-1)/), (/2, rs_dim1/))
386 tmp1_arr(:) = (/(i, i=1, rs_dim1), -rs_dim1/)
387 src_pos1(:, :) = reshape((/tmp1_arr, -tmp1_arr(tmp_size1 - 2:1:-1)/), (/2, rs_dim1/))
390 ALLOCATE (src_pos2_onesdd(0:rs_dim2 - 1))
391 src_pos2_onesdd(:) = (/(i, i=1, rs_dim2)/)
393 srcs_coord(:, 1) = (/src_pos1(1, rs_pos(1)), src_pos2_onesdd(rs_pos(2))/)
394 srcs_coord(:, 2) = (/src_pos1(2, rs_pos(1)), src_pos2_onesdd(rs_pos(2))/)
397 ALLOCATE (srcs_coord(2, maxn_sendrecv))
399 ALLOCATE (src_pos1_onesdd(0:rs_dim1 - 1))
400 src_pos1_onesdd(:) = (/(i, i=1, rs_dim1)/)
402 IF (mod(rs_dim2, 2) .EQ. 0)
THEN
405 tmp_size2 = rs_dim2 + 1
407 ALLOCATE (tmp2_arr(tmp_size2), src_pos2(2, 0:rs_dim2 - 1))
409 IF (mod(rs_dim2, 2) .EQ. 0)
THEN
410 tmp2_arr(:) = (/(i, i=1, rs_dim2)/)
411 src_pos2(:, :) = reshape((/tmp2_arr, -tmp2_arr(tmp_size2:1:-1)/), (/2, rs_dim2/))
413 tmp2_arr(:) = (/(i, i=1, rs_dim2), -rs_dim2/)
414 src_pos2(:, :) = reshape((/tmp2_arr, -tmp2_arr(tmp_size2 - 2:1:-1)/), (/2, rs_dim2/))
417 srcs_coord(:, 1) = (/src_pos1_onesdd(rs_pos(1)), src_pos2(1, rs_pos(2))/)
418 srcs_coord(:, 2) = (/src_pos1_onesdd(rs_pos(1)), src_pos2(2, rs_pos(2))/)
421 ALLOCATE (srcs_coord(2, maxn_sendrecv))
422 ALLOCATE (src_pos1_onesdd(0:rs_dim1 - 1))
423 ALLOCATE (src_pos2_onesdd(0:rs_dim2 - 1))
425 src_pos1_onesdd(:) = (/(i, i=1, rs_dim1)/)
427 src_pos2_onesdd(:) = (/(i, i=1, rs_dim2)/)
429 srcs_coord(:, 1) = (/src_pos1_onesdd(rs_pos(1)), src_pos2_onesdd(rs_pos(2))/)
433 flipg_stat = not_flipped
435 DO k = 1, maxn_sendrecv
437 CALL pw_grid%para%group%rank_cart(abs(srcs_coord(:, k)) - 1, srcs_expand(k))
439 IF ((srcs_coord(1, k) .GT. 0) .AND. (srcs_coord(2, k) .GT. 0))
THEN
440 flipg_stat(k) = not_flipped
441 ELSE IF ((srcs_coord(1, k) .LT. 0) .AND. (srcs_coord(2, k) .GT. 0))
THEN
442 flipg_stat(k) = ud_flipped
443 ELSE IF ((srcs_coord(1, k) .GT. 0) .AND. (srcs_coord(2, k) .LT. 0))
THEN
444 flipg_stat(k) = lr_flipped
446 flipg_stat(k) = rotated
451 ALLOCATE (srcs_expand_all(maxn_sendrecv, group_size))
452 CALL rs_group%allgather(srcs_expand, srcs_expand_all)
457 DO j = 1, maxn_sendrecv
458 IF (srcs_expand_all(j, i) .EQ. rs_mpo)
THEN
459 dests_expand(k) = i - 1
472 DO i = 1, maxn_sendrecv
473 IF (flipg_stat(i) .EQ. not_flipped) dests_shrink(i) = srcs_expand(i)
477 ALLOCATE (dests_shrink_all(maxn_sendrecv, group_size))
478 CALL rs_group%allgather(dests_shrink, dests_shrink_all)
483 DO j = 1, maxn_sendrecv
484 IF (dests_shrink_all(j, i) .EQ. rs_mpo)
THEN
491 CALL timestop(handle)
493 END SUBROUTINE set_dests_srcs_pid
514 SUBROUTINE pw_expand(neumann_directions, recv_msgs_bnds, dests_expand, srcs_expand, &
515 flipg_stat, bounds_shftd, pw_in, pw_expanded)
517 INTEGER,
INTENT(IN) :: neumann_directions
518 INTEGER,
DIMENSION(:, :, :),
INTENT(IN),
POINTER :: recv_msgs_bnds
519 INTEGER,
DIMENSION(:),
INTENT(IN),
POINTER :: dests_expand, srcs_expand, flipg_stat
520 INTEGER,
DIMENSION(2, 3),
INTENT(IN) :: bounds_shftd
524 CHARACTER(LEN=*),
PARAMETER :: routinen =
'pw_expand'
526 INTEGER :: group_size, handle, i, ind, lb1, lb1_loc, lb1_new, lb2, lb2_loc, lb2_new, lb3, &
527 lb3_loc, lb3_new, loc, maxn_sendrecv, rs_mpo, ub1, ub1_loc, ub1_new, ub2, ub2_loc, &
528 ub2_new, ub3, ub3_loc, ub3_new
529 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: dest_hist, src_hist
530 INTEGER,
ALLOCATABLE,
DIMENSION(:, :, :) :: pcs_bnds
531 INTEGER,
DIMENSION(2, 3) :: bounds_local_new
532 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: catd, catd_flipdbf, cr3d_xpndd
533 TYPE(dct_msg_type),
ALLOCATABLE,
DIMENSION(:) :: pcs, recv_msgs
535 TYPE(
mp_request_type),
ALLOCATABLE,
DIMENSION(:) :: recv_reqs, send_reqs
538 CALL timeset(routinen, handle)
540 pw_grid => pw_in%pw_grid
541 rs_group = pw_grid%para%group
542 rs_mpo = pw_grid%para%group%mepos
543 group_size = pw_grid%para%group%num_pe
545 bounds_local_new = pw_expanded%pw_grid%bounds_local
547 SELECT CASE (neumann_directions)
556 ALLOCATE (recv_reqs(maxn_sendrecv), send_reqs(maxn_sendrecv))
557 ALLOCATE (dest_hist(maxn_sendrecv), src_hist(maxn_sendrecv))
558 ALLOCATE (pcs_bnds(2, 3, maxn_sendrecv))
560 ALLOCATE (pcs(maxn_sendrecv), recv_msgs(maxn_sendrecv))
568 DO i = 1, maxn_sendrecv
570 IF ((dests_expand(i) .NE. rs_mpo) .AND. .NOT. any(dest_hist .EQ. dests_expand(i)))
THEN
571 CALL rs_group%isend(pw_in%array, dests_expand(i), send_reqs(i))
573 dest_hist(i) = dests_expand(i)
576 DO i = 1, maxn_sendrecv
577 lb1 = recv_msgs_bnds(1, 1, i)
578 ub1 = recv_msgs_bnds(2, 1, i)
579 lb2 = recv_msgs_bnds(1, 2, i)
580 ub2 = recv_msgs_bnds(2, 2, i)
581 lb3 = recv_msgs_bnds(1, 3, i)
582 ub3 = recv_msgs_bnds(2, 3, i)
584 IF (srcs_expand(i) .EQ. rs_mpo)
THEN
585 ALLOCATE (recv_msgs(i)%msg(lb1:ub1, lb2:ub2, lb3:ub3))
586 recv_msgs(i)%msg(:, :, :) = pw_in%array
588 ELSE IF (any(src_hist .EQ. srcs_expand(i)))
THEN
589 loc = minloc(abs(src_hist - srcs_expand(i)), 1)
590 lb1_loc = recv_msgs_bnds(1, 1, loc)
591 ub1_loc = recv_msgs_bnds(2, 1, loc)
592 lb2_loc = recv_msgs_bnds(1, 2, loc)
593 ub2_loc = recv_msgs_bnds(2, 2, loc)
594 lb3_loc = recv_msgs_bnds(1, 3, loc)
595 ub3_loc = recv_msgs_bnds(2, 3, loc)
596 ALLOCATE (recv_msgs(i)%msg(lb1_loc:ub1_loc, lb2_loc:ub2_loc, lb3_loc:ub3_loc))
597 recv_msgs(i)%msg(:, :, :) = recv_msgs(loc)%msg
599 ALLOCATE (recv_msgs(i)%msg(lb1:ub1, lb2:ub2, lb3:ub3))
600 CALL rs_group%irecv(recv_msgs(i)%msg, srcs_expand(i), recv_reqs(i))
601 CALL recv_reqs(i)%wait()
603 src_hist(i) = srcs_expand(i)
609 DO i = 1, maxn_sendrecv
610 SELECT CASE (flipg_stat(i))
612 lb1 = recv_msgs_bnds(1, 1, i)
613 ub1 = recv_msgs_bnds(2, 1, i)
614 lb2 = recv_msgs_bnds(1, 2, i)
615 ub2 = recv_msgs_bnds(2, 2, i)
616 lb3 = recv_msgs_bnds(1, 3, i)
617 ub3 = recv_msgs_bnds(2, 3, i)
618 ALLOCATE (pcs(i)%msg(lb1:ub1, lb2:ub2, lb3:ub3))
619 pcs(i)%msg(:, :, :) = recv_msgs(i)%msg
621 CALL flipud(recv_msgs(i)%msg, pcs(i)%msg, bounds_shftd)
623 CALL fliplr(recv_msgs(i)%msg, pcs(i)%msg, bounds_shftd)
625 CALL flipbf(recv_msgs(i)%msg, pcs(i)%msg, bounds_shftd)
627 CALL rot180(recv_msgs(i)%msg, pcs(i)%msg, bounds_shftd)
632 DO i = 1, maxn_sendrecv
633 pcs_bnds(1, 1, i) = lbound(pcs(i)%msg, 1)
634 pcs_bnds(2, 1, i) = ubound(pcs(i)%msg, 1)
635 pcs_bnds(1, 2, i) = lbound(pcs(i)%msg, 2)
636 pcs_bnds(2, 2, i) = ubound(pcs(i)%msg, 2)
637 pcs_bnds(1, 3, i) = lbound(pcs(i)%msg, 3)
638 pcs_bnds(2, 3, i) = ubound(pcs(i)%msg, 3)
641 lb1_new = bounds_local_new(1, 1); ub1_new = bounds_local_new(2, 1)
642 lb2_new = bounds_local_new(1, 2); ub2_new = bounds_local_new(2, 2)
643 lb3_new = bounds_local_new(1, 3); ub3_new = bounds_local_new(2, 3)
645 SELECT CASE (neumann_directions)
647 ind = int(0.5*(ub3_new + lb3_new + 1))
648 ALLOCATE (catd(lb1_new:ub1_new, lb2_new:ub2_new, lb3_new:ind - 1))
650 ALLOCATE (catd(lb1_new:ub1_new, lb2_new:ub2_new, lb3_new:ub3_new))
653 DO i = 1, maxn_sendrecv
654 catd(pcs_bnds(1, 1, i):pcs_bnds(2, 1, i), &
655 pcs_bnds(1, 2, i):pcs_bnds(2, 2, i), &
656 pcs_bnds(1, 3, i):pcs_bnds(2, 3, i)) = pcs(i)%msg
660 CALL flipbf(catd, catd_flipdbf, bounds_shftd)
662 ALLOCATE (cr3d_xpndd(lb1_new:ub1_new, lb2_new:ub2_new, lb3_new:ub3_new))
663 SELECT CASE (neumann_directions)
665 cr3d_xpndd(:, :, lb3_new:ind - 1) = catd
666 cr3d_xpndd(:, :, ind:ub3_new) = catd_flipdbf
668 cr3d_xpndd(:, :, :) = catd
671 pw_expanded%array = cr3d_xpndd
673 DO i = 1, maxn_sendrecv
674 DEALLOCATE (pcs(i)%msg)
675 DEALLOCATE (recv_msgs(i)%msg)
677 DEALLOCATE (pcs, recv_msgs)
678 DEALLOCATE (catd, catd_flipdbf, cr3d_xpndd)
680 CALL timestop(handle)
698 SUBROUTINE pw_shrink(neumann_directions, dests_shrink, srcs_shrink, bounds_local_shftd, &
701 INTEGER,
INTENT(IN) :: neumann_directions
702 INTEGER,
DIMENSION(:),
INTENT(IN),
POINTER :: dests_shrink
703 INTEGER,
INTENT(INOUT) :: srcs_shrink
704 INTEGER,
DIMENSION(2, 3),
INTENT(IN) :: bounds_local_shftd
708 CHARACTER(LEN=*),
PARAMETER :: routinen =
'pw_shrink'
710 INTEGER :: group_size, handle, i, lb1_orig, lb1_xpnd, lb2_orig, lb2_xpnd, lb3_orig, &
711 lb3_xpnd, maxn_sendrecv, rs_mpo, send_lb1, send_lb2, send_lb3, send_ub1, send_ub2, &
712 send_ub3, tag, ub1_orig, ub1_xpnd, ub2_orig, ub2_xpnd, ub3_orig, ub3_xpnd
713 INTEGER,
ALLOCATABLE,
DIMENSION(:, :, :) :: bounds_local_all
714 INTEGER,
DIMENSION(2, 3) :: bounds_local_xpnd
715 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: cr3d, send_crmsg
719 CALL timeset(routinen, handle)
721 pw_grid_orig => pw_shrinked%pw_grid
722 rs_group = pw_grid_orig%para%group
723 rs_mpo = pw_grid_orig%para%group%mepos
724 group_size = pw_grid_orig%para%group%num_pe
725 bounds_local_xpnd = pw_in%pw_grid%bounds_local
728 SELECT CASE (neumann_directions)
738 lb1_xpnd = bounds_local_xpnd(1, 1)
739 ub1_xpnd = bounds_local_xpnd(2, 1)
740 lb2_xpnd = bounds_local_xpnd(1, 2)
741 ub2_xpnd = bounds_local_xpnd(2, 2)
742 lb3_xpnd = bounds_local_xpnd(1, 3)
743 ub3_xpnd = bounds_local_xpnd(2, 3)
744 ALLOCATE (cr3d(lb1_xpnd:ub1_xpnd, lb2_xpnd:ub2_xpnd, lb3_xpnd:ub3_xpnd))
745 cr3d(:, :, :) = pw_in%array
748 ALLOCATE (bounds_local_all(2, 3, group_size))
749 CALL rs_group%allgather(bounds_local_shftd, bounds_local_all)
751 DO i = 1, maxn_sendrecv
753 IF ((dests_shrink(i) .NE. rs_mpo) .AND. (dests_shrink(i) .NE. -1))
THEN
754 send_lb1 = bounds_local_all(1, 1, dests_shrink(i) + 1)
755 send_ub1 = bounds_local_all(2, 1, dests_shrink(i) + 1)
756 send_lb2 = bounds_local_all(1, 2, dests_shrink(i) + 1)
757 send_ub2 = bounds_local_all(2, 2, dests_shrink(i) + 1)
758 send_lb3 = bounds_local_all(1, 3, dests_shrink(i) + 1)
759 send_ub3 = bounds_local_all(2, 3, dests_shrink(i) + 1)
761 ALLOCATE (send_crmsg(send_lb1:send_ub1, send_lb2:send_ub2, send_lb3:send_ub3))
762 send_crmsg(:, :, :) = cr3d(send_lb1:send_ub1, send_lb2:send_ub2, send_lb3:send_ub3)
763 CALL rs_group%send(send_crmsg, dests_shrink(i), tag)
764 DEALLOCATE (send_crmsg)
768 lb1_orig = bounds_local_shftd(1, 1)
769 ub1_orig = bounds_local_shftd(2, 1)
770 lb2_orig = bounds_local_shftd(1, 2)
771 ub2_orig = bounds_local_shftd(2, 2)
772 lb3_orig = bounds_local_shftd(1, 3)
773 ub3_orig = bounds_local_shftd(2, 3)
776 IF (srcs_shrink .EQ. rs_mpo)
THEN
777 pw_shrinked%array = cr3d(lb1_orig:ub1_orig, lb2_orig:ub2_orig, lb3_orig:ub3_orig)
778 ELSE IF (srcs_shrink .EQ. -1)
THEN
781 CALL rs_group%recv(pw_shrinked%array, srcs_shrink, tag)
784 DEALLOCATE (bounds_local_all)
786 CALL timestop(handle)
800 SUBROUTINE flipud(cr3d_in, cr3d_out, bounds)
802 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
803 INTENT(IN) :: cr3d_in
804 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
805 INTENT(INOUT) :: cr3d_out
806 INTEGER,
DIMENSION(2, 3),
INTENT(IN) :: bounds
808 CHARACTER(LEN=*),
PARAMETER :: routinen =
'flipud'
810 INTEGER :: handle, i, lb1, lb1_glbl, lb1_new, lb2, lb2_glbl, lb2_new, lb3, lb3_glbl, &
811 lb3_new, ub1, ub1_glbl, ub1_new, ub2, ub2_glbl, ub2_new, ub3, ub3_glbl, ub3_new
812 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: indx
813 INTEGER,
DIMENSION(2, 3) :: bndsl, bndsl_new
815 CALL timeset(routinen, handle)
817 lb1 = lbound(cr3d_in, 1); ub1 = ubound(cr3d_in, 1)
818 lb2 = lbound(cr3d_in, 2); ub2 = ubound(cr3d_in, 2)
819 lb3 = lbound(cr3d_in, 3); ub3 = ubound(cr3d_in, 3)
821 lb1_glbl = bounds(1, 1); ub1_glbl = bounds(2, 1)
822 lb2_glbl = bounds(1, 2); ub2_glbl = bounds(2, 2)
823 lb3_glbl = bounds(1, 3); ub3_glbl = bounds(2, 3)
825 bndsl = reshape((/lb1, ub1, lb2, ub2, lb3, ub3/), (/2, 3/))
826 bndsl_new = flipud_bounds_local(bndsl, bounds)
828 lb1_new = bndsl_new(1, 1); ub1_new = bndsl_new(2, 1)
829 lb2_new = bndsl_new(1, 2); ub2_new = bndsl_new(2, 2)
830 lb3_new = bndsl_new(1, 3); ub3_new = bndsl_new(2, 3)
832 ALLOCATE (cr3d_out(lb1_new:ub1_new, lb2_new:ub2_new, lb3_new:ub3_new))
837 ALLOCATE (indx(ub1_new - lb1_new + 1))
838 indx(:) = (/(i, i=2*(ub1_glbl + 1) - lb1_new, 2*(ub1_glbl + 1) - ub1_new, -1)/)
839 IF (lb1_new .EQ. ub1_glbl + 1) indx(1) = indx(2)
840 cr3d_out(lb1_new:ub1_new, lb2_new:ub2_new, lb3_new:ub3_new) = cr3d_in(indx, :, :)
842 CALL timestop(handle)
844 END SUBROUTINE flipud
856 SUBROUTINE fliplr(cr3d_in, cr3d_out, bounds)
858 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
859 INTENT(IN) :: cr3d_in
860 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
861 INTENT(INOUT) :: cr3d_out
862 INTEGER,
DIMENSION(2, 3),
INTENT(IN) :: bounds
864 CHARACTER(LEN=*),
PARAMETER :: routinen =
'fliplr'
866 INTEGER :: handle, i, lb1, lb1_glbl, lb1_new, lb2, lb2_glbl, lb2_new, lb3, lb3_glbl, &
867 lb3_new, ub1, ub1_glbl, ub1_new, ub2, ub2_glbl, ub2_new, ub3, ub3_glbl, ub3_new
868 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: indy
869 INTEGER,
DIMENSION(2, 3) :: bndsl, bndsl_new
871 CALL timeset(routinen, handle)
873 lb1 = lbound(cr3d_in, 1); ub1 = ubound(cr3d_in, 1)
874 lb2 = lbound(cr3d_in, 2); ub2 = ubound(cr3d_in, 2)
875 lb3 = lbound(cr3d_in, 3); ub3 = ubound(cr3d_in, 3)
877 lb1_glbl = bounds(1, 1); ub1_glbl = bounds(2, 1)
878 lb2_glbl = bounds(1, 2); ub2_glbl = bounds(2, 2)
879 lb3_glbl = bounds(1, 3); ub3_glbl = bounds(2, 3)
881 bndsl = reshape((/lb1, ub1, lb2, ub2, lb3, ub3/), (/2, 3/))
882 bndsl_new = fliplr_bounds_local(bndsl, bounds)
884 lb1_new = bndsl_new(1, 1); ub1_new = bndsl_new(2, 1)
885 lb2_new = bndsl_new(1, 2); ub2_new = bndsl_new(2, 2)
886 lb3_new = bndsl_new(1, 3); ub3_new = bndsl_new(2, 3)
888 ALLOCATE (cr3d_out(lb1_new:ub1_new, lb2_new:ub2_new, lb3_new:ub3_new))
893 ALLOCATE (indy(ub2_new - lb2_new + 1))
894 indy(:) = (/(i, i=2*(ub2_glbl + 1) - lb2_new, 2*(ub2_glbl + 1) - ub2_new, -1)/)
895 IF (lb2_new .EQ. ub2_glbl + 1) indy(1) = indy(2)
896 cr3d_out(lb1_new:ub1_new, lb2_new:ub2_new, lb3_new:ub3_new) = cr3d_in(:, indy, :)
898 CALL timestop(handle)
900 END SUBROUTINE fliplr
912 SUBROUTINE flipbf(cr3d_in, cr3d_out, bounds)
914 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
915 INTENT(IN) :: cr3d_in
916 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
917 INTENT(INOUT) :: cr3d_out
918 INTEGER,
DIMENSION(2, 3),
INTENT(IN) :: bounds
920 CHARACTER(LEN=*),
PARAMETER :: routinen =
'flipbf'
922 INTEGER :: handle, i, lb1, lb1_glbl, lb1_new, lb2, lb2_glbl, lb2_new, lb3, lb3_glbl, &
923 lb3_new, ub1, ub1_glbl, ub1_new, ub2, ub2_glbl, ub2_new, ub3, ub3_glbl, ub3_new
924 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: indz
925 INTEGER,
DIMENSION(2, 3) :: bndsl, bndsl_new
927 CALL timeset(routinen, handle)
929 lb1 = lbound(cr3d_in, 1); ub1 = ubound(cr3d_in, 1)
930 lb2 = lbound(cr3d_in, 2); ub2 = ubound(cr3d_in, 2)
931 lb3 = lbound(cr3d_in, 3); ub3 = ubound(cr3d_in, 3)
933 lb1_glbl = bounds(1, 1); ub1_glbl = bounds(2, 1)
934 lb2_glbl = bounds(1, 2); ub2_glbl = bounds(2, 2)
935 lb3_glbl = bounds(1, 3); ub3_glbl = bounds(2, 3)
937 bndsl = reshape((/lb1, ub1, lb2, ub2, lb3, ub3/), (/2, 3/))
938 bndsl_new = flipbf_bounds_local(bndsl, bounds)
940 lb1_new = bndsl_new(1, 1); ub1_new = bndsl_new(2, 1)
941 lb2_new = bndsl_new(1, 2); ub2_new = bndsl_new(2, 2)
942 lb3_new = bndsl_new(1, 3); ub3_new = bndsl_new(2, 3)
944 ALLOCATE (cr3d_out(lb1_new:ub1_new, lb2_new:ub2_new, lb3_new:ub3_new))
949 ALLOCATE (indz(ub3_new - lb3_new + 1))
950 indz(:) = (/(i, i=2*(ub3_glbl + 1) - lb3_new, 2*(ub3_glbl + 1) - ub3_new, -1)/)
951 IF (lb3_new .EQ. ub3_glbl + 1) indz(1) = indz(2)
952 cr3d_out(lb1_new:ub1_new, lb2_new:ub2_new, lb3_new:ub3_new) = cr3d_in(:, :, indz)
954 CALL timestop(handle)
956 END SUBROUTINE flipbf
968 SUBROUTINE rot180(cr3d_in, cr3d_out, bounds)
970 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
971 INTENT(IN) :: cr3d_in
972 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :, :), &
973 INTENT(INOUT) :: cr3d_out
974 INTEGER,
DIMENSION(2, 3),
INTENT(IN) :: bounds
976 CHARACTER(LEN=*),
PARAMETER :: routinen =
'rot180'
978 INTEGER :: handle, i, lb1, lb1_glbl, lb1_new, lb2, lb2_glbl, lb2_new, lb3, lb3_glbl, &
979 lb3_new, ub1, ub1_glbl, ub1_new, ub2, ub2_glbl, ub2_new, ub3, ub3_glbl, ub3_new
980 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: indx, indy
981 INTEGER,
DIMENSION(2, 3) :: bndsl, bndsl_new
983 CALL timeset(routinen, handle)
985 lb1 = lbound(cr3d_in, 1); ub1 = ubound(cr3d_in, 1)
986 lb2 = lbound(cr3d_in, 2); ub2 = ubound(cr3d_in, 2)
987 lb3 = lbound(cr3d_in, 3); ub3 = ubound(cr3d_in, 3)
989 lb1_glbl = bounds(1, 1); ub1_glbl = bounds(2, 1)
990 lb2_glbl = bounds(1, 2); ub2_glbl = bounds(2, 2)
991 lb3_glbl = bounds(1, 3); ub3_glbl = bounds(2, 3)
993 bndsl = reshape((/lb1, ub1, lb2, ub2, lb3, ub3/), (/2, 3/))
994 bndsl_new = rot180_bounds_local(bndsl, bounds)
996 lb1_new = bndsl_new(1, 1); ub1_new = bndsl_new(2, 1)
997 lb2_new = bndsl_new(1, 2); ub2_new = bndsl_new(2, 2)
998 lb3_new = bndsl_new(1, 3); ub3_new = bndsl_new(2, 3)
1000 ALLOCATE (cr3d_out(lb1_new:ub1_new, lb2_new:ub2_new, lb3_new:ub3_new))
1005 ALLOCATE (indx(ub1_new - lb1_new + 1), indy(ub2_new - lb2_new + 1))
1006 indx(:) = (/(i, i=2*(ub1_glbl + 1) - lb1_new, 2*(ub1_glbl + 1) - ub1_new, -1)/)
1007 indy(:) = (/(i, i=2*(ub2_glbl + 1) - lb2_new, 2*(ub2_glbl + 1) - ub2_new, -1)/)
1008 IF (lb1_new .EQ. ub1_glbl + 1) indx(1) = indx(2)
1009 IF (lb2_new .EQ. ub2_glbl + 1) indy(1) = indy(2)
1010 cr3d_out(lb1_new:ub1_new, lb2_new:ub2_new, lb3_new:ub3_new) = cr3d_in(indx, indy, :)
1012 CALL timestop(handle)
1014 END SUBROUTINE rot180
1031 SUBROUTINE expansion_bounds(pw_grid, neumann_directions, srcs_expand, flipg_stat, &
1032 bounds_shftd, bounds_local_shftd, &
1033 recv_msgs_bnds, bounds_new, bounds_local_new)
1036 INTEGER,
INTENT(IN) :: neumann_directions
1037 INTEGER,
DIMENSION(:),
INTENT(IN),
POINTER :: srcs_expand, flipg_stat
1038 INTEGER,
DIMENSION(2, 3),
INTENT(OUT) :: bounds_shftd, bounds_local_shftd
1039 INTEGER,
DIMENSION(:, :, :),
INTENT(INOUT), &
1040 POINTER :: recv_msgs_bnds
1041 INTEGER,
DIMENSION(2, 3),
INTENT(OUT) :: bounds_new, bounds_local_new
1043 CHARACTER(LEN=*),
PARAMETER :: routinen =
'expansion_bounds'
1045 INTEGER :: group_size, handle, i, lb1_new, lb2_new, &
1046 lb3_new, loc, maxn_sendrecv, rs_mpo, &
1047 ub1_new, ub2_new, ub3_new
1048 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: src_hist
1049 INTEGER,
ALLOCATABLE,
DIMENSION(:, :, :) :: bounds_local_all, bounds_local_new_all, &
1051 INTEGER,
DIMENSION(2, 3) :: bounds, bounds_local
1052 INTEGER,
DIMENSION(3) :: npts_new, shf_yesno, shift
1055 CALL timeset(routinen, handle)
1057 rs_group = pw_grid%para%group
1058 rs_mpo = pw_grid%para%group%mepos
1059 group_size = pw_grid%para%group%num_pe
1060 bounds = pw_grid%bounds
1061 bounds_local = pw_grid%bounds_local
1063 SELECT CASE (neumann_directions)
1066 shf_yesno = (/1, 1, 1/)
1069 shf_yesno = (/1, 1, 0/)
1072 shf_yesno = (/1, 0, 1/)
1075 shf_yesno = (/0, 1, 1/)
1078 shf_yesno = (/1, 0, 0/)
1081 shf_yesno = (/0, 1, 0/)
1084 shf_yesno = (/0, 0, 1/)
1086 cpabort(
"Unknown neumann direction")
1087 shf_yesno = (/0, 0, 0/)
1090 ALLOCATE (pcs_bnds(2, 3, maxn_sendrecv))
1091 ALLOCATE (src_hist(maxn_sendrecv))
1094 npts_new = 2*pw_grid%npts
1096 shift = shift - bounds(1, :)
1097 bounds_shftd(:, 1) = bounds(:, 1) + shf_yesno(1)*shift(1)
1098 bounds_shftd(:, 2) = bounds(:, 2) + shf_yesno(2)*shift(2)
1099 bounds_shftd(:, 3) = bounds(:, 3) + shf_yesno(3)*shift(3)
1100 bounds_local_shftd(:, 1) = bounds_local(:, 1) + shf_yesno(1)*shift(1)
1101 bounds_local_shftd(:, 2) = bounds_local(:, 2) + shf_yesno(2)*shift(2)
1102 bounds_local_shftd(:, 3) = bounds_local(:, 3) + shf_yesno(3)*shift(3)
1105 ALLOCATE (bounds_local_all(2, 3, group_size))
1106 CALL rs_group%allgather(bounds_local_shftd, bounds_local_all)
1110 DO i = 1, maxn_sendrecv
1112 IF (srcs_expand(i) .EQ. rs_mpo)
THEN
1113 recv_msgs_bnds(1, 1, i) = bounds_local_shftd(1, 1)
1114 recv_msgs_bnds(2, 1, i) = bounds_local_shftd(2, 1)
1115 recv_msgs_bnds(1, 2, i) = bounds_local_shftd(1, 2)
1116 recv_msgs_bnds(2, 2, i) = bounds_local_shftd(2, 2)
1117 recv_msgs_bnds(1, 3, i) = bounds_local_shftd(1, 3)
1118 recv_msgs_bnds(2, 3, i) = bounds_local_shftd(2, 3)
1120 ELSE IF (any(src_hist .EQ. srcs_expand(i)))
THEN
1121 loc = minloc(abs(src_hist - srcs_expand(i)), 1)
1122 recv_msgs_bnds(1, 1, i) = bounds_local_all(1, 1, srcs_expand(loc) + 1)
1123 recv_msgs_bnds(2, 1, i) = bounds_local_all(2, 1, srcs_expand(loc) + 1)
1124 recv_msgs_bnds(1, 2, i) = bounds_local_all(1, 2, srcs_expand(loc) + 1)
1125 recv_msgs_bnds(2, 2, i) = bounds_local_all(2, 2, srcs_expand(loc) + 1)
1126 recv_msgs_bnds(1, 3, i) = bounds_local_all(1, 3, srcs_expand(loc) + 1)
1127 recv_msgs_bnds(2, 3, i) = bounds_local_all(2, 3, srcs_expand(loc) + 1)
1129 recv_msgs_bnds(1, 1, i) = bounds_local_all(1, 1, srcs_expand(i) + 1)
1130 recv_msgs_bnds(2, 1, i) = bounds_local_all(2, 1, srcs_expand(i) + 1)
1131 recv_msgs_bnds(1, 2, i) = bounds_local_all(1, 2, srcs_expand(i) + 1)
1132 recv_msgs_bnds(2, 2, i) = bounds_local_all(2, 2, srcs_expand(i) + 1)
1133 recv_msgs_bnds(1, 3, i) = bounds_local_all(1, 3, srcs_expand(i) + 1)
1134 recv_msgs_bnds(2, 3, i) = bounds_local_all(2, 3, srcs_expand(i) + 1)
1136 src_hist(i) = srcs_expand(i)
1140 DO i = 1, maxn_sendrecv
1141 SELECT CASE (flipg_stat(i))
1143 pcs_bnds(:, :, i) = recv_msgs_bnds(:, :, i)
1145 pcs_bnds(:, :, i) = flipud_bounds_local(recv_msgs_bnds(:, :, i), bounds_shftd)
1147 pcs_bnds(:, :, i) = fliplr_bounds_local(recv_msgs_bnds(:, :, i), bounds_shftd)
1149 pcs_bnds(:, :, i) = flipbf_bounds_local(recv_msgs_bnds(:, :, i), bounds_shftd)
1151 pcs_bnds(:, :, i) = rot180_bounds_local(recv_msgs_bnds(:, :, i), bounds_shftd)
1155 lb1_new = minval(pcs_bnds(1, 1, :)); ub1_new = maxval(pcs_bnds(2, 1, :))
1156 lb2_new = minval(pcs_bnds(1, 2, :)); ub2_new = maxval(pcs_bnds(2, 2, :))
1157 lb3_new = minval(pcs_bnds(1, 3, :)); ub3_new = maxval(pcs_bnds(2, 3, :))
1160 bounds_local_new(1, 1) = minval(pcs_bnds(1, 1, :))
1161 bounds_local_new(2, 1) = maxval(pcs_bnds(2, 1, :))
1162 bounds_local_new(1, 2) = minval(pcs_bnds(1, 2, :))
1163 bounds_local_new(2, 2) = maxval(pcs_bnds(2, 2, :))
1164 bounds_local_new(1, 3) = minval(pcs_bnds(1, 3, :))
1165 SELECT CASE (neumann_directions)
1167 bounds_local_new(2, 3) = 2*(maxval(pcs_bnds(2, 3, :)) + 1) - bounds_local_new(1, 3) - 1
1169 bounds_local_new(2, 3) = maxval(pcs_bnds(2, 3, :))
1172 ALLOCATE (bounds_local_new_all(2, 3, group_size))
1173 CALL rs_group%allgather(bounds_local_new, bounds_local_new_all)
1174 bounds_new(1, 1) = minval(bounds_local_new_all(1, 1, :))
1175 bounds_new(2, 1) = maxval(bounds_local_new_all(2, 1, :))
1176 bounds_new(1, 2) = minval(bounds_local_new_all(1, 2, :))
1177 bounds_new(2, 2) = maxval(bounds_local_new_all(2, 2, :))
1178 bounds_new(1, 3) = minval(bounds_local_new_all(1, 3, :))
1179 bounds_new(2, 3) = maxval(bounds_local_new_all(2, 3, :))
1181 DEALLOCATE (bounds_local_all, bounds_local_new_all)
1183 CALL timestop(handle)
1185 END SUBROUTINE expansion_bounds
1196 PURE FUNCTION flipud_bounds_local(bndsl_in, bounds)
RESULT(bndsl_out)
1198 INTEGER,
DIMENSION(2, 3),
INTENT(IN) :: bndsl_in, bounds
1199 INTEGER,
DIMENSION(2, 3) :: bndsl_out
1201 bndsl_out(1, 1) = 2*(bounds(2, 1) + 1) - bndsl_in(2, 1)
1202 bndsl_out(2, 1) = 2*(bounds(2, 1) + 1) - bndsl_in(1, 1)
1203 IF (bndsl_out(1, 1) .EQ. bounds(2, 1) + 2) bndsl_out(1, 1) = bndsl_out(1, 1) - 1
1204 IF (bndsl_out(2, 1) .EQ. 2*(bounds(2, 1) + 1) - bounds(1, 1)) bndsl_out(2, 1) = bndsl_out(2, 1) - 1
1206 bndsl_out(1, 2) = bndsl_in(1, 2)
1207 bndsl_out(2, 2) = bndsl_in(2, 2)
1209 bndsl_out(1, 3) = bndsl_in(1, 3)
1210 bndsl_out(2, 3) = bndsl_in(2, 3)
1212 END FUNCTION flipud_bounds_local
1223 PURE FUNCTION fliplr_bounds_local(bndsl_in, bounds)
RESULT(bndsl_out)
1225 INTEGER,
DIMENSION(2, 3),
INTENT(IN) :: bndsl_in, bounds
1226 INTEGER,
DIMENSION(2, 3) :: bndsl_out
1228 bndsl_out(1, 1) = bndsl_in(1, 1)
1229 bndsl_out(2, 1) = bndsl_in(2, 1)
1231 bndsl_out(1, 2) = 2*(bounds(2, 2) + 1) - bndsl_in(2, 2)
1232 bndsl_out(2, 2) = 2*(bounds(2, 2) + 1) - bndsl_in(1, 2)
1233 IF (bndsl_out(1, 2) .EQ. bounds(2, 2) + 2) bndsl_out(1, 2) = bndsl_out(1, 2) - 1
1234 IF (bndsl_out(2, 2) .EQ. 2*(bounds(2, 2) + 1) - bounds(1, 2)) bndsl_out(2, 2) = bndsl_out(2, 2) - 1
1236 bndsl_out(1, 3) = bndsl_in(1, 3)
1237 bndsl_out(2, 3) = bndsl_in(2, 3)
1239 END FUNCTION fliplr_bounds_local
1250 PURE FUNCTION flipbf_bounds_local(bndsl_in, bounds)
RESULT(bndsl_out)
1252 INTEGER,
DIMENSION(2, 3),
INTENT(IN) :: bndsl_in, bounds
1253 INTEGER,
DIMENSION(2, 3) :: bndsl_out
1255 bndsl_out(1, 1) = bndsl_in(1, 1)
1256 bndsl_out(2, 1) = bndsl_in(2, 1)
1258 bndsl_out(1, 2) = bndsl_in(1, 2)
1259 bndsl_out(2, 2) = bndsl_in(2, 2)
1261 bndsl_out(1, 3) = 2*(bounds(2, 3) + 1) - bndsl_in(2, 3)
1262 bndsl_out(2, 3) = 2*(bounds(2, 3) + 1) - bndsl_in(1, 3)
1263 IF (bndsl_out(1, 3) .EQ. bounds(2, 3) + 2) bndsl_out(1, 3) = bndsl_out(1, 3) - 1
1264 IF (bndsl_out(2, 3) .EQ. 2*(bounds(2, 3) + 1) - bounds(1, 3)) bndsl_out(2, 3) = bndsl_out(2, 3) - 1
1266 END FUNCTION flipbf_bounds_local
1277 PURE FUNCTION rot180_bounds_local(bndsl_in, bounds)
RESULT(bndsl_out)
1279 INTEGER,
DIMENSION(2, 3),
INTENT(IN) :: bndsl_in, bounds
1280 INTEGER,
DIMENSION(2, 3) :: bndsl_out
1282 bndsl_out(1, 1) = 2*(bounds(2, 1) + 1) - bndsl_in(2, 1)
1283 bndsl_out(2, 1) = 2*(bounds(2, 1) + 1) - bndsl_in(1, 1)
1284 IF (bndsl_out(1, 1) .EQ. bounds(2, 1) + 2) bndsl_out(1, 1) = bndsl_out(1, 1) - 1
1285 IF (bndsl_out(2, 1) .EQ. 2*(bounds(2, 1) + 1) - bounds(1, 1)) bndsl_out(2, 1) = bndsl_out(2, 1) - 1
1287 bndsl_out(1, 2) = 2*(bounds(2, 2) + 1) - bndsl_in(2, 2)
1288 bndsl_out(2, 2) = 2*(bounds(2, 2) + 1) - bndsl_in(1, 2)
1289 IF (bndsl_out(1, 2) .EQ. bounds(2, 2) + 2) bndsl_out(1, 2) = bndsl_out(1, 2) - 1
1290 IF (bndsl_out(2, 2) .EQ. 2*(bounds(2, 2) + 1) - bounds(1, 2)) bndsl_out(2, 2) = bndsl_out(2, 2) - 1
1292 bndsl_out(1, 3) = bndsl_in(1, 3)
1293 bndsl_out(2, 3) = bndsl_in(2, 3)
1295 END FUNCTION rot180_bounds_local
the type I Discrete Cosine Transform (DCT-I)
subroutine, public dct_type_release(dct_env)
Releases a dct_type.
integer, parameter, public neumannx
integer, parameter, public neumannxy
subroutine, public dct_type_init(pw_grid, neumann_directions, dct_env)
Initializes a dct_type.
integer, parameter, public neumannxz
subroutine, public pw_shrink(neumann_directions, dests_shrink, srcs_shrink, bounds_local_shftd, pw_in, pw_shrinked)
shrinks an evenly symmetric pw_r3d_rs_type data to a pw_r3d_rs_type data that is 8 times smaller (the...
integer, parameter, public neumannxyz
integer, parameter, public neumannz
integer, parameter, public neumannyz
subroutine, public setup_dct_pw_grids(pw_grid, cell_hmat, neumann_directions, dct_pw_grid)
sets up an extended pw_grid for Discrete Cosine Transform (DCT) calculations
integer, parameter, public neumanny
subroutine, public pw_expand(neumann_directions, recv_msgs_bnds, dests_expand, srcs_expand, flipg_stat, bounds_shftd, pw_in, pw_expanded)
expands a pw_r3d_rs_type data to an evenly symmetric pw_r3d_rs_type data that is 8 times larger than ...
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
type(mp_request_type), parameter, public mp_request_null
This module defines the grid data type and some basic operations on it.