plot_transient_movie

PURPOSE ^

PLOT_TRANSIENT_MOVIE - plot a transient result as a movie

SYNOPSIS ^

function plot_transient_movie(md,options_structure,width,i);

DESCRIPTION ^

PLOT_TRANSIENT_MOVIE - plot a transient result as a movie
   Usage:
      plot_transient_movie(md,options_structure,width,i);

   See also: PLOTMODEL

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function plot_transient_movie(md,options_structure,width,i);
0002 %PLOT_TRANSIENT_MOVIE - plot a transient result as a movie
0003 %   Usage:
0004 %      plot_transient_movie(md,options_structure,width,i);
0005 %
0006 %   See also: PLOTMODEL
0007 
0008     %plot mesh boundaries
0009     subplot(width,width,i); 
0010 
0011     %first load x,y, etc ... to speed up plot
0012     x=md.x;
0013     x2d=md.x2d;
0014     y=md.y;
0015     y2d=md.y2d;
0016     z=md.z;
0017     z2d=md.z2d;
0018     elements2d=md.elements2d;
0019     elements=md.elements;
0020     elements_type2d=md.elements_type2d;
0021 
0022     %units
0023     if ~isnan(options_structure.unitmultiplier),
0024         md.x=md.x*options_structure.unitmultiplier;
0025         md.y=md.y*options_structure.unitmultiplier;
0026         md.z=md.z*options_structure.unitmultiplier;
0027     end
0028 
0029     %edgecolor?
0030     if ~isnan(options_structure.edgecolor),
0031         edgecolor=options_structure.edgecolor;
0032     else
0033         edgecolor='none';
0034     end
0035 
0036     if strcmpi(md.type,'2d') 
0037         choice=input('Which field do you want to plot? (vel/vx/vy/thickness/surface/bed)','s');
0038 
0039         if ~strcmp(choice,'vel') & ~strcmp(choice,'vx') & ~strcmp(choice,'vy') & ~strcmp(choice,'thickness') & ~strcmp(choice,'bed') & ~strcmp(choice,'surface')
0040             disp('plot_transient_movie error message: input not supported yet, exiting...')
0041             return
0042         end
0043         if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf,
0044             pos=find(md.gridoniceshelf);
0045             data(pos)=NaN;
0046         end
0047         if ~isnan(options_structure.noiceshelf) & options_structure.noicesheet,
0048             pos=find(md.gridonicesheet);
0049             data(pos)=NaN;
0050         end
0051         for i=1:length(md.transient_results)
0052             eval(['data=md.transient_results(' num2str(i) ').' num2str(choice) ';']);
0053             titlestring=[choice ' at time ' num2str(md.transient_results(i).time) ' year'];
0054             A=elements(:,1); B=elements(:,2); C=elements(:,3); 
0055             patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0056             apply_options_movie(options_structure,titlestring);
0057             pause(0.5)
0058         end
0059 
0060     else
0061         choice=input('Which field do you want to plot? (vel/vx/vy/vz/thickness/surface/bed/temperature)','s');
0062 
0063         if ~strcmp(choice,'vel') & ~strcmp(choice,'vx') & ~strcmp(choice,'vy') & ~strcmp(choice,'vz') & ~strcmp(choice,'temperature') & ~strcmp(choice,'thickness') & ~strcmp(choice,'bed') & ~strcmp(choice,'surface')
0064             disp('plot_transient_movie error message: input not supported yet, exiting...')
0065             return
0066         end
0067         if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf,
0068             pos=find(md.gridoniceshelf);
0069             data(pos)=NaN;
0070         end
0071         if ~isnan(options_structure.noiceshelf) & options_structure.noicesheet,
0072             pos=find(md.gridonicesheet);
0073             data(pos)=NaN;
0074         end
0075         for i=1:length(md.transient_results)
0076             eval(['data=md.transient_results(' num2str(i) ').' num2str(choice) ';']);
0077             titlestring=[choice 'at time ' num2str(md.transient_results(i).time) ' a'];
0078             A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
0079             patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0080             patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0081             patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0082             patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0083             patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', data,'FaceColor','interp','EdgeColor',edgecolor);
0084             apply_options_movie(options_structure,titlestring);
0085             pause(0.5)
0086         end
0087     end
0088 
0089 end %function
0090 
0091 function apply_options_movie(options_structure,titlestring)
0092     %apply options
0093     if isnan(options_structure.title)
0094         options_structure.title=titlestring;
0095     end 
0096     if isnan(options_structure.colorbar)
0097         options_structure.colorbar=1;
0098     end
0099     applyoptions(md,[],options_structure);
0100 end

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