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