pf_level_destroy Subroutine

public subroutine pf_level_destroy(lev, nlevels)

Uses

  • proc~~pf_level_destroy~~UsesGraph proc~pf_level_destroy pf_level_destroy module~pf_mod_quadrature pf_mod_quadrature proc~pf_level_destroy->module~pf_mod_quadrature module~pf_mod_dtype pf_mod_dtype module~pf_mod_quadrature->module~pf_mod_dtype iso_c_binding iso_c_binding module~pf_mod_quadrature->iso_c_binding module~pf_mod_dtype->iso_c_binding

Deallocate PFASST level deallocate flat buffers for communcition deallocate nodes, flags, and integration matrices deallocate solution and function storage

destroy the sweeper

deallocate misc. arrays

Arguments

Type IntentOptional AttributesName
class(pf_level_t), intent(inout) :: lev

level to destroy

integer :: nlevels

number of pfasst levels


Calls

proc~~pf_level_destroy~~CallsGraph proc~pf_level_destroy pf_level_destroy proc~pf_destroy_sdcmats pf_destroy_sdcmats proc~pf_level_destroy->proc~pf_destroy_sdcmats

Called by

proc~~pf_level_destroy~~CalledByGraph proc~pf_level_destroy pf_level_destroy proc~pf_pfasst_destroy pf_pfasst_destroy proc~pf_pfasst_destroy->proc~pf_level_destroy

Contents

Source Code


Source Code

  subroutine pf_level_destroy(lev,nlevels)
    use pf_mod_quadrature
    class(pf_level_t), intent(inout) :: lev      !!  level to destroy
    integer                          :: nlevels  !!  number of pfasst levels


    integer                          :: npieces  !!  local copy of number of function pieces

    if (.not. lev%allocated) return

    !> deallocate flat buffers for communcition
    deallocate(lev%send)
    deallocate(lev%recv)

    !> deallocate nodes, flags, and integration matrices
    deallocate(lev%nodes)
    deallocate(lev%nflags)

    call pf_destroy_sdcmats(lev%sdcmats)
    deallocate(lev%sdcmats)

    !> deallocate solution and function storage
    npieces = lev%ulevel%sweeper%npieces

    if ((lev%index < nlevels) .and. allocated(lev%tauQ)) then
       call lev%ulevel%factory%destroy_array(lev%tauQ, lev%nnodes-1, lev%index,   lev%shape)
    end if

    call lev%ulevel%factory%destroy_array(lev%Q, lev%nnodes, lev%index,   lev%shape)
    call lev%ulevel%factory%destroy_array(lev%Fflt, lev%nnodes*npieces, lev%index,   lev%shape)
    call lev%ulevel%factory%destroy_array(lev%I, lev%nnodes-1, lev%index,  lev%shape)
    call lev%ulevel%factory%destroy_array(lev%R, lev%nnodes-1, lev%index,  lev%shape)
    call lev%ulevel%factory%destroy_array(lev%pFflt, lev%nnodes*npieces, lev%index, lev%shape)
    if (lev%index < nlevels) then
       call lev%ulevel%factory%destroy_array(lev%pQ, lev%nnodes, lev%index,   lev%shape)
    end if
    call lev%ulevel%factory%destroy_single(lev%qend, lev%index,  lev%shape)
    call lev%ulevel%factory%destroy_single(lev%q0, lev%index,   lev%shape)

    !> destroy the sweeper 
    call lev%ulevel%sweeper%destroy(lev)

    !> deallocate misc. arrays
    if (allocated(lev%shape)) then
       deallocate(lev%shape)
    end if

    if (allocated(lev%tmat)) then
       deallocate(lev%tmat)
    end if

    if (allocated(lev%rmat)) then
       deallocate(lev%rmat)
   end if
  end subroutine pf_level_destroy