Free_DomainDecomposition Subroutine

public subroutine Free_DomainDecomposition(this)

Arguments

TypeIntentOptionalAttributesName
class(DomainDecomposition), intent(inout) :: this

Calls

proc~~free_domaindecomposition~~CallsGraph proc~free_domaindecomposition Free_DomainDecomposition hipfree hipfree proc~free_domaindecomposition->hipfree gpucheck gpucheck proc~free_domaindecomposition->gpucheck proc~releasempi ReleaseMPI proc~free_domaindecomposition->proc~releasempi mpi_finalized mpi_finalized proc~releasempi->mpi_finalized mpi_finalize mpi_finalize proc~releasempi->mpi_finalize

Contents


Source Code

  subroutine Free_DomainDecomposition(this)
    implicit none
    class(DomainDecomposition),intent(inout) :: this

    if(associated(this%offSetElem)) then
      deallocate(this%offSetElem)
    endif
    if(associated(this%elemToRank)) then
      deallocate(this%elemToRank)
      call gpuCheck(hipFree(this%elemToRank_gpu))
    endif

    if(allocated(this%requests)) deallocate(this%requests)
    if(allocated(this%stats)) deallocate(this%stats)

    if(allocated(this%halo_rank)) deallocate(this%halo_rank)
    if(allocated(this%halo_offset)) deallocate(this%halo_offset)
    if(c_associated(this%halo_sides_gpu)) then
      call gpuCheck(hipFree(this%halo_sides_gpu))
      this%halo_sides_gpu = c_null_ptr
    endif
    this%halo_built = .false.

    ! Guard against a second Free, and against freeing a decomposition that was
    ! never initialized, both of which would corrupt the live-decomposition count.
    if(this%initialized) then
      call ReleaseMPI(this%ownsMpi,this%rankId,this%nRanks)
      this%initialized = .false.
    endif

  endsubroutine Free_DomainDecomposition