-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_lagrange_multiplier_stancil_edge.m
32 lines (24 loc) · 1.25 KB
/
get_lagrange_multiplier_stancil_edge.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function LM_stancil = get_lagrange_multiplier_stancil_edge(TR,edge,index)
%GET_LAGRANGE_MULTIPLIER_STANCIL Summary of this function goes here
% return the stancil for the lagrange multiplier at point X
LM_stancil=zeros(1,length(TR.points));
d=TR.points(TR.edge(edge.edge_index(index),2),:)-TR.points(TR.edge(edge.edge_index(index),1),:);
del=norm(d);
if d(1)>0
del_p=norm(edge.position(index,:)-TR.points(TR.edge(edge.edge_index(index),1),:));
LM_stancil(TR.edge(edge.edge_index(index),2))=1/del*del_p;
LM_stancil(TR.edge(edge.edge_index(index),1))=1-1/del*del_p;
elseif d(1)<0
del_p=norm(edge.position(index,:)-TR.points(TR.edge(edge.edge_index(index),2),:));
LM_stancil(TR.edge(edge.edge_index(index),1))=1/del*del_p;
LM_stancil(TR.edge(edge.edge_index(index),2))=1-1/del*del_p;
elseif d(2)>0
del_p=norm(edge.position(index,:)-TR.points(TR.edge(edge.edge_index(index),1),:));
LM_stancil(TR.edge(edge.edge_index(index),2))=1/del*del_p;
LM_stancil(TR.edge(edge.edge_index(index),1))=1-1/del*del_p;
elseif d(2)<0
del_p=norm(edge.position(index,:)-TR.points(TR.edge(edge.edge_index(index),2),:));
LM_stancil(TR.edge(edge.edge_index(index),1))=1/del*del_p;
LM_stancil(TR.edge(edge.edge_index(index),2))=1-1/del*del_p;
end
end