comm_fortran_handle Function

private function comm_fortran_handle(this) result(fh)

The plain default-integer handle this communicator is known by – what comm_from_handle takes back, and what a handle-based API (one that is not itself written against pic-mpi, such as MPI_Comm_c2f’s C callers) expects. Under mpi_f08 this is MPI_Comm’s MPI_VAL component; the MPI standard guarantees it is the same integer the legacy mpi module would hand back for the same communicator, so a caller on either backend gets a value usable the same way.

Type Bound

comm_t

Arguments

Type IntentOptional Attributes Name
class(comm_t), intent(in) :: this

Return Value integer


Source Code

   function comm_fortran_handle(this) result(fh)
   !! The plain default-integer handle this communicator is known by --
   !! what `comm_from_handle` takes back, and what a handle-based API (one
   !! that is not itself written against pic-mpi, such as MPI_Comm_c2f's C
   !! callers) expects. Under mpi_f08 this is MPI_Comm's MPI_VAL component;
   !! the MPI standard guarantees it is the same integer the legacy `mpi`
   !! module would hand back for the same communicator, so a caller on
   !! either backend gets a value usable the same way.
      class(comm_t), intent(in) :: this
      integer :: fh
      if (.not. this%is_valid) then
         error stop "Cannot get a Fortran handle from a null Comm"
      end if
      fh = this%m_comm%MPI_VAL
   end function comm_fortran_handle