append_singlega2d_int Subroutine

public subroutine append_singlega2d_int(me, val, pos1, pos2, length)

append a single value to the growing 2d array.

Arguments

Type IntentOptional Attributes Name
type(grw_int2darray_type) :: me

array to append the value to

integer, intent(in) :: val

value to append

integer, intent(in) :: pos1

position in first dimension (cannot grow)

integer, intent(out), optional :: pos2

the position in second dimension the element were added to

integer, intent(in), optional :: length

optional length to expand the array


Calls

proc~~append_singlega2d_int~~CallsGraph proc~append_singlega2d_int append_singlega2d_int interface~expand~22 expand proc~append_singlega2d_int->interface~expand~22 proc~expand_ga2d_real expand_ga2d_real interface~expand~22->proc~expand_ga2d_real

Called by

proc~~append_singlega2d_int~~CalledByGraph proc~append_singlega2d_int append_singlega2d_int interface~append~22 append interface~append~22->proc~append_singlega2d_int

Contents

Source Code


Source Code

  subroutine append_singlega2d_int(me, val, pos1, pos2, length)
    ! --------------------------------------------------------------------------
    !> array to append the value to
    type(grw_int2darray_type) :: me
    !> value to append
    integer, intent(in) :: val
    !> position in first dimension (cannot grow)
    integer, intent(in) :: pos1
    !> optional length to expand the array
    integer, intent(in), optional :: length
    !> the position in second dimension the element were added to
    integer, intent(out), optional :: pos2
    ! --------------------------------------------------------------------------
    integer :: newpos
    ! --------------------------------------------------------------------------

    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%val(pos1, newpos) = val

    if( present( pos2 ) ) pos2 = newpos

  end subroutine append_singlega2d_int