plot_penalties

PURPOSE ^

PLOT_PENALTIES - plot penalties

SYNOPSIS ^

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

DESCRIPTION ^

PLOT_PENALTIES - plot penalties

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

   See also: PLOTMODEL

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plot_penalties(md,options_structure,width,i);
0002 %PLOT_PENALTIES - plot penalties
0003 %
0004 %   Usage:
0005 %      plot_penalties(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 
0012 %plot mesh penalties
0013 subplot(width,width,i); 
0014 
0015 %units
0016 if ~isnan(options_structure.unitmultiplier),
0017     x=x*options_structure.unitmultiplier;
0018     y=y*options_structure.unitmultiplier;
0019     z=z*options_structure.unitmultiplier;
0020 end
0021 
0022 if ~strcmpi(md.type,'3d'),
0023     error('no penalties to plot for ''2d'' model');
0024 elseif isnan(md.penalties) | isempty(md.penalties)
0025     disp('no penalty applied in this model');
0026     return;
0027 else
0028     %plot mesh
0029     A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
0030     patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
0031     patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
0032     patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
0033     patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
0034     patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
0035 
0036     hold on;
0037     for (i=1:size(md.penalties,1)),
0038         P1=plot3(x(md.penalties(i,1)),y(md.penalties(i,1)),z(md.penalties(i,1)),'ro','MarkerSize',15,'MarkerFaceColor','r');
0039         P2=plot3(x(md.penalties(i,:)),y(md.penalties(i,:)),z(md.penalties(i,:)),'bo-','LineWidth',2,'MarkerSize',8,'MarkerFaceColor','b');
0040     end
0041     legend([P1 P2],'MacAyeal''s penalized grids','Pattyn''s penalized grids');
0042 end
0043 
0044 %apply options
0045 if isnan(options_structure.title)
0046     options_structure.title='Penalties';
0047 end 
0048 if isnan(options_structure.colorbar)
0049     options_structure.colorbar=0;
0050 end
0051 applyoptions(md,[],options_structure);

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