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

Class implementing a custom container where the coarse cells are stored. More...

#include <Coarse_Cell_Container.h>

Public Types

using CoarseCellType = Coarse_Cell< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
 Type for a Coarse_Cell object. More...
 
using CoarseCellPtr = std::shared_ptr< CoarseCellType >
 Type for a shared pointer to a Dual_Graph object. More...
 
using DualGraphPtr = typename CoarseCellType::DualGraphPtr
 Type for a shared pointer to a Dual_Graph object. More...
 

Public Member Functions

 Coarse_Cell_Container (DualGraphPtr &fc_graph, const CoMMAIntType singular_card_thresh)
 Create a Coarse_Cell_Container. More...
 
 ~Coarse_Cell_Container ()=default
 Destructor. More...
 
CoMMAIndexType get_number_of_fc_agglomerated () const
 Helper to get the member variable that defines the number of agglomerated fine cells. More...
 
CoMMAIndexType get_nb_of_cc () const
 Helper to get the number of coarse cells. More...
 
std::set< CoMMAIndexType > get_neighs_cc (const CoMMAIndexType &i_fc, const CoMMAIndexType &i_cc) const
 Retrieve the indexes of the neighbouring coarse cells to a given fine cell in a coarse cell (excluding the given coarse cell in which the fine cell is) More...
 
void correct (const CoMMAIntType max_card)
 Implementation of the correction. In this version it implements the correction of singular cells (if one cell is alone after the agglomeration step is agglomerated to a neighbouring cell) More...
 
std::optional< CoMMAIndexType > select_best_cc_to_agglomerate_whole (const std::unordered_set< CoMMAIndexType > &fcs, const std::set< CoMMAIndexType > &neighs, const CoMMAIntType max_card, std::optional< CoMMAIntType > &new_compactness) const
 Choose among the neighbouring coarse cells, the one to which a singular coarse cell should be assigned to. This function is similar to select_best_cc_to_agglomerate but considers only the compactness and the cardinality. More...
 
std::optional< CoMMAIndexType > select_best_cc_to_agglomerate (const CoMMAIndexType fc, const std::set< CoMMAIndexType > &neighs, const CoMMAIntType max_card, std::optional< CoMMAIntType > &new_compactness) const
 Choose among the neighbouring coarse cells, the one to which a fine cell should be assigned to. We prefer the coarse cell which shares the most faces with the fine cell. Otherwise, we look at the cardinality and choose the coarse cell with the smallest one. More...
 
CoMMAIntType get_shared_faces (const CoMMAIndexType fc, const CoarseCellPtr cc) const
 Compute the number of faces shared between a fine cell and a coarse one. More...
 
CoMMAIndexType create_cc (const std::unordered_set< CoMMAIndexType > &s_fc, const CoMMAIntType compactness, bool is_anisotropic=false, bool is_creation_delayed=false)
 It creates a coarse cell based on the set of fine cells given as input. More...
 
void cc_create_all_delayed_cc ()
 Creates all the delayed coarse cell. It works only when the delayed cell flag is activated in the agglomerator. More...
 

Public Attributes

std::map< CoMMAIndexType, CoarseCellPtr_ccs
 Map containing the CC and their ID. More...
 
DualGraphPtr _fc_graph
 Dual graph representation. More...
 
CoMMAIndexType _cc_counter
 Number of coarse cells. More...
 
std::vector< std::optional< CoMMAIndexType > > _fc_2_cc
 Output vector identifying to which coarse cell the fine cell belongs. More...
 
std::vector< bool > _is_fc_agglomerated
 Vector of boolean telling whether a fine cell has been agglomerated. More...
 
CoMMAIntType _sing_card_thresh
 Minimum cardinality for receiver CC when correcting. More...
 

Protected Attributes

CoMMAIndexType _nb_of_agglomerated_fc = 0
 Number of agglomerated fine cells. More...
 
std::vector< std::pair< std::unordered_set< CoMMAIndexType >, CoMMAIntType > > _delayed_cc
 Vector of the set of fine cells composing the too small coarse cells that will be built at the end of the agglomeration process and their compactness degree. More...
 
std::deque< CoMMAIndexType > _singular_cc
 Set of singular coarse cells, that is, composed of only one fine cell. More...
 

Detailed Description

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

Class implementing a custom container where the coarse cells are stored.

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

◆ CoarseCellPtr

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::CoarseCellPtr = std::shared_ptr<CoarseCellType>

Type for a shared pointer to a Dual_Graph object.

◆ CoarseCellType

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::CoarseCellType = Coarse_Cell<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>

Type for a Coarse_Cell object.

◆ DualGraphPtr

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::DualGraphPtr = typename CoarseCellType::DualGraphPtr

Type for a shared pointer to a Dual_Graph object.

Constructor & Destructor Documentation

◆ Coarse_Cell_Container()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::Coarse_Cell_Container ( DualGraphPtr fc_graph,
const CoMMAIntType  singular_card_thresh 
)
inline

Create a Coarse_Cell_Container.

Parameters
[in]fc_graphInput element Dual_Graph to work on the seeds choice and the seeds pool
[in]singular_card_threshThreshold value below which a coarse cell is considered singular

◆ ~Coarse_Cell_Container()

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

Destructor.

Member Function Documentation

◆ cc_create_all_delayed_cc()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::cc_create_all_delayed_cc ( )
inline

Creates all the delayed coarse cell. It works only when the delayed cell flag is activated in the agglomerator.

