| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(MappedScalar3D), | intent(inout) | :: | this |
subroutine Free_MappedScalar3D(this)
implicit none
class(MappedScalar3D),intent(inout) :: this
! Local
integer :: n,iError
logical :: mpiIsFinalized
this%nVar = 0
this%nElem = 0
this%interp => null()
deallocate(this%interior)
deallocate(this%boundary)
deallocate(this%extBoundary)
deallocate(this%avgBoundary)
deallocate(this%boundarynormal)
deallocate(this%meta)
deallocate(this%eqn)
call gpuCheck(hipFree(this%interior_gpu))
call gpuCheck(hipFree(this%boundary_gpu))
call gpuCheck(hipFree(this%extBoundary_gpu))
call gpuCheck(hipFree(this%avgBoundary_gpu))
call gpuCheck(hipFree(this%boundarynormal_gpu))
call gpuCheck(hipFree(this%jas_gpu))
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
if(allocated(this%halo_reqs)) then
! Persistent requests can only be released while MPI is still
! initialized; if the mesh (and its MPI finalization) was freed first,
! MPI has reclaimed them already.
call MPI_FINALIZED(mpiIsFinalized,iError)
if(.not. mpiIsFinalized) then
do n = 1,size(this%halo_reqs)
call MPI_REQUEST_FREE(this%halo_reqs(n),iError)
enddo
endif
deallocate(this%halo_reqs)
endif
this%halo_nactive = 0
this%halo_inflight = 0
this%halo_static_done = .false.
endsubroutine Free_MappedScalar3D