forked from rajexplo/DG_Matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeshPlotWithSubdomains.m
28 lines (25 loc) · 1.17 KB
/
meshPlotWithSubdomains.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function meshPlotWithSubdomains(meshData)
% Draw the mesh where subdomains are indicated by different colors.
clf;
% Use colors to indicate subdomains.
switch meshData.elementType
case 'triangular'
xx = [meshData.P(1,meshData.T(1,:)); meshData.P(1,meshData.T(2,:)); meshData.P(1,meshData.T(3,:))];
yy = [meshData.P(2,meshData.T(1,:)); meshData.P(2,meshData.T(2,:)); meshData.P(2,meshData.T(3,:))];
p = repmat(meshData.TSubdomN,3, 1);
H1=patch(xx,yy,p);
set(H1,'EdgeColor',[0,0,0]);
case 'quadrilateral'
xx = [meshData.P(1,meshData.T(1,:)); meshData.P(1,meshData.T(2,:)); ...
meshData.P(1,meshData.T(3,:)); meshData.P(1,meshData.T(4,:))];
yy = [meshData.P(2,meshData.T(1,:)); meshData.P(2,meshData.T(2,:)); ...
meshData.P(2,meshData.T(3,:)); meshData.P(2,meshData.T(4,:))];
p = repmat(meshData.TSubdomN,4, 1);
H1=patch(xx,yy,p);
set(H1,'EdgeColor',[0,0,0]);
case {'trigcluster'}
error('meshPlotWithSubdomains currently does not work for trig-cluster meshes');
end
view(2);
axis equal
axis off