Subroutine to receive convergence status information
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(pf_pfasst_t), | intent(inout) | :: | pf | main pfasst structure |
||
integer, | intent(in) | :: | tag | message tag |
||
integer, | intent(inout) | :: | istatus | status flag to receive |
||
integer, | intent(inout) | :: | ierror | error flag |
||
integer, | intent(in), | optional | :: | direction |
subroutine pf_mpi_recv_status(pf, tag,istatus,ierror, direction)
use pf_mod_mpi, only: MPI_INTEGER, MPI_STATUS_SIZE
type(pf_pfasst_t), intent(inout) :: pf !! main pfasst structure
integer, intent(in) :: tag !! message tag
integer, intent(inout) :: istatus !! status flag to receive
integer, intent(inout) :: ierror !! error flag
integer, optional, intent(in) :: direction
integer :: source
integer :: stat(MPI_STATUS_SIZE), dir
integer :: message
dir = 1 ! default 1: send forward; set to 2 for send backwards
if(present(direction)) dir = direction
if(dir == 2) then
source = modulo(pf%rank+1, pf%comm%nproc)
else
source = modulo(pf%rank-1, pf%comm%nproc)
end if
! Get the message
call mpi_recv(message, 1, MPI_INTEGER,source, tag, pf%comm%comm, stat, ierror)
istatus=message
end subroutine pf_mpi_recv_status