| 1 | function plot_mesh(md,options,nlines,ncols,i);
|
|---|
| 2 | %PLOT_MESH - plot model mesh
|
|---|
| 3 | %
|
|---|
| 4 | % Usage:
|
|---|
| 5 | % plot_mesh(md,options,nlines,ncols,i);
|
|---|
| 6 | %
|
|---|
| 7 | % See also: PLOTMODEL
|
|---|
| 8 |
|
|---|
| 9 | %process data and model
|
|---|
| 10 | [x y z elements is2d isplanet]=processmesh(md,[],options);
|
|---|
| 11 |
|
|---|
| 12 | %plot mesh
|
|---|
| 13 | subplot(nlines,ncols,i);
|
|---|
| 14 |
|
|---|
| 15 | %retrieve some options
|
|---|
| 16 | linewidth=getfieldvalue(options,'linewidth',1);
|
|---|
| 17 | edgecolor=getfieldvalue(options,'edgecolor','black');
|
|---|
| 18 |
|
|---|
| 19 | %plot mesh
|
|---|
| 20 | if is2d
|
|---|
| 21 | A=elements(:,1); B=elements(:,2); C=elements(:,3);
|
|---|
| 22 | patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
|
|---|
| 23 | else
|
|---|
| 24 | if ~isplanet,
|
|---|
| 25 | A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
|
|---|
| 26 | patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
|
|---|
| 27 | patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
|
|---|
| 28 | patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
|
|---|
| 29 | patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
|
|---|
| 30 | patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
|
|---|
| 31 | else
|
|---|
| 32 | A=elements(:,1); B=elements(:,2); C=elements(:,3);
|
|---|
| 33 | if (size(elements,2)==4), D=elements(:,4); else D=C; end
|
|---|
| 34 | patch( 'Faces', [A B C D], 'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
|
|---|
| 35 | end
|
|---|
| 36 | end
|
|---|
| 37 |
|
|---|
| 38 | %apply options
|
|---|
| 39 | options=addfielddefault(options,'title','Mesh');
|
|---|
| 40 | options=addfielddefault(options,'colorbar',0);
|
|---|
| 41 | applyoptions(md,[],options);
|
|---|