MPIMortarExchangeAsync_MappedVector2D_t Subroutine

public subroutine MPIMortarExchangeAsync_MappedVector2D_t(this, mesh)

Vector analogue of the scalar mortar exchange message posting; each physical direction of each variable is exchanged as its own message.

Arguments

TypeIntentOptionalAttributesName
class(MappedVector2D_t), intent(inout) :: this
type(Mesh2D), intent(inout) :: mesh

Calls

proc~~mpimortarexchangeasync_mappedvector2d_t~~CallsGraph proc~mpimortarexchangeasync_mappedvector2d_t MPIMortarExchangeAsync_MappedVector2D_t mpi_irecv mpi_irecv proc~mpimortarexchangeasync_mappedvector2d_t->mpi_irecv mpi_isend mpi_isend proc~mpimortarexchangeasync_mappedvector2d_t->mpi_isend

Contents


Source Code

  subroutine MPIMortarExchangeAsync_MappedVector2D_t(this,mesh)
    !! Vector analogue of the scalar mortar exchange message posting; each physical
    !! direction of each variable is exchanged as its own message.
    implicit none
    class(MappedVector2D_t),intent(inout) :: this
    type(Mesh2D),intent(inout) :: mesh
    ! Local
    integer :: m,k,ivar,idir
    integer :: eB,sB,rB,eS,sS,rS
    integer :: globalSideId,tag
    integer :: offset
    integer :: iError
    integer :: msgCount

    msgCount = 0
    offset = mesh%decomp%offsetElem(mesh%decomp%rankId+1)

    do idir = 1,2
      do ivar = 1,this%nvar
        do m = 1,mesh%nMortars

          eB = mesh%mortarInfo(1,m)
          sB = mesh%mortarInfo(2,m)
          rB = mesh%decomp%elemToRank(eB)

          do k = 1,2

            eS = mesh%mortarInfo(2*k+1,m)
            sS = mesh%mortarInfo(2*k+2,m)/10
            rS = mesh%decomp%elemToRank(eS)
            globalSideId = mesh%mortarInfo(6+k,m)
            tag = globalSideId+mesh%nUniqueSides*(ivar-1+this%nvar*(idir-1))

            if(rB == mesh%decomp%rankId .and. rS /= mesh%decomp%rankId) then

              msgCount = msgCount+1
              call MPI_IRECV(this%mortarBuff(:,2+k,m,ivar,idir), &
                             (this%interp%N+1), &
                             mesh%decomp%mpiPrec, &
                             rS,tag, &
                             mesh%decomp%mpiComm, &
                             mesh%decomp%requests(msgCount),iError)

              msgCount = msgCount+1
              call MPI_ISEND(this%boundary(:,sB,eB-offset,ivar,idir), &
                             (this%interp%N+1), &
                             mesh%decomp%mpiPrec, &
                             rS,tag, &
                             mesh%decomp%mpiComm, &
                             mesh%decomp%requests(msgCount),iError)

            elseif(rS == mesh%decomp%rankId .and. rB /= mesh%decomp%rankId) then

              msgCount = msgCount+1
              call MPI_IRECV(this%mortarBuff(:,k,m,ivar,idir), &
                             (this%interp%N+1), &
                             mesh%decomp%mpiPrec, &
                             rB,tag, &
                             mesh%decomp%mpiComm, &
                             mesh%decomp%requests(msgCount),iError)

              msgCount = msgCount+1
              call MPI_ISEND(this%boundary(:,sS,eS-offset,ivar,idir), &
                             (this%interp%N+1), &
                             mesh%decomp%mpiPrec, &
                             rB,tag, &
                             mesh%decomp%mpiComm, &
                             mesh%decomp%requests(msgCount),iError)

            endif

          enddo
        enddo
      enddo
    enddo

    mesh%decomp%msgCount = msgCount

  endsubroutine MPIMortarExchangeAsync_MappedVector2D_t