Changeset 4330
- Timestamp:
- 06/30/10 08:52:00 (15 years ago)
- Location:
- issm/trunk/src/m/classes/public/plot
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/plot/plot_basaldrag.m
r3994 r4330 39 39 40 40 %process data and model 41 [x y z elements is2d]=processmesh(md, options);42 [basal_drag isongrid isquiver]=processdata(md,drag,options);41 [x y z elements is2d]=processmesh(md,[],options); 42 [basal_drag datatype]=processdata(md,drag,options); 43 43 44 44 %plot basaldrag 45 45 subplot(width,width,i); 46 plot_unit(x,y,z,elements,basal_drag,is ongrid,is2d,isquiver,options);46 plot_unit(x,y,z,elements,basal_drag,is2d,datatype,options); 47 47 48 48 %apply options -
issm/trunk/src/m/classes/public/plot/plot_boundaries.m
r2439 r4330 13 13 options=removefield(options,'layer',1); 14 14 end 15 [x y z elements is2d]=processmesh(md, options);15 [x y z elements is2d]=processmesh(md,[],options); 16 16 17 17 for i=1:size(md.segments,1), -
issm/trunk/src/m/classes/public/plot/plot_contour.m
r2439 r4330 8 8 9 9 %process data and model 10 [x y z index is2d]=processmesh(md, options);11 [data isongrid isquiver]=processdata(md,datain,options);10 [x y z index is2d]=processmesh(md,[],options); 11 [data datatype]=processdata(md,datain,options); 12 12 13 13 %check is2d … … 17 17 18 18 %first, process data: must be on grids 19 if isquiver19 if datatype==2, 20 20 %take norm 21 21 data=sqrt(sum(datain.*datain,2)); 22 end 23 if ~isongrid 22 elseif datatype==1, 24 23 %take average 25 24 data=averaging(md,data,0); 25 else 26 error('datatype not supported yet'); 26 27 end 27 28 -
issm/trunk/src/m/classes/public/plot/plot_drivingstress.m
r2439 r4330 11 11 12 12 %process data and model 13 [x y z elements is2d]=processmesh(md, options);14 [dstress isongrid isquiver]=processdata(md,s,options);13 [x y z elements is2d]=processmesh(md,[],options); 14 [dstress datatype]=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,is ongrid,is2d,isquiver,options)19 plot_unit(x,y,z,elements,dstress,is2d,datatype,options) 20 20 21 21 %apply options -
issm/trunk/src/m/classes/public/plot/plot_elementnumbering.m
r2439 r4330 10 10 11 11 %process data and model 12 [x y z elements is2d]=processmesh(md, options);13 [elementnumbers isgrid]=processdata(md,[1:md.numberofelements]',options);12 [x y z elements is2d]=processmesh(md,[],options); 13 [elementnumbers datatype]=processdata(md,[1:md.numberofelements]',options); 14 14 15 15 %plot -
issm/trunk/src/m/classes/public/plot/plot_elementstype.m
r2439 r4330 8 8 9 9 %process data and model 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);10 [x y z elements is2d]=processmesh(md,[],options); 11 [data1 datatype]=processdata(md,md.elements_type(:,1),options); 12 [data2 datatype]=processdata(md,md.elements_type(:,2),options); 13 13 data=[data1 data2]; 14 14 -
issm/trunk/src/m/classes/public/plot/plot_gridnumbering.m
r2439 r4330 8 8 9 9 %process data and model 10 [x y z elements is2d]=processmesh(md, options);11 [gridnumbers isongrid isquiver]=processdata(md,[1:md.numberofgrids]',options);10 [x y z elements is2d]=processmesh(md,[],options); 11 [gridnumbers datatype]=processdata(md,[1:md.numberofgrids]',options); 12 12 13 13 %plot -
issm/trunk/src/m/classes/public/plot/plot_highlightelements.m
r2439 r4330 11 11 12 12 %process data and model 13 [x y z elements is2d]=processmesh(md, options);14 [elementnumbers isgrid]=processdata(md,[1:md.numberofelements]',options);13 [x y z elements is2d]=processmesh(md,[],options); 14 [elementnumbers datatype]=processdata(md,[1:md.numberofelements]',options); 15 15 16 16 %plot -
issm/trunk/src/m/classes/public/plot/plot_highlightgrids.m
r2511 r4330 8 8 9 9 %process data and model 10 [x y z elements is2d]=processmesh(md, options);11 [gridnumbers isongrid isquiver]=processdata(md,[1:md.numberofgrids]',options);10 [x y z elements is2d]=processmesh(md,[],options); 11 [gridnumbers datatype]=processdata(md,[1:md.numberofgrids]',options); 12 12 13 13 %plot -
issm/trunk/src/m/classes/public/plot/plot_importancefactors.m
r2439 r4330 64 64 65 65 %process data and model 66 [x y z elements is2d]=processmesh(md, options);66 [x y z elements is2d]=processmesh(md,[],options); 67 67 68 68 %edgecolor -
issm/trunk/src/m/classes/public/plot/plot_manager.m
r3547 r4330 127 127 128 128 %process data and model 129 [x y z elements is2d]=processmesh(md, options);130 [data2 isongrid isquiver]=processdata(md,data,options);129 [x y z elements is2d]=processmesh(md,data,options); 130 [data2 datatype]=processdata(md,data,options); 131 131 132 132 %standard plot: … … 139 139 140 140 %plot unit 141 plot_unit(x,y,z,elements,data2,is ongrid,is2d,isquiver,options);141 plot_unit(x,y,z,elements,data2,is2d,datatype,options); 142 142 143 143 %apply all options 144 if isquiver144 if datatype==3, 145 145 options=changefieldvalue(options,'colorbar',2); 146 if exist(options,'contourlevels'), 147 data2=data; 148 end 146 149 end 147 if isquiver & exist(options,'contourlevels'), 148 data2=data; 149 end 150 150 151 applyoptions(md,data2,options); 151 152 … … 169 170 axes('pos',PosInset); 170 171 box('on') 171 plot_unit(x,y,z,elements,data2,is ongrid,is2d,isquiver,options);172 plot_unit(x,y,z,elements,data2,is2d,datatype,options); 172 173 173 174 %applay options -
issm/trunk/src/m/classes/public/plot/plot_mesh.m
r2871 r4330 8 8 9 9 %process data and model 10 [x y z elements is2d]=processmesh(md, options);10 [x y z elements is2d]=processmesh(md,[],options); 11 11 12 12 %plot mesh -
issm/trunk/src/m/classes/public/plot/plot_overlay.m
r3547 r4330 8 8 9 9 %process mesh and data 10 [x y z elements is2d]=processmesh(md, options);11 [data isongrid isquiver]=processdata(md,data,options);10 [x y z elements is2d]=processmesh(md,[],options); 11 [data datatype]=processdata(md,data,options); 12 12 13 13 %check is2d … … 15 15 error('buildoverlay error message: overlay not supported for 3d meshes, project on a layer'); 16 16 end 17 if isquiver17 if datatype==3, 18 18 error('buildoverlay error message: overlay not supported for quiver plots'); 19 19 end -
issm/trunk/src/m/classes/public/plot/plot_penalties.m
r3994 r4330 8 8 9 9 %process data and model 10 [x y z elements is2d]=processmesh(md, options);10 [x y z elements is2d]=processmesh(md,[],options); 11 11 12 12 %plot mesh penalties -
issm/trunk/src/m/classes/public/plot/plot_pressureload.m
r3994 r4330 11 11 12 12 %process mesh and data 13 [x y z elements is2d]=processmesh(md, options);13 [x y z elements is2d]=processmesh(md,[],options); 14 14 pressureload=md.pressureload; 15 15 -
issm/trunk/src/m/classes/public/plot/plot_riftfraction.m
r3202 r4330 13 13 14 14 %process data and model 15 [x y z elements is2d]=processmesh(md, options);15 [x y z elements is2d]=processmesh(md,[],options); 16 16 17 17 subplot(nlines,ncols,index); -
issm/trunk/src/m/classes/public/plot/plot_riftpenetration.m
r3202 r4330 8 8 9 9 %process data and model 10 [x y z elements is2d]=processmesh(md, options);10 [x y z elements is2d]=processmesh(md,[],options); 11 11 12 12 subplot(nlines,ncols,index); -
issm/trunk/src/m/classes/public/plot/plot_riftrelvel.m
r3202 r4330 26 26 27 27 %process data and model 28 [x y z elements is2d]=processmesh(md, options);29 [vel isongrid isquiver]=processdata(md,[u v],options);28 [x y z elements is2d]=processmesh(md,[],options); 29 [vel datatype]=processdata(md,[u v],options); 30 30 [quivers,palette]=quiver_process(x,y,vel(:,1),vel(:,2),options); 31 31 -
issm/trunk/src/m/classes/public/plot/plot_rifts.m
r3260 r4330 8 8 9 9 %process data and model 10 [x y z elements is2d]=processmesh(md, options);10 [x y z elements is2d]=processmesh(md,[],options); 11 11 12 12 %plot mesh -
issm/trunk/src/m/classes/public/plot/plot_riftvel.m
r3202 r4330 26 26 27 27 %process data and model 28 [x y z elements is2d]=processmesh(md, options);29 [vel isongrid isquiver]=processdata(md,[u v],options);28 [x y z elements is2d]=processmesh(md,[],options); 29 [vel datatype]=processdata(md,[u v],options); 30 30 [quivers,palette]=quiver_process(x,y,vel(:,1),vel(:,2),options); 31 31 -
issm/trunk/src/m/classes/public/plot/plot_section.m
r3994 r4330 21 21 22 22 %process data and model 23 [x_m y_m z_m elements_m is2d]=processmesh(md, options);24 [data isongrid isquiver]=processdata(md,data,options);23 [x_m y_m z_m elements_m is2d]=processmesh(md,[],options); 24 [data datatype]=processdata(md,data,options); 25 25 26 26 %replug x and y onto model so that SectionValue treats the problem correctly … … 38 38 39 39 %Compute section value 40 if isquiver40 if datatype==3, 41 41 [elements,x,y,z,s,data_s1]=SectionValues(md,data(:,1),getfieldvalue(options,'sectionvalue'),resolution); 42 42 [elements,x,y,z,s,data_s2]=SectionValues(md,data(:,2),getfieldvalue(options,'sectionvalue'),resolution); … … 65 65 %plot section only with labels 66 66 subplot(width,width,index2) 67 plot_unit(x_m,y_m,z_m,elements_m,data,is ongrid,is2d,isquiver,options)67 plot_unit(x_m,y_m,z_m,elements_m,data,is2d,datatype,options) 68 68 hold on 69 69 text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8]) … … 79 79 %plot section value 80 80 subplot(width,width,index1) 81 if isquiver81 if datatype==3, 82 82 plot(s,data_s1,s,data_s2); 83 83 else … … 108 108 %plot section only with labels 109 109 subplot(width,width,index2) 110 plot_unit(x_m,y_m,z_m,elements_m,data,is ongrid,is2d,isquiver,options)110 plot_unit(x_m,y_m,z_m,elements_m,data,is2d,datatype,options) 111 111 hold on 112 112 text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8]) … … 143 143 %plot section only with labels 144 144 subplot(width,width,index2) 145 plot_unit(x_m,y_m,z_m,elements_m,data,is ongrid,is2d,isquiver,options)145 plot_unit(x_m,y_m,z_m,elements_m,data,is2d,datatype,options) 146 146 hold on 147 147 text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8]) -
issm/trunk/src/m/classes/public/plot/plot_segmentnumbering.m
r2439 r4330 11 11 12 12 %process data and model 13 [x y z segments is2d]=processmesh(md, options);13 [x y z segments is2d]=processmesh(md,[],options); 14 14 15 15 error('not implemented yet'); -
issm/trunk/src/m/classes/public/plot/plot_segments.m
r3994 r4330 11 11 12 12 %process mesh and data 13 [x y z elements is2d]=processmesh(md, options);13 [x y z elements is2d]=processmesh(md,[],options); 14 14 segments=md.segments; 15 15 -
issm/trunk/src/m/classes/public/plot/plot_streamlines.m
r2650 r4330 6 6 7 7 %process data and model 8 [x y z index is2d]=processmesh(md, options);9 [u isongrid isquiver]=processdata(md,md.vx,options);10 [v isongrid isquiver]=processdata(md,md.vy,options);8 [x y z index is2d]=processmesh(md,[],options); 9 [u datatype]=processdata(md,md.vx,options); 10 [v datatype]=processdata(md,md.vy,options); 11 11 12 12 %some checks -
issm/trunk/src/m/classes/public/plot/plot_tensor_components.m
r3994 r4330 24 24 25 25 %process data and model 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);26 [x y z elements is2d]=processmesh(md,[],options); 27 [tensor.xx datatype]=processdata(md,tensor.xx,options); 28 [tensor.yy datatype]=processdata(md,tensor.yy,options); 29 [tensor.xy datatype]=processdata(md,tensor.xy,options); 30 30 if md.dim==3 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);31 [tensor.xz datatype]=processdata(md,tensor.xz,options); 32 [tensor.yz datatype]=processdata(md,tensor.yz,options); 33 [tensor.zz datatype]=processdata(md,tensor.zz,options); 34 34 end 35 35 36 36 if ((md.dim==2)), 37 37 subplot(2*width,2*width,index1), 38 plot_unit(x,y,z,elements,tensor.xx,is ongrid,is2d,isquiver,options)38 plot_unit(x,y,z,elements,tensor.xx,is2d,datatype,options) 39 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,is ongrid,is2d,isquiver,options)41 plot_unit(x,y,z,elements,tensor.yy,is2d,datatype,options) 42 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,is ongrid,is2d,isquiver,options)44 plot_unit(x,y,z,elements,tensor.xy,is2d,datatype,options) 45 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,is ongrid,is2d,isquiver,options)48 plot_unit(x,y,z,elements,tensor.xx,is2d,datatype,options) 49 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,is ongrid,is2d,isquiver,options)51 plot_unit(x,y,z,elements,tensor.yy,is2d,datatype,options) 52 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,is ongrid,is2d,isquiver,options)54 plot_unit(x,y,z,elements,tensor.zz,is2d,datatype,options) 55 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,is ongrid,is2d,isquiver,options)57 plot_unit(x,y,z,elements,tensor.xy,is2d,datatype,options) 58 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,is ongrid,is2d,isquiver,options)60 plot_unit(x,y,z,elements,tensor.xz,is2d,datatype,options) 61 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,is ongrid,is2d,isquiver,options)63 plot_unit(x,y,z,elements,tensor.yz,is2d,datatype,options) 64 64 Apply_options_tensor(md,options,type,'yz') 65 65 end -
issm/trunk/src/m/classes/public/plot/plot_tensor_principal.m
r3994 r4330 37 37 38 38 %now plot principal values 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);39 [x y z elements is2d]=processmesh(md,[],options); 40 [tensor.principalvalue1 datatype]=processdata(md,tensor.principalvalue1,options); 41 [tensor.principalvalue2 datatype]=processdata(md,tensor.principalvalue2,options); 42 42 if md.dim==3 43 [tensor.principalvalue3 isongrid isquiver]=processdata(md,tensor.principalvalue3,options);43 [tensor.principalvalue3 datatype]=processdata(md,tensor.principalvalue3,options); 44 44 end 45 45 46 46 if ((md.dim==2)), 47 47 subplot(2*width,2*width,index3) 48 plot_unit(x,y,z,elements,tensor.principalvalue1,is ongrid,is2d,isquiver,options)48 plot_unit(x,y,z,elements,tensor.principalvalue1,is2d,datatype,options) 49 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,is ongrid,is2d,isquiver,options)51 plot_unit(x,y,z,elements,tensor.principalvalue2,is2d,datatype,options) 52 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,is ongrid,is2d,isquiver,options)55 plot_unit(x,y,z,elements,tensor.principalvalue1,is2d,datatype,options) 56 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,is ongrid,is2d,isquiver,options)58 plot_unit(x,y,z,elements,tensor.principalvalue2,is2d,datatype,options) 59 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,is ongrid,is2d,isquiver,options)61 plot_unit(x,y,z,elements,tensor.principalvalue3,is2d,datatype,options) 62 62 Apply_options_tensor(md,options,type,'principal value 3') 63 63 end -
issm/trunk/src/m/classes/public/plot/plot_tensor_principalaxis.m
r3994 r4330 11 11 12 12 %process data and model 13 [x y z elements is2d]=processmesh(md, options);13 [x y z elements is2d]=processmesh(md,[],options); 14 14 15 15 if ((md.dim==2)), 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);19 [Vy isongrid isquiver]=processdata(md,Vy,options);20 [value isongrid isquiver]=processdata(md,value,options);18 [Vx datatype]=processdata(md,Vx,options); 19 [Vy datatype]=processdata(md,Vy,options); 20 [value datatype]=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);24 [Vy isongrid isquiver]=processdata(md,Vy,options);25 [Vz isongrid isquiver]=processdata(md,Vz,options);26 [value isongrid isquiver]=processdata(md,value,options);23 [Vx datatype]=processdata(md,Vx,options); 24 [Vy datatype]=processdata(md,Vy,options); 25 [Vz datatype]=processdata(md,Vz,options); 26 [value datatype]=processdata(md,value,options); 27 27 end 28 28 29 29 %take the center of each element if ~isongrid 30 if ~isongrid30 if datatype==1, 31 31 x=mean(md.x(md.elements'))'; y=mean(md.y(md.elements'))'; z=mean(md.z(md.elements'))'; 32 32 end -
issm/trunk/src/m/classes/public/plot/plot_transient_field.m
r2563 r4330 44 44 45 45 %process mes only once 46 [x y z elements is2d]=processmesh(md, options);46 [x y z elements is2d]=processmesh(md,[],options); 47 47 48 48 %plot data for all steps … … 50 50 51 51 %process data and change title if needed 52 [data isongrid isquiver]=processdata(md,md.results.transient(steps(i)).(field),options);52 [data datatype]=processdata(md,md.results.transient(steps(i)).(field),options); 53 53 options=changefieldvalue(options,'title',[field ' at time ' num2str(md.results.transient(steps(i)).time) ' a']); 54 54 55 55 %create plot of step i 56 56 subplot(subplotwidth,subplotwidth,i); 57 plot_unit(x,y,z,elements,data,is ongrid,is2d,isquiver,options)57 plot_unit(x,y,z,elements,data,is2d,datatype,options) 58 58 applyoptions(md,data,options); 59 59 -
issm/trunk/src/m/classes/public/plot/plot_transient_movie.m
r2667 r4330 17 17 18 18 %process model 19 [x y z elements is2d]=processmesh(md, options);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);26 [data datatype]=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,is ongrid,is2d,isquiver,options)28 plot_unit(x,y,z,elements,data,is2d,datatype,options) 29 29 apply_options_movie(md,options,titlestring); 30 30 -
issm/trunk/src/m/classes/public/plot/plot_unit.m
r3547 r4330 1 function plot_unit(x,y,z,elements,data,is ongrid,is2d,isquiver,options)1 function plot_unit(x,y,z,elements,data,is2d,datatype,options) 2 2 %PLOT_UNIT - unit plot, display data 3 3 % 4 4 % Usage: 5 % plot_unit(x,y,z,elements,data,is ongrid,is2d,isquiver,options);5 % plot_unit(x,y,z,elements,data,is2d,datatype,options); 6 6 % 7 7 % See also: PLOTMODEL, PLOT_MANAGER … … 14 14 %set(gca,'pos',P); 15 15 16 %regular plot 17 if ~isquiver, 16 switch datatype, 18 17 19 %element data 20 if ~isongrid 18 %element plot 19 case 1, 20 21 21 pos=find(~isnan(data)); %needed fpr element on water 22 22 if is2d, … … 32 32 end 33 33 34 %grid data 35 elseif isongrid 34 %node plot 35 case 2, 36 36 37 if is2d, 37 38 A=elements(:,1); B=elements(:,2); C=elements(:,3); … … 45 46 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor); 46 47 end 47 end48 48 49 %quiver 50 elseif isquiver,49 %quiver plot 50 case 3, 51 51 52 %grid data53 if isongrid,54 52 if is2d, 55 53 plot_quiver(x,y,data(:,1),data(:,2),options); … … 57 55 plot_quiver3(x,y,z,data(:,1),data(:,2),data(:,3),options); 58 56 end 59 else 60 error('plot_unit error message: element quiver not implemented yet') 57 58 %Patch plot 59 case 4, 60 61 if is2d, 62 patch( 'Faces',elements,'Vertices',[x y],'CData',data,'FaceColor','interp','EdgeColor',edgecolor); 63 else 64 A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6); 65 patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', data,'FaceColor','flat','EdgeColor',edgecolor); 66 patch( 'Faces', [D E F], 'Vertices', [x y z],'CData', data,'FaceColor','flat','EdgeColor',edgecolor); 67 patch( 'Faces', [A B E D], 'Vertices', [x y z],'CData', data,'FaceColor','flat','EdgeColor',edgecolor); 68 patch( 'Faces', [B E F C ], 'Vertices', [x y z],'CData', data,'FaceColor','flat','EdgeColor',edgecolor); 69 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'CData', data,'FaceColor','flat','EdgeColor',edgecolor); 70 end 71 72 otherwise, 73 error(['case ' num2str(datatype) ' not supported']); 74 61 75 end 62 76 end -
issm/trunk/src/m/classes/public/plot/processdata.m
r3994 r4330 1 function [data isongrid isquiver]=processdata(md,data,options);1 function [data datatype]=processdata(md,data,options); 2 2 %PROCESSDATA - process data to be plotted 3 3 % 4 % datatype = 1 -> elements 5 % datatype = 2 -> nodes 6 % datatype = 3 -> node quivers 7 % datatype = 4 -> patch 8 % 4 9 % Usage: 5 % [data isongrid isquiver]=processdata(md,data,options);10 % [data datatype]=processdata(md,data,options); 6 11 % 7 12 % See also: PLOTMODEL, PROCESSMESH 8 13 9 14 %check format 10 if (iscell(data) | isempty(data) | length(data)== 1),15 if (iscell(data) | isempty(data) | length(data)==0), 11 16 error('plotmodel error message: data provided is empty'); 12 17 end 13 18 14 %transpose data if necessary 15 if (size(data,2) > size(data,1)), 16 data=data'; 19 %Process Patch 20 if isstruct(data) 21 if (isfield(data,'index') & isfield(data,'value')), 22 data=data.value; 23 data=data'; 24 data=data(:); 25 datatype=4; 26 else 27 error('structure other than Patch not supported yet'); 28 end 29 else 30 %initialize datatype 31 datatype=0; 17 32 end 33 34 %get datatype 18 35 datasize=size(data); 19 36 20 %convert to double if necessary 21 if ~isnumeric(data); 22 disp('processdata info message: data is not numeric (logical?). Converted to double'); 23 data=double(data); 24 end 37 %non patch processing 38 if datatype~=4, 25 39 26 %check length 27 if datasize(1)~=md.numberofgrids & datasize(1)~=md.numberofelements & datasize(1)~=md.numberofgrids*6 & (md.dim==3 & ~(datasize(1)==md.numberofelements2d | datasize(1)==md.numberofgrids2d)) 28 error('plotmodel error message: data not supported yet'); 29 end 40 %transpose data if necessary 41 if (size(data,2) > size(data,1)), 42 data=data'; 43 end 44 datasize=size(data); 30 45 31 %isquiver? 32 if datasize(2)>1, 33 isquiver=1; 34 35 %check number of columns, add zeros if necessary, 36 if (md.dim==3) 37 if datasize(2)==2, 38 data=[data, zeros(datasize(1),1)]; 39 elseif datasize(2)~=3, 40 error('plotmodel error message: data provided should have 2 or 3 columns for quiver plot, and 1 for regular plot'); 41 end 42 elseif ((md.dim==2) & datasize(2)~=2), 43 error('plotmodel error message: data provided should have 2 columns for quiver plot, and 1 for regular plot'); 46 %convert to double if necessary 47 if ~isnumeric(data); 48 disp('processdata info message: data is not numeric (logical?). Converted to double'); 49 data=double(data); 44 50 end 45 51 46 else 47 isquiver=0; 48 end 52 %check length 53 if datasize(1)~=md.numberofgrids & datasize(1)~=md.numberofelements & datasize(1)~=md.numberofgrids*6 & (md.dim==3 & ~(datasize(1)==md.numberofelements2d | datasize(1)==md.numberofgrids2d)) 54 error('plotmodel error message: data not supported yet'); 55 end 49 56 50 %treat the case datasize(1)=6*grids 51 if datasize(1)==6*md.numberofgrids 52 %keep the only norm of data 53 data1=data(1:6:md.numberofgrids*6,:); 54 data2=data(2:6:md.numberofgrids*6,:); 55 data=sqrt(data1.^2+data2.^2); 56 datasize(1)=md.numberofgrids; 57 %---> go to grid data 58 end 57 %quiver? 58 if datasize(2)>1, 59 datatype=3; 59 60 60 %treat the case datasize(1)=grids2d 61 if (md.dim==3 & datasize(1)==md.numberofgrids2d), 62 data=project3d(md,data,'node'); 63 datasize(1)=md.numberofgrids; 64 %---> go to grid data 65 end 61 %check number of columns, add zeros if necessary, 62 if (md.dim==3) 63 if datasize(2)==2, 64 data=[data, zeros(datasize(1),1)]; 65 elseif datasize(2)~=3, 66 error('plotmodel error message: data provided should have 2 or 3 columns for quiver plot, and 1 for regular plot'); 67 end 68 elseif ((md.dim==2) & datasize(2)~=2), 69 error('plotmodel error message: data provided should have 2 columns for quiver plot, and 1 for regular plot'); 70 end 71 end 66 72 67 %treat the case datasize(1)=grids2d 68 if (md.dim==3 & datasize(1)==md.numberofelements2d), 69 data=project3d(md,data,'element'); 70 datasize(1)=md.numberofelements; 71 %---> go to grid data 72 end 73 %treat the case datasize(1)=6*grids 74 if datasize(1)==6*md.numberofgrids 75 %keep the only norm of data 76 data1=data(1:6:md.numberofgrids*6,:); 77 data2=data(2:6:md.numberofgrids*6,:); 78 data=sqrt(data1.^2+data2.^2); 79 datasize(1)=md.numberofgrids; 80 %---> go to grid data 81 end 73 82 74 %smoothing? 75 if exist(options,'smooth') 76 data=averaging(md,data,getfieldvalue(options,'smooth')); 77 datasize(1)=md.numberofgrids; 78 %---> go to grid data 83 %treat the case datasize(1)=grids2d 84 if (md.dim==3 & datasize(1)==md.numberofgrids2d), 85 data=project3d(md,data,'node'); 86 datasize(1)=md.numberofgrids; 87 %---> go to grid data 88 end 89 90 %treat the case datasize(1)=grids2d 91 if (md.dim==3 & datasize(1)==md.numberofelements2d), 92 data=project3d(md,data,'element'); 93 datasize(1)=md.numberofelements; 94 %---> go to grid data 95 end 96 97 %smoothing? 98 if exist(options,'smooth') 99 data=averaging(md,data,getfieldvalue(options,'smooth')); 100 datasize(1)=md.numberofgrids; 101 %---> go to grid data 102 end 79 103 end 80 104 81 105 %element data 82 106 if datasize(1)==md.numberofelements; 83 isongrid=0; 107 108 %Initialize datatype if non patch 109 if datatype~=4, 110 datatype=1; 111 end 84 112 85 113 %ice sheet only? … … 104 132 %grid data 105 133 if datasize(1)==md.numberofgrids 106 isongrid=1;134 datatype=1; 107 135 %ice sheet only? 108 136 if getfieldvalue(options,'iceshelf',1)==0, … … 133 161 134 162 %control arrow density if quiverplot 135 if isquiver& exist(options,'density')163 if datatype==3 & exist(options,'density') 136 164 databak=data; 137 165 data=NaN*ones(datasize); -
issm/trunk/src/m/classes/public/plot/processmesh.m
r3994 r4330 1 function [x y z elements is2d]=processmesh(md, options);1 function [x y z elements is2d]=processmesh(md,data,options); 2 2 %PROCESSMESH - process mesh to be plotted 3 3 % 4 4 % Usage: 5 % [x y z elements is2d]=processmesh(md, options)5 % [x y z elements is2d]=processmesh(md,data,options) 6 6 % 7 7 % See also: PLOTMODEL, PROCESSDATA … … 12 12 end 13 13 14 %first load x,y, etc ... to speed up plot 15 x=md.x; 16 x2d=md.x2d; 17 y=md.y; 18 y2d=md.y2d; 19 z=md.z; 20 z2d=md.z2d; 21 elements2d=md.elements2d; 22 elements=md.elements; 23 elements_type2d=md.elements_type2d; 14 if (isempty(data) | ~isstruct(data)), 15 %first load x,y, etc ... to speed up plot 16 x=md.x; 17 x2d=md.x2d; 18 y=md.y; 19 y2d=md.y2d; 20 z=md.z; 21 z2d=md.z2d; 22 elements2d=md.elements2d; 23 elements=md.elements; 24 elements_type2d=md.elements_type2d; 24 25 25 %is it a 2d plot? 26 if (md.dim==2); 27 is2d=1; 28 else 29 if getfieldvalue(options,'layer',0)>=1, 26 %is it a 2d plot? 27 if (md.dim==2); 30 28 is2d=1; 31 29 else 32 is2d=0; 30 if getfieldvalue(options,'layer',0)>=1, 31 is2d=1; 32 else 33 is2d=0; 34 end 33 35 end 34 end35 36 36 %layer projection? 37 if getfieldvalue(options,'layer',0)>=1, 38 %we modify the mesh temporarily to a 2d mesh from which the 3d mesh was extruded. 39 x=x2d; 40 y=y2d; 41 z=z2d; 42 elements=elements2d; 43 elements_type=elements_type2d; 37 %layer projection? 38 if getfieldvalue(options,'layer',0)>=1, 39 %we modify the mesh temporarily to a 2d mesh from which the 3d mesh was extruded. 40 x=x2d; 41 y=y2d; 42 z=z2d; 43 elements=elements2d; 44 elements_type=elements_type2d; 45 end 46 else 47 %Process Patch 48 elements=transpose(reshape(1:3*md.numberofelements,3,md.numberofelements)); 49 x=transpose(reshape(md.x(data.index)',1,3*md.numberofelements)); 50 y=transpose(reshape(md.y(data.index)',1,3*md.numberofelements)); 51 z=zeros(3*md.numberofelements,1); 52 is2d=1; 44 53 end 45 54
Note:
See TracChangeset
for help on using the changeset viewer.