Project

General

Profile

new_from_array Function

private function new_from_array(items, verbose, initial_size) result(this)

Arguments

Type IntentOptional AttributesName
class(*), intent(in), target:: items(:)
logical, intent(in), optional :: verbose
integer, intent(in), optional :: initial_size

Return Value type(vector_ref)

Description

Create a vector from a pre-existing array

Called By

proc~~new_from_array~2~~CalledByGraph proc~new_from_array~2 new_from_array interface~vector_ref vector_ref interface~vector_ref->proc~new_from_array~2

Variables

TypeVisibility AttributesNameInitial
integer, public :: i

Source Code

    function new_from_array(items, verbose, initial_size) result(this)
        class(*), target, intent(in) :: items(:)
        logical, optional, intent(in) :: verbose
        integer, optional, intent(in) :: initial_size
        type(vector_ref) :: this 
        integer :: i
        this%maximum_size = 2*size(items)
        if(present(initial_size)) this%maximum_size = initial_size
        if(present(verbose)) then
            this%verbose = verbose
        end if
        allocate(this%items(this%maximum_size))
        do i = lbound(items, 1), ubound(items, 1)
            call this%add_item(items(i))
        end do
        if(this%verbose) then
            print *, 'created vector_ref (', this%current_size, '/', &
                     this%maximum_size, ' elements)'
        end if
    end function new_from_array


© 2016
self was developed by
Documentation generated by FORD