function [IntGrad] = integrofgrad(vtx,simp,mat_ref); function that calculates the integral of the gradients for first order tetrahedral elements. Required for the calculation of the Jacobian. vtx = The vertices matrix simp = The simplices matrix mat_ref = The reference conductivity vector IntGrad = The intgral of the gradients
0001 function [IntGrad] = integrofgrad(vtx,simp,mat_ref); 0002 %function [IntGrad] = integrofgrad(vtx,simp,mat_ref); 0003 % 0004 %function that calculates the integral of the gradients for first order 0005 %tetrahedral elements. Required for the calculation of the Jacobian. 0006 % 0007 % 0008 % 0009 %vtx = The vertices matrix 0010 %simp = The simplices matrix 0011 %mat_ref = The reference conductivity vector 0012 %IntGrad = The intgral of the gradients 0013 0014 0015 0016 warning('EIDORS:deprecated','INTEGROFGRAD is deprecated as of 06-Jun-2012. '); 0017 0018 [vr,vc] = size(vtx); 0019 [sr,sc] = size(simp); 0020 0021 if sr ~= length(mat_ref) 0022 error('Mismatched data entered') 0023 end 0024 0025 if sc ~= 4 0026 error('Only first order tetrahedral elements supported'); 0027 end 0028 0029 0030 %w = [1/24*ones(4,1)]; 0031 0032 IntGrad = sparse(vr^2,sr); 0033 0034 for i=1:size(simp,1) 0035 0036 vv = []; 0037 0038 for j=1:size(simp,2) 0039 vv = [vv;vtx(simp(i,j),:)]; 0040 end 0041 0042 interp_fun = [-1 1 0 0; -1 0 1 0; -1 0 0 1]; 0043 0044 Jts = interp_fun*vv; 0045 inv_Jts = inv(Jts); 0046 det_Jts = abs(det(Jts)); 0047 0048 Gs = inv_Jts*interp_fun; 0049 0050 %int = 0; 0051 %for q=1:4 0052 % int = int + w(q)*Gs'*Gs; 0053 %end 0054 %Inte = int*det_Jts; % or simplified 0055 % Citation: The FEM displayed G.Dhatt & G. Touzot 0056 0057 Inte = (1/6)*Gs'*Gs*det_Jts; 0058 0059 Local = sparse(vr,vr); 0060 Local(simp(i,:),simp(i,:))= Inte; 0061 IntGrad(:,i) = Local(:); 0062 end 0063 0064 0065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0066 % This is part of the EIDORS suite. 0067 % Copyright (c) N. Polydorides 2003 0068 % Copying permitted under terms of GNU GPL 0069 % See enclosed file gpl.html for details. 0070 % EIDORS 3D version 2.0 0071 % MATLAB version 5.3 R11 0072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%