[13975] | 1 | function 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] | 10 | if exist(options,'designvariable'),
|
---|
| 11 | descriptor=getfieldvalue(options,'designvariable');
|
---|
[1] | 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
|
---|
[2439] | 18 | if exist(options,'responsefunction'),
|
---|
| 19 | responsefunctiondescriptor=getfieldvalue(options,'responsefunction');
|
---|
[1] | 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
|
---|
[9650] | 25 | responsefunctions=md.qmu.results{2};
|
---|
[1] | 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
|
---|
[9650] | 40 | importancefactors=zeros(md.qmu.numberofpartitions,1);
|
---|
[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?
|
---|
[2439] | 54 | if exist(options,'log'),
|
---|
| 55 | logvalue=getfieldvalue(options,'log');
|
---|
[1] | 56 | importancefactors=log(importancefactors)/log(logvalue);
|
---|
| 57 | end
|
---|
| 58 |
|
---|
| 59 | %Ok, get partitioning.
|
---|
[9650] | 60 | [epart npart]=MeshPartition(md,md.qmu.numberofpartitions);
|
---|
[1] | 61 |
|
---|
| 62 | %distribute importance factor
|
---|
[8298] | 63 | nodeimportance=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
|
---|
| 69 | edgecolor=getfieldvalue(options,'edgecolor','none');
|
---|
[1] | 70 |
|
---|
| 71 | %standard plot:
|
---|
| 72 | subplot(width,width,ii);
|
---|
| 73 |
|
---|
[8298] | 74 | %ok, plot nodeimportance now.
|
---|
[1] | 75 | if 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] | 78 | else
|
---|
| 79 | error('plot_importancefactors error message: 3d meshes not supported yet');
|
---|
| 80 | end
|
---|
| 81 |
|
---|
| 82 | %apply options
|
---|
[2439] | 83 | applyoptions(md,[],options);
|
---|