remove_lens Subroutine

public subroutine remove_lens(me, label)

remove the lens with the label (if present)

Type Bound

box

Arguments

Type IntentOptional Attributes Name
class(box), intent(inout) :: me
character(len=*), intent(in) :: label

Called by

proc~~remove_lens~~CalledByGraph proc~remove_lens problem_15_module::box%remove_lens program~problem_15 problem_15 program~problem_15->proc~remove_lens

Source Code

    subroutine remove_lens(me,label) ! -
        !! remove the lens with the label (if present)
        class(box),intent(inout) :: me
        character(len=*),intent(in) :: label
        integer :: i
        type(lens),dimension(:),allocatable :: tmp
        if (allocated(me%lenses)) then
            allocate(tmp(0))
            do i = 1, size(me%lenses)
                if (me%lenses(i)%label/=label) tmp = [tmp, me%lenses(i)]
            end do
            call move_alloc(tmp, me%lenses)
        end if
    end subroutine remove_lens