Append an element to the list of halo elements.
Each entry needs to be identified by the process (proc), the halo has to be exchanged with, and the position of the halo element in the local array of elements (elemPos).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_haloList_type), | intent(inout) | :: | me |
List of halo elements, this entry has to be appended to. |
||
integer, | intent(in) | :: | proc |
Process this element is exchanged with. |
||
integer, | intent(in) | :: | elemPos |
Local position of the halo element. |
||
logical, | intent(out), | optional | :: | wasAdded |
Flag, wether this halo element was newly added, or already there. |
subroutine tem_halo_append(me, proc, elemPos, wasAdded) !> List of halo elements, this entry has to be appended to. type(tem_haloList_type), intent(inout) :: me !> Process this element is exchanged with. integer, intent(in) :: proc !> Local position of the halo element. integer, intent(in) :: elemPos !> Flag, wether this halo element was newly added, or already there. logical, optional, intent(out) :: wasAdded type(dyn_intArray_type) :: newHalos integer :: partnerPos integer :: haloPos logical :: newProc ! First attempt to append the process, this element is to be exchanged with. ! The call will return, where the process is to be found, and wether it was ! a new process or not. call append( me = me%partnerProc, & & val = proc, & & pos = partnerPos, & & wasAdded = newProc ) if (newProc) then ! If the process was newly added, we need to create a new list for halo ! elements. We do this by setting up a temporary dynamic array of integers ! and append this then to the halos component (which is a growing array ! of dynamic arrays). call append( me = me%halos, & & val = newHalos ) end if ! Now, the necessary arrays for this process should be available, and we ! can add the actual halo element to it. call append( me = me%halos%val(partnerPos), & & val = elemPos, & & pos = haloPos, & & wasAdded = wasAdded ) end subroutine tem_halo_append