Every destination column i = 1..ncol of tile rx’s window for a
column family: the owning tile own(i) of its mirror, the owner’s
local storage column src(i) to read, and the fold-row class
cls(i). ncol = w+2ng (T) or w+2ng+1 (U); the arrays must
hold at least that many entries.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | ni |
Global physical width of the fold row (cells). |
||
| integer, | intent(in) | :: | px |
Tiles along the fold row. |
||
| integer, | intent(in) | :: | ng |
Ghost width. |
||
| integer, | intent(in) | :: | fam |
Column family ( |
||
| integer, | intent(in) | :: | rx |
Receiving tile x-coordinate (0-based). |
||
| integer, | intent(out) | :: | ncol |
Destination columns filled ( |
||
| integer, | intent(out) | :: | own(:) |
Owning tile x-coordinate (0-based) of each column’s mirror. |
||
| integer, | intent(out) | :: | src(:) |
Owner’s local storage column to read (1-based, ghosts included). |
||
| integer, | intent(out) | :: | cls(:) |
Fold-row class of each column ( |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | a | ||||
| integer, | private | :: | a_o | ||||
| integer, | private | :: | c | ||||
| integer, | private | :: | g | ||||
| integer, | private | :: | i | ||||
| integer, | private | :: | m | ||||
| integer, | private | :: | p | ||||
| integer, | private | :: | pm | ||||
| integer, | private | :: | w | ||||
| integer, | private | :: | w_o |
pure subroutine fold_receiver_entries(ni, px, ng, fam, rx, ncol, own, src, cls) !! Every destination column `i = 1..ncol` of tile `rx`'s window for a !! column family: the owning tile `own(i)` of its mirror, the owner's !! local storage column `src(i)` to read, and the fold-row class !! `cls(i)`. `ncol` = `w+2ng` (T) or `w+2ng+1` (U); the arrays must !! hold at least that many entries. integer, intent(in) :: ni !! Global physical width of the fold row (cells). integer, intent(in) :: px !! Tiles along the fold row. integer, intent(in) :: ng !! Ghost width. integer, intent(in) :: fam !! Column family (`FOLD_FAM_T` or `FOLD_FAM_U`). integer, intent(in) :: rx !! Receiving tile x-coordinate (0-based). integer, intent(out) :: ncol !! Destination columns filled (`w+2ng` for T, `w+2ng+1` for U). integer, intent(out) :: own(:) !! Owning tile x-coordinate (0-based) of each column's mirror. integer, intent(out) :: src(:) !! Owner's local storage column to read (1-based, ghosts included). integer, intent(out) :: cls(:) !! Fold-row class of each column (`FOLD_ROW_*`). integer :: a, w, a_o, w_o, i, g, c, m, p, pm call fold_tile_extent(ni, px, rx, a, w) if (fam == FOLD_FAM_U) then ncol = w + 2*ng + 1 else ncol = w + 2*ng end if do i = 1, ncol ! Global column of storage slot i, reduced into 1..ni. g = a + i - ng - 1 c = modulo(g - 1, ni) + 1 if (fam == FOLD_FAM_U) then ! Face c (west face of cell c, c = 1 ≡ ni+1) mirrors to face ! m = ni+2-c in 2..ni+1: the EAST face of cell m-1, owned (D1) ! by the tile holding that cell. m = ni + 2 - c own(i) = fold_tile_owner(ni, px, m - 1) call fold_tile_extent(ni, px, own(i), a_o, w_o) src(i) = ng + m - a_o + 1 ! Corner projection rule (`fold_north_corner_2d`). p = c pm = modulo(ni + 1 - p, ni) + 1 else m = ni + 1 - c own(i) = fold_tile_owner(ni, px, m) call fold_tile_extent(ni, px, own(i), a_o, w_o) src(i) = ng + m - a_o + 1 ! v projection rule (`fold_north_v_face_*`). p = c pm = ni + 1 - p end if if (p < pm) then cls(i) = FOLD_ROW_WEST else if (p == pm) then cls(i) = FOLD_ROW_SELF else cls(i) = FOLD_ROW_EAST end if end do end subroutine fold_receiver_entries