LT2_set_col Subroutine

public pure subroutine LT2_set_col(my_lt, col_ix, x1, x2, y)

Fill the column with index col_ix using linearly interpolated data

Arguments

Type IntentOptional Attributes Name
type(LT2_t), intent(inout) :: my_lt
integer, intent(in) :: col_ix
real(kind=dp), intent(in) :: x1(:)
real(kind=dp), intent(in) :: x2(:)
real(kind=dp), intent(in) :: y(:,:)

Calls

proc~~lt2_set_col~~CallsGraph proc~lt2_set_col LT2_set_col proc~lt_get_spaced_data LT_get_spaced_data proc~lt2_set_col->proc~lt_get_spaced_data proc~lt_get_xdata LT_get_xdata proc~lt2_set_col->proc~lt_get_xdata proc~lt_lin_interp_list LT_lin_interp_list proc~lt_get_spaced_data->proc~lt_lin_interp_list proc~find_index_adaptive find_index_adaptive proc~lt_lin_interp_list->proc~find_index_adaptive proc~find_index_bsearch find_index_bsearch proc~find_index_adaptive->proc~find_index_bsearch proc~find_index_linear find_index_linear proc~find_index_adaptive->proc~find_index_linear

Source Code

  pure subroutine LT2_set_col(my_lt, col_ix, x1, x2, y)
    type(LT2_t), intent(inout) :: my_lt
    integer, intent(in)        :: col_ix
    real(dp), intent(in)       :: x1(:), x2(:), y(:, :)
    real(dp), allocatable      :: tmp(:, :), c1(:), c2(:)
    integer                    :: ix

    allocate(c1(my_lt%n_points(1)),c2(my_lt%n_points(2)))
    c1 = LT_get_xdata(my_lt%x_min(1), my_lt%dx(1), my_lt%n_points(1))
    c2 = LT_get_xdata(my_lt%x_min(2), my_lt%dx(2), my_lt%n_points(2))
    allocate(tmp(my_lt%n_points(1), size(x2)))

    ! Interpolate along first coordinate
    do ix = 1, size(x2)
       tmp(:, ix) = LT_get_spaced_data(x1, y(:, ix), c1)
    end do

    ! Interpolate along second coordinate
    do ix = 1, my_lt%n_points(1)
       my_lt%rows_cols(ix, :, col_ix) = LT_get_spaced_data(x2, tmp(ix, :), c2)
    end do
    deallocate(c1,c2)
  end subroutine LT2_set_col