Module fd4_metadata_mod
Uses:
module fd4_globaldef_mod
module fd4_mpi_mod
module fd4_mdsd_mod
module fd4_block_mod
module rbtree_fd4_mdsd_mod
module rbtree_fd4_block_mod
module rbtree_int_mod
module stack3_mod
module section_mod
Types:
public type fd4_mdsd_link
public type fd4_metadata
Variables:
integer, private, parameter :: m2i_shft3 = 20
integer, private, parameter :: m2i_shft2 = 10
Subroutines and functions:
public subroutine fd4_metadata_init (md, blnum, mdsdext, err)
public subroutine fd4_metadata_finalize (md)
public subroutine fd4_metadata_register (md, idx)
public subroutine fd4_metadata_register_with_idx (md, idx)
public subroutine fd4_metadata_unregister (md, idx)
public subroutine fd4_metadata_clear (md)
public subroutine fd4_metadata_full_allocate (md)
public subroutine fd4_metadata_get_subdomain (md, blpos, mdsd)
public subroutine fd4_metadata_get_section (md, sect)
public subroutine fd4_metadata_adapt (md, blocks)
public subroutine fd4_metadata_unadapt (md)
public pure subroutine fd4_metadata_get_blbnd (md, mdidx, blbnd)
public integer (kind=i_k) pure function fd4_metadata_blpos2mdidx (md, blpos)
public pure subroutine fd4_metadata_blpos2mdpos (md, blpos, mdpos)
private pure subroutine fd4_metadata_mdpos2blbnd (md, mdpos, blbnd)
private integer (kind=i_k) elemental pure function fd4_metadata_ijk2if (i, j, k)
private integer (kind=i_k) pure function fd4_metadata_c2if (pos)
private elemental pure subroutine fd4_metadata_i2ijk (idx, i, j, k)
private pure subroutine fd4_metadata_i2pos (idx, pos)
Management of distributed meta data for coupling.
Author: Matthias Lieber
Description of Types
fd4_mdsd_link
public type fd4_mdsd_link
type (fd4_mdsd), pointer :: l => NULL ()
end type fd4_mdsd_link
Type for the meta data context.
fd4_metadata
public type fd4_metadata
integer (kind=i_k), dimension (3) :: mdext = 0
integer (kind=i_k), dimension (3) :: mdsdext = 0
integer (kind=i_k), dimension (3) :: mdsdnum = 1
integer (kind=i_k) :: mdsdnum_tot = 0
type (rbtree_fd4_mdsd) :: mdsub
type (fd4_mdsd_link), pointer, dimension (:,:,:) :: mdbuf => NULL ()
integer (kind=i_k), dimension (FD4_MD_MAX_PART) :: num_cpl = 0
logical :: single_mdsd = .false.
logical :: initialized = .false.
logical :: adapt = .false.
end type fd4_metadata
Components:
mdext | number of blocks per dimension of the domain |
mdsdext | min extent of the meta data subdomains, i.e. number of blocks per dimension |
mdsdnum | number of mdsd's per dimension |
mdsdnum_tot | max number of meta data subdomains |
mdsub | the meta data subdomains are managed in a tree |
mdbuf | buffer of currently not required meta data subdomains |
num_cpl | counts number of couple contexts per meta data partitioning |
single_mdsd | true if only one meta data subdomain is used (legacy mode) |
adapt | true if meta data should adapt/optimize to block allocation |
Type for the meta data context.
Description of Subroutines and Functions
fd4_metadata_init
public subroutine fd4_metadata_init (md, blnum, mdsdext, err)
type (fd4_metadata), intent(inout) :: md
integer (kind=i_k), intent(in), dimension (3) :: blnum
integer (kind=i_k), intent(in), dimension (3) :: mdsdext
integer (kind=i_k), intent(out) :: err
end subroutine fd4_metadata_init
Parameters:
md | meta data context |
blnum | number of blocks per dimension of the domain |
mdsdext | min extent of the meta data subdomains, i.e. number of blocks per dimension |
err | error status: 0...ok |
Initialize meta data management.
fd4_metadata_finalize
public subroutine fd4_metadata_finalize (md)
type (fd4_metadata), intent(inout) :: md
end subroutine fd4_metadata_finalize
Parameters:
Finalize meta data management.
fd4_metadata_register
public subroutine fd4_metadata_register (md, idx)
type (fd4_metadata), intent(inout) :: md
integer (kind=i_k), intent(out) :: idx
end subroutine fd4_metadata_register
Parameters:
md | meta data context |
idx | index of this couple context in the meta data |
Register a couple context with the meta data management.
Returns idx = -1 if max. number of couple context partitions is reached (FD4_MD_MAX_PART).
fd4_metadata_register_with_idx
public subroutine fd4_metadata_register_with_idx (md, idx)
type (fd4_metadata), intent(inout) :: md
integer (kind=i_k), intent(in) :: idx
end subroutine fd4_metadata_register_with_idx
Parameters:
md | meta data context |
idx | index of this couple context in the meta data |
Register a couple context with the meta data management with a partition index
of an already existing couple context.
These couple contexts will share meta data.
fd4_metadata_unregister
public subroutine fd4_metadata_unregister (md, idx)
type (fd4_metadata), intent(inout) :: md
integer (kind=i_k), intent(in) :: idx
end subroutine fd4_metadata_unregister
Unregister a couple context with the meta data management.
Removes memory associated with this couple context.
When the last couple context unregisters, all meta data subdomains are removed.
fd4_metadata_clear
public subroutine fd4_metadata_clear (md)
type (fd4_metadata), intent(inout) :: md
end subroutine fd4_metadata_clear
Removes all memory associated with the meta data management.
fd4_metadata_full_allocate
public subroutine fd4_metadata_full_allocate (md)
type (fd4_metadata), intent(inout) :: md
end subroutine fd4_metadata_full_allocate
Parameters:
Allocates the all meta data subdomains.
fd4_metadata_get_subdomain
public subroutine fd4_metadata_get_subdomain (md, blpos, mdsd)
type (fd4_metadata), intent(in) :: md
integer (kind=i_k), intent(in), dimension (3) :: blpos
type (fd4_mdsd), pointer :: mdsd
end subroutine fd4_metadata_get_subdomain
Parameters:
md | meta data context |
blpos | position of the block |
mdsd | the meta data subdomain |
Get the meta data subdomain which contains the block at
blpos.
Returns NULL() if the mdsd is not allocated.
fd4_metadata_get_section
public subroutine fd4_metadata_get_section (md, sect)
type (fd4_metadata), intent(in) :: md
type (section), intent(out) :: sect
end subroutine fd4_metadata_get_section
Parameters:
md | meta data context |
sect | position of the block |
Get a section (list of rectangles) describing the union of bounds of
the allocated meta data subdomains.
fd4_metadata_adapt
public subroutine fd4_metadata_adapt (md, blocks)
type (fd4_metadata), intent(inout) :: md
type (rbtree_fd4_block), intent(inout) :: blocks
end subroutine fd4_metadata_adapt
Parameters:
md | meta data context |
blocks | blocks of the domain |
Move required meta data subdomains from the buffer to the acutal mdsd
storage and vice versa after repartitioning.
fd4_metadata_unadapt
public subroutine fd4_metadata_unadapt (md)
type (fd4_metadata), intent(inout) :: md
end subroutine fd4_metadata_unadapt
Parameters:
Move alle meta data subdomains from the buffer to the acutal mdsd storage.
(Undo the adaption/optimization from
fd4_metadata_adapt)
fd4_metadata_get_blbnd
public pure subroutine fd4_metadata_get_blbnd (md, mdidx, blbnd)
type (fd4_metadata), intent(in) :: md
integer (kind=i_k), intent(in) :: mdidx
integer (kind=i_k), intent(out), dimension (3,2) :: blbnd
end subroutine fd4_metadata_get_blbnd
Parameters:
md | meta data context |
mdidx | index of the meta data subdomain |
blbnd | block bounds of the mdsd |
Get the min and max block position of a meta data subdomain identified by
mdidx.
fd4_metadata_blpos2mdidx
public integer (kind=i_k) pure function fd4_metadata_blpos2mdidx (md, blpos)
type (fd4_metadata), intent(in) :: md
integer (kind=i_k), intent(in), dimension (3) :: blpos
end function fd4_metadata_blpos2mdidx
Parameters:
md | meta data context |
blpos | position of the block |
Get the index for a meta data subdomain in which the block at
blpos resides.
fd4_metadata_blpos2mdpos
public pure subroutine fd4_metadata_blpos2mdpos (md, blpos, mdpos)
type (fd4_metadata), intent(in) :: md
integer (kind=i_k), intent(in), dimension (3) :: blpos
integer (kind=i_k), intent(out), dimension (3) :: mdpos
end subroutine fd4_metadata_blpos2mdpos
Parameters:
md | meta data context |
blpos | position of the block |
mdpos | position of the meta data subdomain |
Get the position of a meta data subdomain in which the block at
blpos resides.
fd4_metadata_mdpos2blbnd
private pure subroutine fd4_metadata_mdpos2blbnd (md, mdpos, blbnd)
type (fd4_metadata), intent(in) :: md
integer (kind=i_k), intent(in), dimension (3) :: mdpos
integer (kind=i_k), intent(out), dimension (3,2) :: blbnd
end subroutine fd4_metadata_mdpos2blbnd
Parameters:
md | meta data context |
mdpos | position of the meta data subdomain |
blbnd | min and max block position |
Get the min and max block position of a meta data subdomain.
fd4_metadata_ijk2if
private integer (kind=i_k) elemental pure function fd4_metadata_ijk2if (i, j, k)
integer (kind=i_k), intent(in) :: i
integer (kind=i_k), intent(in) :: j
integer (kind=i_k), intent(in) :: k
end function fd4_metadata_ijk2if
Mapping from coordinate to index for meta data subdomains
Same method as in fd4_domain_c2i (fd4_domain.incf).
fd4_metadata_c2if
private integer (kind=i_k) pure function fd4_metadata_c2if (pos)
integer (kind=i_k), intent(in), dimension (3) :: pos
end function fd4_metadata_c2if
Mapping from coordinate to index for meta data subdomains
Same method as in fd4_domain_c2i (fd4_domain.incf).
fd4_metadata_i2ijk
private elemental pure subroutine fd4_metadata_i2ijk (idx, i, j, k)
integer (kind=i_k), intent(in) :: idx
integer (kind=i_k), intent(out) :: i
integer (kind=i_k), intent(out) :: j
integer (kind=i_k), intent(out) :: k
end subroutine fd4_metadata_i2ijk
Mapping from index to coordinate for meta data subdomains
Same method as in fd4_domain_i2c (fd4_domain.incf).
fd4_metadata_i2pos
private pure subroutine fd4_metadata_i2pos (idx, pos)
integer (kind=i_k), intent(in) :: idx
integer (kind=i_k), intent(out), dimension (3) :: pos
end subroutine fd4_metadata_i2pos
Mapping from index to coordinate for meta data subdomains
Same method as in fd4_domain_i2c (fd4_domain.incf).