source: issm/trunk/src/m/classes/public/importancefactors.m@ 2049

Last change on this file since 2049 was 2049, checked in by Eric.Larour, 15 years ago

no more plot_qmuimportancefactors, replaced by importancefactors routine.
fixed bug in LaunchQueueJobGeneric in name of qmu.in file

File size: 1.5 KB
Line 
1function factors=importancefactors(md,variablename,responsename)
2%IMPORTANCEFACTORS - compute importance factors for a certain variable and response.
3%
4% Usage:
5% factors=importancefactors(md,variablename,responsename)
6%
7%
8% Example: factors=importancefactors(md,'drag','max_vel');
9%
10
11
12variablenamelength=length(variablename);
13
14%go through all response functions and find the one corresponding to the correct responsename
15responsefunctions=md.dakotaresults.dresp_out;
16found=0;
17for i=1:length(responsefunctions),
18 if strcmpi(responsefunctions(i).descriptor,responsename),
19 found=i;
20 break;
21 end
22end
23if ~found,
24 error('importancefactors error message: could not find correct response function');
25end
26responsefunctions=responsefunctions(found);
27nfun=size(responsefunctions.var,1);
28
29%Now recover response to the correct design variable
30importancefactors=zeros(1,0);
31count=0;
32for i=1:nfun,
33 desvar=responsefunctions.var{i};
34 if strncmpi(desvar,variablename,variablenamelength),
35 importancefactors(end+1)=responsefunctions.impfac(i);
36 count=count+1;
37 end
38end
39
40if count==0,
41 error('importancefactors error message: could not find to response functions with corresponding design variable');
42end
43
44if count==1, %we have scalar
45 factors=importancefactors;
46 return;
47else
48 %Ok, get partitioning, unless already supplied
49 if isempty(md.part),
50 [epart npart]=MeshPartition(md,md.npart);
51 else
52 npart=md.part+1;
53 end
54
55 %distribute importance factor
56 factors=importancefactors(npart)';
57end
Note: See TracBrowser for help on using the repository browser.