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.
29 lines
1.1 KiB
29 lines
1.1 KiB
3 years ago
|
% every micro ele in contourf
|
||
|
function [elesOffsetx,elesOffsety, nodesOffsetx, nodesOffsety] = offsetSIMP...
|
||
|
(eles, nodes, microx, microy, nelx, nely)
|
||
|
|
||
|
elesOffsetx = zeros(nely, nelx, microx);
|
||
|
elesOffsety = zeros(nely, nelx, microy);
|
||
|
nodesOffsetx = zeros(nely, nelx, microx+1);
|
||
|
nodesOffsety = zeros(nely, nelx, microy+1);
|
||
|
|
||
|
for i = 1:nelx
|
||
|
for j = 1:nely
|
||
|
ele = j + (i-1)*nely;
|
||
|
pos = nodes(eles(ele,:),1:2);
|
||
|
elex = min(pos(:,1)); % begin with 0
|
||
|
eley = max(pos(:,2));
|
||
|
|
||
|
elesOffsetx(j,i,:) = elex*microx+1:(elex+1)*(microx);
|
||
|
|
||
|
% matrix idx in matlab: y-coordinate:
|
||
|
% 1 10
|
||
|
% | |
|
||
|
% y 9
|
||
|
elesOffsety(j,i,:) = (nely-eley)*microy+1:(nely-eley+1)*(microy);
|
||
|
|
||
|
nodesOffsetx(j,i,:) = elex*microx+1:(elex+1)*(microx)+1;
|
||
|
nodesOffsety(j,i,:) = (nely-eley)*microy+1:(nely-eley+1)*(microy)+1;
|
||
|
end
|
||
|
end
|
||
|
end
|