OpenCMISS-Iron Internal API Documentation
trees Module Reference

Implements trees of base types. More...

Data Types

interface  tree_createfinish
 
interface  tree_createstart
 
interface  tree_detachanddestroy
 
interface  tree_inserttypeset
 
interface  tree_itemdelete
 
interface  tree_iteminsert
 
type  tree_node_type
 
interface  tree_nodekeyget
 
interface  tree_nodevalueget
 
interface  tree_nodevalueset
 
type  tree_type
 

Functions/Subroutines

subroutine, public tree_create_finish (TREE, ERR, ERROR,)
 Finishes the creation of a tree created with TREE_CREATE_START. More...
 
subroutine, public tree_create_start (TREE, ERR, ERROR,)
 Starts the creation of a tree and returns a pointer to the created tree. More...
 
subroutine, public tree_destroy (TREE, ERR, ERROR,)
 Destroys a tree. More...
 
subroutine, public tree_detach (TREE, NUMBER_IN_TREE, TREE_VALUES, ERR, ERROR,)
 Detaches the tree values and returns them as a pointer to the an array. More...
 
subroutine, public tree_detach_and_destroy (TREE, NUMBER_IN_TREE, TREE_VALUES, ERR, ERROR,)
 Detaches the tree values and returns them as a pointer to the an array and then destroys the tree. More...
 
recursive subroutine tree_detach_in_order (TREE, X, COUNT, TREE_VALUES, ERR, ERROR,)
 Detaches the tree values in order from the specified tree node and adds them to the tree values array. More...
 
subroutine tree_finalise (TREE, ERR, ERROR,)
 Finalises a tree and deallocates all memory. More...
 
subroutine tree_initialise (TREE, ERR, ERROR,)
 Initialises a tree. More...
 
subroutine, public tree_insert_type_set (TREE, INSERT_TYPE, ERR, ERROR,)
 Sets/changes the insert type for a tree. More...
 
subroutine, public tree_item_delete (TREE, KEY, ERR, ERROR,)
 Deletes a tree node specified by a key from a tree. More...
 
subroutine, public tree_item_insert (TREE, KEY, VALUE, INSERT_STATUS, ERR, ERROR,)
 Inserts a tree node into a red-black tree. More...
 
recursive subroutine tree_node_finalise (TREE, TREE_NODE, ERR, ERROR,)
 Finalises a tree node and deallocates all memory. More...
 
subroutine tree_node_initialise (TREE, TREE_NODE, ERR, ERROR,)
 Initialises a tree node. More...
 
subroutine, public tree_node_key_get (TREE, TREE_NODE, KEY, ERR, ERROR,)
 Gets the key at a specified tree node. More...
 
subroutine, public tree_node_value_get (TREE, TREE_NODE, VALUE, ERR, ERROR,)
 Gets the value at a specified tree node. More...
 
subroutine, public tree_node_value_set (TREE, TREE_NODE, VALUE, ERR, ERROR,)
 Sets the value at a specified tree node. More...
 
subroutine, public tree_output (ID, TREE, ERR, ERROR,)
 Outputs a tree to the specified output stream ID. More...
 
recursive subroutine tree_output_in_order (ID, TREE, X, ERR, ERROR,)
 Outputs a tree in order to the specified output stream ID from the specified tree node. More...
 
type(tree_node_type) function, pointer tree_predecessor (TREE, X, ERR, ERROR)
 Returns the predeccessor of a tree at a specified tree node. More...
 
subroutine, public tree_search (TREE, KEY, X, ERR, ERROR,)
 Searches a tree to see if it contains a key. More...
 
type(tree_node_type) function, pointer tree_successor (TREE, X, ERR, ERROR)
 Returns the successor of a tree at a specified tree node. More...
 

Variables

integer(intg), parameter tree_black_node =0
 The black colour type for a tree node. More...
 
integer(intg), parameter tree_red_node =1
 The red colour type for a tree node. More...
 
integer(intg), parameter, public tree_node_insert_sucessful =1
 Successful insert status. More...
 
