Debian Codegraph @

packages/rol/example/PDE-OPT/topo-opt/poisson/plotresults.m

raw
1 adj = load('cell_to_node_quad.txt') + 1; %% load node adjacency table, increment by 1 for 1-based indexing
2
3 nodes = load('nodes.txt'); %% load node coordinates
4
5 figure('Renderer','painters','Position',[10 10 1800 600])
6
7 data_obj = importdata('state.txt', ' ', 2); %% we need to skip the first two lines
8 state = data_obj.data;
9 subplot(1,3,1)
10 trisurf(adj, nodes(:,1), nodes(:,2), state);
11 shading interp;
12 view(0,90)
13 axis square
14 title('Temperature','FontSize',20)
15 set(gca,'FontSize',16)
16
17 data_obj = importdata('density.txt', ' ', 2); %% we need to skip the first two lines
18 control = data_obj.data;
19 if (length(control) < length(state))
20 subplot(1,3,2)
21 xnodes = nodes(:,1);
22 ynodes = nodes(:,2);
23 patch(xnodes(adj)',ynodes(adj)',ones(size(xnodes(adj)')),'CData',control,'FaceColor','flat','EdgeColor','none');
24 axis equal;
25 axis tight;
26 box on;
27 axis square
28 else
29 subplot(1,3,2)
30 trisurf(adj, nodes(:,1), nodes(:,2), control);
31 shading interp;
32 view(0,90)
33 axis square
34 end
35 title('Density','FontSize',20)
36 set(gca,'FontSize',16)
37
38 data_obj = importdata('filtered_density.txt', ' ', 2); %% we need to skip the first two lines
39 control = data_obj.data;
40 subplot(1,3,3)
41 trisurf(adj, nodes(:,1), nodes(:,2), control);
42 shading interp;
43 view(0,90)
44 axis square
45 title('Filtered Density','FontSize',20)
46 set(gca,'FontSize',16)