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

An interface class responsible of storing the cell centered dual graph and of acting on it (it is an interface for the global Dual_Graph and the Subgraph) More...

#include <Dual_Graph.h>

Inheritance diagram for comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >:
comma::Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > comma::Subgraph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >

Public Types

using ContainerIndexType = std::vector< CoMMAIndexType >
 Type for containers of indices. More...
 
using ContainerWeightType = std::vector< CoMMAWeightType >
 Type for containers of weights. More...
 
using ContainerIndexConstIt = typename ContainerIndexType::const_iterator
 Type for constant iterators of containers of indices. More...
 
using ContainerWeightConstIt = typename ContainerWeightType::const_iterator
 Type for constant iterators of containers of weights. More...
 

Public Member Functions

 Graph (const CoMMAIndexType &nb_c, const ContainerIndexType &m_crs_row_ptr, const ContainerIndexType &m_crs_col_ind, const ContainerWeightType &m_crs_values, const ContainerWeightType &volumes)
 Constructor of the class. More...
 
virtual ~Graph ()=default
 Destructor of the class. More...
 
void DFS (const CoMMAIndexType &i_fc)
 Depth First Search (DFS) recursive function. More...
 
void BFS (const CoMMAIndexType &root)
 Breadth First Search (BFS) function. More...
 
CoMMAIntType get_nb_of_neighbours (const CoMMAIndexType i_c) const
 Retrieve the number of neighbours. More...
 
ContainerIndexType get_neighbours (const CoMMAIndexType &i_c) const
 Based on the CRS representation retrieves the neighbours of the cell given as an input. More...
 
ContainerIndexConstIt neighbours_cbegin (const CoMMAIndexType &i_c) const
 Get constant pointer to the first neighbour of cell i_c. More...
 
ContainerIndexConstIt neighbours_cend (const CoMMAIndexType &i_c) const
 Get constant pointer to the element following the last neighbour of cell i_c. More...
 
ContainerWeightType get_weights (const CoMMAIndexType &i_c) const
 Based on the area of the faces composing the cell given as an input, we retrieve the faces connecting the given cell with the neighbourhood that can be described also as the weight of the graph. More...
 
ContainerWeightConstIt weights_cbegin (const CoMMAIndexType &i_c) const
 Get constant pointer to the first neighbour of cell i_c. More...
 
ContainerWeightConstIt weights_cend (const CoMMAIndexType &i_c) const
 Get constant pointer to the element following the last neighbour of cell i_c. More...
 
bool check_connectivity ()
 Check the connectivity of the graph. More...
 
CoMMAIntType compute_min_fc_compactness_inside_a_cc (const std::unordered_set< CoMMAIndexType > &s_fc) const
 Compute the minimum compactness of fine cells inside a coarse cell. More...
 
std::unordered_map< CoMMAIndexType, CoMMAIntType > compute_fc_compactness_inside_a_cc (const std::unordered_set< CoMMAIndexType > &s_fc) const
 Compute the dictionary of compactness of fine cells inside a coarse cell. More...
 

Public Attributes