integer(intg), parameter, public tree_node_duplicate_key =2
 Duplicate key found for those trees that do not allow duplicate keys. More...
 
integer(intg), parameter, public tree_duplicates_allowed_type =1
 Duplicate keys allowed tree type. More...
 
integer(intg), parameter, public tree_no_duplicates_allowed =2
 No duplicate keys allowed tree type. More...
 

Detailed Description

Implements trees of base types.

Function/Subroutine Documentation

subroutine, public trees::tree_create_finish ( type(tree_type), pointer  TREE,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Finishes the creation of a tree created with TREE_CREATE_START.

See also
{TREES::TREE_CREATE_START}.
Parameters
treeA pointer to the tree to finish
[out]errThe error code
[out]errorThe error string.

Definition at line 190 of file trees.f90.

References base_routines::enters(), base_routines::exits(), tree_finalise(), and tree_node_initialise().

subroutine, public trees::tree_create_start ( type(tree_type), pointer  TREE,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Starts the creation of a tree and returns a pointer to the created tree.

See also
{TREES::TREE_CREATE_FINISH}.
Parameters
treeA pointer to the tree to create. Must not be associated on entry.
[out]errThe error code.
[out]errorThe error string.

Definition at line 233 of file trees.f90.

References base_routines::enters(), base_routines::exits(), tree_duplicates_allowed_type, tree_finalise(), and tree_initialise().

subroutine, public trees::tree_destroy ( type(tree_type), pointer  TREE,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Destroys a tree.

Parameters
treeA pointer to the tree to destroy
[out]errThe error code
[out]errorThe error string.

Definition at line 265 of file trees.f90.

References base_routines::enters(), base_routines::exits(), and tree_finalise().

subroutine, public trees::tree_detach ( type(tree_type), pointer  TREE,
integer(intg), intent(out)  NUMBER_IN_TREE,
integer(intg), dimension(:), pointer  TREE_VALUES,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Detaches the tree values and returns them as a pointer to the an array.

Parameters
treeA pointer to the tree to detach
[out]number_in_treeOn exit, the number in the array that has been detached
tree_valuesOn exit, a pointer to the dettached tree values. Must not be associated on entry.
[out]errThe error code
[out]errorThe error string.

Definition at line 292 of file trees.f90.

References base_routines::enters(), base_routines::exits(), and tree_detach_in_order().

subroutine, public trees::tree_detach_and_destroy ( type(tree_type), pointer  TREE,
integer(intg), intent(out)  NUMBER_IN_TREE,
integer(intg), dimension(:), pointer  TREE_VALUES,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Detaches the tree values and returns them as a pointer to the an array and then destroys the tree.

Parameters
treeA pointer to the tree to detach and destroy
[out]number_in_treeOn exit, the number in the array that has been detached
tree_valuesOn exit, a pointer to the dettached tree values. Must not be associated on entry.
[out]errThe error code
[out]errorThe error string.

Definition at line 335 of file trees.f90.

References base_routines::enters(), base_routines::exits(), tree_detach_in_order(), and tree_finalise().

recursive subroutine trees::tree_detach_in_order ( type(tree_type), pointer  TREE,
type(tree_node_type), pointer  X,
integer(intg), intent(inout)  COUNT,
integer(intg), dimension(:), intent(inout)  TREE_VALUES,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)
private

Detaches the tree values in order from the specified tree node and adds them to the tree values array.

Parameters
treeA pointer to the tree to detach
xA pointer to the specified tree node to detach from
[in,out]countThe current number in the detached tree values array
[in,out]tree_valuesThe current detached tree values array
[out]errThe error code
[out]errorThe error string.

Definition at line 379 of file trees.f90.

References base_routines::enters(), and base_routines::exits().

Referenced by tree_detach(), and tree_detach_and_destroy().

subroutine trees::tree_finalise ( type(tree_type), pointer  TREE,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)
private

Finalises a tree and deallocates all memory.

Parameters
treeA pointer to the tree to finalise
[out]errThe error code
[out]errorThe error string.

Definition at line 422 of file trees.f90.

References base_routines::enters(), base_routines::exits(), and tree_node_finalise().

Referenced by tree_create_finish(), tree_create_start(), tree_destroy(), and tree_detach_and_destroy().

subroutine trees::tree_initialise ( type(tree_type), pointer  TREE,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)
private

Initialises a tree.

Parameters
treeA pointer to the tree to initialise
[out]errThe error code
[out]errorThe error string.

Definition at line 449 of file trees.f90.

References base_routines::enters(), and base_routines::exits().

Referenced by tree_create_start().

subroutine, public trees::tree_insert_type_set ( type(tree_type), pointer  TREE,
integer(intg), intent(in)  INSERT_TYPE,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Sets/changes the insert type for a tree.

Parameters
treeA pointer to the tree
[in]insert_typeThe insert type to set
See also
TREES::TreeInsertTypes,TREES::TreeInsertTypes
Parameters
[out]errThe error code
[out]errorThe error string.

Definition at line 480 of file trees.f90.

References base_routines::enters(), base_routines::exits(), tree_duplicates_allowed_type, and tree_no_duplicates_allowed.

subroutine, public trees::tree_item_delete ( type(tree_type), pointer  TREE,
integer(intg), intent(in)  KEY,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Deletes a tree node specified by a key from a tree.

Parameters
treeA pointer to the Red-Black tree to delete from
[in]keyA pointer to the tree node to delete
[out]errThe error code
[out]errorThe error string.

Definition at line 521 of file trees.f90.

References base_routines::enters(), base_routines::exits(), tree_black_node, tree_red_node, and tree_successor().

subroutine, public trees::tree_item_insert ( type(tree_type), pointer  TREE,
integer(intg), intent(in)  KEY,
integer(intg), intent(in)  VALUE,
integer(intg), intent(out)  INSERT_STATUS,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Inserts a tree node into a red-black tree.

Parameters
treeA pointer to the Red-Black tree to insert into
[in]keyThe key to insert
[in]valueThe value to insert
[out]insert_statusOn exit, the status of the insert
See also
TREES::TreeNodeInsertStatus,TREES::TreeNodeInsertStatus
Parameters
[out]errThe error code
[out]errorThe error string.

Definition at line 769 of file trees.f90.

References base_routines::enters(), base_routines::exits(), tree_black_node, tree_no_duplicates_allowed, tree_node_duplicate_key, tree_node_initialise(), tree_node_insert_sucessful, and tree_red_node.

Referenced by data_projection_routines::data_projection_create_start_data_points().

recursive subroutine trees::tree_node_finalise ( type(tree_type), pointer  TREE,
type(tree_node_type), pointer  TREE_NODE,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)
private

Finalises a tree node and deallocates all memory.

Parameters
treeA pointer to the tree containing the tree node to finalise
tree_nodeA pointer to the tree node to finalise
[out]errThe error code
[out]errorThe error string.

Definition at line 953 of file trees.f90.

References base_routines::enters(), and base_routines::exits().

Referenced by tree_finalise().

subroutine trees::tree_node_initialise ( type(tree_type), pointer  TREE,
type(tree_node_type), pointer  TREE_NODE,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)
private

Initialises a tree node.

Parameters
treeA pointer to the tree containing the tree node to initialise
tree_nodeA pointer to the tree node to initialise
[out]errThe error code
[out]errorThe error string.

Definition at line 985 of file trees.f90.

References base_routines::enters(), base_routines::exits(), and tree_black_node.

Referenced by tree_create_finish(), and tree_item_insert().

subroutine, public trees::tree_node_key_get ( type(tree_type), pointer  TREE,
type(tree_node_type), pointer  TREE_NODE,
integer(intg), intent(out)  KEY,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Gets the key at a specified tree node.

Parameters
treeA pointer to the tree containing the tree node
tree_nodeA pointer to the tree node to get the key of
[out]keyOn exit, the key of the specified tree node
[out]errThe error code
[out]errorThe error string.

Definition at line 1022 of file trees.f90.

References base_routines::enters(), and base_routines::exits().

subroutine, public trees::tree_node_value_get ( type(tree_type), pointer  TREE,
type(tree_node_type), pointer  TREE_NODE,
integer(intg), intent(out)  VALUE,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Gets the value at a specified tree node.

Parameters
treeA pointer to the tree containing the tree node
tree_nodeA pointer to the tree node to get the value of
[out]valueOn exit, the value of the specified tree node
[out]errThe error code
[out]errorThe error string.

Definition at line 1059 of file trees.f90.

References base_routines::enters(), and base_routines::exits().

Referenced by data_projection_routines::dataprojection_datapointcheckexist(), and data_projection_routines::dataprojection_datapointglobalnumberget().

subroutine, public trees::tree_node_value_set ( type(tree_type), pointer  TREE,
type(tree_node_type), pointer  TREE_NODE,
integer(intg), intent(in)  VALUE,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Sets the value at a specified tree node.

Parameters
treeA pointer to the tree containing the tree node
tree_nodeA pointer to the tree node to set the value of
[in]valueThe value of the specified tree node to set
[out]errThe error code
[out]errorThe error string.

Definition at line 1096 of file trees.f90.

References base_routines::enters(), and base_routines::exits().

subroutine, public trees::tree_output ( integer(intg), intent(in)  ID,
type(tree_type), pointer  TREE,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Outputs a tree to the specified output stream ID.

Parameters
[in]idThe ID of the output stream
treeA pointer to the tree to search
[out]errThe error code
[out]errorThe error string.

Definition at line 1133 of file trees.f90.

References base_routines::enters(), base_routines::exits(), and tree_output_in_order().

recursive subroutine trees::tree_output_in_order ( integer(intg), intent(in)  ID,
type(tree_type), pointer  TREE,
type(tree_node_type), pointer  X,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)
private

Outputs a tree in order to the specified output stream ID from the specified tree node.

Parameters
[in]idThe ID of the output stream
treeA pointer to the tree to search
xA pointer to the tree node to output from
[out]errThe error code
[out]errorThe error string.

Definition at line 1168 of file trees.f90.

References base_routines::enters(), and base_routines::exits().

Referenced by tree_output().

type(tree_node_type) function, pointer trees::tree_predecessor ( type(tree_type), pointer  TREE,
type(tree_node_type), pointer  X,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)
private

Returns the predeccessor of a tree at a specified tree node.

Parameters
treeA pointer to the Red-Black tree to find the predecessor of
xA pointer to the tree node to return the predecessor of
[out]errThe error code
[out]errorThe error string.
Returns
On return the pointer to the predecessor of X or NIL if no predecessor exits

Definition at line 1222 of file trees.f90.

References base_routines::enters(), and base_routines::exits().

subroutine, public trees::tree_search ( type(tree_type), pointer  TREE,
integer(intg), intent(in)  KEY,
type(tree_node_type), pointer  X,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)

Searches a tree to see if it contains a key.

Parameters
treeA pointer to the tree to search
[in]keyThe key to search for
xOn return a pointer to the tree node containing the key. If the key does not exist NULL is returned
[out]errThe error code
[out]errorThe error string.

Definition at line 1277 of file trees.f90.

References base_routines::enters(), and base_routines::exits().

Referenced by data_projection_routines::dataprojection_datapointcheckexist(), and data_projection_routines::dataprojection_datapointglobalnumberget().

type(tree_node_type) function, pointer trees::tree_successor ( type(tree_type), pointer  TREE,
type(tree_node_type), pointer  X,
integer(intg), intent(out)  ERR,
type(varying_string), intent(out)  ERROR 
)
private

Returns the successor of a tree at a specified tree node.

Parameters
treeA pointer to the Red-Black tree to find the successor of
xA pointer to the tree node to return the successor of
[out]errThe error code
[out]errorThe error string.
Returns
On return the pointer to the successor of X or NIL if no sucessor exits

Definition at line 1333 of file trees.f90.

References base_routines::enters(), and base_routines::exits().

Referenced by tree_item_delete().