selah_box
SELAH, L1: the box, the part of a block-structured field a kernel updates.
A field is a rank-5 array: components, three cell indices with ghost cells, and blocks, in one of two layouts:
LAYOUT_V_FIRST:(v, i, j, k, b), the components contiguous (ADAM's CPU fields);LAYOUT_V_LAST:(b, i, j, k, v), the blocks contiguous (ADAM's FNL device fields).
A box holds the lower bounds of the allocation (lb, ghosts included) and the range the kernels loop over (lo:hi): the interior cells of the active blocks 1..blocks_number of a pool that may hold more, and all components or a range of them (a partition of a splitting scheme). The kernels never write outside the box: not the ghost cells, not the pool slots past blocks_number. A box is passed at every call, never stored, because the active blocks change at every regrid.
Fields of rank 1 to 4. A field of lower rank is a rank-5 field with singleton dimensions: the kernels and the stepper keep one rank-5 implementation. Dimension d of a rank-k field is dimension d of the rank-5 view when the field's first dimension holds its components, d + 1 when the field is scalar (box_dim):
| Field | As rank 5 (v, i, j, k, b) |
|---|---|
(i), scalar | (1, i, 1, 1, 1) |
(v, i) | (v, i, 1, 1, 1) |
(v, i, j) | (v, i, j, 1, 1) |
(v, i, j, k) | (v, i, j, k, 1) |
(i, j), (i, j, k), (i, j, k, b), scalar | (1, i, j, 1, 1), (1, i, j, k, 1), (1, i, j, k, b) |
The rank-k constructors (box_interior(lb, ub, ngc, components), box_range(lb, lo, hi, components)) take the components flag explicitly: the mapping is never guessed. Fields of rank below 5 have the layout LAYOUT_V_FIRST.
Source: src/lib/selah_box.F90
Contents
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
LAYOUT_V_FIRST | integer(kind=I4P) | parameter | Layout (v, i, j, k, b). |
LAYOUT_V_LAST | integer(kind=I4P) | parameter | Layout (b, i, j, k, v). |
Derived Types
box
The part of a rank-5 field a kernel updates.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
layout | integer(kind=I4P) | Layout, LAYOUT_V_FIRST or LAYOUT_V_LAST. | |
lb | integer(kind=I4P) | Lower bounds of the allocation, ghosts included. | |
lo | integer(kind=I4P) | First index of the loop range, per dimension. | |
hi | integer(kind=I4P) | Last index of the loop range, per dimension. | |
rank | integer(kind=I4P) | Rank of the field (1 to 5), viewed as rank 5. | |
components | logical | The field's first dimension holds its components (always, for rank 5). |
Interfaces
box_interior
The interior cells of a field: of the active blocks of a rank-5 field, or of a field of rank 1 to 4.
Module procedures: box_interior_blocks, box_interior_rank
Functions
box_range
The loop range lo:hi of a field of rank k = size(lb) whose lower bounds are lb, as a box.
Attributes: pure
Returns: type(box)
function box_range(lb, lo, hi, components) result(bx)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lb | integer(kind=I4P) | in | Lower bounds of the field, ghosts included (size k, 1 to 5). | |
lo | integer(kind=I4P) | in | First index of the loop range (size k). | |
hi | integer(kind=I4P) | in | Last index of the loop range (size k). | |
components | logical | in | The field's first dimension holds its components. |
Call graph
box_dim
The dimension of the rank-5 view that holds dimension d of the field: d, or d + 1 for a scalar field.
Attributes: elemental
Returns: integer(kind=I4P)
function box_dim(bx, d) result(m)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
bx | type(box) | in | Box. | |
d | integer(kind=I4P) | in | Dimension of the field (1 to its rank). |
Call graph
component_dim
The dimension of the components: 1 (V_FIRST) or 5 (V_LAST).
Attributes: pure
Returns: integer(kind=I4P)
function component_dim(bx) result(d)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
bx | type(box) | in | Box. |
Call graph
box_components
The same box restricted to the components v1..v2 (the variables of one partition).
Attributes: pure
Returns: type(box)
function box_components(bx, v1, v2) result(sub)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
bx | type(box) | in | Box. | |
v1 | integer(kind=I4P) | in | Component range. | |
v2 | integer(kind=I4P) | in | Component range. |
Call graph