Initialize the cache. Must be called first before use.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(function_cache), | intent(inout) | :: | me | |||
integer, | intent(in) | :: | isize |
the size of the hash table |
||
integer, | intent(in) | :: | n |
number of independant variables (x) |
||
integer, | intent(in) | :: | m |
number of functions (f) |
||
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 |
subroutine initialize_cache(me,isize,n,m,chunk_size) implicit none class(function_cache),intent(inout) :: me integer,intent(in) :: isize !! the size of the hash table integer,intent(in) :: n !! number of independant variables (x) integer,intent(in) :: m !! number of functions (f) 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)) me%n = n me%m = m if (present(chunk_size)) then me%chunk_size = chunk_size else me%chunk_size = 100 end if end subroutine initialize_cache