plot_unit

PURPOSE ^

PLOT_UNIT - unit plot called by plotmodel

SYNOPSIS ^

function plot_unit(md,optionstring,width,i);

DESCRIPTION ^

PLOT_UNIT - unit plot called by plotmodel

   Usage:
      plot_unit(md,optionstring,width,i);

   See also: PLOTMODEL

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plot_unit(md,optionstring,width,i);
0002 %PLOT_UNIT - unit plot called by plotmodel
0003 %
0004 %   Usage:
0005 %      plot_unit(md,optionstring,width,i);
0006 %
0007 %   See also: PLOTMODEL
0008 
0009 %parse options and get a structure of options.
0010 options_structure=parse_options(md,optionstring);
0011 
0012 %figure out if this is a special plot
0013 data=findarg(optionstring,'data');data=data.value;
0014 
0015 %Figure out if this is a semi-transparent plot.
0016 if ~isnan(options_structure.overlay),
0017     plot_overlay(md,data,options_structure,width,i);
0018     return;
0019 end
0020 
0021 if ischar(data),
0022     switch data,
0023     case 'boundaries',
0024         plot_boundaries(md,options_structure,width,i);
0025         return;
0026     case 'elementnumbering',
0027         plot_elementnumbering(md,options_structure,width,i);
0028         return;
0029     case 'highlightelements',
0030         plot_highlightelements(md,options_structure,width,i);
0031     case 'segmentnumbering',
0032         plot_segmentnumbering(md,options_structure,width,i);
0033         return;
0034     case 'importancefactors',
0035         plot_importancefactors(md,options_structure,width,i);
0036         return;
0037     case 'elements_type',
0038         plot_elementstype(md,options_structure,width,i);
0039         return;
0040     case 'gridnumbering',
0041         plot_gridnumbering(md,options_structure,width,i);
0042         return;
0043     case 'highlightgrids',
0044         plot_highlightgrids(md,options_structure,width,i);
0045         return;
0046     case 'basal_drag',
0047         plot_basaldrag(md,options_structure,width,i);
0048         return;
0049     case 'driving_stress',
0050         plot_drivingstress(md,options_structure,width,i);
0051         return;
0052     case 'mesh',
0053         plot_mesh(md,options_structure,width,i);
0054         return;
0055     case 'penalties',
0056         plot_penalties(md,options_structure,width,i);
0057         return;
0058     case 'quiver',
0059         plot_quiver(md,options_structure,width,i);
0060         return;
0061     case 'quiver3',
0062         plot_quiver3(md,options_structure,width,i);
0063         return;
0064     case 'quivervel',
0065         plot_quivervel(md,options_structure,width,i);
0066         return;
0067     case 'riftvel',
0068         plot_riftvel(md,options_structure,width,i);
0069         return;
0070     case 'riftrelvel',
0071         plot_riftrelvel(md,options_structure,width,i);
0072         return;
0073     case 'riftpenetration',
0074         plot_riftpenetration(md,options_structure,width,i);
0075         return;
0076     case 'sarpwr',
0077         plot_sarpwr(md,options_structure,width,i)
0078         return
0079     case {'segmentonneumann_diag','segmentonneumann_prog'}
0080         plot_segmentonneumann(md,options_structure,width,i,data)
0081         return
0082     case {'strainrate_tensor','strainrate','strainrate_principal','strainrate_principalaxis1','strainrate_principalaxis2','strainrate_principalaxis3',...
0083         'stress_tensor','stress','stress_principal','stress_principalaxis1','stress_principalaxis2','stress_principalaxis3',...
0084         'deviatoricstress_tensor','deviatoricstress','deviatoricstress_principal','deviatoricstress_principalaxis1','deviatoricstress_principalaxis2','deviatoricstress_principalaxis3'},
0085         plot_tensor(md,options_structure,width,i,data);
0086         return;
0087     case 'thermaltransient_results',
0088         plot_thermaltransient_results(md,options_structure,width,i);
0089         return;
0090     case 'transient_movie',
0091         plot_transient_movie(md,options_structure,width,i);
0092         return;
0093     case 'transient_results',
0094         plot_transient_results(md,options_structure,width,i);
0095         return;
0096     otherwise,
0097         if isfield(struct(md),data)
0098             data=eval(['md.' data ';']);
0099         else
0100             error('plot error message: data provided not supported yet. Type plotdoc for help');
0101         end
0102     end
0103 end
0104 
0105 %Figure out if this is a Section plot
0106 if ~isnan(options_structure.sectionvalue)
0107     plot_section(md,data,options_structure,width,i);
0108     return;
0109 end
0110 
0111 %check on arguments
0112 if (iscell(data) | isempty(data)),
0113     error('plot error message: data provided is empty');
0114 end
0115 
0116 %process data and model
0117 [x y z elements is2d]=processmesh(md,options_structure);
0118 [data isongrid]=processdata(md,data,options_structure);
0119 
0120 %edgecolor?
0121 if ~isnan(options_structure.edgecolor),
0122     edgecolor=options_structure.edgecolor;
0123 else
0124     edgecolor='none';
0125 end
0126 
0127 %standard plot:
0128 subplot(width,width,i);
0129 
0130 %element data
0131 if ~isongrid
0132     if is2d
0133         A=elements(:,1); B=elements(:,2); C=elements(:,3); 
0134         patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', data(:),'FaceColor','flat','EdgeColor',edgecolor);
0135     else
0136         A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
0137         patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', data(:),'FaceColor','flat','EdgeColor',edgecolor);
0138         patch( 'Faces', [D E F], 'Vertices', [x y z],'CData', data(:),'FaceColor','flat','EdgeColor',edgecolor);
0139         patch( 'Faces', [A B E D], 'Vertices', [x y z],'CData', data(:),'FaceColor','flat','EdgeColor',edgecolor);
0140         patch( 'Faces', [B E F C ], 'Vertices', [x y z],'CData', data(:),'FaceColor','flat','EdgeColor',edgecolor);
0141         patch( 'Faces', [C A D F ], 'Vertices', [x y z],'CData', data(:),'FaceColor','flat','EdgeColor',edgecolor);
0142     end
0143 %grid data
0144 elseif isongrid
0145     if is2d
0146         A=elements(:,1); B=elements(:,2); C=elements(:,3); 
0147         patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0148     else
0149         if options_structure.layer>=1,
0150             A=elements(:,1); B=elements(:,2); C=elements(:,3); 
0151             patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0152         else
0153             A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
0154             patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0155             patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0156             patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0157             patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0158             patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0159         end
0160     end
0161 end
0162 
0163 %apply all options
0164 if isnan(options_structure.shading) & isnan(options_structure.edgecolor) & size(data,1)==md.numberofgrids,
0165     options_structure.shading='interp';
0166 end
0167 
0168 applyoptions(md,data,options_structure);

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