fold_row_map Subroutine

public pure subroutine fold_row_map(stagger, ng, nyl, r, src_row, dst_row)

Storage rows of message row r (1..fold_stagger_nrows) on a north-row tile of nyl physical rows: the sender reads src_row, the receiver writes dst_row. * T, u: r = d = 1..ng: src ng+nyl+1-d, dst ng+nyl+d. * v, corner: r = d+1, d = 0..ng: src ng+nyl+1-d, dst ng+nyl+1+d (d = 0 is the fold-line row, src = dst = ng+nyl+1).

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: stagger

FOLD_STAG_* stagger.

integer, intent(in) :: ng

Ghost width.

integer, intent(in) :: nyl

Physical rows of the north-row tile.

integer, intent(in) :: r

Message row (1-based, 1..fold_stagger_nrows(stagger, ng)).

integer, intent(out) :: src_row

Local storage row the sender reads.

integer, intent(out) :: dst_row

Local storage row the receiver writes.


Variables

Type Visibility Attributes Name Initial
integer, private :: d

Source Code

   pure subroutine fold_row_map(stagger, ng, nyl, r, src_row, dst_row)
      !! Storage rows of message row `r` (1..`fold_stagger_nrows`) on a
      !! north-row tile of `nyl` physical rows: the sender reads
      !! `src_row`, the receiver writes `dst_row`.
      !!   * T, u:  r = d = 1..ng:   src ng+nyl+1-d, dst ng+nyl+d.
      !!   * v, corner: r = d+1, d = 0..ng: src ng+nyl+1-d, dst ng+nyl+1+d
      !!     (d = 0 is the fold-line row, src = dst = ng+nyl+1).
      integer, intent(in) :: stagger
         !! `FOLD_STAG_*` stagger.
      integer, intent(in) :: ng
         !! Ghost width.
      integer, intent(in) :: nyl
         !! Physical rows of the north-row tile.
      integer, intent(in) :: r
         !! Message row (1-based, `1..fold_stagger_nrows(stagger, ng)`).
      integer, intent(out) :: src_row
         !! Local storage row the sender reads.
      integer, intent(out) :: dst_row
         !! Local storage row the receiver writes.

      integer :: d

      if (stagger == FOLD_STAG_V .or. stagger == FOLD_STAG_CORNER) then
         d = r - 1
         src_row = ng + nyl + 1 - d
         dst_row = ng + nyl + 1 + d
      else
         d = r
         src_row = ng + nyl + 1 - d
         dst_row = ng + nyl + d
      end if
   end subroutine fold_row_map