拓展内存空间,
优化效率
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(nnps_pairs_type), | intent(inout) | :: | self | |||
integer, | intent(in) | :: | len |
粒子对容量 |
subroutine extend(self, len)
class(nnps_pairs_type), intent(inout) :: self
integer, intent(in) :: len !! 粒子对容量
self%len = len
if (self%cap < len) then
self%cap = len*2
deallocate (self%wdwdx, self%contact_type)
allocate (self%wdwdx(1 + dim, self%cap), self%contact_type(self%cap))
end if
end subroutine extend