Transfer the staged pre-regrid solution onto the regridded mesh through plan, filling the rank-local element range [eFirst,eLast] of the new solution.
uGlobal is optional and supplies the GLOBAL old field when the caller has already assembled one (the multi-rank allgather path); when absent the locally staged copy from StageSolutionForTransfer is used, which is the whole field on a single rank.
This base implementation runs the portable host transfer and uploads the result; the GPU backend overrides it to run the transfer on the device with no host traffic.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(DGModel2D_t), | intent(inout) | :: | this | |||
| type(TransferPlan2D), | intent(in), | target | :: | plan | ||
| type(Lagrange), | intent(in) | :: | interp | |||
| integer, | intent(in) | :: | eFirst | |||
| integer, | intent(in) | :: | eLast | |||
| real(kind=prec), | intent(in), | optional | :: | uGlobal(:,:,:,:) |
subroutine ApplyTransferPlan_DGModel2D_t(this,plan,interp,eFirst,eLast,uGlobal)
!! Transfer the staged pre-regrid solution onto the regridded mesh through plan, filling the
!! rank-local element range [eFirst,eLast] of the new solution.
!!
!! uGlobal is optional and supplies the GLOBAL old field when the caller has already
!! assembled one (the multi-rank allgather path); when absent the locally staged copy from
!! StageSolutionForTransfer is used, which is the whole field on a single rank.
!!
!! This base implementation runs the portable host transfer and uploads the result; the GPU
!! backend overrides it to run the transfer on the device with no host traffic.
implicit none
class(DGModel2D_t),intent(inout) :: this
! target: the GPU override takes c_loc of the plan's arrays to upload them, which requires
! the POINTER or TARGET attribute. Declared here too so the override's characteristics match.
type(TransferPlan2D),intent(in),target :: plan
type(Lagrange),intent(in) :: interp
integer,intent(in) :: eFirst
integer,intent(in) :: eLast
real(prec),intent(in),optional :: uGlobal(:,:,:,:)
if(present(uGlobal)) then
call ApplyTransferPlanRange(plan,interp,this%nvar,uGlobal,eFirst,eLast, &
this%solution%interior)
else
if(.not. allocated(this%transferStage)) then
print*,__FILE__,':',__LINE__, &
' : Error : ApplyTransferPlan called without a staged solution.'
stop 1
endif
call ApplyTransferPlanRange(plan,interp,this%nvar,this%transferStage,eFirst,eLast, &
this%solution%interior)
endif
call this%solution%UpdateDevice()
if(allocated(this%transferStage)) deallocate(this%transferStage)
endsubroutine ApplyTransferPlan_DGModel2D_t