tem_halo_append Subroutine

public subroutine tem_halo_append(me, proc, elemPos, wasAdded)

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).

Arguments

Type IntentOptional 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.


Calls

proc~~tem_halo_append~~CallsGraph proc~tem_halo_append tem_halo_append interface~append~2 append proc~tem_halo_append->interface~append~2 proc~append_ga_dynlong append_ga_dynlong interface~append~2->proc~append_ga_dynlong proc~append_ga_dynlong_vec append_ga_dynlong_vec interface~append~2->proc~append_ga_dynlong_vec interface~expand~2 expand proc~append_ga_dynlong->interface~expand~2 proc~append_ga_dynlong_vec->interface~expand~2 proc~expand_ga_dynlong expand_ga_dynlong interface~expand~2->proc~expand_ga_dynlong

Called by

proc~~tem_halo_append~~CalledByGraph proc~tem_halo_append tem_halo_append proc~identify_lists identify_lists proc~identify_lists->proc~tem_halo_append proc~tem_find_allelements tem_find_allElements proc~tem_find_allelements->proc~identify_lists proc~communicate_elements communicate_elements proc~tem_find_allelements->proc~communicate_elements proc~communicate_elements->proc~identify_lists proc~tem_create_leveldesc tem_create_levelDesc proc~tem_create_leveldesc->proc~tem_find_allelements proc~tem_dimbydim_construction tem_dimByDim_construction proc~tem_dimbydim_construction->proc~tem_create_leveldesc

Contents

Source Code


Source Code

  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