AllgatherPerElemInts Subroutine

public subroutine AllgatherPerElemInts(decomp, perElem, localArr, globalArr)

Allgather an integer array with perElem entries per element from the decomposition's contiguous rank-local element ranges into the global element ordering.

Arguments

TypeIntentOptionalAttributesName
type(DomainDecomposition), intent(in) :: decomp
integer, intent(in) :: perElem
integer, intent(in) :: localArr(*)
integer, intent(out) :: globalArr(*)

Calls

proc~~allgatherperelemints~2~~CallsGraph proc~allgatherperelemints~2 AllgatherPerElemInts mpi_allgatherv mpi_allgatherv proc~allgatherperelemints~2->mpi_allgatherv

Called by

proc~~allgatherperelemints~2~~CalledByGraph proc~allgatherperelemints~2 AllgatherPerElemInts proc~adapt_amrcontroller3d Adapt_AMRController3D proc~adapt_amrcontroller3d->proc~allgatherperelemints~2 proc~initforestfromdecomposedmesh~2 InitForestFromDecomposedMesh proc~initforestfromdecomposedmesh~2->proc~allgatherperelemints~2 proc~init_amrcontroller3d Init_AMRController3D proc~init_amrcontroller3d->proc~initforestfromdecomposedmesh~2

Contents

Source Code


Source Code

  subroutine AllgatherPerElemInts(decomp,perElem,localArr,globalArr)
    !! Allgather an integer array with perElem entries per element from the decomposition's
    !! contiguous rank-local element ranges into the global element ordering.
    implicit none
    type(DomainDecomposition),intent(in) :: decomp
    integer,intent(in) :: perElem
    integer,intent(in) :: localArr(*)
    integer,intent(out) :: globalArr(*)
    ! Local
    integer :: r,ierror
    integer,allocatable :: counts(:),displs(:)

    allocate(counts(1:decomp%nRanks),displs(1:decomp%nRanks))
    do r = 1,decomp%nRanks
      counts(r) = perElem*(decomp%offsetElem(r+1)-decomp%offsetElem(r))
      displs(r) = perElem*decomp%offsetElem(r)
    enddo
    call mpi_allgatherv(localArr,counts(decomp%rankId+1),MPI_INTEGER, &
                        globalArr,counts,displs,MPI_INTEGER, &
                        decomp%mpiComm,ierror)
    deallocate(counts,displs)

  endsubroutine AllgatherPerElemInts