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.
46 lines
1.3 KiB
46 lines
1.3 KiB
3 years ago
|
%--------------------------
|
||
|
% @Author: Jingqiao Hu
|
||
|
% @Date: 2021-09-03 14:24:03
|
||
|
% @LastEditTime: 2021-09-06 14:08:59
|
||
|
|
||
|
% return global_id of the dofs in micro-cell
|
||
|
%--------------------------
|
||
|
function [cell2global_id, global2cell_id] = global_micro_id(nelx, nely, microx)
|
||
|
|
||
|
globaly = nely * microx;
|
||
|
nele_global = nelx*nely*microx^2;
|
||
|
global_id = zeros(nele_global, 1);
|
||
|
|
||
|
idx = 0;
|
||
|
for i = 1:nelx
|
||
|
for j = 1:nely
|
||
|
|
||
|
% ele_ma = j + (i-1)*nely;
|
||
|
|
||
|
for ii = 1:microx
|
||
|
for jj = 1:microx
|
||
|
idx = idx+1;
|
||
|
|
||
|
global_i = (i-1) * microx + ii;
|
||
|
global_j = (j-1) * microx + jj;
|
||
|
global_ele = global_j + (global_i - 1) * globaly;
|
||
|
global_id(idx) = global_ele;
|
||
|
%
|
||
|
% ele_mi = (ii-1) * microx + jj;
|
||
|
% global_ele2 = (ele_ma-1)*microx^2 + ele_mi;
|
||
|
% cell_id(idx,1) = global_ele2;
|
||
|
% cell_id(idx,2) = global_ele2;
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
global2cell_id = global_id;
|
||
|
|
||
|
global_id(:,2) = 1 : nele_global;
|
||
|
id2 = sortrows(global_id, 1);
|
||
|
cell2global_id = id2(:,2);
|
||
|
|
||
|
% cell_id(:,2) = 1 : nele_global;
|
||
|
% id2 = sortrows(cell_id, 1);
|
||
|
|
||
|
end
|