Debian Codegraph @

packages/rol/example/PDE-OPT/topo-opt/elasticity/plotdensity.m

raw
1 function plotdensity
2
3 adj = load('cell_to_node_quad.txt') + 1; %% load node adjacency table, increment by 1 for 1-based indexing
4
5 nodes = load('nodes.txt'); %% load node coordinates
6
7 data_obj = importdata('density.txt', ' ', 2); %% we need to skip the first two lines
8 dens = data_obj.data(1:2:end,:);
9
10 figure
11 xnodes = nodes(:,1);
12 ynodes = nodes(:,2);
13 celldens = dens(adj);
14 avgcelldens = sum(celldens,2)/4;
15 %maxcelldens = max(celldens,[],2);
16 patch(xnodes(adj)',ynodes(adj)',ones(size(xnodes(adj)')),'CData',avgcelldens,'FaceColor','flat','EdgeColor','none');
17 colormap(flipud(gray))
18 axis equal;
19 axis tight;
20 box on;