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

Child class of Agglomerator_Isotropic which implements a specialized iterative algorithm for the search of fine cells. More...

#include <Agglomerator.h>

Inheritance diagram for comma::Agglomerator_Iterative< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >:
comma::Agglomerator_Biconnected< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > comma::Agglomerator_Isotropic< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > comma::Agglomerator< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >

Public Member Functions

 Agglomerator_Iterative (std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, CoMMAIntType dimension, CoMMAAspectRatioT aspect_ratio, CoMMANeighbourhoodT neighbourhood_type, CoMMAIntType fc_iter)
 Constructor of the class. No specific implementation, it instantiates the base class Agglomerator_Biconnected. More...
 
 ~Agglomerator_Iterative () override=default
 Destructor. More...
 
void compute_best_fc_to_add (const CoMMAIntType fc_iter, const std::shared_ptr< Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > neighbourhood, const std::unordered_map< CoMMAIndexType, CoMMAIntType > &d_n_of_seed, const bool &is_order_primary, const CellFeatures< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &cc_feats, const std::unordered_set< CoMMAIndexType > &s_of_fc_for_current_cc, CoMMAIndexType &argmin_ar, CoMMAIntType &max_faces_in_common, CellFeatures< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &min_ar_cc_feats) const override
 Specialization of the parent function. This is an iterative version. Computes the best fine cell to add to the coarse cell. The choice depends on: the number of shared faces (tries to maximize it), the neighbourhood order (tries to minimize it), and the aspect-ratio of the coarse cell (tries to minimize it). More...
 
- Public Member Functions inherited from comma::Agglomerator_Biconnected< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
 Agglomerator_Biconnected (std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, CoMMAIntType dimension, CoMMAAspectRatioT aspect_ratio, CoMMANeighbourhoodT neighbourhood_type, CoMMAIntType fc_iter)
 Constructor of the class. No specific implementation, it instantiates the base class Agglomerator_Isotropic. More...
 
 ~Agglomerator_Biconnected () override=default
 Destructor. More...
 
std::unordered_set< CoMMAIndexType > choose_optimal_cc_and_update_seeds_pool (const CoMMAIndexType seed, const std::vector< CoMMAWeightType > &priority_weights, CoMMAIntType &compactness) override
 Specialization of the pure virtual function in the parent class, to be used in couple with the agglomerate_one_level of the Agglomerator_Isotropic. More...
 
virtual void compute_best_fc_to_add (const CoMMAIntType fc_iter, const std::shared_ptr< Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > neighbourhood, const std::unordered_map< CoMMAIndexType, CoMMAIntType > &d_n_of_seed, const bool &is_order_primary, const CellFeatures< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &cc_feats, const std::unordered_set< CoMMAIndexType > &s_of_fc_for_current_cc, CoMMAIndexType &argmin_ar, CoMMAIntType &max_faces_in_common, CellFeatures< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &min_ar_cc_feats) const
 Computes the best fine cell to add to the coarse cell. The choice depends on: the number of shared faces (tries to maximize it), the neighbourhood order (tries to minimize it), and the aspect-ratio of the coarse cell (tries to minimize it). More...
 
- Public Member Functions inherited from comma::Agglomerator_Isotropic< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
 Agglomerator_Isotropic (std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, CoMMAIntType dimension, CoMMAAspectRatioT aspect_ratio, CoMMANeighbourhoodT neighbourhood_type, CoMMAIntType fc_iter)
 Constructor. The constructor takes as arguments the same arguments of the father and in this way activates also the constructor of the base class. More...
 
 ~Agglomerator_Isotropic () override=default
 Destructor. More...
 
void set_agglomeration_parameter (CoMMAIntType goal_card=0, CoMMAIntType min_card=0, CoMMAIntType max_card=0)
 The task of the function is to set the parameters of determine the cardinality limits with respect to the parameters passed. More...
 
void agglomerate_one_level (const CoMMAIntType goal_card, const CoMMAIntType min_card, const CoMMAIntType max_card, const std::vector< CoMMAWeightType > &priority_weights, bool correction_steps) override
 Specialization of the pure virtual function to the class Agglomerator_Isotropic. We add the override key as a guard to possible mistakes: https://stackoverflow.com/questions/46446652/is-there-any-point-in-using-override-when-overriding-a-pure-virtual-function
The function calls function choose_optimal_cc_and_update_seeds_pool of the derived class. For further information about the structure, have a look at: http://www.cplusplus.com/forum/general/31851/
The pseudo-code considers the while function and the agglomeration process is not completed until all the cells are not agglomerated. Hence, while there are still non agglomerate fine cells, repeat the following steps: More...
 
virtual std::unordered_set< CoMMAIndexType > choose_optimal_cc_and_update_seeds_pool (const CoMMAIndexType seed, const std::vector< CoMMAWeightType > &priority_weights, CoMMAIntType &compactness)=0
 Pure virtual function that must be implemented in child classes to define the optimal coarse cell. More...
 
- Public Member Functions inherited from comma::Agglomerator< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
 Agglomerator (std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, CoMMAIntType dimension)
 The constructor of the interface. More...
 
virtual ~Agglomerator ()=default
 The destructor of the class. More...
 
std::vector< CoMMAIndexType > get_fc_2_cc () const
 Accessor to retrieve the fine cells to coarse cells from the coarse cell graphs class. More...
 
virtual void agglomerate_one_level (const CoMMAIntType goal_card, const CoMMAIntType min_card, const CoMMAIntType max_card, const std::vector< CoMMAWeightType > &priority_weights, bool correction_steps)=0
 Pure virtual function which implementation is specified in the related child classes and that defines the agglomeration of one level. More...
 

