comm_recv_real_dp_array_2d Subroutine

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

Receive 2D real(dp) array (must be pre-allocated by receiver)

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~2~~CallsGraph proc~comm_recv_real_dp_array_2d~2 comm_recv_real_dp_array_2d mpi_recv mpi_recv proc~comm_recv_real_dp_array_2d~2->mpi_recv proc~status_array_to_type status_array_to_type proc~comm_recv_real_dp_array_2d~2->proc~status_array_to_type

Called by

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

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
integer, private :: stat(MPI_STATUS_SIZE)

Source Code

   subroutine comm_recv_real_dp_array_2d(comm, data, source, tag, status)
      !! Receive 2D real(dp) array (must be pre-allocated by receiver)
      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
      integer :: stat(MPI_STATUS_SIZE)

      ! Receive dimensions first
      call MPI_Recv(dim1, 1_int32, MPI_INTEGER, source, tag, comm%m_comm, stat, ierr)
      call MPI_Recv(dim2, 1_int32, MPI_INTEGER, source, tag, comm%m_comm, stat, 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, stat, ierr)

      ! Convert status
      status = status_array_to_type(stat)
   end subroutine comm_recv_real_dp_array_2d