a 2D version
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

14 lines
571 B

%--------------------------
% @Author: Jingqiao Hu
% @Date: 2020-10-29 15:04:15
% @LastEditTime: 2020-12-02 14:56:29
%--------------------------
function [iK, jK, edofMat, EleNodesID] = forAssemble(nelx, nely)
m = nelx * nely;
nodenrs = reshape(1:(1+nelx)*(1+nely),1+nely,1+nelx);
edofVec = reshape(2*nodenrs(1:end-1,1:end-1)+1,m,1);
edofMat = repmat(edofVec,1,8)+repmat([0 1 2*nely+[2 3 0 1] -2 -1],m,1);
iK = reshape(kron(edofMat,ones(8,1)).',64*m,1);
jK = reshape(kron(edofMat,ones(1,8)).',64*m,1);
EleNodesID = edofMat(:,2:2:8)./2;
end