LagrangeCoeff
Returns the coefficients for lagrange polynomial.
This function returns the coefficient of basis functions.
This routine returns .
Interface 1
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE FUNCTION LagrangeCoeff_Triangle(order, i, xij) RESULT(ans)
INTEGER(I4B), INTENT(IN) :: order
!! order of polynomial
INTEGER(I4B), INTENT(IN) :: i
!! ith coefficients for lagrange polynomial
REAL(DFP), INTENT(IN) :: xij(:, :)
!! points in xij format, size(xij,2)
REAL(DFP) :: ans(SIZE(xij, 2))
!! coefficients
END FUNCTION LagrangeCoeff_Triangle
END INTERFACE
order
Order of Lagrange polynomial.
program main
use easifembase
implicit none
integer( i4b ) :: i1, i2, order, ipType
real( dfp ), allocatable :: x(:,:), xij(:, :), coeff(:)
integer(i4b), allocatable:: degree(:, :)
CHARACTER( 20 ) :: layout
order=1
xij = RefTriangleCoord("UNIT")
ipType=Equidistance
layout="VEFC"
x =InterpolationPoint_Triangle( order=order, &
& ipType=ipType, layout=layout, xij=xij)
degree = LagrangeDegree_Triangle(order=order)
coeff = LagrangeCoeff_Triangle(order=order, xij=x, i = 1)
CALL Display(mdencode(degree), "degree: ")
CALL Display(mdencode(coeff), "coeff(1): ")
coeff = LagrangeCoeff_Triangle(order=order, xij=x, i = 2)
CALL Display(mdencode(coeff), "coeff(2): ")
coeff = LagrangeCoeff_Triangle(order=order, xij=x, i = 3)
CALL Display(mdencode(coeff), "coeff(3): ")
end program main
degree:
x | y |
---|---|
0 | 0 |
1 | 0 |
0 | 1 |
coeff(1):
1 | -1 | -1 |
coeff(2):
0 | 1 | 0 |
coeff(3):
0 | 0 | 1 |
This means:
Interface 2
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE FUNCTION LagrangeCoeff_Triangle(order, i, v, isVandermonde) &
& RESULT(ans)
INTEGER(I4B), INTENT(IN) :: order
!! order of polynomial, it should be SIZE(v,2)-1
INTEGER(I4B), INTENT(IN) :: i
!! coefficient for ith lagrange polynomial
REAL(DFP), INTENT(IN) :: v(:, :)
!! vandermonde matrix size should be (order+1,order+1)
LOGICAL(LGT), INTENT(IN) :: isVandermonde
!! This is just to resolve interface issue
REAL(DFP) :: ans(SIZE(v, 1))
!! coefficients
END FUNCTION LagrangeCoeff_Triangle
END INTERFACE
program main
use easifembase
implicit none
integer( i4b ) :: i1, i2, order, ipType
real( dfp ), allocatable :: x(:,:), xij(:, :), coeff(:), V(:, :)
integer(i4b), allocatable:: degree(:, :)
CHARACTER( 20 ) :: layout
order=1
xij = RefTriangleCoord("UNIT")
ipType=Equidistance
layout="VEFC"
x =InterpolationPoint_Triangle( order=order, &
& ipType=ipType, layout=layout, xij=xij)
degree = LagrangeDegree_Triangle(order=order)
V = LagrangeVandermonde(order=order, xij=x, elemType=Triangle)
coeff = LagrangeCoeff_Triangle(order=order, i = 1, V=V, isVanderMonde=.true.)
CALL Display(mdencode(degree), "degree: ")
CALL Display(mdencode(coeff), "coeff(1): ")
coeff = LagrangeCoeff_Triangle(order=order, i = 2, V=V, isVanderMonde=.true.)
CALL Display(mdencode(coeff), "coeff(2): ")
coeff = LagrangeCoeff_Triangle(order=order, i = 3, V=V, isVanderMonde=.true.)
CALL Display(mdencode(coeff), "coeff(3): ")
end program main
degree:
x | y |
---|---|
0 | 0 |
1 | 0 |
0 | 1 |
coeff(1):
1 | -1 | -1 |
coeff(2):
0 | 1 | 0 |
coeff(3):
0 | 0 | 1 |
This means:
Interface 3
- ܀ Interface