rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
lin_evol_primal_dual_gen_detailed_data.m
Go to the documentation of this file.
1 function detailed_data = lin_evol_primal_dual_gen_detailed_data(model, model_data)
2 %detailed_data = lin_evol_primal_dual_gen_detailed_data(model, model_data)
3 %
4 % function generating both primal and dual detailed_data. Further writes
5 % both detailed_data_primal and detailed_data_dual into one structure:
6 % detailed_data. Used for the improved output and output estimator using
7 % the dual problem.
8 %
9 % special Note: in the european_option_pricing model a functional named
10 % 'theta' includes a partial timederivative and therefore produces a
11 % slightly different dual problem. Therefore the 'theta'-case is sometimes
12 % treated differently. Don't care about this case if you don't use the
13 % european_option_pricing model.
14 
15 % Domink Garmatter 06.09 2012
16 
17 
18 % always use the energy error estimator for basis generation (remeber your
19 % final aim is the improved output and improved output estimator, which
20 % also uses the energy error estimator)
21 %model.RB_error_indicator = 'estimator';
22 %model.error_norm = 'energy';
23 % generate primal detailed_data
24 model.want_dual = 0;
25 detailed_data_primal = gen_detailed_data(model, model_data);
26 % generate dual detailed_data
27 model.want_dual = 1;
28 % if there are model fiels specifying the dual RB generation use them.
29 % Otherwise the primal fields are automatically used.
30 if isfield(model, 'dual_RB_stop_epsilon')
31  model.RB_stop_epsilon = model.dual_RB_stop_epsilon;
32 end
33 if isfield(model, 'dual_RB_stop_Nmax')
34  model.RB_stop_Nmax = model.dual_RB_stop_Nmax;
35 end
36 if isfield(model, 'dual_RB_stop_timeout')
37  model.RB_stop_timeout = model.dual_RB_stop_timeout;
38 end
39 detailed_data_dual = gen_detailed_data(model, model_data);
40 % write both primal and dual detailed_data in one combined detailed_data
41 detailed_data = [];
42 detailed_data = structcpy(detailed_data, detailed_data_primal);
43 detailed_data.dual_RB = detailed_data_dual.RB;
44 detailed_data.dual_RB_info = detailed_data_dual.RB_info;
45 detailed_data.dual_N = detailed_data_dual.N;
46 if isfield(detailed_data_dual, 'L_I_comp')
47  detailed_data.dual_L_I_comp = detailed_data_dual.L_I_comp;
48 end
49 if isfield(detailed_data_dual, 'L_E_comp')
50  detailed_data.dual_L_E_comp = detailed_data_dual.L_E_comp;
51 end
52 if isfield(detailed_data_dual, 'b_comp')
53  detailed_data.dual_b_comp = detailed_data_dual.b_comp;
54 end
function s1 = structcpy(s1, s2)
copies the fields of structure s2 into structure s1. If the field to be copied does not exist in s1 y...
Definition: structcpy.m:17
function detailed_data = lin_evol_primal_dual_gen_detailed_data(model, model_data)
detailed_data = lin_evol_primal_dual_gen_detailed_data(model, model_data)