rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
lin_stat_gen_detailed_data.m
1 function detailed_data = lin_stat_gen_detailed_data(model,model_data)
2 %function detailed_data = lin_stat_gen_detailed_data(model,model_data)
3 %
4 % function computing the high-dimensional parameter independent
5 % data required for rb-treatment of a fem-problem, comprises all
6 % expensive computations
7 
8 % B. Haasdonk 22.2.2011
9 
10 detailed_data = model_data;
11 
12 % change mode of model to components:
13 old_mode = model.decomp_mode;
14 model.decomp_mode = 1; % == components
15 
16 % the following generates cell arrays of components
17 [A_comp,f_comp] = model.operators(model,model_data);
18 Q_A = length(A_comp);
19 Q_f = length(f_comp);
20 H = length(f_comp{1}); % number of dofs
21 if model.compute_output_functional
22  l_comp = model.operators_output(model,detailed_data);
23  Q_l = length(l_comp);
24 end;
25 
26 % transform cell arrays to matrices for efficiency
27 detailed_data.f_comp = zeros(H,Q_f);
28 for q = 1:Q_f
29  detailed_data.f_comp(:,q) = f_comp{q};
30 end;
31 if model.compute_output_functional
32  detailed_data.l_comp = zeros(H,Q_l);
33  for q = 1:Q_l
34  detailed_data.l_comp(:,q) = l_comp{q};
35  end;
36 end;
37 % detect overall sparsity pattern:
38 Asum = A_comp{1};
39 for q = 2:Q_A
40  Asum = Asum + A_comp{q};
41  ind = find(Asum);
42  siz = size(Asum);
43  [i,j] = ind2sub(siz,ind);
44  detailed_data.A_size = siz;
45  detailed_data.A_row_indices = i;
46  detailed_data.A_column_indices = j;
47 end;
48 for q = 1:Q_A
49  Aq = A_comp{q};
50  detailed_data.A_comp(:,q) = Aq(ind);
51 end;
52 
53 % generate reduced basis
54 detailed_data = rb_basis_generation(model,detailed_data);
55 
56 % set back old mode
57 model.decomp_mode = old_mode;
function detailed_data = rb_basis_generation(model, detailed_data)
reduced basis construction with different methods