rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
List of all members | Public Member Functions
DataTree.INode Class Referenceabstract

Detailed Description

Interface for a node in a DataTree.

A DataTree consists of nodes with an arbitrary number of children or DataTree.ILeafNode's which store data. In the abstract version of a DataTree, non-leaf nodes can be one of:

Each of these nodes specify information about the data stored in the leaf nodes.

Considering e.g. the tree configuration

dot_inline_dotgraph_3.png

the red leaf element is tagged with the id "implicit" and valid inside the time slice interval \([11,30]\). Children are numbered consecutively and can be received by using a concatenation of indices. The read leaf element could for example be reached via

red_leaf = get(idmap_root, [1,2]);

where the index vector is obtainable via a call to the get_index() method

index = get_index(idmap_root, "implicit", [], 23);

There exist generic specializations for DataTrees representing detailed data (Greedy.DataTree.Detailed.INode, Greedy.DataTree.Detailed.ILeafNode) and reduced data (Greedy.User.RbReducedDataDefault) which have no extra functionality for non-leaf node elements.

Definition at line 18 of file INode.m.

Inheritance diagram for DataTree.INode:
Inheritance graph
[legend]
Collaboration diagram for DataTree.INode:
Collaboration graph
[legend]

Public Member Functions

virtual function INode
data = 
get (index)
 Access to a child of the current node. More...
 
virtual function index = get_index (id, mu, nt)
 Obtains the leaf index vector that best fits the child description given by the three arguments. More...
 
virtual function DataTree.INode tree = create_tree (DataTree.ICreator creator, ids, mu_cube, tslice, basepath)
 Creates a new tree from a subtree specified by ids, parameter and time index regions. More...
 
virtual function
children = 
length ()
 Returns the number of children of the node. More...
 
virtual function this = set (index, value)
 Sets a child at the given path in the tree hierarchy. More...
 
function  leaf_func (funcptr, ids, mu_cube, tslice)
 applies a function to all leafs of a DataTree More...
 
function tree = create_scalar_tree (funcptr, ids, mu_cube, tslice)
 copies the current trees with different leafs. These leafs are computes by a function returning scalar values. More...
 
function
start_index = 
traverse_start ()
 Start iterator for a full traverse of the DataTree. More...
 
function
next_index = 
traverse_next (this_index)
 iterator for a full traverse of the DataTree. More...
 
function
description = 
get_active_leaf_description (IModel model, ids)
 returns an enumeration of all leaves' basepath index vectors with a description of their parents. More...
 
function
description = 
get_leaf_description (ids, mu_cube, tslice)
 returns an enumeration of all leaves' basepath index vectors with a description of their parents. More...
 
function tstop = index_valid_till (index)
 Returns the last valid time step index of a time slice. More...
 
function INode data = get_by_description (id, mu, nt)
 A combination of get_index() and get() More...
 
function
active_leaf_index = 
get_active_leaf_index (IModel model, id)
 retuns the leaf element index for the current IDetailedModel configuration. More...
 
function DataTree.LeafNode
active_leaf = 
get_active_leaf (IModel model, id)
 retuns the leaf element for the current IDetailedModel configuration. More...
 
function  display (fn, basepath, name)
 overwrites the standard display method for DataTree objects More...
 
function lines = disp_node (basepath, fn)
 returns a cell array of strings with information on the node. More...
 

Member Function Documentation

function tree = DataTree.INode.create_scalar_tree (   funcptr,
  ids,
  mu_cube,
  tslice 
)

copies the current trees with different leafs. These leafs are computes by a function returning scalar values.

For example, one can extract a field available in all leafs with this function, like the reduced basis size N in a reduced data structure.

Parameters
funcptrfunction handle of the function to be applied to all leaf elements.
idsID filter. See create_tree() for details.
mu_cubeparameter filter. See create_tree() for details.
tslicetime filter. See create_tree() for details.
Return values
treetree

Definition at line 207 of file INode.m.

Here is the call graph for this function:

function DataTree.INode tree = DataTree.INode.create_tree ( DataTree.ICreator  creator,
  ids,
  mu_cube,
  tslice,
  basepath 
)
pure virtual

