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

Class representing the pool of all the seeds for creating a coarse cell. More...

#include <Seeds_Pool.h>

Inheritance diagram for comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >:
comma::Seeds_Pool_Boundary_Priority< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > comma::Seeds_Pool_Neighbourhood_Priority< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >

Public Types

using CoMMAPairType = std::pair< CoMMAIndexType, CoMMAWeightType >
 Type of pair. More...
 
using CoMMAQueueType = std::deque< CoMMAIndexType >
 Type of queue which holds seeds. More...
 
using CoMMASetOfPairType = std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > >
 Type of set of pairs. More...
 

Public Member Functions

 Seeds_Pool (const std::vector< CoMMAIntType > &n_bnd_faces, const std::vector< CoMMAWeightType > &priority_weights, const bool one_point_init)
 Constructor. More...
 
virtual ~Seeds_Pool ()=default
 Destructor. More...
 
std::optional< CoMMAIndexType > spoil_queue (const std::vector< bool > &is_fc_agglomerated, CoMMAQueueType &queue)
 Spoil a queue looking for an not-yet-agglomerated seed. More...
 
virtual std::optional< CoMMAIndexType > choose_new_seed (const std::vector< bool > &is_agglomerated)=0
 Choose a new seed in the pool. More...
 
virtual void update (const std::deque< CoMMAIndexType > &new_seeds)=0
 Add the provided seeds to a seeds pool queue according to the number of boundary faces. More...
 
virtual void order_new_seeds_and_update (const std::unordered_set< CoMMAIndexType > &new_seeds)=0
 Add the provided seeds to a seeds pool queue according to the number of boundary faces. The seeds will be ordered considering their priority weights before being added to the queue. More...
 
void build_queue (const std::vector< bool > &is_fc_agglomerated, const CoMMAIntType target)
 Build the weight-ordered queue of seed for a given target level. A set of (index, weight) pair with special comparator is used to enforced order, then the indices are extracted. More...
 
std::optional< CoMMAIntType > get_highest_n_bnd_yet_to_agglomerate (const std::vector< bool > &is_fc_agglomerated, const CoMMAIntType expected_max=CoMMACellT::CORNER) const
 Compute the highest number of boundary faces of cells which are not agglomerated yet. More...
 
bool is_empty (CoMMAIntType i_level=CoMMACellT::N_CELL_TYPES) const
 Given the default levels we define if the list of the targeted level is empty. More...
 
virtual bool need_initialization (const std::vector< bool > &is_agglomerated)=0
 Whether the seeds pool need to be initialized. More...
 
void initialize ()
 Initialize the seeds pool via a call to its initializator. More...
 
void set_top_queue (const CoMMAIntType q_lvl)
 Setter for the top queue member. More...
 

Public Attributes

const std::vector< CoMMAIntType > & _n_bnd_faces
 Vector of number of faces on boundary per cell. More...
 

Protected Attributes

std::vector< CoMMAQueueType_l_of_seeds
 List of deque of seeds. For each identifier we have the available seeds. We want the seed to be chosen preferably in the corner, then ridges, valleys and then interiors, see CoMMACellT. More...
 
const std::vector< CoMMAWeightType > & _priority_weights
 Weights used to set the order of the seed to choose. More...
 
std::optional< CoMMAIntType > _cur_top_queue
 Optional possibly containing the level (0,1,2,3, see Seeds_Pool::_l_of_seeds) of the queue currently being spoiled. More...
 
std::shared_ptr< SPInitializator< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _initializator
 Pointer to a SPInitializator. More...
 

Detailed Description

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

Class representing the pool of all the seeds for creating a coarse cell.

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

◆ CoMMAPairType

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::CoMMAPairType = std::pair<CoMMAIndexType, CoMMAWeightType>

Type of pair.

◆ CoMMAQueueType

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::CoMMAQueueType = std::deque<CoMMAIndexType>

Type of queue which holds seeds.

◆ CoMMASetOfPairType

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::CoMMASetOfPairType = std::set<CoMMAPairType, CustomPairGreaterFunctor<CoMMAPairType> >

Type of set of pairs.

Constructor & Destructor Documentation

◆ Seeds_Pool()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::Seeds_Pool ( const std::vector< CoMMAIntType > &  n_bnd_faces,
const std::vector< CoMMAWeightType > &  priority_weights,
const bool  one_point_init 
)
inline

Constructor.

Parameters
[in]n_bnd_facesVector telling how many boundary faces each cell has
[in]priority_weightsWeights used to set the order of the seed to choose
[in]one_point_initWhether the initialization should be done for the highest boundary level or just for one point

◆ ~Seeds_Pool()

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

Destructor.

Member Function Documentation

◆ build_queue()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::build_queue ( const std::vector< bool > &  is_fc_agglomerated,
const CoMMAIntType  target 
)
inline

