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

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

Use previous partitioning

File size: 1.8 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 %distribute importance factor
49 factors=importancefactors(md.part'+1); %md.part was created to index "c" style
50end
51
52%weight importancefactors by area
53%if numel(factors)==md.numberofgrids,
54% %get areas for each vertex.
55% aire=GetAreas(md.elements,md.x,md.y);
56% num_elements_by_node=md.nodeconnectivity(:,end);
57% grid_aire=zeros(md.numberofgrids,1);
58% for i=1:md.numberofgrids,
59% for j=1:num_elements_by_node(i),
60% grid_aire(i)=grid_aire(i)+aire(md.nodeconnectivity(i,j));
61% end
62% end
63% factors=factors./grid_aire;
64%end
Note: See TracBrowser for help on using the repository browser.