Additional Inherited Members

- Public Types inherited from comma::Agglomerator_Isotropic< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
using NeighbourhoodCreatorBaseType = NeighbourhoodCreator< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
 NeighbourhoodCreator type (base class) More...
 
using NeighbourhoodCreatorExtType = NeighbourhoodExtendedCreator< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
 NeighbourhoodExtendedCreator type (derived class) More...
 
using NeighbourhoodCreatorPFType = NeighbourhoodPureFrontCreator< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
 NeighbourhoodPureFrontCreator type (derived class) More...
 
- Public Attributes inherited from comma::Agglomerator_Isotropic< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
CoMMAIntType _fc_iter
 Number of iterations allowed for the algorithm choosing which fine cell to add next. More...
 
std::shared_ptr< NeighbourhoodCreatorBaseType_neigh_crtor
 Creator responsible for neighborhood objects. More...
 
std::shared_ptr< ARComputer< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _ar_computer
 Object computing the aspect-ratio of a coarse cell. More...
 
- Protected Attributes inherited from comma::Agglomerator< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
CoMMAIntType _dimension
 Dimensionality of the problem (_dimension = 2 -> 2D, _dimension = 3 -> 3D) More...
 
CoMMAIntType _min_neighbourhood = 3
 Minimum number of neighbourhood we extend to search the neighbourhood in the greedy algorithm. Set as default to 3. More...
 
CoMMAIntType _min_card = 0
 Minimum cardinality (default = 0, meaning, equal to the dimension) More...
 
CoMMAIntType _max_card = 0
 Maximum cardinality (default = 0, meaning, 5 or 10 for, resp., 2- and 3D. More...
 
CoMMAIntType _goal_card = 0
 Goal cardinality (default = 0, meaning, 4 or 8 for, resp., 2- and 3D. More...
 
CoMMAIntType _threshold_card = 0
 Threshold cardinality (default = 0, meaning, equal to the dimension) More...
 
std::vector< CoMMAIndexType > _l_nb_of_cells
 List of number of cells per coarse cell created. More...
 
std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _fc_graph
 Dual_Graph object determining Fine cells graph and hence the connectivity. More...
 
std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _cc_graph
 pointer to Coarse_Cell_Container element More...
 
std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _seeds_pool
 Seeds_Pool object giving the order in which the fine cells should be considered when agglomerating. More...
 

Detailed Description

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

Child class of Agglomerator_Isotropic which implements a specialized iterative algorithm for the search of fine 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

Constructor & Destructor Documentation

◆ Agglomerator_Iterative()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
comma::Agglomerator_Iterative< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::Agglomerator_Iterative ( std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > >  graph,
std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > >  cc_graph,
std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > >  seeds_pool,
CoMMAIntType  dimension,
CoMMAAspectRatioT  aspect_ratio,
CoMMANeighbourhoodT  neighbourhood_type,
CoMMAIntType  fc_iter 
)
inline

Constructor of the class. No specific implementation, it instantiates the base class Agglomerator_Biconnected.

Parameters
[in]graphDual_Graph object that determines the connectivity of the matrix
[in]cc_graphContainer for the coarse cells
[in]seeds_poolSeeds_Pool object giving the order in which the fine cells should be considered when agglomerating
[in]dimensionDimension of the problem
[in]aspect_ratioType of aspect-ratio (see CoMMAAspectRatioT)
[in]neighbourhood_typeType of neighbourhood to use when growing a coarse cell. See CoMMANeighbourhoodT for more details.
[in]fc_iterNumber of iterations allowed for the algorithm choosing which fine cell to add next. The cost grows exponentially, hence use small values.

◆ ~Agglomerator_Iterative()

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

Destructor.

Member Function Documentation

◆ compute_best_fc_to_add()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Agglomerator_Iterative< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::compute_best_fc_to_add ( const CoMMAIntType  fc_iter,
const std::shared_ptr< Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > >  neighbourhood,
const std::unordered_map< CoMMAIndexType, CoMMAIntType > &  d_n_of_seed,
const bool &  is_order_primary,
const CellFeatures< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &  cc_feats,
const std::unordered_set< CoMMAIndexType > &  s_of_fc_for_current_cc,
CoMMAIndexType &  argmin_ar,
CoMMAIntType &  max_faces_in_common,
CellFeatures< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &  min_ar_cc_feats 
) const
inlineoverridevirtual

Specialization of the parent function. This is an iterative version. Computes the best fine cell to add to the coarse cell. The choice depends on: the number of shared faces (tries to maximize it), the neighbourhood order (tries to minimize it), and the aspect-ratio of the coarse cell (tries to minimize it).

Parameters
[in]fc_iterNumber of iteration for the fine-cell research algorithm
[in]neighbourhoodNeighborhood object
[in]d_n_of_seedDictionary containing the cells to consider for the agglomeration with their neighbourhood order wrt to the original seed
[in]is_order_primaryIf true, the neighbourhood order prevails on other criteria
[in]cc_featsFeatures of the current coarse cell
[in]s_of_fc_for_current_ccIndices of the fine cells already agglomerated in the coarse cell
[out]argmin_arIndex wrt to neighbours vector of the chosen fine cell
[out]max_faces_in_commonNumber of faces shared between the chosen fine cell and the coarse cell
[out]min_ar_cc_featsFeatures of the coarse cell after the addition of the chosen fine cell

Reimplemented from comma::Agglomerator_Biconnected< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >.


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