Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Lagrange_t) | :: | this | ||||
real(kind=prec) | :: | sE |
function CalculateLagrangePolynomials(this,sE) result(lAtS)
implicit none
class(Lagrange_t) :: this
real(prec) :: sE
real(prec) :: lAtS(0:this%N)
! Local
integer :: j
logical :: xMatchesNode
real(real64) :: temp1,temp2
real(real64) :: sELocal
real(real64) :: controlPoints(0:this%N)
real(real64) :: bWeights(0:this%N)
real(real64) :: lS(0:this%N)
sELocal = real(sE,real64)
do j = 0,this%N
controlPoints(j) = real(this%controlPoints(j+1),real64)
bWeights(j) = real(this%bWeights(j+1),real64)
enddo
xMatchesNode = .false.
do j = 0,this%N
lS(j) = 0.0_real64
if(AlmostEqual(sELocal,controlPoints(j))) then
lS(j) = 1.0_real64
xMatchesNode = .true.
endif
enddo
if(xMatchesNode) then
do j = 0,this%N
lAtS(j) = real(lS(j),prec)
enddo
return
endif
temp1 = 0.0_real64
do j = 0,this%N
temp2 = bWeights(j)/(sE-controlPoints(j))
lS(j) = temp2
temp1 = temp1+temp2
enddo
lS = lS/temp1
do j = 0,this%N
lAtS(j) = real(lS(j),prec)
enddo
endfunction CalculateLagrangePolynomials