Changeset 2439
- Timestamp:
- 10/20/09 09:00:51 (15 years ago)
- 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 15 15 16 16 %Recover option 17 bool= ismember(field,pairoptions.list(:,1));17 bool=any(strcmpi(field,pairoptions.list(:,1))); -
issm/trunk/src/m/classes/@plotoptions/buildlist.m
r2404 r2439 13 13 rawoptions=pairoptions(varargin{:}); 14 14 15 %get figure number 16 plotoptions.figurenumber=getfieldvalue(rawoptions,'figure',1); 17 15 18 %get number of data to be plotted 16 19 numberofplots=fieldoccurences(rawoptions,'data'); … … 26 29 for i=1:size(rawoptions.list,1), 27 30 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}), 38 33 39 34 %get suplot(s) associated … … 42 37 field=string{1}; 43 38 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 46 49 47 50 %assign option field to corresponding subplot … … 63 66 end 64 67 end 68 69 %check that there is no duplicates 70 for i=1:numberofplots, 71 plotoptions.list{i}=deleteduplicates(plotoptions.list{i},1); 72 end -
issm/trunk/src/m/classes/@plotoptions/display.m
r2404 r2439 6 6 disp(sprintf('\n%s = \n',inputname(1))); 7 7 disp(sprintf(' numberofplots: %i',plotoptions.numberofplots)); 8 disp(sprintf(' figurenumber: %i',plotoptions.figurenumber)); 8 9 if ~isempty(plotoptions.list), 9 10 disp(sprintf(' list: (%ix%i)',size(plotoptions.list,1),size(plotoptions.list,2))); -
issm/trunk/src/m/classes/@plotoptions/plotoptions.m
r2404 r2439 13 13 14 14 options.numberofplots=0; 15 options.figurenumber=1; 15 16 options.list=cell(0,0); 16 17 options=class(options,'plotoptions'); -
issm/trunk/src/m/classes/public/parametercontrol.m
r2393 r2439 29 29 30 30 %cm_max 31 cm_max=getfieldvalue(options,'cm_max', 180);31 cm_max=getfieldvalue(options,'cm_max',250); 32 32 if (length(cm_max)~=1) 33 md.cm_max= 180;33 md.cm_max=250; 34 34 else 35 35 md.cm_max=cm_max; … … 37 37 38 38 %cm_noisedmp 39 cm_noisedmp=getfieldvalue(options,'cm_noisedmp',5*10^- 5);39 cm_noisedmp=getfieldvalue(options,'cm_noisedmp',5*10^-7); 40 40 if (length(cm_noisedmp)~=1) 41 md.cm_noisedmp=5*10^- 5;41 md.cm_noisedmp=5*10^-7; 42 42 else 43 43 md.cm_noisedmp=cm_noisedmp; 44 end 45 46 %cm_maxdmp 47 cm_maxdmp_value=getfieldvalue(options,'cm_maxdmp_value',50); 48 if (length(cm_maxdmp_value)~=1) 49 md.cm_maxdmp_value=150; 50 else 51 md.cm_maxdmp_value=cm_maxdmp_value; 52 end 53 cm_maxdmp_slope=getfieldvalue(options,'cm_maxdmp_slope',10^-13); 54 if (length(cm_maxdmp_slope)~=1) 55 md.cm_maxdmp_slope=10^-13; 56 else 57 md.cm_maxdmp_slope=cm_maxdmp_slope; 58 end 59 60 %cm_mindmp 61 cm_mindmp_value=getfieldvalue(options,'cm_mindmp_value',1); 62 if (length(cm_mindmp_value)~=1) 63 md.cm_mindmp_value=1; 64 else 65 md.cm_mindmp_value=cm_mindmp_value; 66 end 67 cm_mindmp_slope=getfieldvalue(options,'cm_mindmp_slope',0); 68 if (length(cm_mindmp_slope)~=1) 69 md.cm_mindmp_slope=0; 70 else 71 md.cm_mindmp_slope=cm_mindmp_slope; 44 72 end 45 73 … … 98 126 if ~found 99 127 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)]; 101 129 md.optscal(md.nsteps+1:end)=[]; 102 130 end -
issm/trunk/src/m/classes/public/plot/applyoptions.m
r2403 r2439 1 function applyoptions(md,data,options _structure)1 function applyoptions(md,data,options) 2 2 %APPLYOPTIONS - apply the options to current plot 3 3 % 4 4 % Usage: 5 % applyoptions(md,data,options _structure)5 % applyoptions(md,data,options) 6 6 % 7 7 % See also: PLOTMODEL, PARSE_OPTIONS 8 8 9 9 %fontsize 10 if ~isnan(options_structure.fontsize), 11 fontsize=options_structure.fontsize; 12 else 13 fontsize=14; 14 end 10 fontsize=getfieldvalue(options,'fontsize',14); 15 11 16 12 %fontweight 17 if ~isnan(options_structure.fontweight), 18 fontweight=options_structure.fontweight; 19 else 20 fontweight='normal'; 21 end 13 fontweight=getfieldvalue(options,'fontweight','normal'); 22 14 23 15 %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); 16 if 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 29 24 end 30 25 end 31 26 32 27 %xlabel 33 if ~isnan(options_structure.xlabel),34 xlabel( options_structure.xlabel,'FontSize',fontsize,'FontWeight',fontweight);28 if exist(options,'xlabel'); 29 xlabel(getfieldvalue(options,'xlabel'),'FontSize',fontsize,'FontWeight',fontweight); 35 30 end 36 31 37 32 %ylabel 38 if ~isnan(options_structure.ylabel),39 ylabel( options_structure.ylabel,'FontSize',fontsize,'FontWeight',fontweight);33 if exist(options,'ylabel'); 34 ylabel(getfieldvalue(options,'ylabel'),'FontSize',fontsize,'FontWeight',fontweight); 40 35 end 41 36 42 37 %zlabel 43 if ~isnan(options_structure.zlabel),44 zlabel( options_structure.zlabel,'FontSize',fontsize,'FontWeight',fontweight);38 if exist(options,'zlabel'); 39 zlabel(getfieldvalue(options,'zlabel'),'FontSize',fontsize,'FontWeight',fontweight); 45 40 end 46 41 47 42 %view 48 if ~isnan(options_structure.view),49 view( options_structure.view);43 if strcmpi(md.type,'3d') & ~exist(options,'layer'), 44 view(getfieldvalue(options,'view',3)); 50 45 else 51 if strcmpi(md.type,'3d') & isnan(options_structure.layer), 52 view(3); 53 else 54 view(2); 46 view(getfieldvalue(options,'view',2)); 47 end 48 49 %xlim 50 if exist(options,'xlim'); 51 xlim(getfieldvalue(options,'xlim')); 52 end 53 54 %ylim 55 if exist(options,'ylim'); 56 ylim(getfieldvalue(options,'ylim')); 57 end 58 59 %zlim 60 if exist(options,'zlim'); 61 zlim(getfieldvalue(options,'zlim')); 62 end 63 64 %Basinzoom 65 if exist(options,'basinzoom'); 66 basinzoom(getfieldvalue(options,'basinzoom'),getfieldvalue(options,'unit',1)); 67 end 68 69 %Caxis 70 if exist(options,'caxis'), 71 caxis(getfieldvalue(options,'caxis')); 72 end 73 74 %shading 75 if exist(options,'shading'), 76 shading(getfieldvalue(options,'shading')); 77 end 78 79 %grid 80 if exist(options,'grid'), 81 if strcmpi(getfieldvalue(options,'grid'),'on'), 82 grid on; 55 83 end 56 84 end 57 85 58 %xlim59 if ~isnan(options_structure.xlim),60 xlim(options_structure.xlim);61 end62 63 %ylim64 if ~isnan(options_structure.ylim),65 ylim(options_structure.ylim);66 end67 68 %zlim69 if ~isnan(options_structure.zlim),70 zlim(options_structure.zlim);71 end72 73 %Basinzoom74 if ~isnan(options_structure.basinzoom),75 basinzoom(options_structure.basinzoom,options_structure.unitmultiplier); end76 77 %Caxis78 if ~isnan(options_structure.caxis),79 caxis(options_structure.caxis);80 end81 82 %shading83 if ~isnan(options_structure.shading),84 shading(options_structure.shading);85 end86 87 %grid88 if ~isnan(options_structure.grid) & strcmpi(options_structure.grid,'on'),89 grid on;90 end91 92 86 %colormap 93 if ~isnan(options_structure.colormap),94 h=colormap( options_structure.colormap);87 if exist(options,'colormap'), 88 h=colormap(getfieldvalue(options,'colormap')); 95 89 end 96 90 97 91 %wrapping 98 if ~isnan(options_structure.wrapping),99 if isnan(options_structure.colormap)92 if exist(options,'wrapping'), 93 if ~exist(options,'colormap'), 100 94 h=jet; 101 95 end 102 colormap(repmat(h, options_structure.wrapping,1));96 colormap(repmat(h,getfieldvalue(options,'wrapping',1))); 103 97 end 104 98 105 99 %colorbar 106 if options_structure.colorbar~=0,100 if getfieldvalue(options,'colorbar',1)~=0, 107 101 c=colorbar;set(c,'FontSize',fontsize); 108 if ~isnan(options_structure.wrapping)102 if exist(options,'wrapping') 109 103 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')]; 111 105 set(c,'Ylim',lim); 112 106 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')); 115 109 end 116 if ~isnan(options_structure.log),117 logvalue= options_structure.log;110 if exist(options,'log'), 111 logvalue=getfieldvalue(options,'log'); 118 112 119 113 scalestring=get(c,'YTickLabel'); … … 131 125 set(c,'FontSize',fontsize); 132 126 end 133 if ~isnan(options_structure.colorbartitle),127 if exist(options,'colorbartitle'), 134 128 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'); 136 130 axes(backup); 137 131 end … … 142 136 143 137 %area 144 if ~isnan(options_structure.area),145 antzoom( options_structure.area);138 if exist(options,'area'), 139 antzoom(getfieldvalue(options,'area')); 146 140 end 147 141 148 142 %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 e nd143 filename=(getfieldvalue(options,'expdisp')); 144 style=(getfieldvalue(options,'expstyle')); 145 for i=1:length(getfieldvalue(options,'expdisp')), 146 filenamei=filename{i}; 147 stylei=style{i}; 148 expdisp(filenamei,gcf,stylei,getfieldvalue(options,'unit',1)); 155 149 end 156 150 157 151 %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 152 textstring=getfieldvalue(options,'text'); 153 textweight=getfieldvalue(options,'textweight'); 154 textsize=getfieldvalue(options,'textsize'); 155 textcolor=getfieldvalue(options,'textcolor'); 156 textposition=getfieldvalue(options,'textposition'); 157 for 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); 167 164 end 168 165 169 166 %latlon 170 if (iscell(options_structure.latlon) | ~isnan(options_structure.latlon)),171 latlonoverlay(options _structure);167 if exist(options,'latlon') 168 latlonoverlay(options); 172 169 end 173 170 174 171 %north arrow 175 if ~isnan(options_structure.northarrow),176 northarrow( options_structure.northarrow);172 if exist(options,'northarrow'), 173 northarrow(getfieldvalue(options,'northarrow')); 177 174 end 178 175 179 176 %Scale ruler 180 if ~isnan(options_structure.scaleruler),181 scaleruler( options_structure.scaleruler);177 if exist(options,'scaleruler'), 178 scaleruler(getfieldvalue(options,'scaleruler')); 182 179 end 183 180 184 181 %axis 185 if ~isnan(options_structure.axis)186 eval(['axis ' options_structure.axis]);182 if exist(options,'axis') 183 eval(['axis ' getfieldvalue(options,'axis')]); 187 184 end 188 185 189 186 %streamliness 190 if iscell(options_structure.streamlines) | ~isnan(options_structure.streamlines),191 plot_streamlines(md,options _structure);187 if exist(options,'streamlines'), 188 plot_streamlines(md,options); 192 189 end 193 190 194 191 %contours 195 if iscell(options_structure.contourlevels) | ~isnan(options_structure.contourlevels),196 plot_contour(md,data,options _structure);192 if exist(options,'contourlevels'), 193 plot_contour(md,data,options); 197 194 end -
issm/trunk/src/m/classes/public/plot/latlonoverlay.m
r2086 r2439 1 function latlonoverlay(options _structure)1 function latlonoverlay(options) 2 2 %LATLONOVERLAY - overlay latitude and longitude lines on current figure 3 3 % … … 8 8 % 9 9 % Usage: 10 % latlonoverlay(options _structure)10 % latlonoverlay(options) 11 11 12 12 %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 13 latlon=getfieldvalue(options,'latlon'); 14 numbering=getfieldvalue(options,'latlonnumbering'); 15 latlonclick=getfieldvalue(options,'latlonclick',0); 16 fontsize=getfieldvalue(options,'fontsize',16); 25 17 26 18 %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); 1 function plot_basaldrag(md,options,width,i,type); 2 2 3 %PLOT_BASALDRAG - plot basal drag 3 4 % 4 5 % Usage: 5 % plot_basaldrag(md,options _structure,width,i,type);6 % plot_basaldrag(md,options,width,i,type); 6 7 % 7 8 % See also: PLOTMODEL … … 9 10 %check layer 10 11 if strcmpi(md.type,'3d') 11 if options_structure.layer~=1,12 if getfieldvalue(options,'layer',1)~=1; 12 13 disp('plot_basaldrag warning: basal drag is displayed in the lower layer') 13 options_structure.layer=1;14 changefieldvalue(options,'layer',1); 14 15 end 15 16 end … … 32 33 33 34 %Figure out if this is a Section plot 34 if ~isnan(options_structure.sectionvalue)35 plot_section(md,drag,options _structure,width,i);35 if exist(options,'sectionvalue') 36 plot_section(md,drag,options,width,i); 36 37 return; 37 38 else 38 39 39 40 %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); 42 43 43 44 %plot basaldrag 44 45 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); 46 47 47 48 %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); 55 52 56 53 end -
issm/trunk/src/m/classes/public/plot/plot_boundaries.m
r27 r2439 1 function plot_boundaries(md,options _structure,width,i);1 function plot_boundaries(md,options,width,i); 2 2 %PLOT_BOUNDARIES - plot mesh boundaries 3 3 % 4 4 % Usage: 5 % plot_boundaries(md,options _structure,width,i);5 % plot_boundaries(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL … … 10 10 11 11 %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; 12 if getfieldvalue(options,'layer',0) 13 options=removefield(options,'layer',1); 15 14 end 16 [x y z elements is2d]=processmesh(md,options _structure);15 [x y z elements is2d]=processmesh(md,options); 17 16 18 17 for i=1:size(md.segments,1), … … 35 34 36 35 %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); 36 options=addfielddefault(options,'title','Mesh boundaries'); 37 options=addfielddefault(options,'colorbar',0); 38 options=addfielddefault(options,'view',2); 39 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_contour.m
r1879 r2439 1 function plot_contour(md,datain,options _structure);1 function plot_contour(md,datain,options); 2 2 %PLOT_CONTOUR - plot contours of a given field 3 3 % 4 4 % Usage: 5 % plot_contour(md,data,options _structure);5 % plot_contour(md,data,options); 6 6 % 7 7 % See also: PLOTMODEL 8 8 9 9 %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); 12 12 13 13 %check is2d … … 27 27 28 28 %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 29 if exist(options,'contouronly') 35 30 %remove the previous plots 36 31 cla 37 32 end 38 color= options_structure.contourcolor;33 color=getfieldvalue(options,'contourcolor','y'); 39 34 40 35 %get contours levels 41 if isnumeric(options_structure.contourlevels), 42 levels=round_ice(linspace(max(data),min(data),options_structure.contourlevels),2); 36 contourlevels=getfieldvalue(options,'contourlevels'); 37 if isnumeric(contourlevels), 38 levels=round_ice(linspace(max(data),min(data),contourlevels),2); 43 39 else 44 40 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}; 47 43 end 48 44 levels=sort(unique(levels),'descend'); … … 220 216 %we now have one subcontour ready to be plotted 221 217 zc=level*ones(length(xc)+1,1); 222 if isnan(color),218 if getfieldvalue(options,'contouronly',0), 223 219 h=[h;patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'Zdata',zc,'Cdata',zc,'facecolor','none','edgecolor','flat')]; 224 220 hold on … … 236 232 237 233 %labels? 238 if (~strcmpi(options_structure.contourticks,'off') & ~isempty(c) & ~isempty(h)) 239 if ~isnan(options_structure.contourcolor) 234 if (~strcmpi(getfieldvalue(options,'contourticks','on'),'off') & ~isempty(c) & ~isempty(h)) 235 if exist(options,'contouronly') 236 clabel(c,h); 237 else 240 238 clabel(c,h,'color',color,'FontSize',14); 241 else 242 clabel(c,h); 243 end 244 end 239 end 240 end -
issm/trunk/src/m/classes/public/plot/plot_drivingstress.m
r1740 r2439 1 function plot_drivingstress(md,options _structure,width,i);1 function plot_drivingstress(md,options,width,i); 2 2 %PLOT_DRIVINGSTRESS - plot driving stress 3 3 % 4 4 % Usage: 5 % plot_drivingstress(md,options _structure,width,i);5 % plot_drivingstress(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER … … 11 11 12 12 %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); 15 15 dstress=dstress/1000; 16 16 17 17 %plot mesh quivervel 18 18 subplot(width,width,i); 19 plot_unit(x,y,z,elements,dstress,isongrid,is2d,isquiver,options _structure)19 plot_unit(x,y,z,elements,dstress,isongrid,is2d,isquiver,options) 20 20 21 21 %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); 22 options=addfielddefault(options,'title','Driving stress [kPa]'); 23 options=addfielddefault(options,'view',2); 24 applyoptions(md,dstress,options); -
issm/trunk/src/m/classes/public/plot/plot_elementnumbering.m
r338 r2439 1 function plot_elementnumbering(md,options _structure,width,i);1 function plot_elementnumbering(md,options,width,i); 2 2 %PLOT_ELEMENTNUMBERING - plot element numbering 3 3 % 4 4 % Usage: 5 % plot_elementnumbering(md,options _structure,width,i);5 % plot_elementnumbering(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER … … 10 10 11 11 %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); 14 14 15 15 %plot … … 20 20 for i=1:size(elements,1), 21 21 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',[])) 23 23 A=elements(i,1); B=elements(i,2); C=elements(i,3); 24 24 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black'); … … 35 35 for i=1:size(elements,1), 36 36 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',[])) 38 38 A=elements(i,1); B=elements(i,2); C=elements(i,3); D=elements(i,4); E=elements(i,5); F=elements(i,6); 39 39 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black'); … … 47 47 48 48 %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); 49 options=addfielddefault(options,'title','Element numbering'); 50 options=addfielddefault(options,'colorbar',0); 51 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_elementstype.m
r1740 r2439 1 function plot_elementstype(md,options _structure,width,i);1 function plot_elementstype(md,options,width,i); 2 2 %PLOT_ELEMENTSTYPE - plot elements type 3 3 % 4 4 % Usage: 5 % plot_elementstype(md,options _structure,width,i);5 % plot_elementstype(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL 8 8 9 9 %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); 13 13 data=[data1 data2]; 14 14 15 15 %edgecolor? 16 if ~isnan(options_structure.edgecolor), 17 edgecolor=options_structure.edgecolor; 18 else 19 edgecolor='none'; 20 end 16 edgecolor=getfieldvalue(options,'edgecolor','none'); 21 17 22 18 %plot … … 88 84 89 85 %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); 86 options=addfielddefault(options,'title','Elements type'); 87 options=addfielddefault(options,'colorbar',0); 88 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_gridnumbering.m
r1740 r2439 1 function plot_gridnumbering(md,options _structure,width,i);1 function plot_gridnumbering(md,options,width,i); 2 2 %PLOT_GRIDNUMBERING - plot grid numbering 3 3 % 4 4 % Usage: 5 % plot_gridnumbering(md,options _structure,width,i);5 % plot_gridnumbering(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL 8 8 9 9 %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); 12 12 13 13 %plot … … 21 21 text(x(i),y(i), z(i),num2str(gridnumbers(i)),'backgroundcolor',[0.8 0.9 0.8]); 22 22 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]); 26 27 end 27 28 end … … 37 38 text(x(i),y(i), z(i),num2str(i),'backgroundcolor',[0.8 0.9 0.8]); 38 39 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]); 42 44 end 43 45 end … … 45 47 46 48 %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); 49 options=addfielddefault(options,'title','Grid numbering'); 50 options=addfielddefault(options,'colorbar',0); 51 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_highlightelements.m
r1 r2439 1 function plot_highlightelements(md,options _structure,width,i);1 function plot_highlightelements(md,options,width,i); 2 2 %PLOT_HIGHLIGHTELEMENTS - plot selected elements 3 3 % 4 4 % Usage: 5 % plot_highlightelements(md,options _structure,width,i);5 % plot_highlightelements(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL … … 11 11 12 12 %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); 15 15 16 16 %plot … … 20 20 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black'); 21 21 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',[])) 23 23 A=elements(i,1); B=elements(i,2); C=elements(i,3); 24 24 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black'); … … 34 34 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black'); 35 35 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',[])) 37 37 A=elements(i,1); B=elements(i,2); C=elements(i,3); D=elements(i,4); E=elements(i,5); F=elements(i,6); 38 38 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black'); … … 46 46 47 47 %apply options 48 if isnan(options_structure.highlight)48 if ~exist(options,'highlight') 49 49 disp('highlightelements warning : highlight option empty, not element highlighted'); 50 50 end 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); 51 options=addfielddefault(options,'title','Highlighted Elements'); 52 options=addfielddefault(options,'colorbar',0); 53 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_highlightgrids.m
r1740 r2439 1 function plot_highlightgrids(md,options _structure,width,i);1 function plot_highlightgrids(md,options,width,i); 2 2 %PLOT_HIGHLIGHTGRIDS - plot selected grids 3 3 % 4 4 % Usage: 5 % plot_highlightgrids(md,options _structure,width,i);5 % plot_highlightgrids(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL 8 8 9 9 %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); 12 12 13 13 %plot … … 18 18 A=elements(:,1); B=elements(:,2); C=elements(:,3); 19 19 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 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 24 24 end 25 25 else … … 31 31 patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black'); 32 32 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 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 37 37 end 38 38 end 39 39 40 40 %apply options 41 if isnan(options_structure.highlight)41 if ~exist(options,'highlight') 42 42 disp('highlightgrids warning : highlight option empty, not grid highlighted'); 43 43 end 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); 44 options=addfielddefault(options,'title','Highlighted Grids'); 45 options=addfielddefault(options,'colorbar',0); 46 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_importancefactors.m
r1 r2439 1 function plot_importancefactors(md,options _structure,width,ii);1 function plot_importancefactors(md,options,width,ii); 2 2 %PLOT_IMPORTANCEFACTORS - plot importance factors 3 3 % 4 4 % Usage: 5 % plot_importancefactors(md,options _structure,width,i);5 % plot_importancefactors(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL 8 8 9 9 %first recover design variable descriptor 10 if ~isnan(options_structure.designvariable),11 descriptor= options_structure.designvariable;10 if exist(options,'designvariable'), 11 descriptor=getfieldvalue(options,'designvariable'); 12 12 else 13 13 error('plot_importancefactors error message: Need to supply design variable descriptor'); … … 16 16 17 17 %then recover responsfunction name 18 if ~isnan(options_structure.responsefunction),19 responsefunctiondescriptor= options_structure.responsefunction;18 if exist(options,'responsefunction'), 19 responsefunctiondescriptor=getfieldvalue(options,'responsefunction'); 20 20 else 21 21 error('plot_importancefactors error message: Need to supply response function descriptor'); … … 52 52 53 53 %log? 54 if ~isnan(options_structure.log),55 logvalue= options_structure.log;54 if exist(options,'log'), 55 logvalue=getfieldvalue(options,'log'); 56 56 importancefactors=log(importancefactors)/log(logvalue); 57 57 end … … 64 64 65 65 %process data and model 66 [x y z elements is2d]=processmesh(md,options _structure);66 [x y z elements is2d]=processmesh(md,options); 67 67 68 %edgecolor? 69 if ~isnan(options_structure.edgecolor), 70 edgecolor=options_structure.edgecolor; 71 else 72 edgecolor='none'; 73 end 68 %edgecolor 69 edgecolor=getfieldvalue(options,'edgecolor','none'); 74 70 75 71 %standard plot: … … 85 81 86 82 %apply options 87 applyoptions(md,[],options _structure);83 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_manager.m
r2242 r2439 1 function plot_manager(md,options tring,width,i);1 function plot_manager(md,options,width,i); 2 2 %PLOT__MANAGER - distribute the plots, called by plotmodel 3 3 % 4 4 % Usage: 5 % plot_manager(md,options tring,width,i);5 % plot_manager(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL, PLOT_UNIT 8 8 9 9 %parse options and get a structure of options. 10 options _structure=parse_options(md,optionstring);10 options=checkplotoptions(md,options); 11 11 12 12 %get data to be displayed 13 data= findarg(optionstring,'data');data=data.value;13 data=getfieldvalue(options,'data'); 14 14 15 15 %figure out if this is a special plot … … 19 19 20 20 case 'boundaries', 21 plot_boundaries(md,options _structure,width,i);21 plot_boundaries(md,options,width,i); 22 22 return; 23 23 case 'elementnumbering', 24 plot_elementnumbering(md,options _structure,width,i);24 plot_elementnumbering(md,options,width,i); 25 25 return; 26 26 case 'highlightelements', 27 plot_highlightelements(md,options _structure,width,i);27 plot_highlightelements(md,options,width,i); 28 28 return; 29 29 case 'segmentnumbering', 30 plot_segmentnumbering(md,options _structure,width,i);30 plot_segmentnumbering(md,options,width,i); 31 31 return; 32 32 case 'histnorm', 33 plot_qmuhistnorm(md,options _structure,width,i);33 plot_qmuhistnorm(md,options,width,i); 34 34 return; 35 35 case 'elements_type', 36 plot_elementstype(md,options _structure,width,i);36 plot_elementstype(md,options,width,i); 37 37 return; 38 38 case 'gridnumbering', 39 plot_gridnumbering(md,options _structure,width,i);39 plot_gridnumbering(md,options,width,i); 40 40 return; 41 41 case 'highlightgrids', 42 plot_highlightgrids(md,options _structure,width,i);42 plot_highlightgrids(md,options,width,i); 43 43 return; 44 44 case {'basal_drag','basal_dragx','basal_dragy'}, 45 plot_basaldrag(md,options _structure,width,i,data);45 plot_basaldrag(md,options,width,i,data); 46 46 return; 47 47 case 'driving_stress', 48 plot_drivingstress(md,options _structure,width,i);48 plot_drivingstress(md,options,width,i); 49 49 return; 50 50 case 'mesh', 51 plot_mesh(md,options _structure,width,i);51 plot_mesh(md,options,width,i); 52 52 return; 53 53 case 'penalties', 54 plot_penalties(md,options _structure,width,i);54 plot_penalties(md,options,width,i); 55 55 return; 56 56 case 'riftvel', 57 plot_riftvel(md,options _structure,width,i);57 plot_riftvel(md,options,width,i); 58 58 return; 59 59 case 'riftrelvel', 60 plot_riftrelvel(md,options _structure,width,i);60 plot_riftrelvel(md,options,width,i); 61 61 return; 62 62 case 'riftpenetration', 63 plot_riftpenetration(md,options _structure,width,i);63 plot_riftpenetration(md,options,width,i); 64 64 return; 65 65 case 'riftfraction', 66 plot_riftfraction(md,options _structure,width,i);66 plot_riftfraction(md,options,width,i); 67 67 return; 68 68 case 'sarpwr', 69 plot_sarpwr(md,options _structure,width,i)69 plot_sarpwr(md,options,width,i) 70 70 return 71 71 case 'pressureload' 72 plot_pressureload(md,options _structure,width,i,data)72 plot_pressureload(md,options,width,i,data) 73 73 return 74 74 case 'segments' 75 plot_segments(md,options _structure,width,i,data)75 plot_segments(md,options,width,i,data) 76 76 return 77 77 case {'strainrate_tensor','strainrate','strainrate_principal','strainrate_principalaxis1','strainrate_principalaxis2','strainrate_principalaxis3',... 78 78 'stress_tensor','stress','stress_principal','stress_principalaxis1','stress_principalaxis2','stress_principalaxis3',... 79 79 '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); 81 81 return; 82 82 case 'thermaltransient_results', 83 plot_thermaltransient_results(md,options _structure,width,i);83 plot_thermaltransient_results(md,options,width,i); 84 84 return; 85 85 case 'transient_movie', 86 plot_transient_movie(md,options _structure,width,i);86 plot_transient_movie(md,options,width,i); 87 87 return; 88 88 case 'transient_results', 89 plot_transient_results(md,options _structure,width,i);89 plot_transient_results(md,options,width,i); 90 90 return; 91 91 … … 101 101 102 102 %Figure out if this is a semi-transparent plot. 103 if ~isnan(options_structure.overlay),104 plot_overlay(md,data,options _structure,width,i);103 if exist(options,'overlay'), 104 plot_overlay(md,data,options,width,i); 105 105 return; 106 106 end 107 107 108 108 %Figure out if this is a Section plot 109 if ~isnan(options_structure.sectionvalue)110 plot_section(md,data,options _structure,width,i);109 if exist(options,'sectionvalue') 110 plot_section(md,data,options,width,i); 111 111 return; 112 112 end 113 113 114 114 %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); 117 117 118 118 %standard plot: 119 119 subplot(width,width,i); 120 plot_unit(x,y,z,elements,data2,isongrid,is2d,isquiver,options _structure);120 plot_unit(x,y,z,elements,data2,isongrid,is2d,isquiver,options); 121 121 122 122 %apply all options 123 if is nan(options_structure.shading) & isnan(options_structure.edgecolor) & size(data2,1)==md.numberofgrids,124 options _structure.shading='interp';123 if isquiver & getfieldvalue(options,'colorbar',0)~=1 124 options.colorbar=2; 125 125 end 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)), 126 if isquiver & exist(options,'contourlevels'), 130 127 data2=data; 131 128 end 132 applyoptions(md,data2,options _structure);129 applyoptions(md,data2,options); -
issm/trunk/src/m/classes/public/plot/plot_mesh.m
r1 r2439 1 function plot_mesh(md,options _structure,width,i);1 function plot_mesh(md,options,width,i); 2 2 %PLOT_MESH - plot model mesh 3 3 % 4 4 % Usage: 5 % plot_mesh(md,options _structure,width,i);5 % plot_mesh(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL 8 8 9 9 %process data and model 10 [x y z elements is2d]=processmesh(md,options _structure);10 [x y z elements is2d]=processmesh(md,options); 11 11 12 12 %plot mesh … … 27 27 28 28 %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); 29 options=addfielddefault(options,'title','Mesh'); 30 options=addfielddefault(options,'colorbar',0); 31 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_overlay.m
r2328 r2439 1 function plot_overlay(md,data,options _structure,width,i)1 function plot_overlay(md,data,options,width,i) 2 2 %PLOT_OVERLAY - superimpose radar image to a given field 3 3 % 4 4 % Usage: 5 % plot_overlay(md,options _structure,width,i);5 % plot_overlay(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL 8 8 9 9 %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); 12 12 13 13 %check is2d … … 17 17 18 18 %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 19 xlim=getfieldvalue(options,'xlim',[min(md.x) max(md.x)]); 20 ylim=getfieldvalue(options,'ylim',[min(md.y) max(md.y)]); 29 21 30 22 %radar power … … 36 28 if redo, 37 29 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)); 39 31 t2=clock;fprintf('%s\n',[' done (' num2str(etime(t2,t1)) ' seconds)']); 40 32 end … … 54 46 if redo, 55 47 %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); 59 52 end 60 53 … … 75 68 76 69 %Build hsv color image from radar and results 77 transparency= options_structure.alpha;78 border= options_structure.border;70 transparency=getfieldvalue(options,'alpha',1.5); %Rignot's setting: 1.5 71 border=getfieldvalue(options,'border',0); 79 72 80 73 %intensity … … 107 100 108 101 %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); 102 iscolorbar=getfieldvalue(options,'colorbar',1); 103 options=changefieldvalue(options,'colorbar',0); 104 options=addfielddefault(options,'axis','equal off'); 105 options=addfielddefault(options,'colorbarpos',[0.80 0.70 0.02 0.15]); 106 applyoptions(md,data,options); 123 107 124 108 %colorbar … … 126 110 127 111 %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)); 129 113 colorbar_handle=colorbar; 130 114 colorbar_image_handle=get(colorbar_handle,'Children'); 131 115 set(colorbar_image_handle,'CData',colorbar_rgb); 132 set(colorbar_handle,'Position', options_structure.colorbarpos);116 set(colorbar_handle,'Position',getfieldvalue(options,'colorbarpos')); 133 117 134 118 %modify ticks. … … 147 131 set(colorbar_handle,'YTickLabel',scalestring); 148 132 set(colorbar_handle,'YColor','y'); 149 set(colorbar_handle,'FontSize', fontsize);133 set(colorbar_handle,'FontSize',getfieldvalue(options,'fontsize',14)); 150 134 end -
issm/trunk/src/m/classes/public/plot/plot_penalties.m
r27 r2439 1 function plot_penalties(md,options _structure,width,i);1 function plot_penalties(md,options,width,i); 2 2 %PLOT_PENALTIES - plot penalties 3 3 % 4 4 % Usage: 5 % plot_penalties(md,options _structure,width,i);5 % plot_penalties(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL 8 8 9 9 %process data and model 10 [x y z elements is2d]=processmesh(md,options _structure);10 [x y z elements is2d]=processmesh(md,options); 11 11 12 12 %plot mesh penalties … … 14 14 15 15 %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; 16 if exist(options,'unit'), 17 unit=getfieldvalue(options,'unit'); 18 x=x*unit; 19 y=y*unit; 20 z=z*unit; 20 21 end 21 22 … … 43 44 44 45 %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); 46 options=addfielddefault(options,'title','Penalties'); 47 options=addfielddefault(options,'colorbar',0); 48 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_pressureload.m
r1758 r2439 1 function plot_pressureload(md,options _structure,width,i,data);1 function plot_pressureload(md,options,width,i,data); 2 2 %PLOT_PRESSURELOAD - plot segment on neumann BC 3 3 % 4 4 % Usage: 5 % plot_pressureload(md,options _structure,width,i);5 % plot_pressureload(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL … … 11 11 12 12 %process mesh and data 13 [x y z elements is2d]=processmesh(md,options _structure);13 [x y z elements is2d]=processmesh(md,options); 14 14 pressureload=md.pressureload; 15 15 … … 75 75 76 76 %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); 77 options=addfielddefault(options,'title','Neumann boundary conditions'); 78 options=addfielddefault(options,'colorbar',0); 79 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_qmuhistnorm.m
r2254 r2439 57 57 58 58 59 function plot_qmuhistnorm(md,options _structure,width,i);59 function plot_qmuhistnorm(md,options,width,i); 60 60 61 61 %recover histnorm data 62 if isnans(options_structure.histnorm_data)62 if ~exist(options,'histnorm_data') 63 63 error('plot_qmuhistnorm error message: option histnorm_data is required'); 64 64 else 65 varargin= options_structure.histnorm_data;65 varargin=getfieldvalue(options,'histnorm_data'); 66 66 end 67 67 68 68 %recover fontsize 69 if isnans(options_structure.fontsize), 70 fontsize=options_structure.fontsize; 71 else 72 fontsize=18; 73 end 69 fontsize=getfieldvalue(options,'fontsize',18), 74 70 75 71 nargin=length(varargin); … … 267 263 268 264 %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); 265 options=addfielddefault(options,'title','Relative Frequency Histogram'); 266 options=addfielddefault(options,'xlabel','Interval Edge Value'); 267 options=addfielddefault(options,'colorbar',0); 268 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_quiver.m
r1878 r2439 1 function plot_quiver(x,y,u,v,options _structure),1 function plot_quiver(x,y,u,v,options), 2 2 %PLOT_QUIVER - quiver plot with colors 3 3 % … … 5 5 % 6 6 % Usage: 7 % plot_quiver(x,y,u,v,options _structure)7 % plot_quiver(x,y,u,v,options) 8 8 % 9 9 % 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); 11 11 12 12 %keep only non NaN elements … … 21 21 22 22 %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 23 scalingfactor=getfieldvalue(options,'scaling',0.40); 30 24 31 25 %number of colors? 32 if isnumeric(options_structure.colorlevels), 33 if isnan(options_structure.colorlevels), 26 colorlevels=getfieldvalue(options,'colorlevels'); 27 if isnumeric(colorlevels), 28 if isnan(colorlevels), 34 29 numcolors=30; 35 30 else 36 numcolors= options_structure.colorlevels;31 numcolors=colorlevels; 37 32 end 38 33 levels=round_ice(linspace(Min,Max,numcolors+1),2); 39 34 else 40 levels=zeros(1,length( options_structure.colorlevels)+2);35 levels=zeros(1,length(colorlevels)+2); 41 36 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}; 44 39 end 45 40 levels(end)=Max; … … 61 56 62 57 %Scale data 63 if ~isnan(options_structure.autoscale) & strcmpi(options_structure.autoscale,'off'),58 if strcmpi(getfieldvalue(options,'autoscale','on'),'off'), 64 59 delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x); 65 60 u=scalingfactor*sqrt(delta)*u./Norm; … … 81 76 82 77 %take care of colorbar 83 if ~strcmpi( options_structure.colorbar,'off'),78 if ~strcmpi(getfieldvalue(options,'colorbar','on'),'off'), 84 79 85 80 %build ticks … … 101 96 set(hcb,'YTickLabel',ticklabel,'YTick',tickpos); 102 97 %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')); 105 100 end 106 101 %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); 112 103 set(hcb,'FontSize',fontsize); 113 104 end -
issm/trunk/src/m/classes/public/plot/plot_quiver3.m
r1878 r2439 1 function plot_quiver3(x,y,z,u,v,w,options _structure),1 function plot_quiver3(x,y,z,u,v,w,options), 2 2 %PLOT_QUIVER3 - 3d quiver plot with colors 3 3 % … … 5 5 % 6 6 % Usage: 7 % plot_quiver3(x,y,z,u,v,w,options _structure)7 % plot_quiver3(x,y,z,u,v,w,options) 8 8 % 9 9 % 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); 11 11 12 12 %keep only non NaN elements … … 21 21 22 22 %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 23 scalingfactor=getfieldvalue(options,'scaling',0.40); 30 24 31 25 %number of colors? 32 if isnumeric(options_structure.colorlevels), 33 if isnan(options_structure.colorlevels), 26 colorlevels=getfieldvalue(options,'colorlevels',NaN); 27 if isnumeric(colorlevels), 28 if isnan(colorlevels), 34 29 numcolors=30; 35 30 else 36 numcolors= options_structure.colorlevels;31 numcolors=colorlevels; 37 32 end 38 33 levels=round_ice(linspace(Min,Max,numcolors+1),2); 39 34 else 40 levels=zeros(1,length( options_structure.colorlevels)+2);35 levels=zeros(1,length(colorlevels)+2); 41 36 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}; 44 39 end 45 40 levels(end)=Max; … … 61 56 62 57 %Scale data 63 if ~isnan(options_structure.autoscale) & strcmpi(options_structure.autoscale,'off'),58 if strcmpi(getfieldvalue(options,'autoscale','on'),'off'), 64 59 delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x); 65 60 u=scalingfactor*sqrt(delta)*u./Norm; … … 81 76 82 77 %take care of colorbar 83 if ~strcmpi( options_structure.colorbar,'off'),78 if ~strcmpi(getfieldvalue(options,'colorbar','on'),'off'), 84 79 85 80 %build ticks … … 101 96 set(hcb,'YTickLabel',ticklabel,'YTick',tickpos); 102 97 %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')); 105 100 end 106 101 %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); 112 103 set(hcb,'FontSize',fontsize); 113 104 end -
issm/trunk/src/m/classes/public/plot/plot_riftfraction.m
r1805 r2439 1 function plot_riftfraction(md,options _structure,width,i);1 function plot_riftfraction(md,options,width,i); 2 2 %PLOT_RIFTRELVEL - plot rift fractions 3 3 % 4 4 % Usage: 5 % plot_riftfraction(md,options _structure,width,i);5 % plot_riftfraction(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL … … 11 11 12 12 %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; 13 if 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; 17 18 end 18 19 … … 45 46 46 47 %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); 48 options=addfielddefault(options,'title','Rift relative velocities'); 49 options=addfielddefault(options,'colorbar',0); 50 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_riftpenetration.m
r2267 r2439 1 function plot_rifpenetration(md,options _structure,width,i);1 function plot_rifpenetration(md,options,width,i); 2 2 %PLOT_RIFTPENETRATION - plot rift penetration 3 3 % 4 4 % Usage: 5 % plot_rifpenetration(md,options _structure,width,i);5 % plot_rifpenetration(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL … … 11 11 12 12 %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; 13 if 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; 17 18 end 18 19 … … 77 78 78 79 %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); 80 options=addfielddefault(options,'title','Rift Penetration'); 81 options=addfielddefault(options,'colorbar',0); 82 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_riftrelvel.m
r1784 r2439 1 function plot_riftrelvel(md,options _structure,width,i);1 function plot_riftrelvel(md,options,width,i); 2 2 %PLOT_RIFTRELVEL - plot rift relative velocities 3 3 % 4 4 % Usage: 5 % plot_riftrelvel(md,options _structure,width,i);5 % plot_riftrelvel(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL … … 11 11 12 12 %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; 13 if 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; 17 18 end 18 19 … … 79 80 80 81 %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); 82 options=addfielddefault(options,'title','Rift relative velocities'); 83 options=addfielddefault(options,'colorbar',0); 84 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_riftvel.m
r1 r2439 11 11 12 12 %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; 13 if 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; 17 18 end 18 19 … … 78 79 79 80 %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 81 options=addfielddefault(options_structure,'title','Rift Velocities'); 82 options=addfielddefault(options_structure,'colorbar',0); 86 83 applyoptions(md,[],options_structure); -
issm/trunk/src/m/classes/public/plot/plot_sarpwr.m
r1 r2439 1 function plot_sarpwr(md,options _structure,width,i);1 function plot_sarpwr(md,options,width,i); 2 2 %PLOT_SARPWR - plot radar image 3 3 % 4 4 % Usage: 5 % plot_sarpwr(md,options _structure,width,i);5 % plot_sarpwr(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL … … 11 11 12 12 %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; 13 if 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; 17 18 end 18 19 … … 20 21 21 22 %apply options 22 if isnan(options_structure.colorbar) 23 options_structure.colorbar=0; 24 end 25 options_structure.colormap='gray'; 23 options=addfielddefault(options,'colorbar',0); 24 options=changefieldvalue(options,'colormap','gray'); 26 25 27 applyoptions(md,[],options _structure);26 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_section.m
r1969 r2439 1 function plot_section(md,data,options _structure,width,i)1 function plot_section(md,data,options,width,i) 2 2 %PLOT_SECTION - plot a given field on a section 3 3 % 4 4 % Usage: 5 % plot_section(md,options _structure,width,i);5 % plot_section(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL 8 8 9 9 %How many subplots? 10 if ~isnan(options_structure.showsection)10 if exist(options,'showsection') 11 11 12 12 %Compute the indexes of the 2 plots (one for the sectionvalue and one for showsection … … 21 21 22 22 %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); 25 25 26 26 %replug x and y onto model so that SectionValue treats the problem correctly 27 if ~isnan(options_structure.layer)27 if exist(options,'layer') 28 28 md.x=md.x2d; md.y=md.y2d; md.elements=md.elements2d; md.type='2d'; 29 29 end 30 30 31 31 %resolution 32 if ~isnan(options_structure.resolution),33 resolution= options_structure.resolution;32 if exist(options,'resolution'), 33 resolution=getfieldvalue(options,'resolution'); 34 34 else %Default resolution 35 35 resolution=[1000 10*md.numlayers]; … … 38 38 39 39 %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); 41 41 42 42 if is2d 43 43 44 44 %Show Section if requested by user 45 if ~isnan(options_structure.showsection)45 if exist(options,'showsection') 46 46 47 47 %compute number of labels 48 numlabels=min( options_structure.showsection,length(s));48 numlabels=min(getfieldvalue(options,'showsection'),length(s)); 49 49 shift=fix(length(s)/numlabels); 50 50 … … 59 59 %plot section only with labels 60 60 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) 62 62 hold on 63 63 text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8]) … … 78 78 %plot section value 79 79 %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 ) 81 81 82 82 %Show Section if requested by user 83 if ~ isnan(options_structure.showsection)83 if ~exist(options,'showsection') 84 84 85 85 %compute number of labels 86 numlabels=min( options_structure.showsection,length(s));86 numlabels=min(getfieldvalue(options,'showsection'),length(s)); 87 87 shift=fix(length(s)/numlabels); 88 88 … … 97 97 %plot section only with labels 98 98 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) 100 100 hold on 101 101 text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8]) … … 116 116 117 117 %Show Section if requested by user 118 if ~isnan(options_structure.showsection)118 if exist(options,'showsection') 119 119 120 120 %compute number of labels 121 numlabels=min( options_structure.showsection,length(s));121 numlabels=min(getfieldvalue(options,'showsection'),length(s)); 122 122 shift=fix(length(x)/numlabels); 123 123 … … 132 132 %plot section only with labels 133 133 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) 135 135 hold on 136 136 text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8]) … … 153 153 154 154 %apply options 155 if isnan(options _structure.title)156 options _structure.title='Section value';155 if isnan(options.title) 156 options=addfielddefault(options,'title','Section value'); 157 157 end 158 if isnan(options_structure.colorbar) &strcmpi(md.type,'2d')159 options _structure.colorbar=0;158 if strcmpi(md.type,'2d') 159 options=addfielddefault(options,'colorbar',0); 160 160 end 161 if isnan(options_structure.xlabel) & (strcmpi(md.type,'2d') | options_structure.view==2 )162 options _structure.xlabel='Curvilinear coordinate';161 if (strcmpi(md.type,'2d') | getfieldvalue(options,'view')==2 ) 162 options=addfielddefault(options,'xlabel','Curvilinear coordinate'; 163 163 end 164 if isnan(options_structure.ylabel) & (strcmpi(md.type,'3d') & options_structure.view==2 )165 options _structure.ylabel='z';164 if (strcmpi(md.type,'3d') & getfieldvalue(options,'view')==2 ) 165 options=addfielddefault(options,'ylabel','z'; 166 166 end 167 applyoptions(md,[],options _structure);167 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_segmentnumbering.m
r1 r2439 1 function plot_segmentnumbering(md,options _structure,width,i);1 function plot_segmentnumbering(md,options,width,i); 2 2 %PLOT_SEGMENTNUMBERING - plot segment numbering 3 3 % 4 4 % Usage: 5 % plot_segmentnumbering(md,options _structure,width,i);5 % plot_segmentnumbering(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL … … 11 11 12 12 %process data and model 13 [x y z segments is2d]=processmesh(md,options _structure);13 [x y z segments is2d]=processmesh(md,options); 14 14 15 15 error('not implemented yet'); … … 21 21 for i=1:size(segments,1), 22 22 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',[])) 24 24 A=segments(i,1); B=segments(i,2); C=segments(i,3); 25 25 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black'); … … 36 36 for i=1:size(segments,1), 37 37 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',[])) 39 39 A=segments(i,1); B=segments(i,2); C=segments(i,3); D=segments(i,4); E=segments(i,5); F=segments(i,6); 40 40 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black'); … … 48 48 49 49 %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); 50 options=addfielddefault(options,'title','Element numbering'); 51 options=addfielddefault(options,'colorbar',0); 52 applyoptions(options); -
issm/trunk/src/m/classes/public/plot/plot_segments.m
r1110 r2439 1 function plot_segments(md,options _structure,width,i,datai);1 function plot_segments(md,options,width,i,datai); 2 2 %PLOT_SEGMENTS - plot segments, with different colors according to segment markers. 3 3 % 4 4 % Usage: 5 % plot_segments(md,options _structure,width,i);5 % plot_segments(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL … … 11 11 12 12 %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; 13 if 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; 17 18 end 18 19 … … 44 45 45 46 %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); 47 options=addfielddefault(options,'title','Segment boundaries'); 48 options=addfielddefault(options,'colorbar',0); 49 applyoptions(md,[],options); -
issm/trunk/src/m/classes/public/plot/plot_streamlines.m
r1740 r2439 1 function plot_streamlines(md,options _structure)1 function plot_streamlines(md,options) 2 2 %PLOT_STREAMLINES - plot stream lines on a figure 3 3 % 4 4 % Usage: 5 % plot_streamlines(md,options _structure)5 % plot_streamlines(md,options) 6 6 7 7 %some options … … 10 10 11 11 %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); 15 15 16 16 %some checks … … 25 25 26 26 %initialize flowpath 27 if iscell(options_structure.streamlines) 27 streamlines=getfieldvalue(options,'streamlines'); 28 if iscell(streamlines) 28 29 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}; 31 32 x0=[x0;coord(1)]; y0=[y0;coord(2)]; 32 33 end 33 34 else 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); 36 37 end 37 38 -
issm/trunk/src/m/classes/public/plot/plot_tensor.m
r742 r2439 1 function plot_tensor(md,options _structure,width,i,type);1 function plot_tensor(md,options,width,i,type); 2 2 %PLOT_TENSOR - plot tensor components 3 3 % 4 4 % Usage: 5 % plot_tensor(md,options _structure,width,i);5 % plot_tensor(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL … … 27 27 %Figure out type of plot being requested 28 28 if 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); 30 30 return; 31 31 elseif 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); 33 33 return; 34 34 elseif 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); 36 36 return; 37 37 else -
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);1 function plot_tensor_components(md,options,width,i,tensor,type,plot_options); 2 2 %PLOT_TENSOR_COMPONENT - plot component of a tensor 3 3 % 4 4 % 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); 6 6 % 7 7 % See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER … … 24 24 25 25 %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); 30 30 if 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); 34 34 end 35 35 36 36 if (strcmpi(md.type,'2d')), 37 37 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') 40 40 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') 43 43 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') 46 46 else 47 47 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') 50 50 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') 53 53 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') 56 56 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') 59 59 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') 62 62 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') 65 65 end 66 66 end 67 67 68 function Apply_options_tensor(md,options _structure,type,component)68 function Apply_options_tensor(md,options,type,component) 69 69 %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); 80 78 end -
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);1 function plot_tensor_principal(md,options,width,i,tensor,type,plot_options); 2 2 %PLOT_TENSOR_PRINCIPAL - plot principal values 3 3 % 4 4 % 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); 6 6 % 7 7 % See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER … … 28 28 %plot principal axis 29 29 type1=[type 'axis1']; 30 plot_tensor_principalaxis(md,options _structure,newwidth,index1,tensor,type1,plot_options);30 plot_tensor_principalaxis(md,options,newwidth,index1,tensor,type1,plot_options); 31 31 type2=[type 'axis2']; 32 plot_tensor_principalaxis(md,options _structure,newwidth,index2,tensor,type2,plot_options);32 plot_tensor_principalaxis(md,options,newwidth,index2,tensor,type2,plot_options); 33 33 if strcmpi(md.type,'3d') 34 34 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); 36 36 end 37 37 38 38 %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); 42 42 if 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); 44 44 end 45 45 46 46 if (strcmpi(md.type,'2d')), 47 47 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') 50 50 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') 53 53 else 54 54 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') 57 57 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') 60 60 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') 63 63 end 64 64 end 65 65 66 function Apply_options_tensor(md,options _structure,type,component)66 function Apply_options_tensor(md,options,type,component) 67 67 %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); 68 if ismember('_',type) %user plotet stress_tensor 69 strings=strsplit(type,'_'); 70 string=strings{1}; 71 else %default plot: user requested stress 72 string=type; 78 73 end 74 options=addfielddefault(options,'title',[upper(string(1)) string(2:end) ' ' component]); 75 applyoptions(md,[],options); 76 end -
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);1 function plot_tensor_principalaxis(md,options,width,i,tensor,type,plot_options); 2 2 %PLOT_TENSOR_PRINCIPALAXIS - plot ytensor principal axis 3 3 % 4 4 % Usage: 5 % plot_tensor_principalaxis(md,options _structure,width,i);5 % plot_tensor_principalaxis(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL … … 11 11 12 12 %process data and model 13 [x y z elements is2d]=processmesh(md,options _structure);13 [x y z elements is2d]=processmesh(md,options); 14 14 15 15 if (strcmpi(md.type,'2d')), 16 16 eval(['Vx=tensor.principalaxis' type(end) '(:,1); Vy=tensor.principalaxis' type(end) '(:,2);']) 17 17 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); 21 21 else 22 22 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); 27 27 end 28 28 … … 36 36 37 37 %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); 44 45 end 45 46 … … 57 58 else 58 59 %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); 67 69 end 68 70 … … 87 89 88 90 %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); 91 strings=strsplit(type,'_'); 92 string=strings{1}; 93 options=addfielddefault(options,'title',[upper(string(1)) string(2:end) ' principal axis ' type(end)]); 94 options=addfielddefault(options,'colorbar',0); 95 applyoptions(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)1 function plot_thermaltransient_results(md,options,width,i) 2 2 %PLOT_THERMALTRANSIENT_RESULTS - plot results of a thermal transient solution 3 3 % 4 4 % Usage: 5 % plot_thermaltransient_results(md,options _structure,width,i);5 % plot_thermaltransient_results(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL … … 11 11 string=[string ',''data'',''thermaltransient_results(' num2str(i) ').temperature'',''view'',3,''title'',''Temperature at time ' num2str(md.thermaltransient_results(i).time) ' a''']; 12 12 end 13 string=[string ',''figure'',1,''colorbar#all'',''on'',''view'',3,''fontsize'',' num2str(options _structure.fontsize) ',''fontweight'',' options_structure.fontweight ');'];13 string=[string ',''figure'',1,''colorbar#all'',''on'',''view'',3,''fontsize'',' num2str(options.fontsize) ',''fontweight'',' options.fontweight ');']; 14 14 eval(string); 15 15 clear string; … … 19 19 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''']; 20 20 end 21 string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' num2str(options _structure.fontsize) ',''fontweight'',' options_structure.fontweight ');'];21 string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' num2str(options.fontsize) ',''fontweight'',' options.fontweight ');']; 22 22 eval(string); 23 23 clear string; -
issm/trunk/src/m/classes/public/plot/plot_transient_movie.m
r2240 r2439 1 function plot_transient_movie(md,options _structure,width,i);1 function plot_transient_movie(md,options,width,i); 2 2 %PLOT_TRANSIENT_MOVIE - plot a transient result as a movie 3 3 % Usage: 4 % plot_transient_movie(md,options _structure,width,i);4 % plot_transient_movie(md,options,width,i); 5 5 % 6 6 % See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER … … 10 10 11 11 %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'); 14 14 else 15 15 error('specify transient_movie_field in options list'); … … 17 17 18 18 %process model 19 [x y z elements is2d]=processmesh(md,options _structure);19 [x y z elements is2d]=processmesh(md,options); 20 20 21 21 %loop over the time steps … … 24 24 25 25 %process data 26 [data isongrid isquiver]=processdata(md,data,options _structure);26 [data isongrid isquiver]=processdata(md,data,options); 27 27 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); 30 30 31 if ~isnan(options_structure.transient_movie_output),31 if exist(options,'transient_movie_output'), 32 32 set(gcf,'Renderer','zbuffer','color','white'); %fixes a bug on Mac OS X (not needed in future Matlab version) 33 33 if i==1, … … 46 46 47 47 %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) 51 51 end 52 52 53 53 end %function 54 54 55 function apply_options_movie(md,options _structure,titlestring)55 function apply_options_movie(md,options,titlestring) 56 56 %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); 64 60 end -
issm/trunk/src/m/classes/public/plot/plot_transient_results.m
r2267 r2439 1 function plot_transient_results(md,options _structure,width,i)1 function plot_transient_results(md,options,width,i) 2 2 %PLOT_TRANSIENT_RESULTS - plot transient results 3 3 % 4 4 % Usage: 5 % plot_transient_results(md,options _structure,width,i);5 % plot_transient_results(md,options,width,i); 6 6 % 7 7 % See also: PLOTMODEL 8 9 fontsize=getfieldvalue(options,'fontsize',14); 10 fontweight=getfieldvalue(options,'fontweight','n'); 8 11 9 12 %Prepare window distribution … … 26 29 string=[string ',''data'',md.results.transient(' num2str(i) ').thickness,''title'',''Thickness at time ' num2str(md.results.transient(i).time) ' a''']; 27 30 end 28 string=[string ',''figure'',1,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)');'];31 string=[string ',''figure'',1,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight ');']; 29 32 eval(string); 30 33 clear string; … … 34 37 string=[string ',''data'',md.results.transient(' num2str(i) ').vel,''view'',3,''title'',''Velocity at time ' num2str(md.results.transient(i).time) ' a''']; 35 38 end 36 string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)');'];39 string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight ');']; 37 40 eval(string); 38 41 clear string; … … 43 46 string=[string ',''data'',md.results.transient(' num2str(i) ').temperature,''view'',3,''title'',''Temperature at time ' num2str(md.results.transient(i).time) ' a''']; 44 47 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 ');']; 46 49 eval(string); 47 50 clear string; … … 52 55 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''']; 53 56 end 54 string=[string ',''figure'',4,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)');'];57 string=[string ',''figure'',4,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight ');']; 55 58 eval(string); 56 59 clear string; … … 60 63 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''']; 61 64 end 62 string=[string ',''figure'',5,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)');'];65 string=[string ',''figure'',5,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight ');']; 63 66 eval(string); 64 67 clear string; … … 69 72 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''']; 70 73 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 ');']; 72 75 eval(string); 73 76 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)1 function plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options) 2 2 %PLOT_UNIT - unit plot, display data 3 3 % 4 4 % 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); 6 6 % 7 7 % See also: PLOTMODEL, PLOT_MANAGER 8 8 9 %edgecolor? 10 if ~isnan(options_structure.edgecolor), 11 edgecolor=options_structure.edgecolor; 12 else 13 edgecolor='none'; 14 end 9 %edgecolor 10 edgecolor=getfieldvalue(options,'edgecolor','none'); 15 11 16 12 %regular plot … … 53 49 if isongrid, 54 50 if is2d, 55 plot_quiver(x,y,data(:,1),data(:,2),options _structure);51 plot_quiver(x,y,data(:,1),data(:,2),options); 56 52 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); 58 54 end 59 55 else -
issm/trunk/src/m/classes/public/plot/plotmodel.m
r338 r2439 7 7 end 8 8 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 10 options=plotoptions(varargin{:}); 13 11 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 13 subplotwidth=ceil(sqrt(options.numberofplots)); 14 15 %Get figure number and number of plots 16 figurenumber=options.figurenumber; 17 numberofplots=options.numberofplots; 25 18 26 19 %go through subplots 27 20 if numberofplots, 28 21 29 %recover options for all subplots.30 options=recover_plot_options(md,varargin,numberofplots);31 32 22 %Create figure 33 23 figure(figurenumber),clf; … … 37 27 38 28 %call unit plot 39 plot_manager(md,options {i},subplotwidth,i);29 plot_manager(md,options.list{i},subplotwidth,i); 40 30 41 31 end -
issm/trunk/src/m/classes/public/plot/processdata.m
r2426 r2439 1 function [data isongrid isquiver]=processdata(md,data,options _structure);1 function [data isongrid isquiver]=processdata(md,data,options); 2 2 %PROCESSDATA - process data to be plotted 3 3 % 4 4 % Usage: 5 % [data isongrid isquiver]=processdata(md,data,options _structure);5 % [data isongrid isquiver]=processdata(md,data,options); 6 6 % 7 7 % See also: PLOTMODEL, PROCESSMESH … … 67 67 68 68 %smoothing? 69 if ~isnan(options_structure.smooth) 70 data=averaging(md,data,options_structure.smooth); 69 if exist(options,'smooth') 70 data=averaging(md,data,getfieldvalue(options,'smooth')); 71 datasize(1)=md.numberofgrids; 71 72 %---> go to grid data 72 73 end … … 77 78 78 79 %ice sheet only? 79 if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf,80 if getfieldvalue(options,'iceshelf',0), 80 81 data(find(md.elementoniceshelf),:)=NaN; 81 82 end 82 83 %ice shelf only? 83 if ~isnan(options_structure.noicesheet) & options_structure.noicesheet,84 if getfieldvalue(options,'icesheet',0), 84 85 data(find(~md.elementoniceshelf),:)=NaN; 85 86 end 86 87 %no water? 87 if ~isnan(options_structure.nowater) & options_structure.nowater,88 if getfieldvalue(options,'water',0), 88 89 data(find(md.elementonwater),:)=NaN; 89 90 end 90 91 %log? 91 if ~isnan(options_structure.log),92 if exist(options,'log'), 92 93 pos=find(~isnan(data)); 93 data(pos)=log(data(pos))/log( options_structure.log);94 data(pos)=log(data(pos))/log(getfieldvalue(options,'log')); 94 95 end 95 96 end … … 99 100 isongrid=1; 100 101 %ice sheet only? 101 if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf,102 if getfieldvalue(options,'iceshelf',0), 102 103 pos=find(md.gridoniceshelf); 103 104 data(pos,:)=NaN; 104 105 end 105 106 %ice shelf only? 106 if ~isnan(options_structure.noiceshelf) & options_structure.noicesheet,107 if getfieldvalue(options,'icesheet',0), 107 108 pos=find(md.gridonicesheet); 108 109 data(pos,:)=NaN; 109 110 end 110 111 %no water? 111 if ~isnan(options_structure.nowater) & options_structure.nowater,112 if getfieldvalue(options,'water',0), 112 113 pos=find(md.gridonwater); 113 114 data(pos,:)=NaN; 114 115 end 115 116 %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')); 118 119 end 119 120 … … 121 122 122 123 %layer projection? 123 if ~isnan(options_structure.layer) & options_structure.layer>=1,124 data=project2d(md,data, options_structure.layer); %project onto 2d mesh124 if getfieldvalue(options,'layer',0)>=1, 125 data=project2d(md,data,getfieldvalue(options,'layer')); %project onto 2d mesh 125 126 end 126 127 127 128 %control arrow density if quiverplot 128 if isquiver & ~isnan(options_structure.density)129 if isquiver & exist(options,'density') 129 130 databak=data; 130 131 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,:); 132 134 clear databak 133 135 end -
issm/trunk/src/m/classes/public/plot/processmesh.m
r1 r2439 1 function [x y z elements is2d]=processmesh(md,options _structure);1 function [x y z elements is2d]=processmesh(md,options); 2 2 %PROCESSMESH - process mesh to be plotted 3 3 % 4 4 % Usage: 5 % [x y z elements is2d]=processmesh(md,options _structure)5 % [x y z elements is2d]=processmesh(md,options) 6 6 % 7 7 % See also: PLOTMODEL, PROCESSDATA … … 27 27 is2d=1; 28 28 else 29 if ~isnan(options_structure.layer) & options_structure.layer>=1,29 if getfieldvalue(options,'layer',0)>=1, 30 30 is2d=1; 31 31 else … … 35 35 36 36 %layer projection? 37 if ~isnan(options_structure.layer) & options_structure.layer>=1,37 if getfieldvalue(options,'layer',0)>=1, 38 38 %we modify the mesh temporarily to a 2d mesh from which the 3d mesh was extruded. 39 39 x=x2d; … … 45 45 46 46 %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; 47 if exist(options,'unit'), 48 unit=getfieldvalue(options,'unit'); 49 x=x*unit; 50 y=y*unit; 51 z=z*unit; 51 52 end
Note:
See TracChangeset
for help on using the changeset viewer.