source: issm/trunk/src/m/plot/plot_importancefactors.m

Last change on this file was 13975, checked in by Mathieu Morlighem, 12 years ago

merged trunk-jpl and trunk for revision 13974

File size: 2.4 KB
RevLine 
[13975]1function plot_importancefactors(md,options,width,ii)
[1]2%PLOT_IMPORTANCEFACTORS - plot importance factors
3%
4% Usage:
[2439]5% plot_importancefactors(md,options,width,i);
[1]6%
7% See also: PLOTMODEL
8
9%first recover design variable descriptor
[2439]10if exist(options,'designvariable'),
11 descriptor=getfieldvalue(options,'designvariable');
[1]12else
13 error('plot_importancefactors error message: Need to supply design variable descriptor');
14end
15descriptorlength=length(descriptor);
16
17%then recover responsfunction name
[2439]18if exist(options,'responsefunction'),
19 responsefunctiondescriptor=getfieldvalue(options,'responsefunction');
[1]20else
21 error('plot_importancefactors error message: Need to supply response function descriptor');
22end
23
24%go through all response functions and find the one corresponding to the correct responsefunctiondescriptor
[9650]25responsefunctions=md.qmu.results{2};
[1]26found=0;
27for i=1:length(responsefunctions),
28 if strcmpi(responsefunctions(i).descriptor,responsefunctiondescriptor),
29 found=i;
30 break;
31 end
32end
33if ~found,
34 error('plot_importancefactors error message: could not find correct response function');
35end
36responsefunctions=responsefunctions(found);
37nfun=size(responsefunctions.desvar,1);
38
39%Now recover response to the correct desgin variable
[9650]40importancefactors=zeros(md.qmu.numberofpartitions,1);
[1]41count=0;
42for i=1:nfun,
43 desvar=responsefunctions.desvar{i};
44 if strncmpi(desvar,descriptor,descriptorlength),
45 count=count+1;
46 importancefactors(count)=responsefunctions.impfac(i);
47 end
48end
49if count==0,
50 error('plot_importancefactors error message: could not find to response functions with corresponding design variable');
51end
52
53%log?
[2439]54if exist(options,'log'),
55 logvalue=getfieldvalue(options,'log');
[1]56 importancefactors=log(importancefactors)/log(logvalue);
57end
58
59%Ok, get partitioning.
[9650]60[epart npart]=MeshPartition(md,md.qmu.numberofpartitions);
[1]61
62%distribute importance factor
[8298]63nodeimportance=importancefactors(npart);
[1]64
65%process data and model
[8472]66[x y z elements is2d isplanet]=processmesh(md,[],options);
[1]67
[2439]68%edgecolor
69edgecolor=getfieldvalue(options,'edgecolor','none');
[1]70
71%standard plot:
72subplot(width,width,ii);
73
[8298]74%ok, plot nodeimportance now.
[1]75if is2d,
76 A=elements(:,1); B=elements(:,2); C=elements(:,3);
[8298]77 patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', nodeimportance,'FaceColor','interp','EdgeColor',edgecolor);
[1]78else
79 error('plot_importancefactors error message: 3d meshes not supported yet');
80end
81
82%apply options
[2439]83applyoptions(md,[],options);
Note: See TracBrowser for help on using the repository browser.