ExchangeOutbox_SetInterface3D_t Subroutine

public subroutine ExchangeOutbox_SetInterface3D_t(this)

Send each remote face's outbox to the partner's rank, and fill

ghost(i,j,v,f) = partner outbox(i2,j2,v), v = 1..nvar(p),

with (i2,j2) the receiving side's flip mapping of (i,j). Same-rank partners are read from the local outbox. Point-to-point only, on this%comm.

Arguments

TypeIntentOptionalAttributesName
class(SetInterface3D_t), intent(inout) :: this

Calls

proc~~exchangeoutbox_setinterface3d_t~~CallsGraph proc~exchangeoutbox_setinterface3d_t ExchangeOutbox_SetInterface3D_t mpi_startall mpi_startall proc~exchangeoutbox_setinterface3d_t->mpi_startall mpi_waitall mpi_waitall proc~exchangeoutbox_setinterface3d_t->mpi_waitall proc~flipindex FlipIndex proc~exchangeoutbox_setinterface3d_t->proc~flipindex

Contents


Source Code

  subroutine ExchangeOutbox_SetInterface3D_t(this)
    !! Send each remote face's outbox to the partner's rank, and fill
    !!
    !!   ghost(i,j,v,f) = partner outbox(i2,j2,v),   v = 1..nvar(p),
    !!
    !! with (i2,j2) the receiving side's flip mapping of (i,j). Same-rank partners are read
    !! from the local outbox. Point-to-point only, on this%comm.
    implicit none
    class(SetInterface3D_t),intent(inout) :: this
    ! Local
    integer :: c,b,f,g,k,p,v,i,j,i2,j2,pos,ierror
    integer :: np1

    np1 = this%N+1

    ! Pack this rank's side of every remote face
    do c = 1,this%nNbr
      pos = this%sendStart(c)
      do b = this%nbrFaceStart(c),this%nbrFaceStart(c+1)-1
        f = this%nbrFace(b)
        k = this%faceSet(f)
        do v = 1,this%nvarOfSet(k)
          do j = 1,np1
            do i = 1,np1
              this%sendBuf(pos) = this%outbox(i,j,v,f)
              pos = pos+1
            enddo
          enddo
        enddo
      enddo
    enddo

    if(this%nNbr > 0) call mpi_startall(2*this%nNbr,this%requests,ierror)

    ! Same-rank partners
    do f = 1,this%nFaces
      g = this%facePartnerFace(f)
      if(g == 0) cycle
      p = this%facePartnerSet(f)
      do v = 1,this%nvarOfSet(p)
        do j = 1,np1
          do i = 1,np1
            call FlipIndex(i,j,this%faceFlip(f),this%N,i2,j2)
            this%ghost(i,j,v,f) = this%outbox(i2,j2,v,g)
          enddo
        enddo
      enddo
    enddo

    if(this%nNbr == 0) return
    call mpi_waitall(2*this%nNbr,this%requests,MPI_STATUSES_IGNORE,ierror)

    ! Unpack remote partners' traces; the sender packed (i,j) unflipped
    do c = 1,this%nNbr
      pos = this%recvStart(c)
      do b = this%nbrFaceStart(c),this%nbrFaceStart(c+1)-1
        f = this%nbrFace(b)
        p = this%facePartnerSet(f)
        do v = 1,this%nvarOfSet(p)
          do j = 1,np1
            do i = 1,np1
              call FlipIndex(i,j,this%faceFlip(f),this%N,i2,j2)
              this%ghost(i,j,v,f) = this%recvBuf(pos+(i2-1)+np1*(j2-1))
            enddo
          enddo
          pos = pos+np1*np1
        enddo
      enddo
    enddo

  endsubroutine ExchangeOutbox_SetInterface3D_t