Rebind a live geometry to a new element count, reusing storage where it fits (AMR Stage 6c). This replaces the Free + Init cycle the adaptive loop performed on a freshly allocated SEMQuad every epoch, which threw away exactly the amortization Stage 6b introduced: each member Free released its pools and device buffers, and each Init reallocated, zeroed, rebuilt metadata and equation parsers, and uploaded the zeros.
Contents are undefined afterwards; GenerateFromMesh (or the incremental reuse path) fills them. The cached nGeo -> N scratch is preserved, which is what makes caching it worthwhile.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SEMQuad), | intent(inout) | :: | myGeom | |||
| type(Lagrange), | intent(in), | pointer | :: | interp | ||
| integer, | intent(in) | :: | nElem |
subroutine Resize_SEMQuad(myGeom,interp,nElem)
!! Rebind a live geometry to a new element count, reusing storage where it fits (AMR Stage
!! 6c). This replaces the Free + Init cycle the adaptive loop performed on a freshly allocated
!! SEMQuad every epoch, which threw away exactly the amortization Stage 6b introduced: each
!! member Free released its pools and device buffers, and each Init reallocated, zeroed,
!! rebuilt metadata and equation parsers, and uploaded the zeros.
!!
!! Contents are undefined afterwards; GenerateFromMesh (or the incremental reuse path) fills
!! them. The cached nGeo -> N scratch is preserved, which is what makes caching it worthwhile.
implicit none
class(SEMQuad),intent(inout) :: myGeom
type(Lagrange),pointer,intent(in) :: interp
integer,intent(in) :: nElem
myGeom%nElem = nElem
call myGeom%x%Resize(interp,1,nElem)
call myGeom%dxds%Resize(interp,1,nElem)
call myGeom%dsdx%Resize(interp,1,nElem)
call myGeom%nHat%Resize(interp,1,nElem)
call myGeom%nScale%Resize(interp,1,nElem)
call myGeom%J%Resize(interp,1,nElem)
endsubroutine Resize_SEMQuad