| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(box), | intent(inout) | :: | me | |||
| type(lens), | intent(in) | :: | l |
lense to add |
subroutine add_lens(me,l) ! = class(box),intent(inout) :: me type(lens),intent(in) :: l !! lense to add integer :: i !! counter if (allocated(me%lenses)) then do i = 1, size(me%lenses) if (me%lenses(i)%label == l%label) then me%lenses(i) = l ! replace with this one return end if end do me%lenses = [me%lenses, l] ! if not found, add to end else me%lenses = [l] ! first one in the box end if end subroutine add_lens