| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | allocatable | :: | this(:) | |||
| integer | :: | remove |
subroutine resize(this, remove) ! Takes a chunk of size remove off the beginning of array ! General routine, does not require global data real(dp), allocatable :: this(:) real(dp), allocatable :: new(:) integer :: remove integer :: length integer :: i character(len=*), parameter :: t_r = "resize" if (.not. allocated(this)) call stop_all(t_r, "Error, array not allocated on entry into resize") length = size(this, 1) allocate(new(length - remove)) new = 0.0_dp do i = 1, length if (i > remove) then new(i - remove) = this(i) end if end do if (abs(new(length - remove)) < 1.0e-10_dp) call stop_all(t_r, "Resize failed") deallocate(this) allocate(this(length - remove)) this = new deallocate(new) end subroutine resize