CoMMA 1.3.2
A geometric agglomerator for unstructured meshes
Loading...
Searching...
No Matches
comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > Class Template Reference

Tree structure that represent a coarse cell, the fine cell and the neighbours to them. More...

#include <Tree.h>

Public Types

using NodeType = Node< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
 Type of node for the current tree. More...
 

Public Member Functions

 Tree (std::shared_ptr< NodeType > &root)
 Constructor. More...
 
 ~Tree ()=default
 Destructor. More...
 
void insertSon (const CoMMAIndexType &father_index, const CoMMAIndexType &index, const CoMMAWeightType &volume, const CoMMAIntType &root)
 Insert a node as child of a given node. More...
 
std::shared_ptr< NodeTypesearch (std::shared_ptr< NodeType > &node, const CoMMAIndexType &value)
 Look for a node. More...
 
std::shared_ptr< NodeTypetransverse (std::shared_ptr< NodeType > &node)
 Traverse the tree. More...
 
void deleteNode (const CoMMAIndexType &value)
 Delete a node. More...
 
void delete_node (std::shared_ptr< NodeType > &searched_node, const CoMMAIndexType &value)
 Delete a node. More...
 
void print ()
 Print the tree. More...
 
void print_nodes (std::shared_ptr< NodeType > &node)
 Print the branches starting from a given node. More...
 

Public Attributes

std::shared_ptr< NodeType_root
 The Node at the root of the tree. More...
 

Detailed Description

template<typename CoMMAIndexType, typename CoMMAWeightType, typename CoMMAIntType>
class comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >

Tree structure that represent a coarse cell, the fine cell and the neighbours to them.

Template Parameters
CoMMAIndexTypethe CoMMA index type for the global index of the mesh
CoMMAWeightTypethe CoMMA weight type for the weights (volume or area) of the nodes or edges of the Mesh
CoMMAIntTypethe CoMMA type for integers

Member Typedef Documentation

◆ NodeType

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::NodeType = Node<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>

Type of node for the current tree.

Constructor & Destructor Documentation

◆ Tree()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::Tree ( std::shared_ptr< NodeType > &  root)
inlineexplicit

Constructor.

Parameters
[in]rootA Node which is the root of the Tree

◆ ~Tree()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::~Tree ( )
default

Destructor.

Member Function Documentation

◆ delete_node()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::delete_node ( std::shared_ptr< NodeType > &  searched_node,
const CoMMAIndexType &  value 
)
inline

Delete a node.

Parameters
[in]searched_nodeWhere to look
[in]valueTarget

◆ deleteNode()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::deleteNode ( const CoMMAIndexType &  value)
inline

Delete a node.

Parameters
[in]valueTarget

◆ insertSon()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::insertSon ( const CoMMAIndexType &  father_index,
const CoMMAIndexType &  index,
const CoMMAWeightType &  volume,
const CoMMAIntType &  root 
)
inline

Insert a node as child of a given node.

Parameters
[in]father_indexIndex of the parent node
[in]indexIndex of the child
[in]volumeVolume of the child
[in]rootWhether it is at the root

◆ print()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::print ( )
inline

Print the tree.

◆ print_nodes()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::print_nodes ( std::shared_ptr< NodeType > &  node)
inline

Print the branches starting from a given node.

Parameters
[in]nodeWhere to start

◆ search()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::shared_ptr< NodeType > comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::search ( std::shared_ptr< NodeType > &  node,
const CoMMAIndexType &  value 
)
inline

Look for a node.

Parameters
[in]nodeStarting point
[in]valueTarget
Returns
a pointer (possibly null) to the target

◆ transverse()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::shared_ptr< NodeType > comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::transverse ( std::shared_ptr< NodeType > &  node)
inline

Traverse the tree.

Parameters
[in]nodeWhere to start the search
Returns
a pointer to a leaf

Member Data Documentation

◆ _root

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::shared_ptr<NodeType> comma::Tree< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_root

The Node at the root of the tree.


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