Add hit to hits(1:n) (growing the array).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(PickHit), | intent(inout), | allocatable | :: | hits(:) |
grown as needed |
|
| integer, | intent(inout) | :: | n |
number of hits in hits |
||
| type(PickHit), | intent(in) | :: | hit |
the hit to add |
subroutine add_pick_hit(hits, n, hit) type(PickHit), allocatable, intent(inout) :: hits(:) !! grown as needed integer, intent(inout) :: n !! number of hits in hits type(PickHit), intent(in) :: hit !! the hit to add type(PickHit), allocatable :: more(:) if (.not. allocated(hits)) allocate(hits(8)) if (n == size(hits)) then allocate(more(2 * n)) more(1:n) = hits(1:n) call move_alloc(more, hits) end if n = n + 1 hits(n) = hit end subroutine add_pick_hit