module fd4_globaldef_mod module fd4_vartab_mod module rbtree_int_modTypes:
public type fd4_data_link public type fd4_block_link public type fd4_cell_link public type fd4_r_k_link public type fd4_blockVariables:
integer (kind=i4k), public, parameter, dimension (3,2) :: BLOCK_EMPTY = reshape ((/ 2, 4, 8, 16, 32, 64 /), (/ 3, 2 /))Subroutines and functions:
public subroutine fd4_block_allocate (b, bext, vartab, varinfo, init, err) public subroutine fd4_block_reset (b, vartab, varinfo, init) public subroutine fd4_block_deallocate (b) public subroutine fd4_block_empty (b, vartab, varinfo, idx, st, emptyplanes)
A block is a rectangular subset of the spatial grid. It is the smallest unit for load balancing.
Blocks have an additional field weight which respects their computational weight. Load balancing routines (should) use this weight. The default value of the weight is the number of grid cells of the block.
TODO:
Author: Matthias Lieber
public type fd4_data_link real (kind=r_k), pointer, dimension (:,:,:,:) :: l => null () end type fd4_data_linkA helper to build an array of pointers to data fields.
public type fd4_block_link type (fd4_block), pointer :: l => null () end type fd4_block_linkA helper to build an array of pointers to blocks.
public type fd4_cell_link real (kind=r_k), pointer, dimension (:) :: l => null () end type fd4_cell_linkA helper to build an array of pointers to cells.
public type fd4_r_k_link real (kind=r_k), pointer :: l => NULL () end type fd4_r_k_linkA helper used to build an array of pointers (not used in fd4_block, but elsewhere)
public type fd4_block integer (kind=i_k), dimension (3) :: pos integer (kind=i_k), dimension (3,2) :: bnd integer (kind=i_k), dimension (3) :: ext type (fd4_block_link), dimension (3,2) :: neigh type (fd4_data_link), pointer, dimension (:,:) :: fields => null () type (fd4_data_link), dimension (0:4) :: sdata integer (kind=i4k), pointer, dimension (:,:) :: empty => null () integer (kind=i4k) :: sempty real (kind=r4k) :: weight end type fd4_blockComponents:
pos | position of the block in the block decomposition |
bnd | bounds of the block in global grid coordinates |
ext | extents of the block |
neigh | array of pointers to spatial neighbors of this block |
fields | array of pointers to array sections of sdata, representing the data fields |
sdata | storage arrays for static data fields (allocated at block creation) |
empty | tells which fields and boundaries are empty (< vthres of vartab) |
sempty | summarized empty info (all vars and time steps) of me |
weight | computational weight of the block |
The actual data fields are allocated in sdata:
CAUTION: fields contains pointers to non-continuous array sections of sdata(0:3)%l. Be careful to avoid creation of temporary arrays!
TODO:
See also: module fd4_vartab_mod
public subroutine fd4_block_allocate (b, bext, vartab, varinfo, init, err) type (fd4_block), pointer :: b integer (kind=i_k), intent(in), dimension (3) :: bext type (fd4_vartab), intent(in), dimension (:) :: vartab type (fd4_varinfo), intent(in) :: varinfo logical, intent(in) :: init integer (kind=i_k), intent(out) :: err end subroutine fd4_block_allocateParameters:
b | the block to allocate |
bext | spatial extent of the block |
vartab | variable table containing the definitions of fields to allocate |
varinfo | variable table info |
init | if false: do not init data fields (faster) |
err | error status, 0 on sucess |
The block itself must be allocated! For internal use only. Error checks require level 3.
public subroutine fd4_block_reset (b, vartab, varinfo, init) type (fd4_block), pointer :: b type (fd4_vartab), intent(in), dimension (:) :: vartab type (fd4_varinfo), intent(in) :: varinfo logical, intent(in) :: init end subroutine fd4_block_resetParameters:
b | the block to allocate |
vartab | variable table containing the definitions of fields to allocate |
varinfo | variable table info |
init | if false: do not init data fields (faster) |
public subroutine fd4_block_deallocate (b) type (fd4_block), pointer :: b end subroutine fd4_block_deallocateParameters:
b | the block to deallocate |
Nullifies the block pointer. For internal use only.
public subroutine fd4_block_empty (b, vartab, varinfo, idx, st, emptyplanes) type (fd4_block), pointer :: b type (fd4_vartab), intent(in), dimension (:) :: vartab type (fd4_varinfo), intent(in) :: varinfo integer (kind=i_k), intent(in) :: idx integer (kind=i_k), intent(in) :: st integer (kind=i_k), intent(in), dimension (3) :: emptyplanes end subroutine fd4_block_emptyParameters:
b | the block |
vartab | variable table |
varinfo | variable info |
idx | field index in vartab |
st | time step index |
emptyplanes | number of "null" cell planes required to the phase boundary, i.e. to not create new block |
Fills block component empty of variable idx at time step st. For internal use only.
TODO: