Extend recs by GROW_FAC, keeping first nkeep records.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(convtype), | intent(inout), | allocatable | :: | recs(:) |
Record array. |
|
| integer(kind=int32), | intent(inout) | :: | ncap |
Capacity of |
||
| integer(kind=int32), | intent(in) | :: | nkeep |
Number of records to keep. |
subroutine grow_models(recs, ncap, nkeep) !! Extend `recs` by `GROW_FAC`, keeping first `nkeep` records. ! Arguments type(convtype), allocatable, intent(inout) :: recs(:) !! Record array. integer(int32), intent(inout) :: ncap !! Capacity of `recs`, updated to the new size. integer(int32), intent(in) :: nkeep !! Number of records to keep. type(convtype), allocatable :: newrecs(:) ncap = int(ncap*GROW_FAC) allocate (newrecs(ncap)) newrecs(1:nkeep) = recs(1:nkeep) call move_alloc(newrecs, recs) end subroutine grow_models