DomainDecomp Subroutine

public subroutine DomainDecomp(nElems, nDomains, offsetElem)

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: nElems
integer, intent(in) :: nDomains
integer, intent(out) :: offsetElem(0:nDomains)

Called by

proc~~domaindecomp~~CalledByGraph proc~domaindecomp DomainDecomp proc~setelemtorank_domaindecomposition_t SetElemToRank_DomainDecomposition_t proc~setelemtorank_domaindecomposition_t->proc~domaindecomp proc~setelemtorank_domaindecomposition SetElemToRank_DomainDecomposition proc~setelemtorank_domaindecomposition->proc~domaindecomp

Contents

Source Code


Source Code

  subroutine DomainDecomp(nElems,nDomains,offSetElem)
    ! From https://www.hopr-project.org/externals/Meshformat.pdf, Algorithm 4
    implicit none
    integer,intent(in) :: nElems
    integer,intent(in) :: nDomains
    integer,intent(out) :: offsetElem(0:nDomains)
    ! Local
    integer :: nLocalElems
    integer :: remainElems
    integer :: iDom

    nLocalElems = nElems/nDomains
    remainElems = nElems-nLocalElems*nDomains
    do iDom = 0,nDomains-1
      offSetElem(iDom) = iDom*nLocalElems+min(iDom,remainElems)
    enddo
    offSetElem(nDomains) = nElems

  endsubroutine DomainDecomp