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

A class implementing the CRS subgraph representation. It is used in the framework of CoMMA for the implementation of the CSR representation of the coarse cells. More...

#include <Dual_Graph.h>

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

Public Types

using BaseClass = Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
 Parent class. More...
 
using ContainerIndexType = std::vector< CoMMAIndexType >
 Type for containers of indices. More...
 
using ContainerWeightType = std::vector< CoMMAWeightType >
 Type for containers of weights. More...
 
- Public Types inherited from comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
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

 Subgraph (const CoMMAIndexType &nb_c, const ContainerIndexType &m_crs_row_ptr, const ContainerIndexType &m_crs_col_ind, const ContainerWeightType &m_crs_values, const ContainerWeightType &volumes, const ContainerIndexType &mapping_l_to_g, const bool &is_isotropic)
 Constructor of the class. More...
 
 ~Subgraph () override=default
 Destructor of the class. More...
 
void insert_node (const ContainerIndexType &v_neigh, const CoMMAIndexType &i_fc, const CoMMAWeightType &volume, const ContainerWeightType &weight)
 Insert a node in the subgraph and add it to the mapping the. More...
 
void remove_node (const CoMMAIndexType &elemento)
 Remove a node from the CRS representation and automatically adjust the mapping. More...
 
- Public Member Functions inherited from 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)
 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

bool _is_isotropic
 Whether it originates from an isotropic cell. More...
 
CoMMAIntType _cardinality
 Cardinality of the given subgraph, alias the number of nodes contained. More...
 
CoMMAIntType _compactness
 Compactness of the given subgraph. The compactness is the minimum number of internal neighbours. More...
 
ContainerIndexType _mapping_l_to_g
 Mapping from the local number of node to the global. Being a subgraph this variable connect the local index of the node with the global one. More...
 
- Public Attributes inherited from comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
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::Subgraph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >

A class implementing the CRS subgraph representation. It is used in the framework of CoMMA for the implementation of the CSR representation of the coarse cells.

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

◆ BaseClass

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Subgraph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::BaseClass = Graph<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>

Parent class.

◆ ContainerIndexType

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

Type for containers of indices.

◆ 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

◆ Subgraph()

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

Constructor of the class.

Parameters
[in]nb_cCardinality of the CC, that is the number of fine cells composing the CC
[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
[in]mapping_l_to_gMapping between the local (to the CC) numbering to global numbering
[in]is_isotropicWhether the cell is isotropic

◆ ~Subgraph()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
comma::Subgraph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::~Subgraph ( )
overridedefault

Destructor of the class.

Member Function Documentation

◆ insert_node()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Subgraph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::insert_node ( const ContainerIndexType v_neigh,
const CoMMAIndexType &  i_fc,
const CoMMAWeightType &  volume,
const ContainerWeightType weight 
)
inline

Insert a node in the subgraph and add it to the mapping the.

Parameters
[in]v_neighVector of the neighbours to be added. The neighbours must be given in the global indexing system.
[in]i_fcGlobal index of the node
[in]volumeVolume of the cell
[in]weightVector of the area of the faces of the given cells to be added.

◆ remove_node()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Subgraph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::remove_node ( const CoMMAIndexType &  elemento)
inline

Remove a node from the CRS representation and automatically adjust the mapping.

Parameters
[in]elementoGlobal index of the node to be deleted.

Member Data Documentation

◆ _cardinality

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIntType comma::Subgraph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_cardinality

Cardinality of the given subgraph, alias the number of nodes contained.

◆ _compactness

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIntType comma::Subgraph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_compactness

Compactness of the given subgraph. The compactness is the minimum number of internal neighbours.

◆ _is_isotropic

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
bool comma::Subgraph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_is_isotropic

Whether it originates from an isotropic cell.

◆ _mapping_l_to_g

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
ContainerIndexType comma::Subgraph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_mapping_l_to_g

Mapping from the local number of node to the global. Being a subgraph this variable connect the local index of the node with the global one.


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