Creates a new tree from a subtree specified by ids, parameter and time index regions.

The method creates a new DataTree for all nodes tagged by an id in ids, lying in the time slice given by tslice and inside the parameter space region given by mu_rect. At each of these nodes a method from a creator is called to build the tree.

Parameters
creatoran object creating the new tree.
idsa cell array of ids which shall be filtered. An empty cell array means that all ids are accepted. (default = [])
mu_cubea 1x2-cell array of vectors { lower_left, upper_right } specifying the lower left and the upper right corner of a cube in the parameter space for filtering parameter vectors. An empty array disables the filtering (default = []).
tslicea 2D vector specifying an interval of time step indices for time slicing. An empty vector disables the filtering (default = [])
basepatha vector specifying the relation of the current node to the parent node at which the merge began.
Return values
treethe newly created tree

Here is the caller graph for this function:

function lines = DataTree.INode.disp_node (   basepath,
  fn 
)

returns a cell array of strings with information on the node.

The default implementation adds the output of the disp command.

Parameters
basepaththe index path needed to reach this element from the root.
fna file name string for a dot file that can be generated
Return values
linesthe cell array of strings

Definition at line 536 of file INode.m.

Here is the caller graph for this function:

function DataTree.INode.display (   fn,
  basepath,
  name 
)

overwrites the standard display method for DataTree objects

Parameters
fnOptional filename under which a dot-file depicting the tree structure is stored.
basepathonly used in recursive calls of this method
nameonly used in recursive calls of this method

Definition at line 489 of file INode.m.

Here is the call graph for this function:

function INode data = DataTree.INode.get (   index)
pure virtual

Access to a child of the current node.

Access a children node by an index which is usually retrieved by a call to get_index()

Parameters
indexvector describing the father-child relation
Return values
datathe children node

Implemented in DataTree.IdMapNode, NonlinEvol.ReducedData, TwoPhaseFlow.ReducedData, DataTree.ILeafNode, Greedy.DataTree.Detailed.InfoNode, DataTree.DummyLeafNode, and DataTree.DefaultNode.

function DataTree.LeafNode active_leaf = DataTree.INode.get_active_leaf ( IModel  model,
  id 
)

retuns the leaf element for the current IDetailedModel configuration.

Todo:
rename this method to get_leaf
Parameters
modela reduced or detailed model holding information about the selected parameters and maybe the time instant.
idoptional parameter defining a special ID that shall be attached to the leaf element.
Return values
active_leafleaf element to be returned.
Optional fields of model:
  • descr —  ModelDescr object specifying the problem discretization
  • descr.t —  current time step number

Definition at line 456 of file INode.m.

Here is the call graph for this function:

function description = DataTree.INode.get_active_leaf_description ( IModel  model,
  ids 
)

returns an enumeration of all leaves' basepath index vectors with a description of their parents.

Parameters
modela reduced or detailed model holding information about the selected parameters and maybe the time instant.
idsID filter. See create_tree() for details.
Return values
descriptiondescription
Optional fields of model:
  • descr —  ModelDescr object specifying the problem discretization
  • descr.t —  current time step number

Definition at line 313 of file INode.m.

Here is the call graph for this function:

function active_leaf_index = DataTree.INode.get_active_leaf_index ( IModel  model,
  id 
)

retuns the leaf element index for the current IDetailedModel configuration.

Todo:
rename this method to get_leaf_index
Parameters
modela reduced or detailed model holding information about the selected parameters and maybe the time instant.
idoptional parameter defining a special ID that shall be attached to the leaf element.
Return values
active_leaf_indexleaf element index to be returned.
Optional fields of model:
  • descr —  ModelDescr object specifying the problem discretization
  • descr.t —  current time step number

Definition at line 426 of file INode.m.

Here is the call graph for this function:

function INode data = DataTree.INode.get_by_description (   id,
  mu,
  nt 
)

A combination of get_index() and get()

This methods gets the child node described by id, mu and nt.

