[2439] | 1 | function plot_highlightelements(md,options,width,i);
|
---|
[1] | 2 | %PLOT_HIGHLIGHTELEMENTS - plot selected elements
|
---|
| 3 | %
|
---|
| 4 | % Usage:
|
---|
[2439] | 5 | % plot_highlightelements(md,options,width,i);
|
---|
[1] | 6 | %
|
---|
| 7 | % See also: PLOTMODEL
|
---|
| 8 |
|
---|
| 9 | %plot mesh boundaries
|
---|
| 10 | subplot(width,width,i);
|
---|
| 11 |
|
---|
| 12 | %process data and model
|
---|
[8472] | 13 | [x y z elements is2d isplanet]=processmesh(md,[],options);
|
---|
[9725] | 14 | [elementnumbers datatype]=processdata(md,[1:md.mesh.numberofelements]',options);
|
---|
[1] | 15 |
|
---|
| 16 | %plot
|
---|
| 17 | if is2d
|
---|
| 18 | %plot mesh
|
---|
| 19 | A=elements(:,1); B=elements(:,2); C=elements(:,3);
|
---|
| 20 | patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
[5616] | 21 |
|
---|
| 22 | %Highlight
|
---|
| 23 | pos=getfieldvalue(options,'highlight',[]);
|
---|
| 24 | A=elements(pos,1); B=elements(pos,2); C=elements(pos,3);
|
---|
| 25 | patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
|
---|
[1] | 26 | else
|
---|
| 27 | %plot mesh
|
---|
| 28 | A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
|
---|
[5617] | 29 | patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
| 30 | patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
| 31 | patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
| 32 | patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
| 33 | patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
[5616] | 34 |
|
---|
| 35 | %Highlight
|
---|
| 36 | pos=getfieldvalue(options,'highlight',[]);
|
---|
| 37 | A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); D=elements(pos,4); E=elements(pos,5); F=elements(pos,6);
|
---|
[5617] | 38 | patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
|
---|
| 39 | patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
|
---|
| 40 | patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
|
---|
| 41 | patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
|
---|
| 42 | patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
|
---|
[1] | 43 | end
|
---|
| 44 |
|
---|
| 45 | %apply options
|
---|
[2439] | 46 | if ~exist(options,'highlight')
|
---|
[1] | 47 | disp('highlightelements warning : highlight option empty, not element highlighted');
|
---|
| 48 | end
|
---|
[2439] | 49 | options=addfielddefault(options,'title','Highlighted Elements');
|
---|
| 50 | options=addfielddefault(options,'colorbar',0);
|
---|
| 51 | applyoptions(md,[],options);
|
---|