placeat_arrayga2d_long Subroutine

public subroutine placeat_arrayga2d_long(me, val, pos2, length)

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) :: pos2

position in second dimension (can grow)

integer, intent(in), optional :: length

optional length to expand the array


Calls

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

Called by

proc~~placeat_arrayga2d_long~~CalledByGraph proc~placeat_arrayga2d_long placeat_arrayga2d_long interface~placeat~33 placeat interface~placeat~33->proc~placeat_arrayga2d_long

Contents


Source Code

  subroutine placeat_arrayga2d_long(me, val, pos2, length)
    ! --------------------------------------------------------------------------
    !> array to append the value to
    type(grw_long2darray_type) :: me
    !> array of values to append
    integer(kind=long_k), intent(in) :: val(:)
    !> position in second dimension (can grow)
    integer, intent(in) :: pos2
    !> optional length to expand the array
    integer, intent(in), optional :: length
    ! --------------------------------------------------------------------------
    integer :: expandlength
    ! --------------------------------------------------------------------------

    if (me%nvals == huge(me%nvals)) then
       write(*,*) "reached end of integer range for growing array!"
       write(*,*) "aborting!!"
       stop
    end if
    if (pos2 > me%containersize) then
      expandlength = pos2 - me%containersize
      if( present( length ) ) expandlength = max(expandlength, length)
      ! expand the array, if its boundary is reached
      call expand( me = me, length = expandlength )
    end if

    me%nvals = max(pos2, me%nvals)
    me%val( : , pos2 ) = val(:)

  end subroutine placeat_arrayga2d_long