Changeset 2439


Ignore:
Timestamp:
10/20/09 09:00:51 (15 years ago)
Author:
Mathieu Morlighem
Message:

Now use pairoptions in plots

Location:
issm/trunk/src/m/classes
Files:
5 added
1 deleted
45 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/@pairoptions/exist.m

    r2398 r2439  
    1515
    1616%Recover option
    17 bool=ismember(field,pairoptions.list(:,1));
     17bool=any(strcmpi(field,pairoptions.list(:,1)));
  • issm/trunk/src/m/classes/@plotoptions/buildlist.m

    r2404 r2439  
    1313rawoptions=pairoptions(varargin{:});
    1414
     15%get figure number
     16plotoptions.figurenumber=getfieldvalue(rawoptions,'figure',1);
     17
    1518%get number of data to be plotted
    1619numberofplots=fieldoccurences(rawoptions,'data');
     
    2629for i=1:size(rawoptions.list,1),
    2730
    28         %option ends by #all
    29         if  strncmpi(fliplr(rawoptions.list{i,1}),fliplr('#all'),4),
    30 
    31                 %Assign to all subplots
    32                 for j=1:numberofplots,
    33                         plotoptions.list{j}=addfield(plotoptions.list{j},rawoptions.list{i,1},rawoptions.list{i,2});
    34                 end
    35 
    36         %option ends by #i
    37         elseif ismember('#',rawoptions.list{i,1}),
     31        %option contains '#'
     32        if ismember('#',rawoptions.list{i,1}),
    3833
    3934                %get suplot(s) associated
     
    4237                field=string{1};
    4338
    44                 %assign to subplot
    45                 plotoptions.list{str2num(plotnum)}=addfield(plotoptions.list{str2num(plotnum)},field,rawoptions.list{i,2});
     39                %#all
     40                if strcmpi(plotnum,'all');
     41                        for j=1:numberofplots,
     42                                plotoptions.list{j}=addfield(plotoptions.list{j},field,rawoptions.list{i,2});
     43                        end
     44                %#i
     45                else
     46                        %assign to subplot
     47                        plotoptions.list{str2num(plotnum)}=addfield(plotoptions.list{str2num(plotnum)},field,rawoptions.list{i,2});
     48                end
    4649
    4750        %assign option field to corresponding subplot
     
    6366        end
    6467end
     68
     69%check that there is no duplicates
     70for i=1:numberofplots,
     71        plotoptions.list{i}=deleteduplicates(plotoptions.list{i},1);
     72end
  • issm/trunk/src/m/classes/@plotoptions/display.m

    r2404 r2439  
    66disp(sprintf('\n%s = \n',inputname(1)));
    77disp(sprintf('   numberofplots: %i',plotoptions.numberofplots));
     8disp(sprintf('   figurenumber: %i',plotoptions.figurenumber));
    89if ~isempty(plotoptions.list),
    910        disp(sprintf('   list: (%ix%i)',size(plotoptions.list,1),size(plotoptions.list,2)));
  • issm/trunk/src/m/classes/@plotoptions/plotoptions.m

    r2404 r2439  
    1313
    1414options.numberofplots=0;
     15options.figurenumber=1;
    1516options.list=cell(0,0);
    1617options=class(options,'plotoptions');
  • issm/trunk/src/m/classes/public/parametercontrol.m

    r2393 r2439  
    2929
    3030%cm_max
    31 cm_max=getfieldvalue(options,'cm_max',180);
     31cm_max=getfieldvalue(options,'cm_max',250);
    3232if (length(cm_max)~=1)
    33         md.cm_max=180;
     33        md.cm_max=250;
    3434else
    3535        md.cm_max=cm_max;
     
    3737
    3838%cm_noisedmp
    39 cm_noisedmp=getfieldvalue(options,'cm_noisedmp',5*10^-5);
     39cm_noisedmp=getfieldvalue(options,'cm_noisedmp',5*10^-7);
    4040if (length(cm_noisedmp)~=1)
    41         md.cm_noisedmp=5*10^-5;
     41        md.cm_noisedmp=5*10^-7;
    4242else
    4343        md.cm_noisedmp=cm_noisedmp;
     44end
     45
     46%cm_maxdmp
     47cm_maxdmp_value=getfieldvalue(options,'cm_maxdmp_value',50);
     48if (length(cm_maxdmp_value)~=1)
     49        md.cm_maxdmp_value=150;
     50else
     51        md.cm_maxdmp_value=cm_maxdmp_value;
     52end
     53cm_maxdmp_slope=getfieldvalue(options,'cm_maxdmp_slope',10^-13);
     54if (length(cm_maxdmp_slope)~=1)
     55        md.cm_maxdmp_slope=10^-13;
     56else
     57        md.cm_maxdmp_slope=cm_maxdmp_slope;
     58end
     59
     60%cm_mindmp
     61cm_mindmp_value=getfieldvalue(options,'cm_mindmp_value',1);
     62if (length(cm_mindmp_value)~=1)
     63        md.cm_mindmp_value=1;
     64else
     65        md.cm_mindmp_value=cm_mindmp_value;
     66end
     67cm_mindmp_slope=getfieldvalue(options,'cm_mindmp_slope',0);
     68if (length(cm_mindmp_slope)~=1)
     69        md.cm_mindmp_slope=0;
     70else
     71        md.cm_mindmp_slope=cm_mindmp_slope;
    4472end
    4573
     
    98126if ~found
    99127        third=ceil(md.nsteps/3);
    100         md.optscal=[15*ones(third,1);10*ones(third,1);repmat([10;10;20;10],third,1)];
     128        md.optscal=[50*ones(3,1);15*ones(third-3,1);10*ones(third,1);repmat([10;10;20;10],third,1)];
    101129        md.optscal(md.nsteps+1:end)=[];
    102130end
  • issm/trunk/src/m/classes/public/plot/applyoptions.m

    r2403 r2439  
    1 function applyoptions(md,data,options_structure)
     1function applyoptions(md,data,options)
    22%APPLYOPTIONS - apply the options to current plot
    33%
    44%   Usage:
    5 %      applyoptions(md,data,options_structure)
     5%      applyoptions(md,data,options)
    66%
    77%   See also: PLOTMODEL, PARSE_OPTIONS
    88
    99%fontsize
    10 if ~isnan(options_structure.fontsize),
    11         fontsize=options_structure.fontsize;
    12 else
    13         fontsize=14;
    14 end
     10fontsize=getfieldvalue(options,'fontsize',14);
    1511
    1612%fontweight
    17 if ~isnan(options_structure.fontweight),
    18         fontweight=options_structure.fontweight;
    19 else
    20         fontweight='normal';
    21 end
     13fontweight=getfieldvalue(options,'fontweight','normal');
    2214
    2315%title
    24 if iscell(options_structure.title),
    25         title(options_structure.title,'FontSize',fontsize,'FontWeight',fontweight);
    26 else
    27         if ~isnan(options_structure.title),
    28                 title(options_structure.title,'FontSize',fontsize,'FontWeight',fontweight);
     16if exist(options,'title')
     17        titlevalue=getfieldvalue(options,'title');
     18        if iscell(titlevalue),
     19                title(titlevalue,'FontSize',fontsize,'FontWeight',fontweight);
     20        else
     21                if ~isnan(titlevalue),
     22                        title(titlevalue,'FontSize',fontsize,'FontWeight',fontweight);
     23                end
    2924        end
    3025end
    3126
    3227%xlabel
    33 if ~isnan(options_structure.xlabel),
    34         xlabel(options_structure.xlabel,'FontSize',fontsize,'FontWeight',fontweight);
     28if exist(options,'xlabel');
     29        xlabel(getfieldvalue(options,'xlabel'),'FontSize',fontsize,'FontWeight',fontweight);
    3530end
    3631
    3732%ylabel
    38 if ~isnan(options_structure.ylabel),
    39         ylabel(options_structure.ylabel,'FontSize',fontsize,'FontWeight',fontweight);
     33if exist(options,'ylabel');
     34        ylabel(getfieldvalue(options,'ylabel'),'FontSize',fontsize,'FontWeight',fontweight);
    4035end
    4136
    4237%zlabel
    43 if ~isnan(options_structure.zlabel),
    44         zlabel(options_structure.zlabel,'FontSize',fontsize,'FontWeight',fontweight);
     38if exist(options,'zlabel');
     39        zlabel(getfieldvalue(options,'zlabel'),'FontSize',fontsize,'FontWeight',fontweight);
    4540end
    4641
    4742%view
    48 if ~isnan(options_structure.view),
    49         view(options_structure.view);
     43if strcmpi(md.type,'3d') & ~exist(options,'layer'),
     44        view(getfieldvalue(options,'view',3));
    5045else
    51         if strcmpi(md.type,'3d') & isnan(options_structure.layer),
    52                 view(3);
    53         else
    54                 view(2);
     46        view(getfieldvalue(options,'view',2));
     47end
     48
     49%xlim
     50if exist(options,'xlim');
     51        xlim(getfieldvalue(options,'xlim'));
     52end
     53
     54%ylim
     55if exist(options,'ylim');
     56        ylim(getfieldvalue(options,'ylim'));
     57end
     58
     59%zlim
     60if exist(options,'zlim');
     61        zlim(getfieldvalue(options,'zlim'));
     62end
     63
     64%Basinzoom
     65if exist(options,'basinzoom');
     66        basinzoom(getfieldvalue(options,'basinzoom'),getfieldvalue(options,'unit',1));
     67end
     68
     69%Caxis
     70if exist(options,'caxis'),
     71        caxis(getfieldvalue(options,'caxis'));
     72end
     73
     74%shading
     75if exist(options,'shading'),
     76        shading(getfieldvalue(options,'shading'));
     77end
     78
     79%grid
     80if exist(options,'grid'),
     81        if strcmpi(getfieldvalue(options,'grid'),'on'),
     82                grid on;
    5583        end
    5684end
    5785
    58 %xlim
    59 if ~isnan(options_structure.xlim),
    60         xlim(options_structure.xlim);
    61 end
    62 
    63 %ylim
    64 if ~isnan(options_structure.ylim),
    65         ylim(options_structure.ylim);
    66 end
    67 
    68 %zlim
    69 if ~isnan(options_structure.zlim),
    70         zlim(options_structure.zlim);
    71 end
    72 
    73 %Basinzoom
    74 if ~isnan(options_structure.basinzoom),                                                                                                                         
    75         basinzoom(options_structure.basinzoom,options_structure.unitmultiplier);                                                                                                                          end
    76 
    77 %Caxis
    78 if ~isnan(options_structure.caxis),
    79         caxis(options_structure.caxis);
    80 end
    81 
    82 %shading
    83 if ~isnan(options_structure.shading),
    84         shading(options_structure.shading);
    85 end
    86 
    87 %grid
    88 if ~isnan(options_structure.grid) & strcmpi(options_structure.grid,'on'),
    89         grid on;
    90 end
    91 
    9286%colormap
    93 if ~isnan(options_structure.colormap),
    94         h=colormap(options_structure.colormap);
     87if exist(options,'colormap'),
     88        h=colormap(getfieldvalue(options,'colormap'));
    9589end
    9690
    9791%wrapping
    98 if ~isnan(options_structure.wrapping),
    99         if  isnan(options_structure.colormap)
     92if exist(options,'wrapping'),
     93        if ~exist(options,'colormap'),
    10094                h=jet;
    10195        end
    102         colormap(repmat(h,options_structure.wrapping,1));
     96        colormap(repmat(h,getfieldvalue(options,'wrapping',1)));
    10397end
    10498
    10599%colorbar
    106 if options_structure.colorbar~=0,
     100if getfieldvalue(options,'colorbar',1)~=0,
    107101        c=colorbar;set(c,'FontSize',fontsize);
    108         if ~isnan(options_structure.wrapping)
     102        if exist(options,'wrapping')
    109103                lim=get(c,'Ylim');
    110                 lim=[lim(1) lim(1)+(lim(2)-lim(1))/options_structure.wrapping];
     104                lim=[lim(1) lim(1)+(lim(2)-lim(1))/getfieldvalue(options,'wrapping')];
    111105                set(c,'Ylim',lim);
    112106        end
    113         if ~isnan(options_structure.colorbarpos),
    114                 set(c,'Position',options_structure.colorbarpos);
     107        if exist(options,'colorbarpos'),
     108                set(c,'Position',getfieldvalue(options,'colorbarpos'));
    115109        end
    116         if ~isnan(options_structure.log),
    117                 logvalue=options_structure.log;
     110        if exist(options,'log'),
     111                logvalue=getfieldvalue(options,'log');
    118112
    119113                scalestring=get(c,'YTickLabel');
     
    131125                set(c,'FontSize',fontsize);
    132126        end
    133         if ~isnan(options_structure.colorbartitle),
     127        if exist(options,'colorbartitle'),
    134128                backup=gca;
    135                 axes(c);lab=ylabel(options_structure.colorbartitle);set(lab,'Rotation',-90);set(lab,'VerticalAlignment','bottom');
     129                axes(c);lab=ylabel(getfieldvalue(options,'colorbartitle'));set(lab,'Rotation',-90);set(lab,'VerticalAlignment','bottom');
    136130                axes(backup);
    137131        end
     
    142136
    143137%area
    144 if ~isnan(options_structure.area),
    145         antzoom(options_structure.area);
     138if exist(options,'area'),
     139        antzoom(getfieldvalue(options,'area'));
    146140end
    147141
    148142%expdisp
    149 if iscell(options_structure.expdisp) | ~isnan(options_structure.expdisp),
    150         for i=1:length(options_structure.expdisp),
    151                 filename=options_structure.expdisp{i};
    152                 style=options_structure.expstyle{i};
    153                 expdisp(filename,gcf,style,options_structure.unitmultiplier);
    154         end
     143filename=(getfieldvalue(options,'expdisp'));
     144style=(getfieldvalue(options,'expstyle'));
     145for i=1:length(getfieldvalue(options,'expdisp')),
     146        filenamei=filename{i};
     147        stylei=style{i};
     148        expdisp(filenamei,gcf,stylei,getfieldvalue(options,'unit',1));
    155149end
    156150
    157151%text (default value is empty, not NaN...)
    158 if ~isempty(options_structure.text)
    159         for i=1:length(options_structure.text);
    160                 textstring=options_structure.text{i};
    161                 textweight=options_structure.textweight{i};
    162                 textsize=options_structure.textsize{i};
    163                 textcolor=options_structure.textcolor{i};
    164                 textposition=options_structure.textposition{i};
    165                 text(textposition(1),textposition(2),textstring,'FontSize',textsize,'FontWeight',textweight,'Color',textcolor);
    166         end
     152textstring=getfieldvalue(options,'text');
     153textweight=getfieldvalue(options,'textweight');
     154textsize=getfieldvalue(options,'textsize');
     155textcolor=getfieldvalue(options,'textcolor');
     156textposition=getfieldvalue(options,'textposition');
     157for i=1:length(getfieldvalue(options,'text'));
     158        textstringi=textstring{i};
     159        textweighti=textweight{i};
     160        textsizei=textsize{i};
     161        textcolori=textcolor{i};
     162        textpositioni=textposition{i};
     163        text(textpositioni(1),textpositioni(2),textstringi,'FontSize',textsizei,'FontWeight',textweighti,'Color',textcolori);
    167164end
    168165
    169166%latlon
    170 if (iscell(options_structure.latlon) | ~isnan(options_structure.latlon)),
    171         latlonoverlay(options_structure);
     167if exist(options,'latlon')
     168        latlonoverlay(options);
    172169end
    173170
    174171%north arrow
    175 if ~isnan(options_structure.northarrow),
    176         northarrow(options_structure.northarrow);
     172if exist(options,'northarrow'),
     173        northarrow(getfieldvalue(options,'northarrow'));
    177174end
    178175
    179176%Scale ruler
    180 if ~isnan(options_structure.scaleruler),
    181         scaleruler(options_structure.scaleruler);
     177if exist(options,'scaleruler'),
     178        scaleruler(getfieldvalue(options,'scaleruler'));
    182179end
    183180
    184181%axis
    185 if ~isnan(options_structure.axis)
    186         eval(['axis ' options_structure.axis]);
     182if exist(options,'axis')
     183        eval(['axis ' getfieldvalue(options,'axis')]);
    187184end
    188185
    189186%streamliness
    190 if iscell(options_structure.streamlines) | ~isnan(options_structure.streamlines),
    191         plot_streamlines(md,options_structure);
     187if exist(options,'streamlines'),
     188        plot_streamlines(md,options);
    192189end
    193190
    194191%contours
    195 if iscell(options_structure.contourlevels) | ~isnan(options_structure.contourlevels),
    196         plot_contour(md,data,options_structure);
     192if exist(options,'contourlevels'),
     193        plot_contour(md,data,options);
    197194end
  • issm/trunk/src/m/classes/public/plot/latlonoverlay.m

    r2086 r2439  
    1 function latlonoverlay(options_structure)
     1function latlonoverlay(options)
    22%LATLONOVERLAY - overlay latitude and longitude lines on current figure
    33%
     
    88%
    99%   Usage:
    10 %      latlonoverlay(options_structure)
     10%      latlonoverlay(options)
    1111
    1212%get options
    13 latlon=options_structure.latlon;
    14 numbering=options_structure.latlonnumbering;
    15 if ~isnan(options_structure.latlonclick),
    16         latlonclick=1;
    17 else
    18         latlonclick=0;
    19 end
    20 if ~isnan(options_structure.fontsize),
    21         fontsize=options_structure.fontsize;
    22 else
    23         fontsize=16;
    24 end
     13latlon=getfieldvalue(options,'latlon');
     14numbering=getfieldvalue(options,'latlonnumbering');
     15latlonclick=getfieldvalue(options,'latlonclick',0);
     16fontsize=getfieldvalue(options,'fontsize',16);
    2517
    2618%recover arguments (set default parameters if needed)
  • issm/trunk/src/m/classes/public/plot/plot_basaldrag.m

    r1740 r2439  
    1 function plot_basaldrag(md,options_structure,width,i,type);
     1function plot_basaldrag(md,options,width,i,type);
     2
    23%PLOT_BASALDRAG - plot basal drag
    34%
    45%   Usage:
    5 %      plot_basaldrag(md,options_structure,width,i,type);
     6%      plot_basaldrag(md,options,width,i,type);
    67%
    78%   See also: PLOTMODEL
     
    910%check layer
    1011if strcmpi(md.type,'3d')
    11         if options_structure.layer~=1,
     12        if getfieldvalue(options,'layer',1)~=1;
    1213                disp('plot_basaldrag warning: basal drag is displayed in the lower layer')
    13                 options_structure.layer=1;
     14                changefieldvalue(options,'layer',1);
    1415        end
    1516end
     
    3233
    3334%Figure out if this is a Section plot
    34 if ~isnan(options_structure.sectionvalue)
    35         plot_section(md,drag,options_structure,width,i);
     35if exist(options,'sectionvalue')
     36        plot_section(md,drag,options,width,i);
    3637        return;
    3738else
    3839
    3940        %process data and model
    40         [x y z elements is2d]=processmesh(md,options_structure);
    41         [basal_drag isongrid isquiver]=processdata(md,drag,options_structure);
     41        [x y z elements is2d]=processmesh(md,options);
     42        [basal_drag isongrid isquiver]=processdata(md,drag,options);
    4243
    4344        %plot basaldrag
    4445        subplot(width,width,i);
    45         plot_unit(x,y,z,elements,basal_drag,isongrid,is2d,isquiver,options_structure);
     46        plot_unit(x,y,z,elements,basal_drag,isongrid,is2d,isquiver,options);
    4647
    4748        %apply options
    48         if isnan(options_structure.title)
    49                 options_structure.title='Basal drag [kPa]';
    50         end
    51         if isnan(options_structure.view)
    52                 options_structure.view=2;
    53         end
    54         applyoptions(md,basal_drag,options_structure);
     49        options=addfielddefault(options,'title','Basal drag [kPa]');
     50        options=addfielddefault(options,'view',2);
     51        applyoptions(md,basal_drag,options);
    5552
    5653end
  • issm/trunk/src/m/classes/public/plot/plot_boundaries.m

    r27 r2439  
    1 function plot_boundaries(md,options_structure,width,i);
     1function plot_boundaries(md,options,width,i);
    22%PLOT_BOUNDARIES - plot mesh boundaries
    33%
    44%   Usage:
    5 %      plot_boundaries(md,options_structure,width,i);
     5%      plot_boundaries(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     
    1010
    1111%process data and model
    12 if ~isnan(options_structure.layer)
    13         disp('plotmodel warning: layer projection not supported yet by plot_boundaries');
    14         options_structure.layer=NaN;
     12if getfieldvalue(options,'layer',0)
     13        options=removefield(options,'layer',1);
    1514end
    16 [x y z elements is2d]=processmesh(md,options_structure);
     15[x y z elements is2d]=processmesh(md,options);
    1716
    1817for i=1:size(md.segments,1),
     
    3534
    3635%apply options
    37 if isnan(options_structure.title)
    38         options_structure.title='Mesh boundaries';
    39 end
    40 if isnan(options_structure.colorbar)
    41         options_structure.colorbar=0;
    42 end
    43 if isnan(options_structure.view)
    44         options_structure.view=2;
    45 end
    46 applyoptions(md,[],options_structure);
     36options=addfielddefault(options,'title','Mesh boundaries');
     37options=addfielddefault(options,'colorbar',0);
     38options=addfielddefault(options,'view',2);
     39applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_contour.m

    r1879 r2439  
    1 function plot_contour(md,datain,options_structure);
     1function plot_contour(md,datain,options);
    22%PLOT_CONTOUR - plot contours of a given field
    33%
    44%   Usage:
    5 %      plot_contour(md,data,options_structure);
     5%      plot_contour(md,data,options);
    66%
    77%   See also: PLOTMODEL
    88
    99%process data and model
    10 [x y z index is2d]=processmesh(md,options_structure);
    11 [data isongrid isquiver]=processdata(md,datain,options_structure);
     10[x y z index is2d]=processmesh(md,options);
     11[data isongrid isquiver]=processdata(md,datain,options);
    1212
    1313%check is2d
     
    2727
    2828%prepare colors
    29 if isnan(options_structure.contouronly)
    30         %contour color
    31         if isnan(options_structure.contourcolor)
    32                 options_structure.contourcolor='y';
    33         end
    34 else
     29if exist(options,'contouronly')
    3530        %remove the previous plots
    3631        cla
    3732end
    38 color=options_structure.contourcolor;
     33color=getfieldvalue(options,'contourcolor','y');
    3934
    4035%get contours levels
    41 if isnumeric(options_structure.contourlevels),
    42         levels=round_ice(linspace(max(data),min(data),options_structure.contourlevels),2);
     36contourlevels=getfieldvalue(options,'contourlevels');
     37if isnumeric(contourlevels),
     38        levels=round_ice(linspace(max(data),min(data),contourlevels),2);
    4339else
    4440        levels=[];
    45         for i=1:length(options_structure.contourlevels)
    46                 levels(end+1)=options_structure.contourlevels{i};
     41        for i=1:length(contourlevels)
     42                levels(end+1)=contourlevels{i};
    4743        end
    4844        levels=sort(unique(levels),'descend');
     
    220216                %we now have one subcontour ready to be plotted
    221217                zc=level*ones(length(xc)+1,1);
    222                 if isnan(color),
     218                if getfieldvalue(options,'contouronly',0),
    223219                        h=[h;patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'Zdata',zc,'Cdata',zc,'facecolor','none','edgecolor','flat')];
    224220                        hold on     
     
    236232
    237233%labels?
    238 if (~strcmpi(options_structure.contourticks,'off') & ~isempty(c) & ~isempty(h))
    239         if ~isnan(options_structure.contourcolor)
     234if (~strcmpi(getfieldvalue(options,'contourticks','on'),'off') & ~isempty(c) & ~isempty(h))
     235        if exist(options,'contouronly')
     236                clabel(c,h);
     237        else
    240238                clabel(c,h,'color',color,'FontSize',14);
    241         else
    242                 clabel(c,h);
    243         end
    244 end
     239        end
     240end
  • issm/trunk/src/m/classes/public/plot/plot_drivingstress.m

    r1740 r2439  
    1 function plot_drivingstress(md,options_structure,width,i);
     1function plot_drivingstress(md,options,width,i);
    22%PLOT_DRIVINGSTRESS - plot driving stress
    33%
    44%   Usage:
    5 %      plot_drivingstress(md,options_structure,width,i);
     5%      plot_drivingstress(md,options,width,i);
    66%
    77%   See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER
     
    1111
    1212%process data and model
    13 [x y z elements is2d]=processmesh(md,options_structure);
    14 [dstress isongrid isquiver]=processdata(md,s,options_structure);
     13[x y z elements is2d]=processmesh(md,options);
     14[dstress isongrid isquiver]=processdata(md,s,options);
    1515dstress=dstress/1000;
    1616
    1717%plot mesh quivervel
    1818subplot(width,width,i);
    19 plot_unit(x,y,z,elements,dstress,isongrid,is2d,isquiver,options_structure)
     19plot_unit(x,y,z,elements,dstress,isongrid,is2d,isquiver,options)
    2020
    2121%apply options
    22 if isnan(options_structure.title)
    23         options_structure.title='Driving stress [kPa]';
    24 end
    25 if isnan(options_structure.view)
    26         options_structure.view=2;
    27 end
    28 applyoptions(md,dstress,options_structure);
     22options=addfielddefault(options,'title','Driving stress [kPa]');
     23options=addfielddefault(options,'view',2);
     24applyoptions(md,dstress,options);
  • issm/trunk/src/m/classes/public/plot/plot_elementnumbering.m

    r338 r2439  
    1 function plot_elementnumbering(md,options_structure,width,i);
     1function plot_elementnumbering(md,options,width,i);
    22%PLOT_ELEMENTNUMBERING - plot element numbering
    33%
    44%   Usage:
    5 %      plot_elementnumbering(md,options_structure,width,i);
     5%      plot_elementnumbering(md,options,width,i);
    66%
    77%   See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER
     
    1010
    1111%process data and model
    12 [x y z elements is2d]=processmesh(md,options_structure);
    13 [elementnumbers isgrid]=processdata(md,[1:md.numberofelements]',options_structure);
     12[x y z elements is2d]=processmesh(md,options);
     13[elementnumbers isgrid]=processdata(md,[1:md.numberofelements]',options);
    1414
    1515%plot
     
    2020        for i=1:size(elements,1),
    2121                text(sum(x(elements(i,:)))/3,sum(y(elements(i,:)))/3,sum(z(elements(i,:)))/3,num2str(elementnumbers(i)));
    22                 if ~isnan(options_structure.highlight) & ismember(elementnumbers(i),options_structure.highlight)
     22                if ismember(elementnumbers(i),getfieldvalue(options,'highlight',[]))
    2323                        A=elements(i,1); B=elements(i,2);  C=elements(i,3);
    2424                        patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
     
    3535        for i=1:size(elements,1),
    3636                text(sum(x(elements(i,:)))/6,sum(y(elements(i,:)))/6,sum(z(elements(i,:)))/6,num2str(elementnumbers(i)));
    37                 if ~isnan(options_structure.highlight) & ismember(elementnumbers(i),options_structure.highlight)
     37                if ismember(elementnumbers(i),getfieldvalue(options,'highlight',[]))
    3838                        A=elements(i,1); B=elements(i,2);  C=elements(i,3);  D=elements(i,4); E=elements(i,5);  F=elements(i,6);
    3939                        patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
     
    4747
    4848%apply options
    49 if isnan(options_structure.title)
    50         options_structure.title='Element numbering';
    51 end
    52 if isnan(options_structure.colorbar)
    53         options_structure.colorbar=0;
    54 end
    55 applyoptions(md,[],options_structure);
     49options=addfielddefault(options,'title','Element numbering');
     50options=addfielddefault(options,'colorbar',0);
     51applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_elementstype.m

    r1740 r2439  
    1 function plot_elementstype(md,options_structure,width,i);
     1function plot_elementstype(md,options,width,i);
    22%PLOT_ELEMENTSTYPE - plot elements type
    33%
    44%   Usage:
    5 %      plot_elementstype(md,options_structure,width,i);
     5%      plot_elementstype(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
    88
    99%process data and model
    10 [x y z elements is2d]=processmesh(md,options_structure);
    11 [data1 isongrid isquiver]=processdata(md,md.elements_type(:,1),options_structure);
    12 [data2 isongrid isquiver]=processdata(md,md.elements_type(:,2),options_structure);
     10[x y z elements is2d]=processmesh(md,options);
     11[data1 isongrid isquiver]=processdata(md,md.elements_type(:,1),options);
     12[data2 isongrid isquiver]=processdata(md,md.elements_type(:,2),options);
    1313data=[data1 data2];
    1414
    1515%edgecolor?
    16 if ~isnan(options_structure.edgecolor),
    17         edgecolor=options_structure.edgecolor;
    18 else
    19         edgecolor='none';
    20 end
     16edgecolor=getfieldvalue(options,'edgecolor','none');
    2117
    2218%plot
     
    8884
    8985%apply options
    90 if isnan(options_structure.title)
    91         options_structure.title='Elements type';
    92 end
    93 if isnan(options_structure.colorbar)
    94         options_structure.colorbar=0;
    95 end
    96 applyoptions(md,[],options_structure);
     86options=addfielddefault(options,'title','Elements type');
     87options=addfielddefault(options,'colorbar',0);
     88applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_gridnumbering.m

    r1740 r2439  
    1 function plot_gridnumbering(md,options_structure,width,i);
     1function plot_gridnumbering(md,options,width,i);
    22%PLOT_GRIDNUMBERING - plot grid numbering
    33%
    44%   Usage:
    5 %      plot_gridnumbering(md,options_structure,width,i);
     5%      plot_gridnumbering(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
    88
    99%process data and model
    10 [x y z elements is2d]=processmesh(md,options_structure);
    11 [gridnumbers isongrid isquiver]=processdata(md,[1:md.numberofgrids]',options_structure);
     10[x y z elements is2d]=processmesh(md,options);
     11[gridnumbers isongrid isquiver]=processdata(md,[1:md.numberofgrids]',options);
    1212
    1313%plot
     
    2121                text(x(i),y(i), z(i),num2str(gridnumbers(i)),'backgroundcolor',[0.8 0.9 0.8]);
    2222        end
    23         if ~isnan(options_structure.highlight),
    24                 for i=1:length(options_structure.highlight)
    25                         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]);
     23        if exist(options,'highlight'),
     24                list=getfieldvalue(options,'highlight');
     25                for i=1:length(list)
     26                        text(x(list(i)),y(list(i)), z(list(i)),num2str(list(i)),'backgroundcolor',[1 0 0]);
    2627                end
    2728        end
     
    3738                text(x(i),y(i), z(i),num2str(i),'backgroundcolor',[0.8 0.9 0.8]);
    3839        end
    39         if ~isnan(options_structure.highlight),
    40                 for i=1:length(options_structure.highlight)
    41                         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]);
     40        if exist(options,'highlight'),
     41                list=getfieldvalue(options,'highlight');
     42                for i=1:length(list)
     43                        text(x(list(i)),y(list(i)), z(list(i)),num2str(list(i)),'backgroundcolor',[1 0 0]);
    4244                end
    4345        end
     
    4547
    4648%apply options
    47 if isnan(options_structure.title)
    48         options_structure.title='Grid numbering';
    49 end
    50 if isnan(options_structure.colorbar)
    51         options_structure.colorbar=0;
    52 end
    53 applyoptions(md,[],options_structure);
     49options=addfielddefault(options,'title','Grid numbering');
     50options=addfielddefault(options,'colorbar',0);
     51applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_highlightelements.m

    r1 r2439  
    1 function plot_highlightelements(md,options_structure,width,i);
     1function plot_highlightelements(md,options,width,i);
    22%PLOT_HIGHLIGHTELEMENTS - plot selected elements
    33%
    44%   Usage:
    5 %      plot_highlightelements(md,options_structure,width,i);
     5%      plot_highlightelements(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     
    1111
    1212%process data and model
    13 [x y z elements is2d]=processmesh(md,options_structure);
    14 [elementnumbers isgrid]=processdata(md,[1:md.numberofelements]',options_structure);
     13[x y z elements is2d]=processmesh(md,options);
     14[elementnumbers isgrid]=processdata(md,[1:md.numberofelements]',options);
    1515
    1616%plot
     
    2020        patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
    2121        for i=1:size(elements,1),
    22                 if ~isnan(options_structure.highlight) & ismember(elementnumbers(i),options_structure.highlight)
     22                if ismember(elementnumbers(i),getfieldvalue(options,'highlight',[]))
    2323                        A=elements(i,1); B=elements(i,2);  C=elements(i,3);
    2424                        patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
     
    3434        patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
    3535        for i=1:size(elements,1),
    36                 if ~isnan(options_structure.highlight) & ismember(elementnumbers(i),options_structure.highlight)
     36                if ismember(elementnumbers(i),getfieldvalue(options,'highlight',[]))
    3737                        A=elements(i,1); B=elements(i,2);  C=elements(i,3);  D=elements(i,4); E=elements(i,5);  F=elements(i,6);
    3838                        patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
     
    4646
    4747%apply options
    48 if isnan(options_structure.highlight)
     48if ~exist(options,'highlight')
    4949        disp('highlightelements warning : highlight option empty, not element highlighted');
    5050end
    51 if isnan(options_structure.title)
    52         options_structure.title='Highlighted Elements';
    53 end
    54 if isnan(options_structure.colorbar)
    55         options_structure.colorbar=0;
    56 end
    57 applyoptions(md,[],options_structure);
     51options=addfielddefault(options,'title','Highlighted Elements');
     52options=addfielddefault(options,'colorbar',0);
     53applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_highlightgrids.m

    r1740 r2439  
    1 function plot_highlightgrids(md,options_structure,width,i);
     1function plot_highlightgrids(md,options,width,i);
    22%PLOT_HIGHLIGHTGRIDS - plot selected grids
    33%
    44%   Usage:
    5 %      plot_highlightgrids(md,options_structure,width,i);
     5%      plot_highlightgrids(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
    88
    99%process data and model
    10 [x y z elements is2d]=processmesh(md,options_structure);
    11 [gridnumbers isongrid isquiver]=processdata(md,[1:md.numberofgrids]',options_structure);
     10[x y z elements is2d]=processmesh(md,options);
     11[gridnumbers isongrid isquiver]=processdata(md,[1:md.numberofgrids]',options);
    1212
    1313%plot
     
    1818        A=elements(:,1); B=elements(:,2); C=elements(:,3);
    1919        patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
    20         if ~isnan(options_structure.highlight),
    21                 for i=1:length(options_structure.highlight)
    22                         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]);
    23                 end
     20        list=getfieldvalue(options,'highlight',[]);
     21        for i=1:length(list)
     22                text(x(list(i)),y(list(i)), z(list(i)),num2str(list(i)),'backgroundcolor',[1 0 0]);
     23        end
    2424        end
    2525else
     
    3131        patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
    3232        patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
    33         if ~isnan(options_structure.highlight),
    34                 for i=1:length(options_structure.highlight)
    35                         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]);
    36                 end
     33        list=getfieldvalue(options,'highlight',[]);
     34        for i=1:length(list)
     35                text(x(list(i)),y(list(i)), z(list(i)),num2str(list(i)),'backgroundcolor',[1 0 0]);
     36        end
    3737        end
    3838end
    3939
    4040%apply options
    41 if isnan(options_structure.highlight)
     41if ~exist(options,'highlight')
    4242        disp('highlightgrids warning : highlight option empty, not grid highlighted');
    4343end
    44 if isnan(options_structure.title)
    45         options_structure.title='Highlighted Grids';
    46 end
    47 if isnan(options_structure.colorbar)
    48         options_structure.colorbar=0;
    49 end
    50 applyoptions(md,[],options_structure);
     44options=addfielddefault(options,'title','Highlighted Grids');
     45options=addfielddefault(options,'colorbar',0);
     46applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_importancefactors.m

    r1 r2439  
    1 function plot_importancefactors(md,options_structure,width,ii);
     1function plot_importancefactors(md,options,width,ii);
    22%PLOT_IMPORTANCEFACTORS - plot importance factors
    33%
    44%   Usage:
    5 %      plot_importancefactors(md,options_structure,width,i);
     5%      plot_importancefactors(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
    88
    99%first recover design variable descriptor
    10 if ~isnan(options_structure.designvariable),
    11         descriptor=options_structure.designvariable;
     10if exist(options,'designvariable'),
     11        descriptor=getfieldvalue(options,'designvariable');
    1212else
    1313        error('plot_importancefactors error message: Need to supply design variable descriptor');
     
    1616
    1717%then recover responsfunction name
    18 if ~isnan(options_structure.responsefunction),
    19         responsefunctiondescriptor=options_structure.responsefunction;
     18if exist(options,'responsefunction'),
     19        responsefunctiondescriptor=getfieldvalue(options,'responsefunction');
    2020else
    2121        error('plot_importancefactors error message: Need to supply response function descriptor');
     
    5252
    5353%log?
    54 if ~isnan(options_structure.log),
    55         logvalue=options_structure.log;
     54if exist(options,'log'),
     55        logvalue=getfieldvalue(options,'log');
    5656        importancefactors=log(importancefactors)/log(logvalue);
    5757end
     
    6464
    6565%process data and model
    66 [x y z elements is2d]=processmesh(md,options_structure);
     66[x y z elements is2d]=processmesh(md,options);
    6767
    68 %edgecolor?
    69 if ~isnan(options_structure.edgecolor),
    70         edgecolor=options_structure.edgecolor;
    71 else
    72         edgecolor='none';
    73 end
     68%edgecolor
     69edgecolor=getfieldvalue(options,'edgecolor','none');
    7470
    7571%standard plot:
     
    8581
    8682%apply options
    87 applyoptions(md,[],options_structure);
     83applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_manager.m

    r2242 r2439  
    1 function plot_manager(md,optionstring,width,i);
     1function plot_manager(md,options,width,i);
    22%PLOT__MANAGER - distribute the plots, called by plotmodel
    33%
    44%   Usage:
    5 %      plot_manager(md,optionstring,width,i);
     5%      plot_manager(md,options,width,i);
    66%
    77%   See also: PLOTMODEL, PLOT_UNIT
    88
    99%parse options and get a structure of options.
    10 options_structure=parse_options(md,optionstring);
     10options=checkplotoptions(md,options);
    1111
    1212%get data to be displayed
    13 data=findarg(optionstring,'data');data=data.value;
     13data=getfieldvalue(options,'data');
    1414
    1515%figure out if this is a special plot
     
    1919
    2020                case 'boundaries',
    21                         plot_boundaries(md,options_structure,width,i);
     21                        plot_boundaries(md,options,width,i);
    2222                        return;
    2323                case 'elementnumbering',
    24                         plot_elementnumbering(md,options_structure,width,i);
     24                        plot_elementnumbering(md,options,width,i);
    2525                        return;
    2626                case 'highlightelements',
    27                         plot_highlightelements(md,options_structure,width,i);
     27                        plot_highlightelements(md,options,width,i);
    2828                        return;
    2929                case 'segmentnumbering',
    30                         plot_segmentnumbering(md,options_structure,width,i);
     30                        plot_segmentnumbering(md,options,width,i);
    3131                        return;
    3232                case 'histnorm',
    33                         plot_qmuhistnorm(md,options_structure,width,i);
     33                        plot_qmuhistnorm(md,options,width,i);
    3434                        return;
    3535                case 'elements_type',
    36                         plot_elementstype(md,options_structure,width,i);
     36                        plot_elementstype(md,options,width,i);
    3737                        return;
    3838                case 'gridnumbering',
    39                         plot_gridnumbering(md,options_structure,width,i);
     39                        plot_gridnumbering(md,options,width,i);
    4040                        return;
    4141                case 'highlightgrids',
    42                         plot_highlightgrids(md,options_structure,width,i);
     42                        plot_highlightgrids(md,options,width,i);
    4343                        return;
    4444                case {'basal_drag','basal_dragx','basal_dragy'},
    45                         plot_basaldrag(md,options_structure,width,i,data);
     45                        plot_basaldrag(md,options,width,i,data);
    4646                        return;
    4747                case 'driving_stress',
    48                         plot_drivingstress(md,options_structure,width,i);
     48                        plot_drivingstress(md,options,width,i);
    4949                        return;
    5050                case 'mesh',
    51                         plot_mesh(md,options_structure,width,i);
     51                        plot_mesh(md,options,width,i);
    5252                        return;
    5353                case 'penalties',
    54                         plot_penalties(md,options_structure,width,i);
     54                        plot_penalties(md,options,width,i);
    5555                        return;
    5656                case 'riftvel',
    57                         plot_riftvel(md,options_structure,width,i);
     57                        plot_riftvel(md,options,width,i);
    5858                        return;
    5959                case 'riftrelvel',
    60                         plot_riftrelvel(md,options_structure,width,i);
     60                        plot_riftrelvel(md,options,width,i);
    6161                        return;
    6262                case 'riftpenetration',
    63                         plot_riftpenetration(md,options_structure,width,i);
     63                        plot_riftpenetration(md,options,width,i);
    6464                        return;
    6565                case 'riftfraction',
    66                         plot_riftfraction(md,options_structure,width,i);
     66                        plot_riftfraction(md,options,width,i);
    6767                        return;
    6868                case 'sarpwr',
    69                         plot_sarpwr(md,options_structure,width,i)
     69                        plot_sarpwr(md,options,width,i)
    7070                        return
    7171                case 'pressureload'
    72                         plot_pressureload(md,options_structure,width,i,data)
     72                        plot_pressureload(md,options,width,i,data)
    7373                        return
    7474                case 'segments'
    75                         plot_segments(md,options_structure,width,i,data)
     75                        plot_segments(md,options,width,i,data)
    7676                        return
    7777                case {'strainrate_tensor','strainrate','strainrate_principal','strainrate_principalaxis1','strainrate_principalaxis2','strainrate_principalaxis3',...
    7878                                'stress_tensor','stress','stress_principal','stress_principalaxis1','stress_principalaxis2','stress_principalaxis3',...
    7979                                'deviatoricstress_tensor','deviatoricstress','deviatoricstress_principal','deviatoricstress_principalaxis1','deviatoricstress_principalaxis2','deviatoricstress_principalaxis3'},
    80                         plot_tensor(md,options_structure,width,i,data);
     80                        plot_tensor(md,options,width,i,data);
    8181                        return;
    8282                case 'thermaltransient_results',
    83                         plot_thermaltransient_results(md,options_structure,width,i);
     83                        plot_thermaltransient_results(md,options,width,i);
    8484                        return;
    8585                case 'transient_movie',
    86                         plot_transient_movie(md,options_structure,width,i);
     86                        plot_transient_movie(md,options,width,i);
    8787                        return;
    8888                case 'transient_results',
    89                         plot_transient_results(md,options_structure,width,i);
     89                        plot_transient_results(md,options,width,i);
    9090                        return;
    9191
     
    101101
    102102%Figure out if this is a semi-transparent plot.
    103 if ~isnan(options_structure.overlay),
    104         plot_overlay(md,data,options_structure,width,i);
     103if exist(options,'overlay'),
     104        plot_overlay(md,data,options,width,i);
    105105        return;
    106106end
    107107
    108108%Figure out if this is a Section plot
    109 if ~isnan(options_structure.sectionvalue)
    110         plot_section(md,data,options_structure,width,i);
     109if exist(options,'sectionvalue')
     110        plot_section(md,data,options,width,i);
    111111        return;
    112112end
    113113
    114114%process data and model
    115 [x y z elements is2d]=processmesh(md,options_structure);
    116 [data2 isongrid isquiver]=processdata(md,data,options_structure);
     115[x y z elements is2d]=processmesh(md,options);
     116[data2 isongrid isquiver]=processdata(md,data,options);
    117117
    118118%standard plot:
    119119subplot(width,width,i);
    120 plot_unit(x,y,z,elements,data2,isongrid,is2d,isquiver,options_structure);
     120plot_unit(x,y,z,elements,data2,isongrid,is2d,isquiver,options);
    121121
    122122%apply all options
    123 if isnan(options_structure.shading) & isnan(options_structure.edgecolor) & size(data2,1)==md.numberofgrids,
    124         options_structure.shading='interp';
     123if isquiver & getfieldvalue(options,'colorbar',0)~=1
     124        options.colorbar=2;
    125125end
    126 if isquiver & ~strcmpi(options_structure.colorbar,'off'),
    127         options_structure.colorbar=2;
    128 end
    129 if isquiver & (iscell(options_structure.contourlevels) | ~isnan(options_structure.contourlevels)),
     126if isquiver & exist(options,'contourlevels'),
    130127        data2=data;
    131128end
    132 applyoptions(md,data2,options_structure);
     129applyoptions(md,data2,options);
  • issm/trunk/src/m/classes/public/plot/plot_mesh.m

    r1 r2439  
    1 function plot_mesh(md,options_structure,width,i);
     1function plot_mesh(md,options,width,i);
    22%PLOT_MESH - plot model mesh
    33%
    44%   Usage:
    5 %      plot_mesh(md,options_structure,width,i);
     5%      plot_mesh(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
    88
    99%process data and model
    10 [x y z elements is2d]=processmesh(md,options_structure);
     10[x y z elements is2d]=processmesh(md,options);
    1111
    1212%plot mesh
     
    2727
    2828%apply options
    29 if isnan(options_structure.title)
    30         options_structure.title='Mesh';
    31 end
    32 if isnan(options_structure.colorbar)
    33         options_structure.colorbar=0;
    34 end
    35 applyoptions(md,[],options_structure);
     29options=addfielddefault(options,'title','Mesh');
     30options=addfielddefault(options,'colorbar',0);
     31applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_overlay.m

    r2328 r2439  
    1 function plot_overlay(md,data,options_structure,width,i)
     1function plot_overlay(md,data,options,width,i)
    22%PLOT_OVERLAY - superimpose radar image to a given field
    33%
    44%   Usage:
    5 %      plot_overlay(md,options_structure,width,i);
     5%      plot_overlay(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
    88
    99%process mesh and data
    10 [x y z elements is2d]=processmesh(md,options_structure);
    11 [data isongrid isquiver]=processdata(md,data,options_structure);
     10[x y z elements is2d]=processmesh(md,options);
     11[data isongrid isquiver]=processdata(md,data,options);
    1212
    1313%check is2d
     
    1717
    1818%get xlim and ylim
    19 if ~isnan(options_structure.xlim),
    20         xlim=options_structure.xlim;
    21 else
    22         xlim=[min(md.x) max(md.x)];
    23 end
    24 if ~isnan(options_structure.ylim),
    25         ylim=options_structure.ylim;
    26 else
    27         ylim=[min(md.y) max(md.y)];
    28 end
     19xlim=getfieldvalue(options,'xlim',[min(md.x) max(md.x)]);
     20ylim=getfieldvalue(options,'ylim',[min(md.y) max(md.y)]);
    2921
    3022%radar power
     
    3628if redo,
    3729        t1=clock; fprintf('%s','Extracting radar image...');
    38         md=radarpower(md,xlim,ylim,options_structure.highres);
     30        md=radarpower(md,xlim,ylim,getfieldvalue(options,'highres',0));
    3931        t2=clock;fprintf('%s\n',[' done (' num2str(etime(t2,t1)) ' seconds)']);
    4032end
     
    5446if redo,
    5547        %apply caxis if required
    56         if ~isnan(options_structure.caxis),
    57                 data(find(data<options_structure.caxis(1)))=options_structure.caxis(1);
    58                 data(find(data>options_structure.caxis(2)))=options_structure.caxis(2);
     48        if exist(options,'caxis'),
     49                caxis_opt=getfieldvalue(options,'caxis');
     50                data(find(data<caxis_opt(1)))=caxis_opt(1);
     51                data(find(data>caxis_opt(2)))=caxis_opt(2);
    5952        end
    6053
     
    7568
    7669%Build hsv color image from radar and results
    77 transparency=options_structure.alpha;
    78 border=options_structure.border;
     70transparency=getfieldvalue(options,'alpha',1.5);  %Rignot's setting: 1.5
     71border=getfieldvalue(options,'border',0);
    7972
    8073%intensity
     
    107100
    108101%Apply options, without colorbar and without grid
    109 if ~isnan(options_structure.fontsize),
    110         fontsize=options_structure.fontsize;
    111 else
    112         fontsize=14;
    113 end
    114 if isnan(options_structure.axis),
    115         options_structure.axis='equal off';
    116 end
    117 if isnan(options_structure.colorbarpos),
    118         options_structure.colorbarpos=[0.80 0.70 0.02 0.15];
    119 end
    120 iscolorbar=(options_structure.colorbar==1 | isnan(options_structure.colorbar));
    121 options_structure.colorbar=0;
    122 applyoptions(md,data,options_structure);
     102iscolorbar=getfieldvalue(options,'colorbar',1);
     103options=changefieldvalue(options,'colorbar',0);
     104options=addfielddefault(options,'axis','equal off');
     105options=addfielddefault(options,'colorbarpos',[0.80 0.70 0.02 0.15]);
     106applyoptions(md,data,options);
    123107
    124108%colorbar
     
    126110
    127111        %create colorbar with correct colors and position
    128         colorbar_rgb=buildoverlaycolorbar(md,data,options_structure.alpha);
     112        colorbar_rgb=buildoverlaycolorbar(md,data,getfieldvalue(options,'aplha',1.5));
    129113        colorbar_handle=colorbar;
    130114        colorbar_image_handle=get(colorbar_handle,'Children');
    131115        set(colorbar_image_handle,'CData',colorbar_rgb);
    132         set(colorbar_handle,'Position',options_structure.colorbarpos);
     116        set(colorbar_handle,'Position',getfieldvalue(options,'colorbarpos'));
    133117
    134118        %modify ticks.
     
    147131        set(colorbar_handle,'YTickLabel',scalestring);
    148132        set(colorbar_handle,'YColor','y');
    149         set(colorbar_handle,'FontSize',fontsize);
     133        set(colorbar_handle,'FontSize',getfieldvalue(options,'fontsize',14));
    150134end
  • issm/trunk/src/m/classes/public/plot/plot_penalties.m

    r27 r2439  
    1 function plot_penalties(md,options_structure,width,i);
     1function plot_penalties(md,options,width,i);
    22%PLOT_PENALTIES - plot penalties
    33%
    44%   Usage:
    5 %      plot_penalties(md,options_structure,width,i);
     5%      plot_penalties(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
    88
    99%process data and model
    10 [x y z elements is2d]=processmesh(md,options_structure);
     10[x y z elements is2d]=processmesh(md,options);
    1111
    1212%plot mesh penalties
     
    1414
    1515%units
    16 if ~isnan(options_structure.unitmultiplier),
    17         x=x*options_structure.unitmultiplier;
    18         y=y*options_structure.unitmultiplier;
    19         z=z*options_structure.unitmultiplier;
     16if exist(options,'unit'),
     17        unit=getfieldvalue(options,'unit');
     18        x=x*unit;
     19        y=y*unit;
     20        z=z*unit;
    2021end
    2122
     
    4344
    4445%apply options
    45 if isnan(options_structure.title)
    46         options_structure.title='Penalties';
    47 end
    48 if isnan(options_structure.colorbar)
    49         options_structure.colorbar=0;
    50 end
    51 applyoptions(md,[],options_structure);
     46options=addfielddefault(options,'title','Penalties');
     47options=addfielddefault(options,'colorbar',0);
     48applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_pressureload.m

    r1758 r2439  
    1 function plot_pressureload(md,options_structure,width,i,data);
     1function plot_pressureload(md,options,width,i,data);
    22%PLOT_PRESSURELOAD - plot segment on neumann BC
    33%
    44%   Usage:
    5 %      plot_pressureload(md,options_structure,width,i);
     5%      plot_pressureload(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     
    1111
    1212%process mesh and data
    13 [x y z elements is2d]=processmesh(md,options_structure);
     13[x y z elements is2d]=processmesh(md,options);
    1414pressureload=md.pressureload;
    1515
     
    7575
    7676%apply options
    77 if isnan(options_structure.title)
    78         options_structure.title='Neumann boundary conditions';
    79 end
    80 if isnan(options_structure.colorbar)
    81         options_structure.colorbar=0;
    82 end
    83 applyoptions(md,[],options_structure);
     77options=addfielddefault(options,'title','Neumann boundary conditions');
     78options=addfielddefault(options,'colorbar',0);
     79applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_qmuhistnorm.m

    r2254 r2439  
    5757
    5858
    59 function plot_qmuhistnorm(md,options_structure,width,i);
     59function plot_qmuhistnorm(md,options,width,i);
    6060
    6161%recover histnorm data
    62 if isnans(options_structure.histnorm_data)
     62if ~exist(options,'histnorm_data')
    6363        error('plot_qmuhistnorm error message: option histnorm_data is required');
    6464else
    65         varargin=options_structure.histnorm_data;
     65        varargin=getfieldvalue(options,'histnorm_data');
    6666end
    6767
    6868%recover fontsize
    69 if isnans(options_structure.fontsize),
    70         fontsize=options_structure.fontsize;
    71 else
    72         fontsize=18;
    73 end
     69fontsize=getfieldvalue(options,'fontsize',18),
    7470
    7571nargin=length(varargin);
     
    267263
    268264%apply options.
    269 if isnans(options_structure.title),
    270         options_structure.title='Relative Frequency Histogram';
    271 end
    272 if isnans(options_structure.xlabel),
    273         options_structure.xlabel='Interval Edge Value';
    274 end
    275 
    276 if isnan(options_structure.colorbar)
    277         options_structure.colorbar=0;
    278 end
    279 
    280 applyoptions(md,[],options_structure);
     265options=addfielddefault(options,'title','Relative Frequency Histogram');
     266options=addfielddefault(options,'xlabel','Interval Edge Value');
     267options=addfielddefault(options,'colorbar',0);
     268applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_quiver.m

    r1878 r2439  
    1 function plot_quiver(x,y,u,v,options_structure),
     1function plot_quiver(x,y,u,v,options),
    22%PLOT_QUIVER - quiver plot with colors
    33%
     
    55%
    66%   Usage:
    7 %      plot_quiver(x,y,u,v,options_structure)
     7%      plot_quiver(x,y,u,v,options)
    88%
    99%   Example:
    10 %      plot_quiver(md.x,md.y,md.vx,md.vy,options_structure);
     10%      plot_quiver(md.x,md.y,md.vx,md.vy,options);
    1111
    1212%keep only non NaN elements
     
    2121
    2222%process options: scaling factor?
    23 if isnan(options_structure.scaling),
    24         scalingfactor=0.40;
    25 elseif isnumeric(options_structure.scaling),
    26         scalingfactor=options_structure.scaling;
    27 else
    28         error('plot_quiver error message: scaling option other than scalaer or ''off'' not supported yet')
    29 end
     23scalingfactor=getfieldvalue(options,'scaling',0.40);
    3024
    3125%number of colors?
    32 if isnumeric(options_structure.colorlevels),
    33         if isnan(options_structure.colorlevels),
     26colorlevels=getfieldvalue(options,'colorlevels');
     27if isnumeric(colorlevels),
     28        if isnan(colorlevels),
    3429                numcolors=30;
    3530        else
    36                 numcolors=options_structure.colorlevels;
     31                numcolors=colorlevels;
    3732        end
    3833        levels=round_ice(linspace(Min,Max,numcolors+1),2);
    3934else
    40         levels=zeros(1,length(options_structure.colorlevels)+2);
     35        levels=zeros(1,length(colorlevels)+2);
    4136        levels(1)=Min;
    42         for i=1:length(options_structure.colorlevels)
    43                 levels(i+1)=options_structure.colorlevels{i};
     37        for i=1:length(colorlevels)
     38                levels(i+1)=colorlevels{i};
    4439        end
    4540        levels(end)=Max;
     
    6156
    6257%Scale data
    63 if ~isnan(options_structure.autoscale) & strcmpi(options_structure.autoscale,'off'),
     58if strcmpi(getfieldvalue(options,'autoscale','on'),'off'),
    6459        delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x);
    6560        u=scalingfactor*sqrt(delta)*u./Norm;
     
    8176
    8277%take care of colorbar
    83 if  ~strcmpi(options_structure.colorbar,'off'),
     78if  ~strcmpi(getfieldvalue(options,'colorbar','on'),'off'),
    8479
    8580        %build ticks
     
    10196        set(hcb,'YTickLabel',ticklabel,'YTick',tickpos);
    10297        %position
    103         if ~isnan(options_structure.colorbarpos),
    104                 set(hcb,'Position',options_structure.colorbarpos);
     98        if exist(options.colorbarpos),
     99                set(hcb,'Position',getfieldvalue(options,'colorbarpos'));
    105100        end
    106101        %fontsize
    107         if ~isnan(options_structure.fontsize),
    108                 fontsize=options_structure.fontsize;
    109         else
    110                 fontsize=14;
    111         end
     102        fontsize=getfieldvalue(options,'fontsize',14);
    112103        set(hcb,'FontSize',fontsize);
    113104end
  • issm/trunk/src/m/classes/public/plot/plot_quiver3.m

    r1878 r2439  
    1 function plot_quiver3(x,y,z,u,v,w,options_structure),
     1function plot_quiver3(x,y,z,u,v,w,options),
    22%PLOT_QUIVER3 - 3d quiver plot with colors
    33%
     
    55%
    66%   Usage:
    7 %      plot_quiver3(x,y,z,u,v,w,options_structure)
     7%      plot_quiver3(x,y,z,u,v,w,options)
    88%
    99%   Example:
    10 %      plot_quiver(md.x,md.y,md.z,md.vx,md.vy,md.vz,options_structure);
     10%      plot_quiver(md.x,md.y,md.z,md.vx,md.vy,md.vz,options);
    1111
    1212%keep only non NaN elements
     
    2121
    2222%process options: scaling factor?
    23 if isnan(options_structure.scaling),
    24         scalingfactor=0.40;
    25 elseif isnumeric(options_structure.scaling),
    26         scalingfactor=options_structure.scaling;
    27 else
    28         error('plot_quiver error message: scaling option other than scalaer or ''off'' not supported yet')
    29 end
     23scalingfactor=getfieldvalue(options,'scaling',0.40);
    3024
    3125%number of colors?
    32 if isnumeric(options_structure.colorlevels),
    33         if isnan(options_structure.colorlevels),
     26colorlevels=getfieldvalue(options,'colorlevels',NaN);
     27if isnumeric(colorlevels),
     28        if isnan(colorlevels),
    3429                numcolors=30;
    3530        else
    36                 numcolors=options_structure.colorlevels;
     31                numcolors=colorlevels;
    3732        end
    3833        levels=round_ice(linspace(Min,Max,numcolors+1),2);
    3934else
    40         levels=zeros(1,length(options_structure.colorlevels)+2);
     35        levels=zeros(1,length(colorlevels)+2);
    4136        levels(1)=Min;
    42         for i=1:length(options_structure.colorlevels)
    43                 levels(i+1)=options_structure.colorlevels{i};
     37        for i=1:length(colorlevels)
     38                levels(i+1)=colorlevels{i};
    4439        end
    4540        levels(end)=Max;
     
    6156
    6257%Scale data
    63 if ~isnan(options_structure.autoscale) & strcmpi(options_structure.autoscale,'off'),
     58if strcmpi(getfieldvalue(options,'autoscale','on'),'off'),
    6459        delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x);
    6560        u=scalingfactor*sqrt(delta)*u./Norm;
     
    8176
    8277%take care of colorbar
    83 if  ~strcmpi(options_structure.colorbar,'off'),
     78if  ~strcmpi(getfieldvalue(options,'colorbar','on'),'off'),
    8479
    8580        %build ticks
     
    10196        set(hcb,'YTickLabel',ticklabel,'YTick',tickpos);
    10297        %position
    103         if ~isnan(options_structure.colorbarpos),
    104                 set(hcb,'Position',options_structure.colorbarpos);
     98        if exist(options,'colorbarpos'),
     99                set(hcb,'Position',getfieldvalue(options,'colorbarpos'));
    105100        end
    106101        %fontsize
    107         if ~isnan(options_structure.fontsize),
    108                 fontsize=options_structure.fontsize;
    109         else
    110                 fontsize=14;
    111         end
     102        fontsize=getfieldvalue(options,'fontsize',14);
    112103        set(hcb,'FontSize',fontsize);
    113104end
  • issm/trunk/src/m/classes/public/plot/plot_riftfraction.m

    r1805 r2439  
    1 function plot_riftfraction(md,options_structure,width,i);
     1function plot_riftfraction(md,options,width,i);
    22%PLOT_RIFTRELVEL - plot rift fractions
    33%
    44%   Usage:
    5 %      plot_riftfraction(md,options_structure,width,i);
     5%      plot_riftfraction(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     
    1111
    1212%units
    13 if ~isnan(options_structure.unitmultiplier),
    14         md.x=md.x*options_structure.unitmultiplier;
    15         md.y=md.y*options_structure.unitmultiplier;
    16         md.z=md.z*options_structure.unitmultiplier;
     13if exist(options,'unit'),
     14        unit=getfieldvalue(options,'unit');
     15        md.x=md.x*unit;
     16        md.y=md.y*unit;
     17        md.z=md.z*unit;
    1718end
    1819
     
    4546
    4647%apply options
    47 if isnan(options_structure.title)
    48         options_structure.title='Rift relative velocities';
    49 end
    50 if isnan(options_structure.colorbar)
    51         options_structure.colorbar=0;
    52 end
    53 applyoptions(md,[],options_structure);
     48options=addfielddefault(options,'title','Rift relative velocities');
     49options=addfielddefault(options,'colorbar',0);
     50applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_riftpenetration.m

    r2267 r2439  
    1 function plot_rifpenetration(md,options_structure,width,i);
     1function plot_rifpenetration(md,options,width,i);
    22%PLOT_RIFTPENETRATION - plot rift penetration
    33%
    44%   Usage:
    5 %      plot_rifpenetration(md,options_structure,width,i);
     5%      plot_rifpenetration(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     
    1111
    1212%units
    13 if ~isnan(options_structure.unitmultiplier),
    14         md.x=md.x*options_structure.unitmultiplier;
    15         md.y=md.y*options_structure.unitmultiplier;
    16         md.z=md.z*options_structure.unitmultiplier;
     13if exist(options,'unit'),
     14        unit=getfieldvalue(options,'unit');
     15        md.x=md.x*unit;
     16        md.y=md.y*unit;
     17        md.z=md.z*unit;
    1718end
    1819
     
    7778
    7879%apply options
    79 if isnan(options_structure.title)
    80         options_structure.title='Rift Penetration';
    81 end
    82 if isnan(options_structure.colorbar)
    83         options_structure.colorbar=0;
    84 end
    85 applyoptions(md,[],options_structure);
     80options=addfielddefault(options,'title','Rift Penetration');
     81options=addfielddefault(options,'colorbar',0);
     82applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_riftrelvel.m

    r1784 r2439  
    1 function plot_riftrelvel(md,options_structure,width,i);
     1function plot_riftrelvel(md,options,width,i);
    22%PLOT_RIFTRELVEL - plot rift relative velocities
    33%
    44%   Usage:
    5 %      plot_riftrelvel(md,options_structure,width,i);
     5%      plot_riftrelvel(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     
    1111
    1212%units
    13 if ~isnan(options_structure.unitmultiplier),
    14         md.x=md.x*options_structure.unitmultiplier;
    15         md.y=md.y*options_structure.unitmultiplier;
    16         md.z=md.z*options_structure.unitmultiplier;
     13if exist(options,'unit'),
     14        unit=getfieldvalue(options,'unit');
     15        md.x=md.x*unit;
     16        md.y=md.y*unit;
     17        md.z=md.z*unit;
    1718end
    1819
     
    7980
    8081%apply options
    81 if isnan(options_structure.title)
    82         options_structure.title='Rift relative velocities';
    83 end
    84 if isnan(options_structure.colorbar)
    85         options_structure.colorbar=0;
    86 end
    87 applyoptions(md,[],options_structure);
     82options=addfielddefault(options,'title','Rift relative velocities');
     83options=addfielddefault(options,'colorbar',0);
     84applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_riftvel.m

    r1 r2439  
    1111
    1212%units
    13 if ~isnan(options_structure.unitmultiplier),
    14         md.x=md.x*options_structure.unitmultiplier;
    15         md.y=md.y*options_structure.unitmultiplier;
    16         md.z=md.z*options_structure.unitmultiplier;
     13if exist(options,'unit'),
     14        unit=getfieldvalue(options,'unit');
     15        md.x=md.x*unit;
     16        md.y=md.y*unit;
     17        md.z=md.z*unit;
    1718end
    1819
     
    7879
    7980%apply options
    80 if isnan(options_structure.title)
    81         options_structure.title='Rift Velocities';
    82 end
    83 if isnan(options_structure.colorbar)
    84         options_structure.colorbar=0;
    85 end
     81options=addfielddefault(options_structure,'title','Rift Velocities');
     82options=addfielddefault(options_structure,'colorbar',0);
    8683applyoptions(md,[],options_structure);
  • issm/trunk/src/m/classes/public/plot/plot_sarpwr.m

    r1 r2439  
    1 function plot_sarpwr(md,options_structure,width,i);
     1function plot_sarpwr(md,options,width,i);
    22%PLOT_SARPWR - plot radar image
    33%
    44%   Usage:
    5 %      plot_sarpwr(md,options_structure,width,i);
     5%      plot_sarpwr(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     
    1111
    1212%units
    13 if ~isnan(options_structure.unitmultiplier),
    14         md.x=md.x*options_structure.unitmultiplier;
    15         md.y=md.y*options_structure.unitmultiplier;
    16         md.z=md.z*options_structure.unitmultiplier;
     13if exist(options,'unit'),
     14        unit=getfieldvalue(options,'unit');
     15        md.x=md.x*unit;
     16        md.y=md.y*unit;
     17        md.z=md.z*unit;
    1718end
    1819                                       
     
    2021
    2122%apply options
    22 if isnan(options_structure.colorbar)
    23         options_structure.colorbar=0;
    24 end
    25 options_structure.colormap='gray';
     23options=addfielddefault(options,'colorbar',0);
     24options=changefieldvalue(options,'colormap','gray');
    2625
    27 applyoptions(md,[],options_structure);
     26applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_section.m

    r1969 r2439  
    1 function plot_section(md,data,options_structure,width,i)
     1function plot_section(md,data,options,width,i)
    22%PLOT_SECTION - plot a given field on a section
    33%
    44%   Usage:
    5 %      plot_section(md,options_structure,width,i);
     5%      plot_section(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
    88
    99%How many subplots?
    10 if ~isnan(options_structure.showsection)
     10if exist(options,'showsection')
    1111
    1212        %Compute the indexes of the 2 plots (one for the sectionvalue and one for showsection
     
    2121
    2222%process data and model
    23 [x_m y_m z_m elements_m is2d]=processmesh(md,options_structure);
    24 [data isongrid isquiver]=processdata(md,data,options_structure);
     23[x_m y_m z_m elements_m is2d]=processmesh(md,options);
     24[data isongrid isquiver]=processdata(md,data,options);
    2525
    2626%replug x and y onto model so that SectionValue treats the problem correctly
    27 if ~isnan(options_structure.layer)
     27if exist(options,'layer')
    2828        md.x=md.x2d; md.y=md.y2d; md.elements=md.elements2d; md.type='2d';
    2929end
    3030
    3131%resolution
    32 if ~isnan(options_structure.resolution),
    33         resolution=options_structure.resolution;
     32if exist(options,'resolution'),
     33        resolution=getfieldvalue(options,'resolution');
    3434else %Default resolution
    3535        resolution=[1000 10*md.numlayers];
     
    3838
    3939%Compute section value
    40 [elements,x,y,z,s,data_s]=SectionValues(md,data,options_structure.sectionvalue,resolution);
     40[elements,x,y,z,s,data_s]=SectionValues(md,data,getfieldvalue(options,'sectionvalue'),resolution);
    4141
    4242if is2d
    4343
    4444        %Show Section if requested by user
    45         if ~isnan(options_structure.showsection)
     45        if exist(options,'showsection')
    4646
    4747                %compute number of labels
    48                 numlabels=min(options_structure.showsection,length(s));
     48                numlabels=min(getfieldvalue(options,'showsection'),length(s));
    4949                shift=fix(length(s)/numlabels);
    5050
     
    5959                %plot section only with labels
    6060                subplot(width,width,index2)
    61                 plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,isquiver,options_structure)
     61                plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,isquiver,options)
    6262                hold on
    6363                text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8])
     
    7878        %plot section value
    7979        %if user requested view2: 2d plot with curvilinear coordinate
    80         if (~isnan(options_structure.view) & options_structure.view==2 )
     80        if (getfieldvalue(options,'view',3)==2 )
    8181
    8282                %Show Section if requested by user
    83                 if ~isnan(options_structure.showsection)
     83                if ~exist(options,'showsection')
    8484
    8585                        %compute number of labels
    86                         numlabels=min(options_structure.showsection,length(s));
     86                        numlabels=min(getfieldvalue(options,'showsection'),length(s));
    8787                        shift=fix(length(s)/numlabels);
    8888
     
    9797                        %plot section only with labels
    9898                        subplot(width,width,index2)
    99                         plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,isquiver,options_structure)
     99                        plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,isquiver,options)
    100100                        hold on
    101101                        text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8])
     
    116116
    117117                %Show Section if requested by user
    118                 if ~isnan(options_structure.showsection)
     118                if exist(options,'showsection')
    119119
    120120                        %compute number of labels
    121                         numlabels=min(options_structure.showsection,length(s));
     121                        numlabels=min(getfieldvalue(options,'showsection'),length(s));
    122122                        shift=fix(length(x)/numlabels);
    123123
     
    132132                        %plot section only with labels
    133133                        subplot(width,width,index2)
    134                         plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,isquiver,options_structure)
     134                        plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,isquiver,options)
    135135                        hold on
    136136                        text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8])
     
    153153
    154154%apply options
    155 if isnan(options_structure.title)
    156         options_structure.title='Section value';
     155if isnan(options.title)
     156        options=addfielddefault(options,'title','Section value');
    157157end
    158 if isnan(options_structure.colorbar) & strcmpi(md.type,'2d')
    159         options_structure.colorbar=0;
     158if strcmpi(md.type,'2d')
     159        options=addfielddefault(options,'colorbar',0);
    160160end
    161 if isnan(options_structure.xlabel) & (strcmpi(md.type,'2d') | options_structure.view==2 )
    162         options_structure.xlabel='Curvilinear coordinate';
     161if (strcmpi(md.type,'2d') | getfieldvalue(options,'view')==2 )
     162        options=addfielddefault(options,'xlabel','Curvilinear coordinate';
    163163end
    164 if isnan(options_structure.ylabel) & (strcmpi(md.type,'3d') & options_structure.view==2 )
    165         options_structure.ylabel='z';
     164if (strcmpi(md.type,'3d') & getfieldvalue(options,'view')==2 )
     165        options=addfielddefault(options,'ylabel','z';
    166166end
    167 applyoptions(md,[],options_structure);
     167applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_segmentnumbering.m

    r1 r2439  
    1 function plot_segmentnumbering(md,options_structure,width,i);
     1function plot_segmentnumbering(md,options,width,i);
    22%PLOT_SEGMENTNUMBERING - plot segment numbering
    33%
    44%   Usage:
    5 %      plot_segmentnumbering(md,options_structure,width,i);
     5%      plot_segmentnumbering(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     
    1111
    1212%process data and model
    13 [x y z segments is2d]=processmesh(md,options_structure);
     13[x y z segments is2d]=processmesh(md,options);
    1414
    1515error('not implemented yet');
     
    2121        for i=1:size(segments,1),
    2222                text(sum(x(segments(i,:)))/3,sum(y(segments(i,:)))/3,sum(z(segments(i,:)))/3,num2str(segmentnumbers(i)));
    23                 if ~isnan(options_structure.highlight) & ismember(segmentnumbers(i),options_structure.highlight)
     23                if ismember(segmentnumbers(i),getfieldvalue(options,'highlight',[]))
    2424                        A=segments(i,1); B=segments(i,2);  C=segments(i,3);
    2525                        patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
     
    3636        for i=1:size(segments,1),
    3737                text(sum(x(segments(i,:)))/6,sum(y(segments(i,:)))/6,sum(z(segments(i,:)))/6,num2str(segmentnumbers(i)));
    38                 if ~isnan(options_structure.highlight) & ismember(segmentnumbers(i),options_structure.highlight)
     38                if ismember(segmentnumbers(i),getfieldvalue(options,'highlight',[]))
    3939                        A=segments(i,1); B=segments(i,2);  C=segments(i,3);  D=segments(i,4); E=segments(i,5);  F=segments(i,6);
    4040                        patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
     
    4848
    4949%apply options
    50 if isnan(options_structure.title)
    51         options_structure.title='Element numbering';
    52 end
    53 if isnan(options_structure.colorbar)
    54         options_structure.colorbar=0;
    55 end
    56 applyoptions(options_structure);
     50options=addfielddefault(options,'title','Element numbering');
     51options=addfielddefault(options,'colorbar',0);
     52applyoptions(options);
  • issm/trunk/src/m/classes/public/plot/plot_segments.m

    r1110 r2439  
    1 function plot_segments(md,options_structure,width,i,datai);
     1function plot_segments(md,options,width,i,datai);
    22%PLOT_SEGMENTS - plot segments, with different colors according to segment markers.
    33%
    44%   Usage:
    5 %      plot_segments(md,options_structure,width,i);
     5%      plot_segments(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     
    1111
    1212%units
    13 if ~isnan(options_structure.unitmultiplier),
    14         md.x=md.x*options_structure.unitmultiplier;
    15         md.y=md.y*options_structure.unitmultiplier;
    16         md.z=md.z*options_structure.unitmultiplier;
     13if exist(options,'unit'),
     14        unit=getfieldvalue(options,'unit');
     15        md.x=md.x*unit;
     16        md.y=md.y*unit;
     17        md.z=md.z*unit;
    1718end
    1819
     
    4445
    4546%apply options
    46 if isnan(options_structure.title)
    47         options_structure.title='Segment boundaries';
    48 end
    49 if isnan(options_structure.colorbar)
    50         options_structure.colorbar=0;
    51 end
    52 applyoptions(md,[],options_structure);
     47options=addfielddefault(options,'title','Segment boundaries');
     48options=addfielddefault(options,'colorbar',0);
     49applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_streamlines.m

    r1740 r2439  
    1 function plot_streamlines(md,options_structure)
     1function plot_streamlines(md,options)
    22%PLOT_STREAMLINES - plot stream lines on a figure
    33%
    44%   Usage:
    5 %      plot_streamlines(md,options_structure)
     5%      plot_streamlines(md,options)
    66
    77%some options
     
    1010
    1111%process data and model
    12 [x y z index is2d]=processmesh(md,options_structure);
    13 [u isongrid isquiver]=processdata(md,md.vx,options_structure);
    14 [v isongrid isquiver]=processdata(md,md.vy,options_structure);
     12[x y z index is2d]=processmesh(md,options);
     13[u isongrid isquiver]=processdata(md,md.vx,options);
     14[v isongrid isquiver]=processdata(md,md.vy,options);
    1515
    1616%some checks
     
    2525
    2626%initialize flowpath
    27 if iscell(options_structure.streamlines)
     27streamlines=getfieldvalue(options,'streamlines');
     28if iscell(streamlines)
    2829        x0=[]; y0=[];
    29         for i=1:size(options_structure.streamlines,2)
    30                 coord=options_structure.streamlines{i};
     30        for i=1:size(streamlines,2)
     31                coord=streamlines{i};
    3132                x0=[x0;coord(1)]; y0=[y0;coord(2)];
    3233        end
    3334else
    34         x0=x(1:ceil(length(x)/options_structure.streamlines):end);
    35         y0=y(1:ceil(length(x)/options_structure.streamlines):end);
     35        x0=x(1:ceil(length(x)/streamlines):end);
     36        y0=y(1:ceil(length(x)/streamlines):end);
    3637end
    3738
  • issm/trunk/src/m/classes/public/plot/plot_tensor.m

    r742 r2439  
    1 function plot_tensor(md,options_structure,width,i,type);
     1function plot_tensor(md,options,width,i,type);
    22%PLOT_TENSOR - plot tensor components
    33%
    44%   Usage:
    5 %      plot_tensor(md,options_structure,width,i);
     5%      plot_tensor(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     
    2727%Figure out type of plot being requested
    2828if strncmpi(fliplr(type),fliplr('tensor'),6) | strcmpi(type,'strainrate') | strcmpi(type,'deviatoricstress') | strcmpi(type,'stress'),
    29         plot_tensor_components(md,options_structure,width,i,tensor,type,plot_options);
     29        plot_tensor_components(md,options,width,i,tensor,type,plot_options);
    3030        return;
    3131elseif strncmpi(fliplr(type),fliplr('principal'),9),
    32         plot_tensor_principal(md,options_structure,width,i,tensor,type,plot_options);
     32        plot_tensor_principal(md,options,width,i,tensor,type,plot_options);
    3333        return;
    3434elseif strncmpi(fliplr(type(1:end-1)),fliplr('principalaxis'),13),
    35         plot_tensor_principalaxis(md,options_structure,width,i,tensor,type,plot_options);
     35        plot_tensor_principalaxis(md,options,width,i,tensor,type,plot_options);
    3636        return;
    3737else
  • issm/trunk/src/m/classes/public/plot/plot_tensor_components.m

    r1740 r2439  
    1 function plot_tensor_components(md,options_structure,width,i,tensor,type,plot_options);
     1function plot_tensor_components(md,options,width,i,tensor,type,plot_options);
    22%PLOT_TENSOR_COMPONENT - plot component of a tensor
    33%
    44%   Usage:
    5 %      plot_tensor_components(md,options_structure,width,i,tensor,type,plot_option);
     5%      plot_tensor_components(md,options,width,i,tensor,type,plot_option);
    66%
    77%   See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER
     
    2424
    2525%process data and model
    26 [x y z elements is2d]=processmesh(md,options_structure);
    27 [tensor.xx isongrid isquiver]=processdata(md,tensor.xx,options_structure);
    28 [tensor.yy isongrid isquiver]=processdata(md,tensor.yy,options_structure);
    29 [tensor.xy isongrid isquiver]=processdata(md,tensor.xy,options_structure);
     26[x y z elements is2d]=processmesh(md,options);
     27[tensor.xx isongrid isquiver]=processdata(md,tensor.xx,options);
     28[tensor.yy isongrid isquiver]=processdata(md,tensor.yy,options);
     29[tensor.xy isongrid isquiver]=processdata(md,tensor.xy,options);
    3030if  strcmpi(md.type,'3d')
    31         [tensor.xz isongrid isquiver]=processdata(md,tensor.xz,options_structure);
    32         [tensor.yz isongrid isquiver]=processdata(md,tensor.yz,options_structure);
    33         [tensor.zz isongrid isquiver]=processdata(md,tensor.zz,options_structure);
     31        [tensor.xz isongrid isquiver]=processdata(md,tensor.xz,options);
     32        [tensor.yz isongrid isquiver]=processdata(md,tensor.yz,options);
     33        [tensor.zz isongrid isquiver]=processdata(md,tensor.zz,options);
    3434end
    3535
    3636if (strcmpi(md.type,'2d')),
    3737        subplot(2*width,2*width,index1),
    38         plot_unit(x,y,z,elements,tensor.xx,isongrid,is2d,isquiver,options_structure)
    39         Apply_options_tensor(md,options_structure,type,'xx')
     38        plot_unit(x,y,z,elements,tensor.xx,isongrid,is2d,isquiver,options)
     39        Apply_options_tensor(md,options,type,'xx')
    4040        subplot(2*width,2*width,index2),
    41         plot_unit(x,y,z,elements,tensor.yy,isongrid,is2d,isquiver,options_structure)
    42         Apply_options_tensor(md,options_structure,type,'yy')
     41        plot_unit(x,y,z,elements,tensor.yy,isongrid,is2d,isquiver,options)
     42        Apply_options_tensor(md,options,type,'yy')
    4343        subplot(2*width,2*width,index3),
    44         plot_unit(x,y,z,elements,tensor.xy,isongrid,is2d,isquiver,options_structure)
    45         Apply_options_tensor(md,options_structure,type,'xy')
     44        plot_unit(x,y,z,elements,tensor.xy,isongrid,is2d,isquiver,options)
     45        Apply_options_tensor(md,options,type,'xy')
    4646else
    4747        subplot(3*width,3*width,index1),
    48         plot_unit(x,y,z,elements,tensor.xx,isongrid,is2d,isquiver,options_structure)
    49         Apply_options_tensor(md,options_structure,type,'xx')
     48        plot_unit(x,y,z,elements,tensor.xx,isongrid,is2d,isquiver,options)
     49        Apply_options_tensor(md,options,type,'xx')
    5050        subplot(3*width,3*width,index2),
    51         plot_unit(x,y,z,elements,tensor.yy,isongrid,is2d,isquiver,options_structure)
    52         Apply_options_tensor(md,options_structure,type,'yy')
     51        plot_unit(x,y,z,elements,tensor.yy,isongrid,is2d,isquiver,options)
     52        Apply_options_tensor(md,options,type,'yy')
    5353        subplot(3*width,3*width,index3),
    54         plot_unit(x,y,z,elements,tensor.zz,isongrid,is2d,isquiver,options_structure)
    55         Apply_options_tensor(md,options_structure,type,'zz')
     54        plot_unit(x,y,z,elements,tensor.zz,isongrid,is2d,isquiver,options)
     55        Apply_options_tensor(md,options,type,'zz')
    5656        subplot(3*width,3*width,index4),
    57         plot_unit(x,y,z,elements,tensor.xy,isongrid,is2d,isquiver,options_structure)
    58         Apply_options_tensor(md,options_structure,type,'xy')
     57        plot_unit(x,y,z,elements,tensor.xy,isongrid,is2d,isquiver,options)
     58        Apply_options_tensor(md,options,type,'xy')
    5959        subplot(3*width,3*width,index5),
    60         plot_unit(x,y,z,elements,tensor.xz,isongrid,is2d,isquiver,options_structure)
    61         Apply_options_tensor(md,options_structure,type,'xz')
     60        plot_unit(x,y,z,elements,tensor.xz,isongrid,is2d,isquiver,options)
     61        Apply_options_tensor(md,options,type,'xz')
    6262        subplot(3*width,3*width,index6),
    63         plot_unit(x,y,z,elements,tensor.yz,isongrid,is2d,isquiver,options_structure)
    64         Apply_options_tensor(md,options_structure,type,'yz')
     63        plot_unit(x,y,z,elements,tensor.yz,isongrid,is2d,isquiver,options)
     64        Apply_options_tensor(md,options,type,'yz')
    6565end
    6666end
    6767
    68 function Apply_options_tensor(md,options_structure,type,component)
     68function Apply_options_tensor(md,options,type,component)
    6969        %apply options
    70         if isnan(options_structure.title)
    71                 if ismember('_',type) %user plotet stress_tensor
    72                         strings=strsplit(type,'_');
    73                         string=strings{1};
    74                 else %default plot: user requested stress
    75                         string=type;
    76                 end
    77                 options_structure.title=[upper(string(1)) string(2:end) ' ' component];
    78         end
    79         applyoptions(md,[],options_structure);
     70        if ismember('_',type) %user plotet stress_tensor
     71                strings=strsplit(type,'_');
     72                string=strings{1};
     73        else %default plot: user requested stress
     74                string=type;
     75        end
     76        options=addfielddefault(options,'title',[upper(string(1)) string(2:end) ' ' component]);
     77        applyoptions(md,[],options);
    8078end
  • issm/trunk/src/m/classes/public/plot/plot_tensor_principal.m

    r1740 r2439  
    1 function plot_tensor_principal(md,options_structure,width,i,tensor,type,plot_options);
     1function plot_tensor_principal(md,options,width,i,tensor,type,plot_options);
    22%PLOT_TENSOR_PRINCIPAL - plot principal values
    33%
    44%   Usage:
    5 %      plot_tensor_principal(md,options_structure,width,i,tensor,type,plot_options);
     5%      plot_tensor_principal(md,options,width,i,tensor,type,plot_options);
    66%
    77%   See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER
     
    2828%plot principal axis
    2929type1=[type 'axis1'];
    30 plot_tensor_principalaxis(md,options_structure,newwidth,index1,tensor,type1,plot_options);
     30plot_tensor_principalaxis(md,options,newwidth,index1,tensor,type1,plot_options);
    3131type2=[type 'axis2'];
    32 plot_tensor_principalaxis(md,options_structure,newwidth,index2,tensor,type2,plot_options);
     32plot_tensor_principalaxis(md,options,newwidth,index2,tensor,type2,plot_options);
    3333if  strcmpi(md.type,'3d')
    3434        type3=[type 'axis3'];
    35         plot_tensor_principalaxis(md,options_structure,newwidth,index3,tensor,type3,plot_options);
     35        plot_tensor_principalaxis(md,options,newwidth,index3,tensor,type3,plot_options);
    3636end
    3737
    3838%now plot principal values
    39 [x y z elements is2d]=processmesh(md,options_structure);
    40 [tensor.principalvalue1 isongrid isquiver]=processdata(md,tensor.principalvalue1,options_structure);
    41 [tensor.principalvalue2 isongrid isquiver]=processdata(md,tensor.principalvalue2,options_structure);
     39[x y z elements is2d]=processmesh(md,options);
     40[tensor.principalvalue1 isongrid isquiver]=processdata(md,tensor.principalvalue1,options);
     41[tensor.principalvalue2 isongrid isquiver]=processdata(md,tensor.principalvalue2,options);
    4242if  strcmpi(md.type,'3d')
    43         [tensor.principalvalue3 isongrid isquiver]=processdata(md,tensor.principalvalue3,options_structure);
     43        [tensor.principalvalue3 isongrid isquiver]=processdata(md,tensor.principalvalue3,options);
    4444end
    4545
    4646if (strcmpi(md.type,'2d')),
    4747        subplot(2*width,2*width,index3)
    48         plot_unit(x,y,z,elements,tensor.principalvalue1,isongrid,is2d,isquiver,options_structure)
    49         Apply_options_tensor(md,options_structure,type,'principal value 1')
     48        plot_unit(x,y,z,elements,tensor.principalvalue1,isongrid,is2d,isquiver,options)
     49        Apply_options_tensor(md,options,type,'principal value 1')
    5050        subplot(2*width,2*width,index4)
    51         plot_unit(x,y,z,elements,tensor.principalvalue2,isongrid,is2d,isquiver,options_structure)
    52         Apply_options_tensor(md,options_structure,type,'principal value 2')
     51        plot_unit(x,y,z,elements,tensor.principalvalue2,isongrid,is2d,isquiver,options)
     52        Apply_options_tensor(md,options,type,'principal value 2')
    5353else
    5454        subplot(3*width,3*width,index4)
    55         plot_unit(x,y,z,elements,tensor.principalvalue1,isongrid,is2d,isquiver,options_structure)
    56         Apply_options_tensor(md,options_structure,type,'principal value 1')
     55        plot_unit(x,y,z,elements,tensor.principalvalue1,isongrid,is2d,isquiver,options)
     56        Apply_options_tensor(md,options,type,'principal value 1')
    5757        subplot(3*width,3*width,index5)
    58         plot_unit(x,y,z,elements,tensor.principalvalue2,isongrid,is2d,isquiver,options_structure)
    59         Apply_options_tensor(md,options_structure,type,'principal value 2')
     58        plot_unit(x,y,z,elements,tensor.principalvalue2,isongrid,is2d,isquiver,options)
     59        Apply_options_tensor(md,options,type,'principal value 2')
    6060        subplot(3*width,3*width,index6)
    61         plot_unit(x,y,z,elements,tensor.principalvalue3,isongrid,is2d,isquiver,options_structure)
    62         Apply_options_tensor(md,options_structure,type,'principal value 3')
     61        plot_unit(x,y,z,elements,tensor.principalvalue3,isongrid,is2d,isquiver,options)
     62        Apply_options_tensor(md,options,type,'principal value 3')
    6363end
    6464end
    6565
    66 function Apply_options_tensor(md,options_structure,type,component)
     66function Apply_options_tensor(md,options,type,component)
    6767%apply options
    68         if isnan(options_structure.title)
    69                 if ismember('_',type) %user plotet stress_tensor
    70                         strings=strsplit(type,'_');
    71                         string=strings{1};
    72                 else %default plot: user requested stress
    73                         string=type;
    74                 end
    75                 options_structure.title=[upper(string(1)) string(2:end) ' ' component];
    76         end
    77         applyoptions(md,[],options_structure);
     68if ismember('_',type) %user plotet stress_tensor
     69        strings=strsplit(type,'_');
     70        string=strings{1};
     71else %default plot: user requested stress
     72        string=type;
    7873end
     74options=addfielddefault(options,'title',[upper(string(1)) string(2:end) ' ' component]);
     75        applyoptions(md,[],options);
     76end
  • issm/trunk/src/m/classes/public/plot/plot_tensor_principalaxis.m

    r1740 r2439  
    1 function plot_tensor_principalaxis(md,options_structure,width,i,tensor,type,plot_options);
     1function plot_tensor_principalaxis(md,options,width,i,tensor,type,plot_options);
    22%PLOT_TENSOR_PRINCIPALAXIS - plot ytensor principal axis
    33%
    44%   Usage:
    5 %      plot_tensor_principalaxis(md,options_structure,width,i);
     5%      plot_tensor_principalaxis(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     
    1111
    1212%process data and model
    13 [x y z elements is2d]=processmesh(md,options_structure);
     13[x y z elements is2d]=processmesh(md,options);
    1414
    1515if (strcmpi(md.type,'2d')),
    1616        eval(['Vx=tensor.principalaxis' type(end) '(:,1); Vy=tensor.principalaxis' type(end) '(:,2);'])
    1717        eval(['value=tensor.principalvalue' type(end) ';']);
    18         [Vx isongrid isquiver]=processdata(md,Vx,options_structure);
    19         [Vy isongrid isquiver]=processdata(md,Vy,options_structure);
    20         [value isongrid isquiver]=processdata(md,value,options_structure);
     18        [Vx isongrid isquiver]=processdata(md,Vx,options);
     19        [Vy isongrid isquiver]=processdata(md,Vy,options);
     20        [value isongrid isquiver]=processdata(md,value,options);
    2121else
    2222        eval(['Vx=tensor.principalaxis' type(end) '(:,1); Vy=tensor.principalaxis' type(end) '(:,2); Vz=tensor.principalaxis' type(end) '(:,3);'])
    23         [Vx isongrid isquiver]=processdata(md,Vx,options_structure);
    24         [Vy isongrid isquiver]=processdata(md,Vy,options_structure);
    25         [Vz isongrid isquiver]=processdata(md,Vz,options_structure);
    26         [value isongrid isquiver]=processdata(md,value,options_structure);
     23        [Vx isongrid isquiver]=processdata(md,Vx,options);
     24        [Vy isongrid isquiver]=processdata(md,Vy,options);
     25        [Vz isongrid isquiver]=processdata(md,Vz,options);
     26        [value isongrid isquiver]=processdata(md,value,options);
    2727end
    2828
     
    3636
    3737        %density
    38         if ~isnan(options_structure.density)
    39                 x=x(1:options_structure.density:end);
    40                 y=y(1:options_structure.density:end);
    41                 Vx=Vx(1:options_structure.density:end);
    42                 Vy=Vy(1:options_structure.density:end);
    43                 value=value(1:options_structure.density:end);
     38        if exist(options,'density')
     39                density=getfieldvalue(options,'density');
     40                x=x(1:density:end);
     41                y=y(1:density:end);
     42                Vx=Vx(1:density:end);
     43                Vy=Vy(1:density:end);
     44                value=value(1:density:end);
    4445        end
    4546
     
    5758else
    5859        %density
    59         if ~isnan(options_structure.density)
    60                 x=x(1:options_structure.density:end);
    61                 y=y(1:options_structure.density:end);
    62                 z=z(1:options_structure.density:end);
    63                 Vx=Vx(1:options_structure.density:end);
    64                 Vy=Vy(1:options_structure.density:end);
    65                 Vz=Vz(1:options_structure.density:end);
    66                 value=value(1:options_structure.density:end);
     60        if exist(options,'density')
     61                density=getfieldvalue(options,'density');
     62                x=x(1:density:end);
     63                y=y(1:density:end);
     64                z=z(1:density:end);
     65                Vx=Vx(1:density:end);
     66                Vy=Vy(1:density:end);
     67                Vz=Vz(1:density:end);
     68                value=value(1:density:end);
    6769        end
    6870
     
    8789
    8890%apply options
    89 if isnan(options_structure.title)
    90         strings=strsplit(type,'_');
    91         string=strings{1};
    92         options_structure.title=[upper(string(1)) string(2:end) ' principal axis ' type(end)];
    93 end
    94 if isnan(options_structure.colorbar)
    95         options_structure.colorbar=0;
    96 end
    97 applyoptions(md,[],options_structure);
     91strings=strsplit(type,'_');
     92string=strings{1};
     93options=addfielddefault(options,'title',[upper(string(1)) string(2:end) ' principal axis ' type(end)]);
     94options=addfielddefault(options,'colorbar',0);
     95applyoptions(md,[],options);
  • issm/trunk/src/m/classes/public/plot/plot_thermaltransient_results.m

    r1 r2439  
    1 function plot_thermaltransient_results(md,options_structure,width,i)
     1function plot_thermaltransient_results(md,options,width,i)
    22%PLOT_THERMALTRANSIENT_RESULTS - plot  results of a thermal transient solution
    33%
    44%   Usage:
    5 %      plot_thermaltransient_results(md,options_structure,width,i);
     5%      plot_thermaltransient_results(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     
    1111        string=[string ',''data'',''thermaltransient_results(' num2str(i) ').temperature'',''view'',3,''title'',''Temperature at time ' num2str(md.thermaltransient_results(i).time) ' a'''];
    1212end
    13 string=[string ',''figure'',1,''colorbar#all'',''on'',''view'',3,''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' options_structure.fontweight ');'];
     13string=[string ',''figure'',1,''colorbar#all'',''on'',''view'',3,''fontsize'',' num2str(options.fontsize) ',''fontweight'',' options.fontweight ');'];
    1414eval(string);
    1515clear string;
     
    1919        string=[string ',''data'',md.thermaltransient_results(' num2str(i) ').temperature-md.thermaltransient_results(' num2str(i-1) ').temperature,''view'',3,''title'',''Delta temperature at time ' num2str(md.thermaltransient_results(i).time) ' a'''];
    2020end
    21 string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' options_structure.fontweight ');'];
     21string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' num2str(options.fontsize) ',''fontweight'',' options.fontweight ');'];
    2222eval(string);
    2323clear string;
  • issm/trunk/src/m/classes/public/plot/plot_transient_movie.m

    r2240 r2439  
    1 function plot_transient_movie(md,options_structure,width,i);
     1function plot_transient_movie(md,options,width,i);
    22%PLOT_TRANSIENT_MOVIE - plot a transient result as a movie
    33%   Usage:
    4 %      plot_transient_movie(md,options_structure,width,i);
     4%      plot_transient_movie(md,options,width,i);
    55%
    66%   See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER
     
    1010
    1111        %xlim
    12         if ~isnan(options_structure.transient_movie_field),
    13                 field=options_structure.transient_movie_field;
     12        if ~exist(options,'transient_movie_field'),
     13                field=getfieldvalue(options,'transient_movie_field');
    1414        else
    1515                error('specify transient_movie_field in options list');
     
    1717
    1818        %process model
    19         [x y z elements is2d]=processmesh(md,options_structure);
     19        [x y z elements is2d]=processmesh(md,options);
    2020
    2121        %loop over the time steps
     
    2424
    2525                %process data
    26                 [data isongrid isquiver]=processdata(md,data,options_structure);
     26                [data isongrid isquiver]=processdata(md,data,options);
    2727                titlestring=[field ' at time ' num2str(md.results.transient(i).time) ' year'];
    28                 plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options_structure)
    29                 apply_options_movie(md,options_structure,titlestring);
     28                plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options)
     29                apply_options_movie(md,options,titlestring);
    3030               
    31                 if ~isnan(options_structure.transient_movie_output),
     31                if exist(options,'transient_movie_output'),
    3232                        set(gcf,'Renderer','zbuffer','color','white'); %fixes a bug on Mac OS X (not needed in future Matlab version)
    3333                        if i==1,
     
    4646
    4747        %output movie if requested.
    48         if ~isnan(options_structure.transient_movie_output),
    49                 filename=options_structure.transient_movie_output;
    50                 imwrite(images,map,filename,'DelayTime',options_structure.transient_movie_time,'LoopCount',inf)
     48        if exist(options,'transient_movie_output'),
     49                filename=getfieldvalue(options,'transient_movie_output');
     50                imwrite(images,map,filename,'DelayTime',getfieldvalue(options,'transient_movie_time',2),'LoopCount',inf)
    5151        end
    5252
    5353end %function
    5454
    55 function apply_options_movie(md,options_structure,titlestring)
     55function apply_options_movie(md,options,titlestring)
    5656        %apply options
    57         if isnan(options_structure.title)
    58                 options_structure.title=titlestring;
    59         end
    60         if isnan(options_structure.colorbar)
    61                 options_structure.colorbar=1;
    62         end
    63         applyoptions(md,[],options_structure);
     57        options=addfielddefault(options,'title',titlestring);
     58        options=addfielddefault(options,'colorbar',1);
     59        applyoptions(md,[],options);
    6460end
  • issm/trunk/src/m/classes/public/plot/plot_transient_results.m

    r2267 r2439  
    1 function plot_transient_results(md,options_structure,width,i)
     1function plot_transient_results(md,options,width,i)
    22%PLOT_TRANSIENT_RESULTS - plot transient results
    33%
    44%   Usage:
    5 %      plot_transient_results(md,options_structure,width,i);
     5%      plot_transient_results(md,options,width,i);
    66%
    77%   See also: PLOTMODEL
     8
     9fontsize=getfieldvalue(options,'fontsize',14);
     10fontweight=getfieldvalue(options,'fontweight','n');
    811
    912%Prepare window distribution
     
    2629        string=[string ',''data'',md.results.transient(' num2str(i) ').thickness,''title'',''Thickness at time ' num2str(md.results.transient(i).time) ' a'''];
    2730end
    28 string=[string ',''figure'',1,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight) ');'];
     31string=[string ',''figure'',1,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight ');'];
    2932eval(string);
    3033clear string;
     
    3437        string=[string ',''data'',md.results.transient(' num2str(i) ').vel,''view'',3,''title'',''Velocity at time ' num2str(md.results.transient(i).time) ' a'''];
    3538end
    36 string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)  ');'];
     39string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight  ');'];
    3740eval(string);
    3841clear string;
     
    4346                string=[string ',''data'',md.results.transient(' num2str(i) ').temperature,''view'',3,''title'',''Temperature at time ' num2str(md.results.transient(i).time) ' a'''];
    4447        end
    45         string=[string ',''figure'',3,''colorbar#all'',''on'',''view'',3,''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)  ');'];
     48        string=[string ',''figure'',3,''colorbar#all'',''on'',''view'',3,''fontsize'',' fontsize ',''fontweight'',' fontweight  ');'];
    4649        eval(string);
    4750        clear string;
     
    5255        string=[string ',''data'',md.results.transient(' num2str(i) ').thickness-md.results.transient(' num2str(i-1) ').thickness,''title'',''Delta thickness at time ' num2str(md.results.transient(i).time) ' a'''];
    5356end
    54 string=[string ',''figure'',4,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)  ');'];
     57string=[string ',''figure'',4,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight  ');'];
    5558eval(string);
    5659clear string;
     
    6063        string=[string ',''data'',md.results.transient(' num2str(i) ').vel-md.results.transient(' num2str(i-1) ').vel,''view'',3,''title'',''Delta velocity at time ' num2str(md.results.transient(i).time) ' a'''];
    6164end
    62 string=[string ',''figure'',5,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)  ');'];
     65string=[string ',''figure'',5,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight  ');'];
    6366eval(string);
    6467clear string;
     
    6972                string=[string ',''data'',md.results.transient(' num2str(i) ').temperature-md.results.transient(' num2str(i-1) ').temperature,''view'',3,''title'',''Delta temperature at time ' num2str(md.results.transient(i).time) ' a'''];
    7073        end
    71         string=[string ',''figure'',6,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)  ');'];
     74        string=[string ',''figure'',6,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight  ');'];
    7275        eval(string);
    7376        clear string;
  • issm/trunk/src/m/classes/public/plot/plot_unit.m

    r1744 r2439  
    1 function plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options_structure)
     1function plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options)
    22%PLOT_UNIT - unit plot, display data
    33%
    44%   Usage:
    5 %      plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options_structure);
     5%      plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options);
    66%
    77%   See also: PLOTMODEL, PLOT_MANAGER
    88
    9 %edgecolor?
    10 if ~isnan(options_structure.edgecolor),
    11         edgecolor=options_structure.edgecolor;
    12 else
    13         edgecolor='none';
    14 end
     9%edgecolor
     10edgecolor=getfieldvalue(options,'edgecolor','none');
    1511
    1612%regular plot
     
    5349        if isongrid,
    5450                if is2d,
    55                         plot_quiver(x,y,data(:,1),data(:,2),options_structure);
     51                        plot_quiver(x,y,data(:,1),data(:,2),options);
    5652                else
    57                         plot_quiver3(x,y,z,data(:,1),data(:,2),data(:,3),options_structure);
     53                        plot_quiver3(x,y,z,data(:,1),data(:,2),data(:,3),options);
    5854                end
    5955        else
  • issm/trunk/src/m/classes/public/plot/plotmodel.m

    r338 r2439  
    77end
    88
    9 %First go through varargin and  figure out how many subplots we are going to make
    10 datavalues=findarg(varargin,'data');
    11 numberofplots=length(datavalues);
    12 subplotwidth=ceil(sqrt(numberofplots));
     9%First process options
     10options=plotoptions(varargin{:});
    1311
    14 %Get figure number
    15 figurevalues=findarg(varargin,'figure');
    16 if ~isempty(figurevalues),
    17         if length(figurevalues)>1,
    18                 error('plotmodel error message: only one figure allowed');
    19         else
    20                 figurenumber=figurevalues.value;
    21         end
    22 else
    23         figurenumber=1;
    24 end
     12%get numberof subplot
     13subplotwidth=ceil(sqrt(options.numberofplots));
     14
     15%Get figure number and number of plots
     16figurenumber=options.figurenumber;
     17numberofplots=options.numberofplots;
    2518
    2619%go through subplots
    2720if numberofplots,
    2821               
    29         %recover options  for all subplots.
    30         options=recover_plot_options(md,varargin,numberofplots);
    31        
    3222        %Create figure
    3323        figure(figurenumber),clf;
     
    3727
    3828                %call unit plot
    39                 plot_manager(md,options{i},subplotwidth,i);
     29                plot_manager(md,options.list{i},subplotwidth,i);
    4030
    4131        end
  • issm/trunk/src/m/classes/public/plot/processdata.m

    r2426 r2439  
    1 function [data isongrid isquiver]=processdata(md,data,options_structure);
     1function [data isongrid isquiver]=processdata(md,data,options);
    22%PROCESSDATA - process data to be plotted
    33%
    44%   Usage:
    5 %      [data isongrid isquiver]=processdata(md,data,options_structure);
     5%      [data isongrid isquiver]=processdata(md,data,options);
    66%
    77%   See also: PLOTMODEL, PROCESSMESH
     
    6767
    6868%smoothing?
    69 if ~isnan(options_structure.smooth)
    70         data=averaging(md,data,options_structure.smooth);
     69if exist(options,'smooth')
     70        data=averaging(md,data,getfieldvalue(options,'smooth'));
     71        datasize(1)=md.numberofgrids;
    7172        %---> go to grid data
    7273end
     
    7778
    7879        %ice sheet only?
    79         if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf,
     80        if getfieldvalue(options,'iceshelf',0),
    8081                data(find(md.elementoniceshelf),:)=NaN;
    8182        end
    8283        %ice shelf only?
    83         if ~isnan(options_structure.noicesheet) & options_structure.noicesheet,
     84        if getfieldvalue(options,'icesheet',0),
    8485                data(find(~md.elementoniceshelf),:)=NaN;
    8586        end
    8687        %no water?
    87         if ~isnan(options_structure.nowater) & options_structure.nowater,
     88        if getfieldvalue(options,'water',0),
    8889                data(find(md.elementonwater),:)=NaN;
    8990        end
    9091        %log?
    91         if ~isnan(options_structure.log),
     92        if exist(options,'log'),
    9293                pos=find(~isnan(data));
    93                 data(pos)=log(data(pos))/log(options_structure.log);
     94                data(pos)=log(data(pos))/log(getfieldvalue(options,'log'));
    9495        end
    9596end
     
    99100        isongrid=1;
    100101        %ice sheet only?
    101         if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf,
     102        if getfieldvalue(options,'iceshelf',0),
    102103                pos=find(md.gridoniceshelf);
    103104                data(pos,:)=NaN;
    104105        end
    105106        %ice shelf only?
    106         if ~isnan(options_structure.noiceshelf) & options_structure.noicesheet,
     107        if getfieldvalue(options,'icesheet',0),
    107108                pos=find(md.gridonicesheet);
    108109                data(pos,:)=NaN;
    109110        end
    110111        %no water?
    111         if ~isnan(options_structure.nowater) & options_structure.nowater,
     112        if getfieldvalue(options,'water',0),
    112113                pos=find(md.gridonwater);
    113114                data(pos,:)=NaN;
    114115        end
    115116        %log?
    116         if ~isnan(options_structure.log),
    117                 data=log(data)/log(options_structure.log);
     117        if exist(options,'log'),
     118                data=log(data)/log(getfieldvalue(options,'log'));
    118119        end
    119120
     
    121122
    122123%layer projection?
    123 if ~isnan(options_structure.layer) & options_structure.layer>=1,
    124         data=project2d(md,data,options_structure.layer); %project onto 2d mesh
     124if getfieldvalue(options,'layer',0)>=1,
     125        data=project2d(md,data,getfieldvalue(options,'layer')); %project onto 2d mesh
    125126end
    126127
    127128%control arrow density if quiverplot
    128 if isquiver & ~isnan(options_structure.density)
     129if isquiver & exist(options,'density')
    129130        databak=data;
    130131        data=NaN*ones(datasize);
    131         data(1:options_structure.density:end,:)=databak(1:options_structure.density:end,:);
     132        density=getfieldvalue(options,'density');
     133        data(1:density:end,:)=databak(1:density:end,:);
    132134        clear databak
    133135end
  • issm/trunk/src/m/classes/public/plot/processmesh.m

    r1 r2439  
    1 function [x y z elements is2d]=processmesh(md,options_structure);
     1function [x y z elements is2d]=processmesh(md,options);
    22%PROCESSMESH - process mesh to be plotted
    33%
    44%   Usage:
    5 %      [x y z elements is2d]=processmesh(md,options_structure)
     5%      [x y z elements is2d]=processmesh(md,options)
    66%
    77%   See also: PLOTMODEL, PROCESSDATA
     
    2727        is2d=1;
    2828else
    29         if ~isnan(options_structure.layer) & options_structure.layer>=1,
     29        if getfieldvalue(options,'layer',0)>=1,
    3030                is2d=1;
    3131        else
     
    3535
    3636%layer projection?
    37 if ~isnan(options_structure.layer) & options_structure.layer>=1,
     37if getfieldvalue(options,'layer',0)>=1,
    3838        %we modify the mesh temporarily to a 2d mesh from which the 3d mesh was extruded.
    3939        x=x2d;
     
    4545
    4646%units
    47 if ~isnan(options_structure.unitmultiplier),
    48         x=x*options_structure.unitmultiplier;
    49         y=y*options_structure.unitmultiplier;
    50         z=z*options_structure.unitmultiplier;
     47if exist(options,'unit'),
     48        unit=getfieldvalue(options,'unit');
     49        x=x*unit;
     50        y=y*unit;
     51        z=z*unit;
    5152end
Note: See TracChangeset for help on using the changeset viewer.