Sorting routine: stacks active lagrangian objects (i.e., who's id is >=1) at the beginning of the array then resizes. Objects with id <= 0 (such as ghost objects) are removed by this subroutine.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(lagrangian_set), | intent(inout) | :: | this |
A set of Lagrangian objects |
pure subroutine lagrangian_set_Recycle(this) !> Sorting routine: stacks active lagrangian ! objects (i.e., who's id is >=1) at the beginning of ! the array then resizes. Objects with id <= 0 (such as ! ghost objects) are removed by this subroutine. implicit none class(lagrangian_set), intent(inout) :: this !! A set of Lagrangian objects ! Work variables integer :: count_active !! Number of active objects integer :: i !! iterator count_active = 0 if (allocated(this%p)) then do i=1,size(this%p) if (this%p(i)%id.gt.0) then count_active = count_active + 1 if (i.ne.count_active) then ! Move back the object this%p(count_active)=this%p(i) ! Set current position inactive this%p(i)%id = -1 end if end if end do end if ! Resize array to count_active call this%Resize(count_active) return end subroutine lagrangian_set_Recycle