AllgatherPerElemReals Subroutine

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

Allgather a real(prec) 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
real(kind=prec), intent(in) :: localArr(*)
real(kind=prec), intent(out) :: globalArr(*)

Calls

proc~~allgatherperelemreals~~CallsGraph proc~allgatherperelemreals AllgatherPerElemReals mpi_allgatherv mpi_allgatherv proc~allgatherperelemreals->mpi_allgatherv

Called by

proc~~allgatherperelemreals~~CalledByGraph proc~allgatherperelemreals AllgatherPerElemReals proc~adapt_amrcontroller2d Adapt_AMRController2D proc~adapt_amrcontroller2d->proc~allgatherperelemreals proc~initforestfromdecomposedmesh InitForestFromDecomposedMesh proc~initforestfromdecomposedmesh->proc~allgatherperelemreals proc~init_amrcontroller2d Init_AMRController2D proc~init_amrcontroller2d->proc~initforestfromdecomposedmesh

Contents

Source Code


Source Code

  subroutine AllgatherPerElemReals(decomp,perElem,localArr,globalArr)
    !! Allgather a real(prec) 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
    real(prec),intent(in) :: localArr(*)
    real(prec),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),decomp%mpiPrec, &
                        globalArr,counts,displs,decomp%mpiPrec, &
                        decomp%mpiComm,ierror)
    deallocate(counts,displs)

  endsubroutine AllgatherPerElemReals