Routine used to initialize the memory module. It should be called during the module initialization.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical | :: | do_chk |
Switch for memory soft limit |
|||
real(kind=rp), | intent(in) | :: | max_Gbytes |
Amount of memory available in bytes |
subroutine memory_init(do_chk, max_Gbytes)
!! Routine used to initialize the memory module. It should
!! be called during the module initialization.
implicit none
logical :: do_chk !! Switch for memory soft limit
real(rp), intent(in) :: max_Gbytes !! Amount of memory available in bytes
integer(ip) :: my_int !! Integer used only as target for sizeof
real(rp) :: my_real !! Real used only as target for sizeof
logical(lp) :: my_bool
intrinsic :: sizeof
if(.not. is_init) then
do_chk_limit = do_chk
maxmem = max_Gbytes
usedmem = 0.0
max_used = 0.0
size_of_real = sizeof(my_real)
size_of_int = sizeof(my_int)
size_of_logical = sizeof(my_bool)
is_init = .true.
end if
end subroutine memory_init