CoMMAIndexType _number_of_cells
 Number of nodes in the Graph (it corresponds to the number of cells in the subgraph or the dual graph. More...
 
std::vector< bool > _visited
 Helper vector for the DFS. More...
 
ContainerIndexType _m_CRS_Row_Ptr
 Vector of row pointer of CRS representation. More...
 
ContainerIndexType _m_CRS_Col_Ind
 Vector of column index of CRS representation. More...
 
ContainerWeightType _m_CRS_Values
 Vector of area weight of CRS representation. More...
 
ContainerWeightType _volumes
 Vector of volumes. More...
 

Detailed Description

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

An interface class responsible of storing the cell centered dual graph and of acting on it (it is an interface for the global Dual_Graph and the Subgraph)

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

◆ ContainerIndexConstIt

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::ContainerIndexConstIt = typename ContainerIndexType::const_iterator

Type for constant iterators of containers of indices.

◆ ContainerIndexType

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::ContainerIndexType = std::vector<CoMMAIndexType>

Type for containers of indices.

◆ ContainerWeightConstIt

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::ContainerWeightConstIt = typename ContainerWeightType::const_iterator

Type for constant iterators of containers of weights.

◆ ContainerWeightType

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::ContainerWeightType = std::vector<CoMMAWeightType>

Type for containers of weights.

Constructor & Destructor Documentation

◆ Graph()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::Graph ( const CoMMAIndexType &  nb_c,
const ContainerIndexType m_crs_row_ptr,
const ContainerIndexType m_crs_col_ind,
const ContainerWeightType m_crs_values,
const ContainerWeightType volumes 
)
inline

Constructor of the class.

Parameters
[in]nb_cNumber of cells
[in]m_crs_row_ptrThe row pointer of the CRS representation
[in]m_crs_col_indThe column index of the CRS representation
[in]m_crs_valuesThe weight of the CRS representation (in CoMMA case will be the area of the faces that in the graph representation are the edges between two nodes represented by the cell centers.
[in]volumesThe volumes of the cells

◆ ~Graph()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
virtual comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::~Graph ( )
virtualdefault

Destructor of the class.

Member Function Documentation

◆ BFS()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::BFS ( const CoMMAIndexType &  root)
inline

Breadth First Search (BFS) function.

Parameters
[in]rootRoot of the spanning tree

◆ check_connectivity()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
bool comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::check_connectivity ( )
inline

Check the connectivity of the graph.

Returns
True if the graph is connected, false if it is not connected

◆ compute_fc_compactness_inside_a_cc()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::unordered_map< CoMMAIndexType, CoMMAIntType > comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::compute_fc_compactness_inside_a_cc ( const std::unordered_set< CoMMAIndexType > &  s_fc) const
inline

Compute the dictionary of compactness of fine cells inside a coarse cell.

Parameters
[in]s_fcSet of fine cells to analyse
Returns
the dictionary associating a fine cell in the coarse cell with its compactness

◆ compute_min_fc_compactness_inside_a_cc()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIntType comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::compute_min_fc_compactness_inside_a_cc ( const std::unordered_set< CoMMAIndexType > &  s_fc) const
inline

Compute the minimum compactness of fine cells inside a coarse cell.

Parameters
[in]s_fcSet of fine cells to analyse
Returns
the compactness of the fine cell

◆ DFS()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::DFS ( const CoMMAIndexType &  i_fc)
inline

Depth First Search (DFS) recursive function.

Parameters
[in]i_fcIndex of the node to print

◆ get_nb_of_neighbours()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIntType comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::get_nb_of_neighbours ( const CoMMAIndexType  i_c) const
inline

Retrieve the number of neighbours.

Parameters
[in]i_cIndex of the cell
Returns
Number of neighbours of the given cell.

◆ get_neighbours()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
ContainerIndexType comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::get_neighbours ( const CoMMAIndexType &  i_c) const
inline

Based on the CRS representation retrieves the neighbours of the cell given as an input.

Parameters
[in]i_cIndex of the cell
Returns
vector of the neighbours.

◆ get_weights()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
ContainerWeightType comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::get_weights ( const CoMMAIndexType &  i_c) const
inline

Based on the area of the faces composing the cell given as an input, we retrieve the faces connecting the given cell with the neighbourhood that can be described also as the weight of the graph.

Parameters
[in]i_cIndex of the cell
Returns
Vector of weights associated to the cell.

◆ neighbours_cbegin()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
ContainerIndexConstIt comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::neighbours_cbegin ( const CoMMAIndexType &  i_c) const
inline

Get constant pointer to the first neighbour of cell i_c.

Parameters
[in]i_cIndex of the cell
Returns
The pointer

◆ neighbours_cend()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
ContainerIndexConstIt comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::neighbours_cend ( const CoMMAIndexType &  i_c) const
inline

Get constant pointer to the element following the last neighbour of cell i_c.

Parameters
[in]i_cIndex of the cell
Returns
The pointer

◆ weights_cbegin()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
ContainerWeightConstIt comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::weights_cbegin ( const CoMMAIndexType &  i_c) const
inline

Get constant pointer to the first neighbour of cell i_c.

Parameters
[in]i_cIndex of the cell
Returns
The pointer

◆ weights_cend()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
ContainerWeightConstIt comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::weights_cend ( const CoMMAIndexType &  i_c) const
inline

Get constant pointer to the element following the last neighbour of cell i_c.

Parameters
[in]i_cIndex of the cell
Returns
The pointer

Member Data Documentation

◆ _m_CRS_Col_Ind

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
ContainerIndexType comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_m_CRS_Col_Ind

Vector of column index of CRS representation.

◆ _m_CRS_Row_Ptr

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
ContainerIndexType comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_m_CRS_Row_Ptr

Vector of row pointer of CRS representation.

◆ _m_CRS_Values

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
ContainerWeightType comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_m_CRS_Values

Vector of area weight of CRS representation.

◆ _number_of_cells

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIndexType comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_number_of_cells

Number of nodes in the Graph (it corresponds to the number of cells in the subgraph or the dual graph.

◆ _visited

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::vector<bool> comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_visited

Helper vector for the DFS.

◆ _volumes

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
ContainerWeightType comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_volumes

Vector of volumes.


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