map_free Subroutine

subroutine map_free(map)

Free array map (nullify pointers and deallocate array)

Arguments

Type IntentOptional Attributes Name
type(array_ptr), allocatable :: map(:)

Source Code

  subroutine map_free(map)
    !! Free array map (nullify pointers and deallocate array)
    implicit none
    type(array_ptr), allocatable :: map(:)
    integer :: i

    if(allocated(map))then
       do i = 1, size(map)
          if(associated(map(i)%p))then
             nullify(map(i)%p)
          end if
       end do
       deallocate(map)
    end if
  end subroutine map_free