First global cell a and width w of tile rx — the
decomp_init split (remainder to the WEST tiles), restated here so
the plan stays pure and dependency-free (cross-checked against
decomp_init by the unit test).
| 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) | :: | rx |
Tile x-coordinate (0-based, |
||
| integer, | intent(out) | :: | a |
First global cell of the tile (1-based). |
||
| integer, | intent(out) | :: | w |
Tile width (cells). |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | base | ||||
| integer, | private | :: | rem |
pure subroutine fold_tile_extent(ni, px, rx, a, w) !! First global cell `a` and width `w` of tile `rx` — the !! `decomp_init` split (remainder to the WEST tiles), restated here so !! the plan stays pure and dependency-free (cross-checked against !! `decomp_init` by the unit test). integer, intent(in) :: ni !! Global physical width of the fold row (cells). integer, intent(in) :: px !! Tiles along the fold row. integer, intent(in) :: rx !! Tile x-coordinate (0-based, `0..px-1`). integer, intent(out) :: a !! First global cell of the tile (1-based). integer, intent(out) :: w !! Tile width (cells). integer :: base, rem base = ni/px rem = mod(ni, px) if (rx < rem) then w = base + 1 a = rx*(base + 1) + 1 else w = base a = rem*(base + 1) + (rx - rem)*base + 1 end if end subroutine fold_tile_extent