merge_rows Subroutine

subroutine merge_rows(rows, new)

Add the new rows: a segment already in the list gets the union of the sample ranges.

Arguments

Type IntentOptional Attributes Name
type(eclipse_row), intent(inout), dimension(:), allocatable :: rows
type(eclipse_row), intent(in), dimension(:) :: new

Called by

proc~~merge_rows~~CalledByGraph proc~merge_rows merge_rows proc~eclipse_optimize eclipse_optimize proc~eclipse_optimize->proc~merge_rows interface~eclipse_optimize my_solver_type%eclipse_optimize interface~eclipse_optimize->proc~eclipse_optimize proc~halo_solver_main halo_solver_main proc~halo_solver_main->interface~eclipse_optimize

Source Code

    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