print_cache Subroutine

private subroutine print_cache(me, iunit)

Print the contents of the cache. Used for debugging.

Type Bound

function_cache

Arguments

Type IntentOptional Attributes Name
class(function_cache), intent(inout) :: me
integer, intent(in) :: iunit

file unit for writing (assumed to be opened)


Source Code

    subroutine print_cache(me,iunit)

    implicit none

    class(function_cache),intent(inout) :: me
    integer,intent(in) :: iunit !! file unit for writing
                                !! (assumed to be opened)

    integer :: i  !! counter

    write(iunit,'(A)') ''
    write(iunit,'(A)') '------------------------'
    if (allocated(me%c)) then
        do i = 1, size(me%c)
            if (allocated(me%c(i)%x)) then
                write(iunit,'(A)') ''
                write(iunit,'(A,1X,I10)') 'Entry ',i
                write(iunit,'(A,1X,*(F27.16,1X))') 'x  :', me%c(i)%x
                if (allocated(me%c(i)%f)) then
                    write(iunit,'(A,1X,*(I27,1X))')    'ifs:', me%c(i)%ifs
                    write(iunit,'(A,1X,*(F27.16,1X))') 'f  :', me%c(i)%f(me%c(i)%ifs)
                end if
                write(iunit,'(A)') '------------------------'
            end if
        end do
    else
        write(iunit,'(A)') 'Cache is not initialized'
        write(iunit,'(A)') '------------------------'
    end if
    write(iunit,'(A)') ''

    end subroutine print_cache