plot_highlightgrids

PURPOSE ^

PLOT_HIGHLIGHTGRIDS - plot selected grids

SYNOPSIS ^

function plot_highlightgrids(md,options_structure,width,i);

DESCRIPTION ^

PLOT_HIGHLIGHTGRIDS - plot selected grids

   Usage:
      plot_highlightgrids(md,options_structure,width,i);

   See also: PLOTMODEL

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plot_highlightgrids(md,options_structure,width,i);
0002 %PLOT_HIGHLIGHTGRIDS - plot selected grids
0003 %
0004 %   Usage:
0005 %      plot_highlightgrids(md,options_structure,width,i);
0006 %
0007 %   See also: PLOTMODEL
0008 
0009 %process data and model
0010 [x y z elements is2d]=processmesh(md,options_structure);
0011 [gridnumbers isongrid]=processdata(md,[1:md.numberofgrids]',options_structure);
0012 
0013 %plot
0014 subplot(width,width,i); 
0015 
0016 if is2d
0017     %plot mesh
0018     A=elements(:,1); B=elements(:,2); C=elements(:,3);
0019     patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
0020     if ~isnan(options_structure.highlight),
0021         for i=1:length(options_structure.highlight)
0022             text(x(options_structure.highlight(i)),y(options_structure.highlight(i)), z(options_structure.highlight(i)),num2str(options_structure.highlight(i)),'backgroundcolor',[1 0 0]);
0023         end
0024     end
0025 else
0026     %plot mesh
0027     A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
0028     patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
0029     patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
0030     patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
0031     patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
0032     patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
0033     if ~isnan(options_structure.highlight),
0034         for i=1:length(options_structure.highlight)
0035             text(x(options_structure.highlight(i)),y(options_structure.highlight(i)), z(options_structure.highlight(i)),num2str(options_structure.highlight(i)),'backgroundcolor',[1 0 0]);
0036         end
0037     end
0038 end
0039 
0040 %apply options
0041 if isnan(options_structure.highlight)
0042     disp('highlightgrids warning : highlight option empty, not grid highlighted');
0043 end
0044 if isnan(options_structure.title)
0045     options_structure.title='Highlighted Grids';
0046 end 
0047 if isnan(options_structure.colorbar)
0048     options_structure.colorbar=0;
0049 end
0050 applyoptions(md,[],options_structure);

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003