append an array of values to the growing 2d array.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grw_real2darray_type) | :: | me |
array to append the value to |
|||
real(kind=rk), | intent(in) | :: | val(:) |
array of values to append |
||
integer, | intent(in), | optional | :: | length |
optional length to expand the array |
|
integer, | intent(out), | optional | :: | pos |
the position in second dimension the elements were added to |
subroutine append_arrayga2d_real(me, val, length, pos)
! --------------------------------------------------------------------------
!> array to append the value to
type(grw_real2darray_type) :: me
!> array of values to append
real(kind=rk), intent(in) :: val(:)
!> optional length to expand the array
integer, intent(in), optional :: length
!> the position in second dimension the elements were added to
integer, intent(out), optional :: pos
! --------------------------------------------------------------------------
integer :: newpos
! --------------------------------------------------------------------------
if (me%nvals == huge(me%nvals)) then
write(*,*) "reached end of integer range for growing array!"
write(*,*) "aborting!!"
stop
end if
newpos = me%nvals + 1
if (newpos > me%containersize) then
! expand the array, if its boundary is reached
call expand( me = me, length = length )
end if
me%nvals = max(newpos, me%nvals)
me%val( : , newpos ) = val(:)
if( present( pos ) ) pos = newpos
end subroutine append_arrayga2d_real