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~~CallsGraph proc~allgatherperelemints AllgatherPerElemInts mpi_allgatherv mpi_allgatherv proc~allgatherperelemints->mpi_allgatherv

Called by

proc~~allgatherperelemints~~CalledByGraph proc~allgatherperelemints AllgatherPerElemInts proc~adapt_amrcontroller2d Adapt_AMRController2D proc~adapt_amrcontroller2d->proc~allgatherperelemints proc~initforestfromdecomposedmesh InitForestFromDecomposedMesh proc~initforestfromdecomposedmesh->proc~allgatherperelemints proc~init_amrcontroller2d Init_AMRController2D proc~init_amrcontroller2d->proc~initforestfromdecomposedmesh

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