Changeset 700
- Timestamp:
- 06/02/09 11:09:38 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/displayresults.m
r1 r700 9 9 % displayresults(md) 10 10 11 disp(sprintf(' Results:')); 12 disp(sprintf(' ''%s''','diagnostic')); 13 if isempty(md.vx), disp(sprintf(' vx: N/A')); else disp(sprintf(' vx [m/a]: (%i)',length(md.vx))); end 14 if isempty(md.vy), disp(sprintf(' vy: N/A')); else disp(sprintf(' vy [m/a]: (%i)',length(md.vy))); end 15 if isempty(md.vz), disp(sprintf(' vz: N/A')); else disp(sprintf(' vz [m/a]: (%i)',length(md.vz))); end 16 if isempty(md.vel), disp(sprintf(' vel: N/A')); else disp(sprintf(' vel [m/a]: (%i)',length(md.vel))); end 17 if isempty(md.pressure), disp(sprintf(' pressure: N/A')); else disp(sprintf(' pressure [Pa]: (%i)',length(md.pressure))); end 18 if isempty(md.viscousheating), disp(sprintf(' viscousheating: N/A')); else disp(sprintf(' viscousheating [Pa]: (%i)',length(md.viscousheating))); end 19 if ~isstruct(md.stress), disp(sprintf(' stress: N/A')); 11 fprintf(' Results:\n'); 12 13 %call struct_display recursively on md.results 14 struct_display(md.results,' '); 15 16 %display output parameters 17 fprintf('\n output parameters:\n'); 18 if ~isstruct(md.stress), fprintf(' stress: N/A\n'); 20 19 else 21 disp(sprintf(' stress [Pa]:'))20 fprintf(' stress [Pa]:'); 22 21 struct_display(md.stress,' '); 23 22 end 24 if ~isstruct(md.deviatoricstress), disp(sprintf(' deviatoricstress: N/A'));23 if ~isstruct(md.deviatoricstress), fprintf(' deviatoricstress: N/A\n'); 25 24 else 26 disp(sprintf(' deviatoricstress [Pa]:'))25 fprintf(' deviatoricstress [Pa]:'); 27 26 struct_display(md.deviatoricstress,' '); 28 27 end 29 if ~isstruct(md.strainrate), disp(sprintf(' strainrate: N/A'));28 if ~isstruct(md.strainrate), fprintf(' strainrate: N/A\n'); 30 29 else 31 disp(sprintf(' strainrate [1/a]:'))32 30 fprintf(' strainrate [1/a]:'); 31 struct_display(md.strainrate,' '); 33 32 end 34 35 disp(sprintf(' ''%s''','transient'));36 if ~isstruct(md.transient_results), disp(sprintf(' transient_results: N/A'));37 else38 struct_display(md.transient_results,' ');39 end40 41 disp(sprintf(' ''%s''','control method'));42 if isempty(md.cont_vx), disp(sprintf(' cont_vx: N/A')); else disp(sprintf(' cont_vx [m/a]: (%i)',length(md.cont_vx))); end43 if isempty(md.cont_vy), disp(sprintf(' cont_vy: N/A')); else disp(sprintf(' cont_vy [m/a]: (%i)',length(md.cont_vy))); end44 if isempty(md.cont_vz), disp(sprintf(' cont_vz: N/A')); else disp(sprintf(' cont_vz [m/a]: (%i)',length(md.cont_vz))); end45 if isempty(md.cont_vel), disp(sprintf(' cont_vel: N/A')); else disp(sprintf(' cont_vel [m/a]: (%i)',length(md.cont_vel))); end46 if isempty(md.cont_parameters), disp(sprintf(' cont_parameters: N/A')); else disp(sprintf(' cont_parameters: (%i)',length(md.cont_parameters))); end47 if isempty(md.cont_J), disp(sprintf(' cont_J: N/A')); else disp(sprintf(' cont_J: (%i)',length(md.cont_J))); end48 49 50 disp(sprintf(' ''%s''','thermal'));51 if isempty(md.temperature), disp(sprintf(' temperature: N/A')); else disp(sprintf(' temperature [K]: (%i)',length(md.temperature))); end52 if ~isstruct(md.thermaltransient_results), disp(sprintf(' thermaltransient_results: N/A'));53 else54 struct_display(md.thermaltransient_results,' ');55 end56 57 disp(sprintf(' ''%s''','mesh2grid'));58 if isempty(md.mesh2grid_results) | isnan(md.mesh2grid_results), disp(sprintf(' mesh2grid_results: N/A')); else disp(sprintf(' mesh2grid_results: (%i)',length(md.mesh2grid_results))); end59 60 33 end 61 34 62 35 function struct_display(structure,offset) 63 structure_fields=fields(structure); 64 for i=1:length(structure_fields), 65 disp(sprintf('%s',[offset ' ' structure_fields{i} ': (' num2str(size( eval([' structure.' structure_fields{i}]),1)) ')' ])); 36 structure_fields=fields(structure); 37 for i=1:length(structure_fields), 38 %recursive call if necessary 39 field=eval(['structure.' structure_fields{i}]); 40 if isstruct(field), 41 fprintf('\n%s\n',[offset structure_fields{i} ':']); 42 struct_display(field,[offset ' ']); 43 else 44 fprintf('%s\n',[offset structure_fields{i} ': (' num2str(size(field,1)) ')' ]); 45 end 46 end 66 47 end 67 68 end
Note:
See TracChangeset
for help on using the changeset viewer.