set_gcp_mpi_comm Subroutine

public subroutine set_gcp_mpi_comm(verror, vgcp, comm) bind(C, name=namespace//"set_gcp_mpi_comm")

Distribute the counter-poise correction over an MPI communicator.

In contrast to the externally managed work partition the results are reduced over the communicator, every rank receives the complete result. Communicators are passed as Fortran handles, use MPI_Comm_c2f to convert.

Arguments

Type IntentOptional Attributes Name
type(c_ptr), value :: verror
type(c_ptr), value :: vgcp
integer(kind=c_int), intent(in), value :: comm

Source Code

subroutine set_gcp_mpi_comm(verror, vgcp, comm) &
      & bind(C, name=namespace//"set_gcp_mpi_comm")
   type(c_ptr), value :: verror
   type(vp_error), pointer :: error
   type(c_ptr), value :: vgcp
   type(vp_gcp), pointer :: gcp
   integer(c_int), value, intent(in) :: comm

   if (.not.c_associated(verror)) return
   call c_f_pointer(verror, error)

   if (.not.c_associated(vgcp)) then
      call fatal_error(error%ptr, "Counter-poise parameters are missing")
      return
   end if
   call c_f_pointer(vgcp, gcp)

   ! reports a missing MPI build or an unusable communicator
   call new_mpi_work_partition(error%ptr, gcp%partition, int(comm))
   if (allocated(error%ptr)) return

   gcp%comm = int(comm)
end subroutine set_gcp_mpi_comm