Build the weight-ordered queue of seed for a given target level. A set of (index, weight) pair with special comparator is used to enforced order, then the indices are extracted.

Parameters
[in]is_fc_agglomeratedVector of boolean telling whether a face has been agglomerated
[in]targetLevel of the queue to build. It corresponds to the number of boundary faces

◆ choose_new_seed()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
virtual std::optional< CoMMAIndexType > comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::choose_new_seed ( const std::vector< bool > &  is_agglomerated)
pure virtual

Choose a new seed in the pool.

Parameters
[in]is_agglomeratedVector of booleans telling whether fine cells are agglomerated
Returns
New seed

Implemented in comma::Seeds_Pool_Boundary_Priority< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >, and comma::Seeds_Pool_Neighbourhood_Priority< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >.

◆ get_highest_n_bnd_yet_to_agglomerate()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::optional< CoMMAIntType > comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::get_highest_n_bnd_yet_to_agglomerate ( const std::vector< bool > &  is_fc_agglomerated,
const CoMMAIntType  expected_max = CoMMACellT::CORNER 
) const
inline

Compute the highest number of boundary faces of cells which are not agglomerated yet.

Parameters
[in]is_fc_agglomeratedVector of boolean telling whether a face has been agglomerated
[in]expected_maxExpected value. If found, function returns immediately. Defaulted to CoMMACellT::CORNER
Returns
An optional which contains the number of boundary faces if there is at least one cell left to agglomerate

◆ initialize()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::initialize ( )
inline

Initialize the seeds pool via a call to its initializator.

◆ is_empty()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
bool comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::is_empty ( CoMMAIntType  i_level = CoMMACellT::N_CELL_TYPES) const
inline

Given the default levels we define if the list of the targeted level is empty.

Parameters
[in]i_levellevel of the defined list

◆ need_initialization()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
virtual bool comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::need_initialization ( const std::vector< bool > &  is_agglomerated)
pure virtual

Whether the seeds pool need to be initialized.

Parameters
[in]is_agglomeratedVector of booleans telling whether fine cells are agglomerated
Returns
A bool

Implemented in comma::Seeds_Pool_Boundary_Priority< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >, and comma::Seeds_Pool_Neighbourhood_Priority< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >.

◆ order_new_seeds_and_update()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
virtual void comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::order_new_seeds_and_update ( const std::unordered_set< CoMMAIndexType > &  new_seeds)
pure virtual

Add the provided seeds to a seeds pool queue according to the number of boundary faces. The seeds will be ordered considering their priority weights before being added to the queue.

Parameters
[in]new_seedsVector of seeds to add

Implemented in comma::Seeds_Pool_Boundary_Priority< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >, and comma::Seeds_Pool_Neighbourhood_Priority< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >.

◆ set_top_queue()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::set_top_queue ( const CoMMAIntType  q_lvl)
inline

Setter for the top queue member.

Parameters
[in]q_lvlLevel of the new top queue

◆ spoil_queue()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::optional< CoMMAIndexType > comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::spoil_queue ( const std::vector< bool > &  is_fc_agglomerated,
CoMMAQueueType queue 
)
inline

Spoil a queue looking for an not-yet-agglomerated seed.

Parameters
[in]is_fc_agglomeratedVector of boolean telling whether a face has been agglomerated
[out]queueThe queue to spoil
Returns
An optional which contains the new seed if found

◆ update()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
virtual void comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::update ( const std::deque< CoMMAIndexType > &  new_seeds)
pure virtual

Add the provided seeds to a seeds pool queue according to the number of boundary faces.

Parameters
[in]new_seedsSeeds to add
Warning
new_seeds is supposed to be already ordered by the priority weight, therefore no check will be performed

Implemented in comma::Seeds_Pool_Boundary_Priority< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >, and comma::Seeds_Pool_Neighbourhood_Priority< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >.

Member Data Documentation

◆ _cur_top_queue

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::optional<CoMMAIntType> comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_cur_top_queue
protected

Optional possibly containing the level (0,1,2,3, see Seeds_Pool::_l_of_seeds) of the queue currently being spoiled.

◆ _initializator

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::shared_ptr< SPInitializator<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> > comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_initializator
protected

Pointer to a SPInitializator.

◆ _l_of_seeds

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::vector<CoMMAQueueType> comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_l_of_seeds
protected

List of deque of seeds. For each identifier we have the available seeds. We want the seed to be chosen preferably in the corner, then ridges, valleys and then interiors, see CoMMACellT.

◆ _n_bnd_faces

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
const std::vector<CoMMAIntType>& comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_n_bnd_faces

Vector of number of faces on boundary per cell.

◆ _priority_weights

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
const std::vector<CoMMAWeightType>& comma::Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_priority_weights
protected

Weights used to set the order of the seed to choose.


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