Module fd4_ghostlist_mod


Uses:
    module fd4_block_mod
    module fd4_globaldef_mod
Types:
    public type fd4_ghostlist
Variables:
    integer (kind=i_k), public, parameter :: FD4_GHOST_BND = 0
    integer (kind=i_k), public, parameter :: FD4_GHOST_CMM = -1
Subroutines and functions:
    public subroutine fd4_ghostlist_add (gl, b)
    public subroutine fd4_ghostlist_remove (gl, b)
    public function fd4_ghostlist_next (b)

Simple list of ghost blocks by utilizing the neighbor pointers of blocks.

This list abuses the neighbor pointers of blocks to create a doubly linked list. It only works for blocks whose neighbor pointers are unused (ghost blocks, boundary ghost blocks).

Two of the neighbor pointers are used:

 
    b%neigh(1,1)%l  ...  previous
    b%neigh(1,2)%l  ...  next
 

Identification of ghost blocks:

 
    $pos(1) == FD4_GHOST_BND   ... boundary ghost
    $pos(1) == FD4_GHOST_CMM   ... communication ghost
 

Author: Matthias Lieber


Description of Types

fd4_ghostlist

public type fd4_ghostlist
    type (fd4_block), pointer :: start => NULL ()
    integer (kind=i_k) :: length = 0
    logical :: touched = .false.
end type fd4_ghostlist
Components:
start first block of the ghostlist
length length of the ghostlist
touched indicator if ghostlist has been changed (set in add and remove)

Description of Subroutines and Functions

fd4_ghostlist_add

public subroutine fd4_ghostlist_add (gl, b)
    type (fd4_ghostlist), intent(inout) :: gl
    type (fd4_block), pointer :: b
end subroutine fd4_ghostlist_add
Parameters:
gl the ghostlist
b the block to add
Add block to the begining of the list.

fd4_ghostlist_remove

public subroutine fd4_ghostlist_remove (gl, b)
    type (fd4_ghostlist), intent(inout) :: gl
    type (fd4_block), pointer :: b
end subroutine fd4_ghostlist_remove
Parameters:
gl the ghostlist
b the block to remove
Remove specified block from the list.

Bad things will happen, if the block is not member of the list!


fd4_ghostlist_next

public function fd4_ghostlist_next (b)
    type (fd4_block), pointer :: b
    type (fd4_block), pointer :: fd4_ghostlist_next
end function fd4_ghostlist_next
Parameters:
b the current block
fd4_ghostlist_next return value: next block
Get next block from the ghostlist.

Returns NULL() if b is last block in the list. This routine simply does:

  fd4_ghostlist_next => b%neigh(1,2)%l