0001 function TVop=TV_operator_2D(msh);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 num_tri=length(msh.TC);
0012 num_nod=length(msh.PC);
0013
0014 list=[];
0015
0016
0017
0018 SEL=[ 1 2 3; 2 3 1];
0019
0020 INC=spalloc(num_nod,num_nod,num_tri*3);
0021
0022 for k=1:num_tri
0023
0024 for j=1:3
0025
0026 m=msh.TC(SEL(1,j),k);
0027 n=msh.TC(SEL(2,j),k);
0028
0029 if m<n
0030
0031 if (INC(m,n)==0) INC(m,n)=k;
0032 else
0033 len=sqrt((msh.PC(1,m)-msh.PC(1,n))^2+(msh.PC(2,m)-msh.PC(2,n))^2);
0034 list(size(list,1)+1,:)=[len,k,INC(m,n)];
0035 end
0036
0037 else
0038
0039 if (INC(n,m)==0) INC(n,m)=k;
0040 else
0041 len=sqrt((msh.PC(1,m)-msh.PC(1,n))^2+(msh.PC(2,m)-msh.PC(2,n))^2);
0042 list(size(list,1)+1,:)=[len,k,INC(n,m)];
0043 end
0044
0045
0046 end
0047
0048 end
0049
0050 end
0051
0052 TVop=spalloc(num_tri,num_tri,2*length(list));
0053
0054 for i=1:length(list)
0055
0056 TVop(i,list(i,2))=list(i,1);
0057
0058 TVop(i,list(i,3))=-list(i,1);
0059
0060 end
0061
0062 TVl=list(:,1);
0063
0064
0065