rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
LeafDescription.m
1 classdef LeafDescription < DataTree.ICreator
2  % DataTree.ICreator implementation which does not create a tree, but a cell
3  % array of descriptions for all leafs in the tree.
4 
5  methods
6  function node = create_tpart_node(this, t_part_map, initvalues)
7  % function node = create_tpart_node(this, t_part_map, initvalues)
9  %
11  for i = 1:length(initvalues)
12  tslice = get_coords(t_part_map, t_part_map.leaf_enum(i));
13  bary = barycenter(t_part_map, t_part_map.leaf_enum(i));
14  for j = 1:length(initvalues{i})
15  if isempty(initvalues{i}(j).tslice)
16  initvalues{i}(j).tslice = tslice;
17  initvalues{i}(j).t_bary = bary;
18  end
19  end
20  end
21 
22  node = [initvalues{:}];
23  end
24 
25  function node = create_idmap_node(this, id_map, initvalues)
26  % function node = create_idmap_node(this, id_map, initvalues)
28  %
30 
31  for i = 1:length(initvalues)
32  for j = 1:length(initvalues{i})
33  if isempty(initvalues{i}(j).id)
34  initvalues{i}(j).id = DataTree.IdMapNode.flatten_cell_array(id_map{i});
35  end
36  end
37  end
38  node = [initvalues{:}];
39  end
40 
41  function node = create_ppart_node(this, p_part_map, initvalues)
42  % function node = create_ppart_node(this, p_part_map, initvalues)
44  %
46  for i = 1:length(initvalues)
47  mu_cube = get_coords(p_part_map, p_part_map.leaf_enum(i));
48  mu_bary = barycenter(p_part_map, p_part_map.leaf_enum(i));
49  for j = 1:length(initvalues{i})
50  if isempty(initvalues{i}(j).mu_cube)
51  initvalues{i}(j).mu_cube = mu_cube;
52  initvalues{i}(j).mu_bary = mu_bary;
53  end
54  end
55  end
56 
57  node = [initvalues{:}];
58  end
59 
60  function node = create_leaf_node(this, arg_node, basepath, mu_cube, tslice)
61  % function node = create_leaf_node(this, arg_node, basepath, mu_cube, tslice)
63  %
64  % @copydetails DataTree.ICreator.create_leaf_node()
65 
66  node = struct('tslice', [], 't_bary', [], 'id', [], 'mu_cube', [], 'mu_bary', [], 'basepath', basepath);
67 
68  end
69 
70  end
71 end
Data Tree element which can be filtered by ids
Definition: IdMapNode.m:18
virtual function DataTree.ILeafNode node = create_leaf_node(DataTree.ILeafNode arg_node, basepath, mu_cube, tslice)
is called on leaf elements of a DataTree and returns a new leaf out of it.
interface for a class used to create a new (sub-)tree from an old one with the DataTree.INode.creat...
Definition: ICreator.m:18
virtual function DataTree.PpartNode node = create_tpart_node(t_part_map, initvalues)
is called on DataTree.PpartNode elements of a DataTree and returns a new p-part node out of it...
virtual function DataTree.IdMapNode node = create_idmap_node(id_map, initvalues)
is called on DataTree.IdMapNode elements of a DataTree and returns a new ID mapped node out of it...
static function flatca = flatten_cell_array(ca)
flattens a cell array, i.e. returns a cell without cell entries which are cell arrays by itself...
Definition: IdMapNode.m:531
virtual function DataTree.PpartNode node = create_ppart_node(p_part_map, initvalues)
is called on DataTree.PpartNode elements of a DataTree and returns a new p-part node out of it...