LT_create Function

public function LT_create(x_min, x_max, n_points, n_cols) result(my_lt)

This function returns a new lookup table

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: x_min

Minimum x-coordinate

real(kind=dp), intent(in) :: x_max

Maximum x-coordinate

integer, intent(in) :: n_points

How many x-values to store

integer, intent(in) :: n_cols

Number of variables that will be looked up

Return Value type(LT_t)


Source Code

  function LT_create(x_min, x_max, n_points, n_cols) result(my_lt)
    real(dp), intent(in) :: x_min
    !< Minimum x-coordinate
    real(dp), intent(in) :: x_max
    !< Maximum x-coordinate
    integer, intent(in)  :: n_points
    !< How many x-values to store
    integer, intent(in)  :: n_cols
    !< Number of variables that will be looked up
    type(LT_t)           :: my_lt

    if (x_max <= x_min) stop "set_xdata: x_max should be > x_min"
    if (n_points <= 1)    stop "set_xdata: n_points should be bigger than 1"

    my_lt%n_points = n_points
    my_lt%x_min    = x_min
    my_lt%dx       = (x_max - x_min) / (n_points - 1)
    my_lt%inv_dx   = 1 / my_lt%dx

    allocate(my_lt%cols_rows(n_cols, n_points))
    allocate(my_lt%rows_cols(n_points, n_cols))
    my_lt%cols_rows = 0
    my_lt%rows_cols = 0
    my_lt%n_cols    = n_cols
  end function LT_create