@brief Set up the re-sizeable array (buffer) with a given start size and grow_factor.
@details Has to be called before first use and can be called any time.
@param[in] rows Number of rows in the first dimension. @param[in] start_size Initial size of the buffer along the last dimension. @param[in] grow_factor Factor about which to grow the buffer along the last dimension, if the capacity is not sufficient.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(buffer_int64_2D_t), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | rows | |||
real, | intent(in), | optional | :: | grow_factor | ||
integer, | intent(in), | optional | :: | start_size |
pure subroutine init_int64_2D (this, rows, grow_factor, start_size)
class(buffer_int64_2D_t), intent(inout) :: this
integer, intent(in) :: rows
real, optional, intent(in) :: grow_factor
integer, optional, intent(in) :: start_size
character(*), parameter :: this_routine = 'buffer::init'
if (present(grow_factor)) this%grow_factor = grow_factor
if (present(start_size)) this%start_size = start_size
#ifdef DEBUG_
block
use util_mod, only: stop_all
if (.not. (this%grow_factor > 1.0_dp)) then
call stop_all (this_routine, "Assert fail: this%grow_factor > 1.0_dp")
end if
end block
#endif
#ifdef DEBUG_
block
use util_mod, only: stop_all
if (.not. (this%start_size >= 0_int64)) then
call stop_all (this_routine, "Assert fail: this%start_size >= 0_int64")
end if
end block
#endif
allocate(this%buf(rows, this%start_size))
this%pos = 0_int64
end subroutine init_int64_2D