Resize_Vector2D_t Subroutine

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

Rebind a live object to a new element count, reusing existing storage when it fits (AMR Stage 6b). Unlike Init - which is intent(out), so it resets the object, reallocates, zeroes and reconstructs the equation parsers - this preserves metadata and parsers (neither depends on nElem) and touches storage only when it must grow. Preserving the parsers also avoids repeating the EquationParser construction that Init performs 2*nVar times as an amdflang workaround.

All arrays are zeroed, exactly as Init leaves them - see Resize_Scalar2D_t for why that is required rather than merely tidy.

Arguments

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

Called by

proc~~resize_vector2d_t~~CalledByGraph proc~resize_vector2d_t Resize_Vector2D_t proc~resize_mappedvector2d_t Resize_MappedVector2D_t proc~resize_mappedvector2d_t->proc~resize_vector2d_t proc~resize_vector2d Resize_Vector2D proc~resize_vector2d->proc~resize_vector2d_t proc~resize_mappedvector2d Resize_MappedVector2D proc~resize_mappedvector2d->proc~resize_mappedvector2d_t

Contents

Source Code


Source Code

  subroutine Resize_Vector2D_t(this,interp,nVar,nElem)
    !! Rebind a live object to a new element count, reusing existing storage when it fits (AMR
    !! Stage 6b). Unlike Init - which is intent(out), so it resets the object, reallocates,
    !! zeroes and reconstructs the equation parsers - this preserves metadata and parsers
    !! (neither depends on nElem) and touches storage only when it must grow. Preserving the
    !! parsers also avoids repeating the EquationParser construction that Init performs 2*nVar
    !! times as an amdflang workaround.
    !!
    !! All arrays are zeroed, exactly as Init leaves them - see Resize_Scalar2D_t for why that is
    !! required rather than merely tidy.
    implicit none
    class(Vector2D_t),intent(inout) :: this
    type(Lagrange),target,intent(in) :: interp
    integer,intent(in) :: nVar
    integer,intent(in) :: nElem

    if(nVar /= this%nVar) then
      print*,__FILE__,':',__LINE__, &
        ' : Error : Resize cannot change nVar. Use Free followed by Init.'
      stop 1
    endif

    this%interp => interp
    this%nElem = nElem
    this%N = interp%N
    this%M = interp%M

    call this%MapArrays(interp%N+1,nVar,nElem)

    this%interior = 0.0_prec
    this%boundary = 0.0_prec
    this%boundarynormal = 0.0_prec
    this%extBoundary = 0.0_prec
    this%avgBoundary = 0.0_prec

  endsubroutine Resize_Vector2D_t