◆ correct()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::correct ( const CoMMAIntType  max_card)
inline

Implementation of the correction. In this version it implements the correction of singular cells (if one cell is alone after the agglomeration step is agglomerated to a neighbouring cell)

Parameters
max_cardMaximum cardinality allowed (CoMMA might still be beyond this value)

◆ create_cc()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIndexType comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::create_cc ( const std::unordered_set< CoMMAIndexType > &  s_fc,
const CoMMAIntType  compactness,
bool  is_anisotropic = false,
bool  is_creation_delayed = false 
)
inline

It creates a coarse cell based on the set of fine cells given as input.

Parameters
[in]s_fcSet of fine cells passed as a reference
[in]compactnessCompactness degree of the CC
[in]is_anisotropicBoolean that tells if we are in an anisotropic case or not
[in]is_creation_delayedBased on the agglomerator instruction we define if we delay or not the agglomeration
Returns
Global identifier of the coarse cell

◆ get_nb_of_cc()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIndexType comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::get_nb_of_cc ( ) const
inline

Helper to get the number of coarse cells.

Returns
The number of coarse cells created so far

◆ get_neighs_cc()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::set< CoMMAIndexType > comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::get_neighs_cc ( const CoMMAIndexType &  i_fc,
const CoMMAIndexType &  i_cc 
) const
inline

Retrieve the indexes of the neighbouring coarse cells to a given fine cell in a coarse cell (excluding the given coarse cell in which the fine cell is)

Parameters
[in]i_fcindex of the fine cell inside the coarse cell to be analysed
[in]i_ccindex of the coarse cell in which the fine cell is in
Returns
vector of the index of the coarse cells

◆ get_number_of_fc_agglomerated()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIndexType comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::get_number_of_fc_agglomerated ( ) const
inline

Helper to get the member variable that defines the number of agglomerated fine cells.

Returns
The number of fine cells agglomerated so far

◆ get_shared_faces()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIntType comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::get_shared_faces ( const CoMMAIndexType  fc,
const CoarseCellPtr  cc 
) const
inline

Compute the number of faces shared between a fine cell and a coarse one.

Parameters
[in]fcIndex of the fine cell
[in]ccPointer to the coarse cell
Returns
The number of shared faces

◆ select_best_cc_to_agglomerate()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::optional< CoMMAIndexType > comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::select_best_cc_to_agglomerate ( const CoMMAIndexType  fc,
const std::set< CoMMAIndexType > &  neighs,
const CoMMAIntType  max_card,
std::optional< CoMMAIntType > &  new_compactness 
) const
inline

Choose among the neighbouring coarse cells, the one to which a fine cell should be assigned to. We prefer the coarse cell which shares the most faces with the fine cell. Otherwise, we look at the cardinality and choose the coarse cell with the smallest one.

Parameters
[in]fcIndex of the fine cell
[in]neighsNeighbouring coarse cells
[in]max_cardMaximum cardinality allowed (CoMMA might still go beyond this value)
[out]new_compactnessCompactness degree of the CC if the result would to be added
Returns
The index of the chosen coarse cell
Warning
max_card might not be honored

◆ select_best_cc_to_agglomerate_whole()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::optional< CoMMAIndexType > comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::select_best_cc_to_agglomerate_whole ( const std::unordered_set< CoMMAIndexType > &  fcs,
const std::set< CoMMAIndexType > &  neighs,
const CoMMAIntType  max_card,
std::optional< CoMMAIntType > &  new_compactness 
) const
inline

Choose among the neighbouring coarse cells, the one to which a singular coarse cell should be assigned to. This function is similar to select_best_cc_to_agglomerate but considers only the compactness and the cardinality.

Parameters
[in]fcsSet of indices of the fine cells composing the coarse cell to be agglomerated
[in]neighsNeighbouring coarse cells
[in]max_cardMaximum cardinality allowed (CoMMA might still go beyond this value)
[out]new_compactnessCompactness degree of the CC if the result would to be added
Returns
The index of the chosen coarse cell
Warning
max_card might not be honored

Member Data Documentation

◆ _cc_counter

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIndexType comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_cc_counter

Number of coarse cells.

◆ _ccs

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::map<CoMMAIndexType, CoarseCellPtr> comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_ccs

Map containing the CC and their ID.

◆ _delayed_cc

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::vector<std::pair<std::unordered_set<CoMMAIndexType>, CoMMAIntType> > comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_delayed_cc
protected

Vector of the set of fine cells composing the too small coarse cells that will be built at the end of the agglomeration process and their compactness degree.

◆ _fc_2_cc

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::vector<std::optional<CoMMAIndexType> > comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_fc_2_cc

Output vector identifying to which coarse cell the fine cell belongs.

◆ _fc_graph

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
DualGraphPtr comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_fc_graph

Dual graph representation.

◆ _is_fc_agglomerated

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::vector<bool> comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_is_fc_agglomerated

Vector of boolean telling whether a fine cell has been agglomerated.

◆ _nb_of_agglomerated_fc

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIndexType comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_nb_of_agglomerated_fc = 0
protected

Number of agglomerated fine cells.

◆ _sing_card_thresh

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIntType comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_sing_card_thresh

Minimum cardinality for receiver CC when correcting.

◆ _singular_cc

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::deque<CoMMAIndexType> comma::Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_singular_cc
protected

Set of singular coarse cells, that is, composed of only one fine cell.


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