Resize_MappedVector3D Subroutine

public subroutine Resize_MappedVector3D(this, interp, nVar, nElem)

Rebind to a new element count, reusing host pools and device buffers where they fit (AMR Stage 6b). Inherits the Vector3D resize (host pools plus the five device buffers) and adds this class's mortar buffers, which are sized by mesh%nMortars rather than nElem: nMortars changes with the mesh independently of the element count, so a stale buffer would silently under-size the next mortar exchange. They are invalidated here and lazily re-created at the correct size on next use.

Arguments

TypeIntentOptionalAttributesName
class(MappedVector3D), intent(inout) :: this
type(Lagrange), intent(in), target:: interp
integer, intent(in) :: nVar
integer, intent(in) :: nElem

Calls

proc~~resize_mappedvector3d~~CallsGraph proc~resize_mappedvector3d Resize_MappedVector3D proc~resize_mappedvector3d_t Resize_MappedVector3D_t proc~resize_mappedvector3d->proc~resize_mappedvector3d_t proc~gpucheck gpuCheck proc~resize_mappedvector3d->proc~gpucheck ensuredevicebuffers_vector3d ensuredevicebuffers_vector3d proc~resize_mappedvector3d->ensuredevicebuffers_vector3d interface~hipfree hipFree proc~resize_mappedvector3d->interface~hipfree proc~resize_vector3d_t Resize_Vector3D_t proc~resize_mappedvector3d_t->proc~resize_vector3d_t

Contents

Source Code


Source Code

  subroutine Resize_MappedVector3D(this,interp,nVar,nElem)
    !! Rebind to a new element count, reusing host pools and device buffers where they fit (AMR
    !! Stage 6b). Inherits the Vector3D resize (host pools plus the five device buffers) and adds
    !! this class's mortar buffers, which are sized by mesh%nMortars rather than nElem: nMortars
    !! changes with the mesh independently of the element count, so a stale buffer would silently
    !! under-size the next mortar exchange. They are invalidated here and lazily re-created at
    !! the correct size on next use.
    implicit none
    class(MappedVector3D),intent(inout) :: this
    type(Lagrange),target,intent(in) :: interp
    integer,intent(in) :: nVar
    integer,intent(in) :: nElem

    call Resize_MappedVector3D_t(this,interp,nVar,nElem)
    call EnsureDeviceBuffers_Vector3D(this)
    if(c_associated(this%mortarBuff_gpu)) then
      call gpuCheck(hipFree(this%mortarBuff_gpu))
      this%mortarBuff_gpu = c_null_ptr
    endif

    ! The packed halo-exchange buffers are sized by the mesh/partition's shared-side
    ! count, which changes with a regrid; free them so the next exchange rebuilds
    ! against the new mesh (see Resize_MappedScalar3D for the failure this prevents).
    if(c_associated(this%halo_sendbuf_gpu)) call gpuCheck(hipFree(this%halo_sendbuf_gpu))
    if(c_associated(this%halo_recvbuf_gpu)) call gpuCheck(hipFree(this%halo_recvbuf_gpu))
    this%halo_sendbuf_gpu = c_null_ptr
    this%halo_recvbuf_gpu = c_null_ptr

  endsubroutine Resize_MappedVector3D