A data structure for working with Lagrange Interpolating Polynomials in one, two, and three dimensions. The Lagrange data-structure stores the information necessary to interpolate between two sets of grid-points and to estimate the derivative of data at native grid points. Routines for multidimensional interpolation are based on the tensor product of 1-D interpolants. It is assumed that the polynomial degree (and the interpolation nodes) are the same in each direction. This assumption permits the storage of only one array of interpolation nodes and barycentric weights and is what allows this data structure to be flexible.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | M | The number of target points. |
|||
integer, | public | :: | N | The number of control points. |
|||
real(kind=prec), | public, | pointer, contiguous, dimension(:,:) | :: | bMatrix | The boundary interpolation matrix that is used to map a grid of nodal values at the control points to the element boundaries. |
||
real(kind=prec), | public, | pointer, contiguous, dimension(:) | :: | bWeights | The barycentric weights that are calculated from the controlPoints and used for interpolation. |
||
type(c_ptr), | public | :: | blas_handle | = | c_null_ptr | A handle for working with hipblas |
|
integer, | public | :: | controlNodeType | ||||
real(kind=prec), | public, | pointer, contiguous, dimension(:) | :: | controlPoints | The set of nodes in one dimension where data is known. To create higher dimension interpolation and differentiation operators, structured grids in two and three dimensions are created by tensor products of the controlPoints. This design decision implies that all spectral element methods supported by the Lagrange class have the same polynomial degree in each computational/spatial dimension. In practice, the controlPoints are the Legendre-Gauss, Legendre-Gauss-Lobatto, Legendre-Gauss-Radau, Chebyshev-Gauss, Chebyshev-Gauss-Lobatto, or Chebyshev-Gauss-Radau quadrature points over the domain [-1,1] (computational space). The Init routine for this class restricts controlPoints to one of these quadrature types or uniform points on [-1,1]. |
||
real(kind=prec), | public, | pointer, contiguous, dimension(:,:) | :: | dMatrix | The derivative matrix for mapping function nodal values to a nodal values of the derivative estimate. The dMatrix is based on a strong form of the derivative. |
||
real(kind=prec), | public, | pointer, contiguous, dimension(:,:) | :: | dgMatrix | The derivative matrix for mapping function nodal values to a nodal values of the derivative estimate. The dgMatrix is based on a weak form of the derivative. It must be used with bMatrix to account for boundary contributions in the weak form. |
||
real(kind=prec), | public, | pointer, contiguous, dimension(:,:) | :: | iMatrix | The interpolation matrix (transpose) for mapping data from the control grid to the target grid. |
||
real(kind=prec), | public, | pointer, contiguous, dimension(:) | :: | qWeights | The quadrature weights for discrete integration. The quadradture weights depend on the type of controlPoints provided; one of Legendre-Gauss, Legendre-Gauss-Lobatto, Legendre-Gauss-Radau, Chebyshev-Gauss, Chebyshev-Gauss-Lobatto, Chebyshev-Gauss Radau, or Uniform. If Uniform, the quadrature weights are constant . |
||
integer, | public | :: | targetNodeType | ||||
real(kind=prec), | public, | pointer, contiguous, dimension(:) | :: | targetPoints | The set of nodes in one dimension where data is to be interpolated to. To create higher dimension interpolation and differentiation operators, structured grids in two and three dimensions are created by tensor products of the targetPoints. In practice, the targetPoints are set to a uniformly distributed set of points between [-1,1] (computational space) to allow for interpolation from unevenly spaced quadrature points to a plotting grid. |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Lagrange_t), | intent(inout) | :: | this |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Lagrange_t), | intent(inout) | :: | this |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Lagrange_t), | intent(inout) | :: | this |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Lagrange_t) | :: | this | ||||
real(kind=prec) | :: | sE |
Frees all memory (host and device) associated with an instance of the Lagrange_t class
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Lagrange_t), | intent(inout) | :: | this | Lagrange_t class instance |
Initialize an instance of the Lagrange_t class On output, all of the attributes for the Lagrange_t class are allocated and values are initialized according to the number of control points, number of target points, and the types for the control and target nodes. If a GPU is available, device pointers for the Lagrange_t attributes are allocated and initialized.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Lagrange_t), | intent(out) | :: | this | Lagrange_t class instance |
||
integer, | intent(in) | :: | N | The number of control points for interpolant |
||
integer, | intent(in) | :: | controlNodeType | The integer code specifying the type of control points. Parameters are defined in SELF_Constants.f90. One of GAUSS(=1), GAUSS_LOBATTO(=2), or UNIFORM(=3) |
||
integer, | intent(in) | :: | M | The number of target points for the interpolant |
||
integer, | intent(in) | :: | targetNodeType | The integer code specifying the type of target points. Parameters are defined in SELF_Constants.f90. One of GAUSS(=1), GAUSS_LOBATTO(=2), or UNIFORM(=3) |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Lagrange_t), | intent(in) | :: | this | |||
integer(kind=HID_T), | intent(in) | :: | fileId |
type,public :: Lagrange_t
!! A data structure for working with Lagrange Interpolating Polynomials in one, two, and three dimensions.
!! The Lagrange data-structure stores the information necessary to interpolate between two
!! sets of grid-points and to estimate the derivative of data at native grid points. Routines for
!! multidimensional interpolation are based on the tensor product of 1-D interpolants. It is
!! assumed that the polynomial degree (and the interpolation nodes) are the same in each direction.
!! This assumption permits the storage of only one array of interpolation nodes and barycentric
!! weights and is what allows this data structure to be flexible.
integer :: N
!! The number of control points.
integer :: controlNodeType
integer :: M
!! The number of target points.
integer :: targetNodeType
type(c_ptr) :: blas_handle = c_null_ptr
!! A handle for working with hipblas
real(prec),pointer,contiguous,dimension(:) :: controlPoints
!! The set of nodes in one dimension where data is known.
!! To create higher dimension interpolation and differentiation operators, structured grids in two and three
!! dimensions are created by tensor products of the controlPoints. This design decision implies that all
!! spectral element methods supported by the Lagrange class have the same polynomial degree in each
!! computational/spatial dimension. In practice, the controlPoints are the Legendre-Gauss, Legendre-Gauss-Lobatto,
!! Legendre-Gauss-Radau, Chebyshev-Gauss, Chebyshev-Gauss-Lobatto, or Chebyshev-Gauss-Radau quadrature points over
!! the domain [-1,1] (computational space). The Init routine for this class restricts controlPoints to one of
!! these quadrature types or uniform points on [-1,1].
real(prec),pointer,contiguous,dimension(:) :: targetPoints
!! The set of nodes in one dimension where data is to be interpolated to. To create higher dimension interpolation
!! and differentiation operators, structured grids in two and three dimensions are created by tensor products of
!! the targetPoints. In practice, the targetPoints are set to a uniformly distributed set of points between [-1,1]
!! (computational space) to allow for interpolation from unevenly spaced quadrature points to a plotting grid.
real(prec),pointer,contiguous,dimension(:) :: bWeights
!! The barycentric weights that are calculated from the controlPoints and used for interpolation.
real(prec),pointer,contiguous,dimension(:) :: qWeights
!! The quadrature weights for discrete integration. The quadradture weights depend on the type of controlPoints
!! provided; one of Legendre-Gauss, Legendre-Gauss-Lobatto, Legendre-Gauss-Radau, Chebyshev-Gauss,
!! Chebyshev-Gauss-Lobatto, Chebyshev-Gauss Radau, or Uniform. If Uniform, the quadrature weights are constant
!! $$dx = \frac{2.0}{N+1}$$.
real(prec),pointer,contiguous,dimension(:,:) :: iMatrix
!! The interpolation matrix (transpose) for mapping data from the control grid to the target grid.
real(prec),pointer,contiguous,dimension(:,:) :: dMatrix
!! The derivative matrix for mapping function nodal values to a nodal values of the derivative estimate. The
!! dMatrix is based on a strong form of the derivative.
real(prec),pointer,contiguous,dimension(:,:) :: dgMatrix
!! The derivative matrix for mapping function nodal values to a nodal values of the derivative estimate. The dgMatrix is based
!! on a weak form of the derivative. It must be used with bMatrix to account for boundary contributions in the weak form.
real(prec),pointer,contiguous,dimension(:,:) :: bMatrix
!! The boundary interpolation matrix that is used to map a grid of nodal values at the control points to the element boundaries.
contains
procedure,public :: Init => Init_Lagrange_t
procedure,public :: Free => Free_Lagrange_t
procedure,public :: WriteHDF5 => WriteHDF5_Lagrange_t
procedure,public :: CalculateBarycentricWeights
procedure,public :: CalculateInterpolationMatrix
procedure,public :: CalculateDerivativeMatrix
procedure,public :: CalculateLagrangePolynomials
endtype Lagrange_t