Parameters
ida string id filtered through an DataTree.IdMapNode in the tree hierarchy.
mua parameter vector filtered through a DataTree.PpartNode instance in the tree hierarchy.
ntan integer corresponding to a time step index filtered through a DataTree.TpartNode instance in the tree hierarchy.
Return values
datathe children node

Definition at line 398 of file INode.m.

Here is the call graph for this function:

Here is the caller graph for this function:

function index = DataTree.INode.get_index (   id,
  mu,
  nt 
)
pure virtual

Obtains the leaf index vector that best fits the child description given by the three arguments.

Todo:
add get_indices method returning indices in a range

The leaf child description consists of an

  • id string,
  • a parameter vector and
  • a time step number.
Parameters
ida string id filtered through an DataTree.IdMapNode in the tree hierarchy.
mua parameter vector filtered through a DataTree.PpartNode instance in the tree hierarchy.
ntan integer corresponding to a time step index filtered through a DataTree.TpartNode instance in the tree hierarchy.
Return values
indexthe most-specific (longest possible) index vector leading to a DataTree.ILeafNode element matching the child description.

Implemented in DataTree.IdMapNode, NonlinEvol.ReducedData, TwoPhaseFlow.ReducedData, DataTree.TpartNode, Greedy.DataTree.Detailed.InfoNode, DataTree.DefaultNode, DataTree.DummyLeafNode, and DataTree.ILeafNode.

Here is the caller graph for this function:

function description = DataTree.INode.get_leaf_description (   ids,
  mu_cube,
  tslice 
)

returns an enumeration of all leaves' basepath index vectors with a description of their parents.

Parameters
idsID filter. See create_tree() for details.
mu_cubeparameter filter. See create_tree() for details.
tslicetime filter. See create_tree() for details.
Return values
descriptiondescription

Definition at line 345 of file INode.m.

Here is the call graph for this function:

function tstop = DataTree.INode.index_valid_till (   index)

Returns the last valid time step index of a time slice.

This method can be used to obtain the last time slice index for the node given by get(this, index)

Parameters
indexthe index vector of the child for which the time slice shall be analyzed.
Return values
tstoplast valid time step index

Definition at line 376 of file INode.m.

function DataTree.INode.leaf_func (   funcptr,
  ids,
  mu_cube,
  tslice 
)

applies a function to all leafs of a DataTree

Parameters
funcptrfunction handle of the function to be applied to all leaf elements.
idsID filter. See create_tree() for details.
mu_cubeparameter filter. See create_tree() for details.
tslicetime filter. See create_tree() for details.

Definition at line 177 of file INode.m.

Here is the call graph for this function:

function children = DataTree.INode.length ( )
pure virtual

Returns the number of children of the node.

For leaf elements this method should return 0.

Return values
childrenthe number of childres of the current node

Implemented in Greedy.DataTree.Detailed.InfoNode, DataTree.DefaultNode, and DataTree.ILeafNode.

Here is the caller graph for this function:

function this = DataTree.INode.set (   index,
  value 
)
pure virtual

Sets a child at the given path in the tree hierarchy.

Usually this method is used to set a leaf data node with attached data.

Parameters
indexthe path index where the node shall be injected
valuethe node that shall be attached as a child
Return values
thisthe modified DataTree node.

Implemented in Fem.CompositeFunctionSpace, Greedy.DataTree.Detailed.InfoNode, and DataTree.DefaultNode.

function next_index = DataTree.INode.traverse_next (   this_index)

iterator for a full traverse of the DataTree.

Use this method to get the next index for a tree traversal. Every node is touched during a traversal, until an empty index is returned.

Parameters
this_indexprevious index.
Return values
next_indexthe next index vector for tree traversal. Empty vector after the last node.

Definition at line 262 of file INode.m.

Here is the call graph for this function:

function start_index = DataTree.INode.traverse_start ( )

Start iterator for a full traverse of the DataTree.

Use this method to get a start index for a tree traversal. Subsequently, indices can be obtained by calls to traverse_next(). Every node is touched during a traversal, until an empty index is returned.

Return values
start_indexthe start index vector for tree traversal.

Definition at line 241 of file INode.m.

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: