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.
52 lines
1.4 KiB
52 lines
1.4 KiB
%--------------------------
|
|
% @Author: Jingqiao Hu
|
|
% @Date: 2020-11-21 19:52:48
|
|
% @LastEditTime: 2021-02-22 14:22:01
|
|
%--------------------------
|
|
function [global_u, global_l] = global_u_l(u0, l0, u1, l1, rho, global_rho, opt_scale)
|
|
if opt_scale == 1
|
|
[global_u, global_l] = global_u_l_1scale(u0, l0, u1, l1, global_rho);
|
|
else
|
|
[global_u, global_l] = global_u_l_2scale(u0, l0, u1, l1, rho);
|
|
end
|
|
end
|
|
|
|
function [global_u, global_l] = global_u_l_2scale(u0, l0, u1, l1, material)
|
|
|
|
global_u = cell(size(material));
|
|
global_l = cell(size(material));
|
|
microx = size(material{1}, 1);
|
|
|
|
parfor ele = 1:size(material(:),1)
|
|
|
|
u = zeros(microx^3, 1);
|
|
l = zeros(microx^3, 1);
|
|
|
|
for i = 1:microx^3
|
|
if material{ele}(i)==1
|
|
u(i) = u1;
|
|
l(i) = l1;
|
|
else
|
|
u(i) = u0;
|
|
l(i) = l0;
|
|
end
|
|
end
|
|
|
|
global_u{ele} = u;
|
|
global_l{ele} = l;
|
|
end
|
|
end
|
|
|
|
function [global_u, global_l] = global_u_l_1scale(u0, l0, u1, l1, material)
|
|
global_u = zeros(size(material));
|
|
global_l = zeros(size(material));
|
|
for i = 1:size(material(:),1)
|
|
if material(i)==1
|
|
global_u(i) = u1;
|
|
global_l(i) = l1;
|
|
else
|
|
global_u(i) = u0;
|
|
global_l(i) = l0;
|
|
end
|
|
end
|
|
end
|