Tile holding global cell c (1..ni), closed form of the
decomp_init split.
| 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) | :: | c |
Global cell index (1-based, |
Owning tile x-coordinate (0-based).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | base | ||||
| integer, | private | :: | rem |
pure function fold_tile_owner(ni, px, c) result(rx) !! Tile holding global cell `c` (1..ni), closed form of the !! `decomp_init` split. integer, intent(in) :: ni !! Global physical width of the fold row (cells). integer, intent(in) :: px !! Tiles along the fold row. integer, intent(in) :: c !! Global cell index (1-based, `1..ni`). integer :: rx !! Owning tile x-coordinate (0-based). integer :: base, rem base = ni/px rem = mod(ni, px) if (c <= rem*(base + 1)) then rx = (c - 1)/(base + 1) else rx = rem + (c - 1 - rem*(base + 1))/base end if end function fold_tile_owner