register_seg_list Subroutine

private pure subroutine register_seg_list(new, list, k)

Registers a new segment into a list if it is valid.

This subroutine adds a new segment to a given list if the segment is valid. After registering, it sets the new segment to a predefined upper limit segment.

Arguments

Type IntentOptional Attributes Name
type(segment_t), intent(inout) :: new
type(segment_t), intent(inout) :: list(:)
integer(kind=int32), intent(inout) :: k

Note

This implementation is badly behaved and should be fixed as soon as possible.


Source Code

   pure subroutine register_seg_list(new, list, k)
      use, intrinsic :: iso_fortran_env, only: int32
      implicit none
      type(segment_t), intent(inout) :: new, list(:)
      integer(int32),  intent(inout) :: k

      ! If the `new` segment is valid, add it to the list and incremetn the count.
      !! @note This implementation is badly behaved and should be fixed as soon as possible.
      if (new%validate()) then
         list(k) = new
         k = k + 1
      end if
      new = SEG_UPPER
   end subroutine register_seg_list