% ************************************************************** % lbem2_on : Sets up diagonal of matrices for BEMLAP % ************************************************************** % BEM-LAP-MAT project % Matlab/Freemat codes % Copyright 2008- Stephen Kirkup % John Tyndall Nuclear Research Institute % School of Computing Engineering and Physical Sciences % University of Central Lancashire - www.uclan.ac.uk % Westlakes Campus % Samuel Lindow Building % West Lakes Science and Technology Park % Whitehaven % Cumbria CA24 3JY % United Kingdom % smkirkup@uclan.ac.uk % % This open source code can be found at % boundary-element-method.com/freematlab/lbem2_on.m % % Issued under the GNU General Public License 2007, see gpl.txt % % Part of the the author's open source BEM packages. % All codes and manuals can be downloaded from % www.boundary-element-method.com % % ************************************************************** % function [L,M,Mt,N] =lbem2(n,vertpts,elemvert,p_on,needL,needM,needMt,needN) % Sets up the matrices required in the boundary element method % for a boundary made up of n elements. vertpts lists the coordinates % of the edges of the elements and elemvert lists the pairs of vertices % that define each element.needL,needM,needMt,needN indicate which matrices % are needed by being set to true. function [L,M,Mt,N] =lbem2_on(n,vertpts,elemvert,needL,needM,needMt,needN) [qa,qb]=vertices(n,vertpts,elemvert); p=(qa+qb)/2; qbma=qb-qa; for(i=1:n) qlen(i)=norm(qbma(i,:)); end for (i=1:n) normp(i,1)=-qbma(i,2)/qlen(i); normp(i,2)=qbma(i,1)/qlen(i); end [L,M,Mt,N] =lbem2(n,p,normp,n,vertpts,elemvert,true,needL,needM,needMt,needN);