append_arrayga2d_int Subroutine

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

append an array of values 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(:)

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_int~~CallsGraph proc~append_arrayga2d_int append_arrayga2d_int interface~expand~22 expand proc~append_arrayga2d_int->interface~expand~22 proc~expand_ga2d_real expand_ga2d_real interface~expand~22->proc~expand_ga2d_real

Called by

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

Contents

Source Code


Source Code

  subroutine append_arrayga2d_int(me, val, length, pos)
    ! --------------------------------------------------------------------------
    !> array to append the value to
    type(grw_int2darray_type) :: me
    !> array of values to append
    integer, 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_int