Class xlifepp::LagrangeStdSegment#

class LagrangeStdSegment : public xlifepp::LagrangeSegment#

child class of LagrangeHexahedron with standard interpolation

Public Functions

LagrangeStdSegment(const Interpolation *interp_p)#

constructor by interpolation

Lagrange segment Reference Element for Pk interpolation at equidistant nodes.

inline ~LagrangeStdSegment()#

destructor

virtual void computeShapeFunctions()#

compute polynomials representation

compute shape functions as polynomials using general algorithm

virtual void computeShapeValues(std::vector<real_t>::const_iterator it_pt, ShapeValues &shv, const bool withDeriv = true, const bool with2Deriv = false) const#

compute shape functions at given point

shapeFunctions defines Lagrange Reference Element shape functions

Shape functions (Lagrange polynomials at \(n_0=1, n_1=0, n_2=1-1/n, n_3=1-2/n, \ldots n_n=1/n\)) with \(w_i(n_j)=\delta_{ij} \; (0 <= i,j <= n)\), are given by

\(\begin{array}{rl} w_0 & \displaystyle = \frac{n^{n-1}}{(n-1)!} x \prod_{j=1,n-1} (x-j/n) \\ & \displaystyle = \frac{x}{(n-1)!} \prod_{j=1,n-1} (nx-j) \\ w_1 & \displaystyle = (-1)^n n^{n-1}C_n^n (x-1)\frac{x-1/n}{1}\ldots\frac{x-(n-1)/n}{n-1} \\ & \displaystyle = (-1)^n \frac{n^{n-1}}{(n-1)!} (x-1) \prod_{j=1,n-1} (x-j/n) \\ & \displaystyle = (-1)^n \frac{x-1}{(n-1)!} \prod_{j=1,n-1} (nx-j) \\ w_2 & \displaystyle = (-1) n^{n-1} C_n^1 x(x-1)\frac{(x-1/n)}{1}\ldots\frac{(x-(j-1)/n)}{(j-1)}\frac{(x-j)/n)}{j}*\frac{(x-(j+1)/n)}{(j+1)}\ldots\frac{(x-(n-2)/n)}{(n-2)} \\ & \displaystyle = (-1) \frac{n^{n-1}}{(n-1)!} \frac{n!}{((n-2)2!)} \prod_{j=0,n \& j!= n-1} (x-j/n) \\ & \displaystyle = (-1) \frac{nx(x-1)}{((n-2)2!)} \prod_{j=1,n-2} (nx-j) \\ \forall i=3,n \; w_i & \displaystyle = (-1)^{i-1} n^{n-1} C_n^{i-1} x(x-1)\frac{(x-1/n)}{1}\ldots\frac{(x-(k-1)/n)}{(k-1)}\frac{(x-(k+1)/n)}{(k+1)}\ldots\frac{(x-(n-1)/n)}{(n-1)} \\ & \displaystyle = (-1)^{i-1} \frac{n^{n-1}}{(n-1)!} \frac{n!}{((n-i)i!)} \prod_{j=1,n-1 \& j!=k} (x-j/n) \\ & \displaystyle = (-1)^{i-1} \frac{n*x(x-1)}{((n-i)i!)} \prod_{j=1,n-1 \& j!=k} (n*x-j) \end{array}\)

where \(k=n+1-i\) and \(\displaystyle C_n^j=\frac{n!}{(n-j)! j!}\) are Pascal’s triangle binomial coefficients.

Examples:

  • n=1

    • \( w_0 = 1*1^0 x = x\)

    • \( w_1 = -1*1^(x-1) = 1-x\)

  • n=2

    • \( w_0 = 1*2^1/1 \;x (x-1/2) = x *(2x-1)\)

    • \( w_1 = 1*2^1/1 \;(x-1)(x-1/2) = (x-1)*(2x-1)\)

    • \( w_2 = -2*2^1/1 \;x(x-1) = -4x(x-1)\)

  • n=3

    • \( w_0 = 1*3^2/2 \; x(x-1/3)(x-2/3) = 1/2 \; x(3x-1)(3x-2)\)

    • \( w_1 = -1*3^2/2 \; (x-1)(x-1/3)(x-2/3) = -1/2 \; (x-1)(3x-1)(3x-2)\)

    • \( w_2 = -3*3^2/2 \; x(x-1)(x-1/3) = -9/2 \; x(x-1)(3x-1)\)

    • \( w_3 = 3*3^2/2 \; x(x-1)(x-2/3)= 9/2 \; x(x-1)(3x-2)\)

    Note: shv has to be sized before

inline virtual const splitvec_t &getO1splitting() const#

returns reference to splitting scheme computed by splitO1

virtual void pointCoordinates()#

point coordinates (!) (equidistant on [0,1])

pointCoordinates defines Lagrange Reference Element point coordinates

Local numbering of Lagrange Pk 1D elements

--1-- 2---1  2---3---1  2---4---3---1  2---5---4---3---1  2---6---5---4---3---1
 k=0   k=1      k=2          k=3              k=4                  k=5