init_da_path Subroutine

public subroutine init_da_path(me, length)

Include the subroutines for the dynamic array. initialization of a dynamic array

before a dynamic array can be used, it has to be initialized with this routine. the initial length provided here, can avoid reallocations and memory copying, if approximated correctly enough. if none is specified, the provided container initially will be of size 0.


Type IntentOptional Attributes Name
type(dyn_patharray_type), intent(out) :: me
integer, intent(in), optional :: length

Called by

proc~~init_da_path~~CalledByGraph proc~init_da_path init_da_path interface~init~5 init interface~init~5->proc~init_da_path proc~sorttruncate_da_path sorttruncate_da_path proc~sorttruncate_da_path->interface~init~5 interface~sorttruncate sorttruncate interface~sorttruncate->proc~sorttruncate_da_path


Source Code

Source Code

  subroutine init_da_path(me, length)
    type(dyn_patharray_type), intent(out) :: me !< dynamic array to init
    integer, intent(in), optional :: length !< initial length of the container

    if (present(length)) then
      me%containersize = length
      me%containersize = zerolength
    end if

    ! deallocate ...
    if( allocated( me%val ) ) deallocate(me%val)
    if( allocated( me%sorted ) ) deallocate(me%sorted)
    ! ... and reallocate
    me%nvals = 0

  end subroutine init_da_path