rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
hp_simulation.m
1  function sim_data = hp_simulation(hp_model)
2  %function sim_data = hp_simulation_alt(tree,param)
3  %
4  % findes the correct subdomain and computes a reduced basis simutlation
5  % need a hp_model with a generated reduced basis (function: hp_rb_generation);
6 
7 
8  sim_data = navigation(hp_model.tree,get_mu(hp_model));
9 
10  function data = navigation(tree,param)
11  test = iscell(tree);
12  %Navigation
13  if test ==1
14  % Representanten bestimmen
15  first_l=tree_first(tree{1});
16  first_r=tree_first(tree{2});
17  % Mit d-Funktion naviagtion durchführen
18 
19 
20  if hp_model.error_distance_extionsion ==1
21 
22  distance_l = hp_model.distance_function(first_l.model,first_l.anchor,param,...
23  first_l.detailed_data,first_l.reduced_data);%norm(first_l-param,2);
24  distance_r = hp_model.distance_function(first_r.model, first_r.anchor,param,...
25  first_r.detailed_data,first_r.reduced_data) ;%norm(first_r-param,2);
26 
27  else
28 
29  distance_l = hp_model.distance_function(first_l.model,first_l.anchor,param);%norm(first_l-param,2);
30  distance_r = hp_model.distance_function(first_r.model, first_r.anchor,param);%norm(first_r-param,2);
31 
32  end
33  % Unterbaum finden und Rekursiv vortfahren
34  if distance_l<distance_r
35  data = navigation(tree{1},param);
36  else
37  data = navigation(tree{2},param);
38  end;
39  else
40  % im passenden Gebiet angekommen - RB Simulation durchführen
41  tree.model=set_mu(tree.model,param);
42  data = rb_simulation(tree.model,tree.reduced_data);
43  data = rb_reconstruction(tree.model,tree.detailed_data,data);
44  end;
45  end
46  %Hilfsfunktion für die Baumnavigation
47  function value= tree_first (tree)
48  t= iscell(tree);
49  if t==1
50  value=tree_first(tree{1});
51  else
52  value=tree;
53  end;
54 
55  end
56 
57  end