initialize_cache Subroutine

private subroutine initialize_cache(me, isize, chunk_size)

Initialize the cache. Must be called first before use.

Type Bound

function_cache

Arguments

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

the size of the hash table

integer, intent(in), optional :: chunk_size

chunk size to speed up reallocation of arrays. A good value is a guess for the actual number of elements of f that will be saved per value of x [default is 100]


Calls

proc~~initialize_cache~2~~CallsGraph proc~initialize_cache~2 aoc_cache_module::function_cache%initialize_cache proc~destroy_cache~2 aoc_cache_module::function_cache%destroy_cache proc~initialize_cache~2->proc~destroy_cache~2

Called by

proc~~initialize_cache~2~~CalledByGraph proc~initialize_cache~2 aoc_cache_module::function_cache%initialize_cache program~problem_12b problem_12b program~problem_12b->proc~initialize_cache~2 program~problem_17~2 problem_17 program~problem_17~2->proc~initialize_cache~2

Source Code

    subroutine initialize_cache(me,isize,chunk_size)

    implicit none

    class(function_cache),intent(inout) :: me
    integer,intent(in) :: isize !! the size of the hash table
    integer,intent(in),optional :: chunk_size  !! chunk size to speed up reallocation
                                               !! of arrays. A good value is a guess for
                                               !! the actual number of elements of `f` that
                                               !! will be saved per value of `x` [default is 100]

    call me%destroy()

    allocate(me%c(0:isize-1))

    if (present(chunk_size)) then
        me%chunk_size = chunk_size
    else
        me%chunk_size = 100
    end if

    end subroutine initialize_cache