Cartesius Library
polymorphic_tree.f90 File Reference

Data Types

type  polymorphic_tree::node
 
type  polymorphic_tree::node_ptr
 
interface  polymorphic_tree::DoSomethingToNode
 Interface to apply a one-node operation to the whole tree using DoSomethingToTree. More...
 
interface  polymorphic_tree::DoSomethingToNodeWithArg
 Interface to apply a one-node operation to the whole tree using DoSomethingToTreeWithArg. More...
 
interface  polymorphic_tree::DoSomethingTo2Nodes
 Does nothing. More...
 
interface  polymorphic_tree::DoSomethingTo2NodesWithArg
 Does nothing. More...
 

Modules

module  polymorphic_tree
 Implements trees and procedures to use them.
 

Functions/Subroutines

subroutine polymorphic_tree::copynode (someNode, copy)
 Copies every field of the node to a copy. More...
 
subroutine polymorphic_tree::initialize_new_tree (someValue, root, pDeallocator)
 Creates new tree. The result is a node with name 'root', of rank zero, which points to the passed value. More...
 
recursive subroutine polymorphic_tree::find_node_by_name (someName, tree, pNode)
 Returns a pointer to the node with the specified name. The desired node must be one of the chidren or siblings of the input node. More...
 
type(node) function, pointer polymorphic_tree::find_node_by_name_fn (tree, someName)
 Same as above, but can be used as a function. More...
 
recursive subroutine polymorphic_tree::find_node_by_value (pValue, tree, pNode)
 Returns the node with the first (depth-first) occurence of the given value in the tree. More...
 
type(node) function, pointer polymorphic_tree::find_node_by_value_fn (tree, pValue)
 Same as above, but can be used as a function. More...
 
class(*) function, pointer polymorphic_tree::get_value (pNode)
 Returns the value stored in the given node. If pNode points to null, returns a null-pointer. More...
 
class(*) function, pointer polymorphic_tree::get_value_by_name (someName, tree)
 Returns a pointer to the value in the node with the specified name. More...
 
class(*) function, pointer polymorphic_tree::get_value_by_name2 (tree, someName)
 Same as above, but changed arguments to use as type-bound procedure. More...
 
recursive subroutine polymorphic_tree::dosomethingtotree (tree, pSomething)
 Applies the procedure in the pSomething pointer to every child and sibling recursively. More...
 
recursive subroutine polymorphic_tree::dosomethingtotreewitharg (tree, pSomething, arg)
 Applies the procedure (which takes an argument) in the pSomething pointer to every child and sibling recursively. More...
 
recursive subroutine polymorphic_tree::dosomethingto2trees (tree1, tree2, pSomething)
 
recursive subroutine polymorphic_tree::dosomethingto2treeswitharg (tree1, tree2, pSomething, arg)
 
subroutine polymorphic_tree::dosomethingtosomenodes (tree, Names, pSomething)
 Applies the procedure in the pSomething pointer to every node with the name from the Names array. More...
 
subroutine polymorphic_tree::dosomethingtosomenodeswitharg (tree, Names, pSomething, arg)
 
subroutine polymorphic_tree::printtree (tree)
 Passes a pointer to the printNode subroutine to DoSomethingToTree. More...
 
subroutine polymorphic_tree::printnode (someNode)
 If the value in the node is of type real, prints the value. More...
 
subroutine polymorphic_tree::printnode_new (someNode)
 A prettier output for the contents of a node. More...
 
recursive subroutine polymorphic_tree::printtree_new (tree, line, pProcedure)
 Draws the structure of the tree. More...
 
subroutine polymorphic_tree::find_common_predecessor (someName1, someName2, tree, pPred)
 Finds the first common predecessor of two nodes in the tree. More...
 
subroutine polymorphic_tree::find_common_predecessor_for_three (someName1, someName2, someName3, tree, pPred)
 Finds the common predecessor for three nodes by calling find_common_predecessor twice. More...
 
recursive subroutine polymorphic_tree::update_tree_rank (this)
 Updates the ranks of a subtree's nodes based on the parent of the provided node. Useful when moving or grafting. More...
 
type(node) function, pointer polymorphic_tree::getroot (this)
 Returns the root of the tree, given the node. More...
 
subroutine polymorphic_tree::add_child_to_node (parent_node, new_name, new_value, pDeallocator, result_node)
 
subroutine polymorphic_tree::add_node (parentName, newName, tree, newValue, pDeallocator, result_node)
 Adds node to the tree as a new child of a specified node. More...
 
subroutine polymorphic_tree::add_node2 (tree, parentName, newName, newValue, pDeallocator, result_node)
 Same as above, but changed the order to use as a type-bound procedure. More...
 
subroutine polymorphic_tree::graft (this, new_branch)
 Grafts the new_branch node as one of the children of this and refactors the ranks of all its children. More...
 
type(node) function, pointer polymorphic_tree::node_from_polymorphic (x)
 Converts a polymorphic pointer to a node pointer if possible, else returns a null-pointer. More...
 
recursive subroutine polymorphic_tree::deallocate_tree_native (this, start)
 Destroys all data contained in the (sub)tree. Presence of start allows to remove the siblings of the starting node. Otherwise, they will be untouched. For use with pDeallocator, use deallocate_tree_poly. More...
 
subroutine polymorphic_tree::deallocate_tree (pTree)
 Same subroutine as deallocate_tree to pass as pDeallocator. More...
 
subroutine polymorphic_tree::remove_node (someName, tree, pNodeOut)
 Remove a node from the tree by rearranging the pointers. More...
 
subroutine polymorphic_tree::purge_node (someName, tree)
 
subroutine polymorphic_tree::move_node_from_one_parent_to_another (nodeName, newParentName, tree)
 Moving node with its child from one parent to another. More...
 

Variables

integer, parameter, public polymorphic_tree::max_char =120
 
character(len=4), parameter, public polymorphic_tree::key_root = 'root'