Add the new rows: a segment already in the list gets the union of the sample ranges.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(eclipse_row), | intent(inout), | dimension(:), allocatable | :: | rows | ||
| type(eclipse_row), | intent(in), | dimension(:) | :: | new |
subroutine merge_rows(rows, new) type(eclipse_row),dimension(:),allocatable,intent(inout) :: rows type(eclipse_row),dimension(:),intent(in) :: new integer :: k, j logical :: found do k = 1, size(new) found = .false. do j = 1, size(rows) if (rows(j)%iseg == new(k)%iseg) then rows(j)%k_lo = min(rows(j)%k_lo, new(k)%k_lo) rows(j)%k_hi = max(rows(j)%k_hi, new(k)%k_hi) found = .true. exit end if end do if (.not. found) rows = [rows, new(k)] end do end subroutine merge_rows