append_arrayga2d_long Subroutine

public subroutine append_arrayga2d_long(me, val, length, pos)

append an array of values to the growing 2d array.

Arguments

Type IntentOptional Attributes Name
type(grw_long2darray_type) :: me

array to append the value to

integer(kind=long_k), 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


Calls

proc~~append_arrayga2d_long~~CallsGraph proc~append_arrayga2d_long append_arrayga2d_long interface~expand~18 expand proc~append_arrayga2d_long->interface~expand~18 proc~expand_ga2d_real expand_ga2d_real interface~expand~18->proc~expand_ga2d_real

Called by

proc~~append_arrayga2d_long~~CalledByGraph proc~append_arrayga2d_long append_arrayga2d_long interface~append~18 append interface~append~18->proc~append_arrayga2d_long

Source Code

  subroutine append_arrayga2d_long(me, val, length, pos)
    ! --------------------------------------------------------------------------
    !> array to append the value to
    type(grw_long2darray_type) :: me
    !> array of values to append
    integer(kind=long_k), 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_long