set_model_mpi_comm Subroutine

public subroutine set_model_mpi_comm(verror, vdisp, comm) bind(C, name=namespace//"set_model_mpi_comm")

Distribute the interaction loops of this model over an MPI communicator.

Arguments

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

Source Code

subroutine set_model_mpi_comm(verror, vdisp, comm) &
      & bind(C, name=namespace//"set_model_mpi_comm")
   type(c_ptr), value :: verror
   type(vp_error), pointer :: error
   type(c_ptr), value :: vdisp
   type(vp_model), pointer :: disp
   integer(c_int), value, intent(in) :: comm

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

   if (.not.c_associated(vdisp)) then
      call fatal_error(error%ptr, "D3 dispersion model is missing")
      return
   end if
   call c_f_pointer(vdisp, disp)

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

   disp%comm = int(comm)
end subroutine set_model_mpi_comm