BarycentricVertexBasis
Returns the vertex basis functions on reference Triangle.
Interface
INTERFACE
MODULE PURE FUNCTION BarycentricVertexBasis_Triangle(lambda) &
& RESULT(ans)
REAL(DFP), INTENT(IN) :: lambda(:, :)
!! point of evaluation in terms of barycentrix coords
REAL(DFP) :: ans(SIZE(lambda, 2), 3)
!! ans(:,v1) basis function of vertex v1 at all points
END FUNCTION BarycentricVertexBasis_Triangle
END INTERFACE
lambda
Barycentric coordinates. The vertex basis function will be evaluated here. The number of rows in lambda is 3 and the number of columns is the number of points. The three rows of lambda dentoe the .
ans
The number of rows in ans
is equal to the number of points of evaluation. The number of columns is 3. The three columns of ans
denote the basis functions of vertex at all points.
Example
program main
use easifembase
use easifemClasses
implicit none
real(dfp), allocatable :: xij(:,:), avec(:), lambda(:, :)
integer(i4b) :: ii, jj, cnt, n
n = 51
call reallocate(avec, n)
call reallocate(xij, 2, int((n+1)*(n+2)/2))
avec= linspace(0.0_DFP, 1.0_DFP, n)
cnt=0
do ii = 1, n
do jj = 1, n-ii+1
cnt=cnt+1
xij(1,cnt) = avec(ii)
xij(2,cnt) = avec(jj)
end do
end do
lambda = BarycentricCoordTriangle(xij, "UNIT")
BLOCK
real(dfp), allocatable :: ans(:,:)
integer(i4b) :: ii, order, pe1, pe2, pe3
type( VTKPlot_ ) :: aplot
character(len=*), parameter :: fname="./results/"
!!
order=4
pe1=order; pe2 = order; pe3 = order
!!
ans = BarycentricVertexBasis_Triangle(&
& lambda=lambda )
!!
do ii = 1, size(ans,2)
call aplot%scatter3D(x=xij(1,:), y=xij(2, :), z=ans(:,ii), &
& filename=fname//"PVertexBary-" // tostring(ii) // &
& tostring(ii) //".vtp", &
& label="P")
end do
!!
END BLOCK
end program main