LT2_create Function

public function LT2_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(2)

Minimum coordinate

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

Maximum coordinate

integer, intent(in) :: n_points(2)

How many values to store

integer, intent(in) :: n_cols

Number of variables that will be looked up

Return Value type(LT2_t)


Source Code

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

    if (any(x_max <= x_min)) stop "LT2_create error: x_max <= x_min"
    if (any(n_points <= 1)) stop "LT2_create error: n_points <= 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%rows_cols(n_points(1), n_points(2), n_cols))
    my_lt%rows_cols = 0
    my_lt%n_cols    = n_cols
  end function LT2_create