%-------------------------- % @Author: Jingqiao Hu % @Date: 2021-04-06 15:45:53 % @LastEditTime: 2021-04-18 15:47:44 %-------------------------- function [def_full, edofMat_full, global_rho, def_cell, rho_cell] = scale_global_rho(def_full_recover, nelx, nely, microx, lx, ... optStruct, def_full_cell) globaly = nely * microx; globalx = nelx * microx; cx = reshape(def_full_recover(:,1), globaly+1, globalx+1); cx2 = interp2(cx); cy = reshape(def_full_recover(:,2), globaly+1, globalx+1); cy2 = interp2(cy); def_full = [cx2(:), cy2(:)]; [rho_cell, global_rho] = generateStruct(microx*2, microx*2, nelx, nely, lx, lx, optStruct); [~, ~, edofMat_full] = forAssemble(globalx*2, globaly*2); def_cell = cell(nely, nelx); if nargin > 6 % figure; for j = 1:nely for i = 1:nelx tmp = def_full_cell{j,i}; cx = reshape(tmp(:,1), 2*microx+1, 2*microx+1); cx2 = interp2(cx); cy = reshape(tmp(:,2), 2*microx+1, 2*microx+1); cy2 = interp2(cy); def_cell{j,i} = [cx2(:), cy2(:)]; % scatter(def_cell{j,i}(:,1), def_cell{j,i}(:,2)); hold on; end end end % figure; scatter(def_full(:,1),def_full(:,2)); % global_rho(global_rho > 0) = 0.6; % global_rho(global_rho < 0.5) = 0.4; end