Rebind to a new element count, reusing host pools and device buffers where they fit (AMR Stage 6b), and without uploading zeros the way Init does.
The mortar buffers are sized by mesh%nMortars, not nElem, and nMortars changes with the mesh independently of the element count, so they are invalidated here and lazily re-created at the right size by the next mortar exchange. Leaving a stale buffer in place would silently under-size that exchange.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(MappedScalar2D), | intent(inout) | :: | this | |||
| type(Lagrange), | intent(in), | target | :: | interp | ||
| integer, | intent(in) | :: | nVar | |||
| integer, | intent(in) | :: | nElem |
subroutine Resize_MappedScalar2D(this,interp,nVar,nElem)
!! Rebind to a new element count, reusing host pools and device buffers where they fit
!! (AMR Stage 6b), and without uploading zeros the way Init does.
!!
!! The mortar buffers are sized by mesh%nMortars, not nElem, and nMortars changes with the
!! mesh independently of the element count, so they are invalidated here and lazily
!! re-created at the right size by the next mortar exchange. Leaving a stale buffer in place
!! would silently under-size that exchange.
implicit none
class(MappedScalar2D),intent(inout) :: this
type(Lagrange),intent(in),target :: interp
integer,intent(in) :: nVar
integer,intent(in) :: nElem
call Resize_MappedScalar2D_t(this,interp,nVar,nElem)
call EnsureDeviceBuffers_MappedScalar2D(this)
if(c_associated(this%mortarBuff_gpu)) then
call gpuCheck(hipFree(this%mortarBuff_gpu))
this%mortarBuff_gpu = c_null_ptr
endif
endsubroutine Resize_MappedScalar2D