Ignore:
Timestamp:
04/24/09 10:14:10 (16 years ago)
Author:
Mathieu Morlighem
Message:

updated classes form ice1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/public/plot/plot_unit.m

    r1 r27  
    1 function plot_unit(md,optionstring,width,i);
    2 %PLOT_UNIT - unit plot called by plotmodel
     1function plot_unit(x,y,z,elements,data,isongrid,is2d,options_structure)
     2%PLOT_UNIT - unit plot, display data
    33%
    44%   Usage:
    5 %      plot_unit(md,optionstring,width,i);
     5%      plot_unit(x,y,z,elements,data,isongrid,is2d,options_structure);
    66%
    7 %   See also: PLOTMODEL
    8 
    9 %parse options and get a structure of options.
    10 options_structure=parse_options(md,optionstring);
    11 
    12 %figure out if this is a special plot
    13 data=findarg(optionstring,'data');data=data.value;
    14 
    15 %Figure out if this is a semi-transparent plot.
    16 if ~isnan(options_structure.overlay),
    17         plot_overlay(md,data,options_structure,width,i);
    18         return;
    19 end
    20 
    21 if ischar(data),
    22         switch data,
    23         case 'boundaries',
    24                 plot_boundaries(md,options_structure,width,i);
    25                 return;
    26         case 'elementnumbering',
    27                 plot_elementnumbering(md,options_structure,width,i);
    28                 return;
    29         case 'highlightelements',
    30                 plot_highlightelements(md,options_structure,width,i);
    31         case 'segmentnumbering',
    32                 plot_segmentnumbering(md,options_structure,width,i);
    33                 return;
    34         case 'importancefactors',
    35                 plot_importancefactors(md,options_structure,width,i);
    36                 return;
    37         case 'elements_type',
    38                 plot_elementstype(md,options_structure,width,i);
    39                 return;
    40         case 'gridnumbering',
    41                 plot_gridnumbering(md,options_structure,width,i);
    42                 return;
    43         case 'highlightgrids',
    44                 plot_highlightgrids(md,options_structure,width,i);
    45                 return;
    46         case 'basal_drag',
    47                 plot_basaldrag(md,options_structure,width,i);
    48                 return;
    49         case 'driving_stress',
    50                 plot_drivingstress(md,options_structure,width,i);
    51                 return;
    52         case 'mesh',
    53                 plot_mesh(md,options_structure,width,i);
    54                 return;
    55         case 'penalties',
    56                 plot_penalties(md,options_structure,width,i);
    57                 return;
    58         case 'quiver',
    59                 plot_quiver(md,options_structure,width,i);
    60                 return;
    61         case 'quiver3',
    62                 plot_quiver3(md,options_structure,width,i);
    63                 return;
    64         case 'quivervel',
    65                 plot_quivervel(md,options_structure,width,i);
    66                 return;
    67         case 'riftvel',
    68                 plot_riftvel(md,options_structure,width,i);
    69                 return;
    70         case 'riftrelvel',
    71                 plot_riftrelvel(md,options_structure,width,i);
    72                 return;
    73         case 'riftpenetration',
    74                 plot_riftpenetration(md,options_structure,width,i);
    75                 return;
    76         case 'sarpwr',
    77                 plot_sarpwr(md,options_structure,width,i)
    78                 return
    79         case {'segmentonneumann_diag','segmentonneumann_prog'}
    80                 plot_segmentonneumann(md,options_structure,width,i,data)
    81                 return
    82         case {'strainrate_tensor','strainrate','strainrate_principal','strainrate_principalaxis1','strainrate_principalaxis2','strainrate_principalaxis3',...
    83                 'stress_tensor','stress','stress_principal','stress_principalaxis1','stress_principalaxis2','stress_principalaxis3',...
    84                 'deviatoricstress_tensor','deviatoricstress','deviatoricstress_principal','deviatoricstress_principalaxis1','deviatoricstress_principalaxis2','deviatoricstress_principalaxis3'},
    85                 plot_tensor(md,options_structure,width,i,data);
    86                 return;
    87         case 'thermaltransient_results',
    88                 plot_thermaltransient_results(md,options_structure,width,i);
    89                 return;
    90         case 'transient_movie',
    91                 plot_transient_movie(md,options_structure,width,i);
    92                 return;
    93         case 'transient_results',
    94                 plot_transient_results(md,options_structure,width,i);
    95                 return;
    96         otherwise,
    97                 if isfield(struct(md),data)
    98                         data=eval(['md.' data ';']);
    99                 else
    100                         error('plot error message: data provided not supported yet. Type plotdoc for help');
    101                 end
    102         end
    103 end
    104 
    105 %Figure out if this is a Section plot
    106 if ~isnan(options_structure.sectionvalue)
    107         plot_section(md,data,options_structure,width,i);
    108         return;
    109 end
    110 
    111 %check on arguments
    112 if (iscell(data) | isempty(data)),
    113         error('plot error message: data provided is empty');
    114 end
    115 
    116 %process data and model
    117 [x y z elements is2d]=processmesh(md,options_structure);
    118 [data isongrid]=processdata(md,data,options_structure);
     7%   See also: PLOTMODEL, PLOT_DEALER
    1198
    1209%edgecolor?
     
    12413        edgecolor='none';
    12514end
    126 
    127 %standard plot:
    128 subplot(width,width,i);
    12915
    13016%element data
     
    14531        if is2d
    14632                A=elements(:,1); B=elements(:,2); C=elements(:,3);
    147                 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
     33                patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
    14834        else
    14935                if options_structure.layer>=1,
    15036                        A=elements(:,1); B=elements(:,2); C=elements(:,3);
    151                         patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
     37                        patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
    15238                else
    15339                        A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
    154                         patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
    155                         patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
    156                         patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
    157                         patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
    158                         patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
     40                        patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
     41                        patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
     42                        patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
     43                        patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
     44                        patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
    15945                end
    16046        end
    16147end
    162 
    163 %apply all options
    164 if isnan(options_structure.shading) & isnan(options_structure.edgecolor) & size(data,1)==md.numberofgrids,
    165         options_structure.shading='interp';
    166 end
    167 
    168 applyoptions(md,data,options_structure);
Note: See TracChangeset for help on using the changeset viewer.