comm_recv_real_dp_array_2d Subroutine

private subroutine comm_recv_real_dp_array_2d(comm, data, source, tag, status)

Blocking receive of a 2D allocatable double precision real array

Arguments

Type IntentOptional Attributes Name
type(comm_t), intent(in) :: comm
real(kind=dp), intent(inout), allocatable :: data(:,:)
integer(kind=int32), intent(in) :: source
integer(kind=int32), intent(in) :: tag
type(MPI_Status), intent(out) :: status

Calls

proc~~comm_recv_real_dp_array_2d~~CallsGraph proc~comm_recv_real_dp_array_2d comm_recv_real_dp_array_2d mpi_recv mpi_recv proc~comm_recv_real_dp_array_2d->mpi_recv

Called by

proc~~comm_recv_real_dp_array_2d~~CalledByGraph proc~comm_recv_real_dp_array_2d comm_recv_real_dp_array_2d interface~recv recv interface~recv->proc~comm_recv_real_dp_array_2d

Variables

Type Visibility Attributes Name Initial
integer(kind=int32), private :: count
integer(kind=int32), private :: dim1
integer(kind=int32), private :: dim2
integer(kind=int32), private :: ierr

Source Code

   subroutine comm_recv_real_dp_array_2d(comm, data, source, tag, status)
   !! Blocking receive of a 2D allocatable double precision real array
      type(comm_t), intent(in) :: comm
      real(dp), intent(inout), allocatable :: data(:, :)
      integer(int32), intent(in) :: source
      integer(int32), intent(in) :: tag
      type(MPI_Status), intent(out) :: status
      integer(int32) :: ierr, count, dim1, dim2

      ! Receive dimensions first
      call MPI_Recv(dim1, 1, MPI_INTEGER, source, tag, comm%m_comm, MPI_STATUS_IGNORE, ierr)
      call MPI_Recv(dim2, 1, MPI_INTEGER, source, tag, comm%m_comm, MPI_STATUS_IGNORE, ierr)

      ! Allocate array with received dimensions
      if (.not. allocated(data)) then
         allocate (data(dim1, dim2))
      end if

      ! Receive data
      count = dim1*dim2
      call MPI_Recv(data, count, MPI_DOUBLE_PRECISION, source, tag, comm%m_comm, status, ierr)
   end subroutine comm_recv_real_dp_array_2d