1 function PP = edge_quad_points(grid,elids,edgeids,degree)
2 %
function PP = edge_quad_points(grid,elids,edgeids, degree)
3 %
get the evaluation points
for a quadrature over edges of the
6 % Given a list of edges `\{e(i_k, j_k)\}_{i=1}^K`, where `i_k` are cell indices
7 % and `j_k` denotes local edge numbers,
this function computes quadrature
9 % ``\left( x_k^1, \ldots, x_k^Q \right)``
10 %
for each `k=1,\ldots, K`.
13 % elids: vector of length `K` of cell indices `i_k`.
14 % edgeids: vector of length `K` of local edge indices `j_k`.
15 % degree: scalar defining the degree of the quadrature rule.
18 % PP: matrix of size `K \times Q` holding the quadrature
for each edge.
19 % This can be used as last argument
for either edge_quad_eval() or
20 % edge_quad_eval_mean().
23 % Bernard Haasdonk 12.5.2007
27 % simple midpoint integration
29 li = sub2ind(size(grid.ECX),elids(:),edgeids(:));
30 PP = [grid.ECX(li), grid.ECY(li)];
32 % gauss quadrature of order 2
33 % x0 = 0.5-0.5* sqrt(1/3) w0 = 0.5
34 % x1 = 0.5+0.5* sqrt(1/3) w1 = 0.5
35 x0 = 0.5 - 0.5*sqrt(1/3);
36 x1 = 0.5 + 0.5*sqrt(1/3);
37 [P1,P2] = get_edge_points(grid,elids,edgeids);
38 PP = [P1*x0 + P2*(1-x0); P1*x1 + P2*(1-x1)];
40 % gauss quadrature of order 3
41 % x0 = 0.5-0.5* sqrt(3/5) w0 = 5/18
43 % x0 = 0.5+0.5* sqrt(3/5) w0 = 5/18
48 [P1,P2] = get_edge_points(grid,elids,edgeids);
49 PP = [P1*x0 + P2*(1-x0); P1*x1 + P2*(1-x1); P1*x2 + P2*(1-x2) ];
51 error('quadrature degree not implemented!');