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

Class representing the neighbourhood of a given cell in the graph. In this derived class, the neighbourhood is 'pure front-advancing', meaning that the next candidates are only the direct neighbours of the last added cell. More...

#include <Neighbourhood.h>

Inheritance diagram for comma::Neighbourhood_Pure_Front< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >:
comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >

Public Types

using NeighbourhoodBaseType = Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
 Base class. More...
 
using CoMMAPairType = std::pair< CoMMAIndexType, CoMMAWeightType >
 Type of pair. More...
 
using CoMMASetOfPairType = std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > >
 Type of set of pairs. More...
 
using CoMMAPairFindFirstBasedType = PairFindFirstBasedFunctor< CoMMAPairType >
 Functor used if find-like function relying only on first element of the pair. More...
 
using ContainerIndexType = std::vector< CoMMAIndexType >
 Type for containers of indices. More...
 
using ContainerIndexConstIt = typename ContainerIndexType::const_iterator
 Type for constant iterators of containers of indices. More...
 
- Public Types inherited from comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
using CoMMAPairType = std::pair< CoMMAIndexType, CoMMAWeightType >
 Type of pair. More...
 
using CoMMASetOfPairType = std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > >
 Type of set of pairs. More...
 
using CoMMAPairFindFirstBasedType = PairFindFirstBasedFunctor< CoMMAPairType >
 Functor used if find-like function relying only on first element of the pair. More...
 
using CandidatesContainerType = std::deque< CoMMAIndexType >
 Type for container of candidates. More...
 
using ContainerIndexType = std::vector< CoMMAIndexType >
 Type for containers of indices. More...
 
using ContainerIndexConstIt = typename ContainerIndexType::const_iterator
 Type for constant iterators of containers of indices. More...
 

Public Member Functions

 Neighbourhood_Pure_Front (const std::unordered_set< CoMMAIndexType > &s_neighbours_of_seed, const std::vector< CoMMAWeightType > &weights, CoMMAIntType dimension)
 Constructor. More...
 
 Neighbourhood_Pure_Front (const Neighbourhood_Pure_Front< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &other)=default
 Copy constructor. More...
 
 ~Neighbourhood_Pure_Front () override=default
 Destructor. More...
 
void update_it (const CoMMAIndexType new_fc, ContainerIndexConstIt neighs_begin, ContainerIndexConstIt neighs_end) override
 Method that updates the neighbourhood. Given the new_fc, if is in the neighbours, it is deleted. Then, the new neighbours are considered as candidates. More...
 
const CoMMASetOfPairTypeget_neighbours_by_level (const CoMMAIntType lvl) const
 Get the neighbours from a previous stage. More...
 
- Public Member Functions inherited from comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
 Neighbourhood (const std::unordered_set< CoMMAIndexType > &s_neighbours_of_seed, const std::vector< CoMMAWeightType > &weights)
 Constructor. More...
 
 Neighbourhood (const Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &other)=default
 Copy constructor. More...
 
virtual ~Neighbourhood ()=default
 Destructor. More...
 
void update (const CoMMAIndexType new_fc, const ContainerIndexType &new_neighbours)
 Method that updates the neighbourhood. Given the new_fc, if is in the neighbours, it is deleted. Then, the new neighbours are added as candidates. More...
 
virtual void update_it (const CoMMAIndexType new_fc, ContainerIndexConstIt neighs_begin, ContainerIndexConstIt neighs_end)=0
 Method that updates the neighbourhood. Given the new_fc, if is in the neighbours, it is deleted. Then, the new neighbours are added as candidates. More...
 
const CandidatesContainerTypeget_candidates () const
 Get candidates that should be consider in the next step of the agglomeration. More...
 

Protected Attributes

std::deque< CoMMASetOfPairType_q_neighs_w_weights
 History of the first-order-neighbourhoods of the fine cells recently agglomerated. More...
 
CoMMAIntType _dimension
 Dimensionality of the problem (_dimension = 2 -> 2D, _dimension = 3 -> 3D) More...
 
- Protected Attributes inherited from comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
const std::unordered_set< CoMMAIndexType > _s_neighbours_of_seed
 Set of the neighbours of seed given as an input in the constructor. Here, we can find all the neighbours of order up to a user-defined value of the initial seed. Hence, it holds the cells allowed to be agglomerated. More...
 
const std::vector< CoMMAWeightType > & _weights
 Priority weights. More...
 
std::unordered_set< CoMMAIndexType > _s_fc
 Set of the fine cells composing the coarse cell. More...
 
CandidatesContainerType _candidates
 Candidates that should be considered when choosing the next fine cell to add to the coarse one. More...
 

Additional Inherited Members

- Protected Member Functions inherited from comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >
void extract_and_update_candidates (const CoMMASetOfPairType &candidates_w_weights)
 Extract the indices from a list of index-weight pairs and add them at the back of the candidates list. More...
 

Detailed Description

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

Class representing the neighbourhood of a given cell in the graph. In this derived class, the neighbourhood is 'pure front-advancing', meaning that the next candidates are only the direct neighbours of the last added 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

◆ CoMMAPairFindFirstBasedType

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::CoMMAPairFindFirstBasedType = PairFindFirstBasedFunctor<CoMMAPairType>

Functor used if find-like function relying only on first element of the pair.

◆ CoMMAPairType

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

Type of pair.

◆ CoMMASetOfPairType

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

Type of set of pairs.

◆ ContainerIndexConstIt

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Neighbourhood< 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::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::ContainerIndexType = std::vector<CoMMAIndexType>

Type for containers of indices.

◆ NeighbourhoodBaseType

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Neighbourhood_Pure_Front< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::NeighbourhoodBaseType = Neighbourhood<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>

Base class.

Constructor & Destructor Documentation

◆ Neighbourhood_Pure_Front() [1/2]

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
comma::Neighbourhood_Pure_Front< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::Neighbourhood_Pure_Front ( const std::unordered_set< CoMMAIndexType > &  s_neighbours_of_seed,
const std::vector< CoMMAWeightType > &  weights,
CoMMAIntType  dimension 
)
inline

Constructor.

Parameters
[in]s_neighbours_of_seedSet of the neighbours of the given cell chosen as seed
[in]weightsWeights used to set up the order of the neighbours to visit
[in]dimensionDimension of the problem

◆ Neighbourhood_Pure_Front() [2/2]

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
comma::Neighbourhood_Pure_Front< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::Neighbourhood_Pure_Front ( const Neighbourhood_Pure_Front< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &  other)
default

Copy constructor.

◆ ~Neighbourhood_Pure_Front()

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

Destructor.

Member Function Documentation

◆ get_neighbours_by_level()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
const CoMMASetOfPairType & comma::Neighbourhood_Pure_Front< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::get_neighbours_by_level ( const CoMMAIntType  lvl) const
inline

Get the neighbours from a previous stage.

Parameters
[in]lvlStage identifier. 0 = current neighbours, 1 = previous neighbours, 2 = second-to-last neighbours, etc...
Returns
A constant reference to a set of pairs of neighbours and weights

◆ update_it()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Neighbourhood_Pure_Front< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::update_it ( const CoMMAIndexType  new_fc,
ContainerIndexConstIt  neighs_begin,
ContainerIndexConstIt  neighs_end 
)
inlineoverridevirtual

Method that updates the neighbourhood. Given the new_fc, if is in the neighbours, it is deleted. Then, the new neighbours are considered as candidates.

Parameters
[in]new_fcIndex of the new fine cell to be added to the set of fine cells
[in]neighs_beginConstant iterator giving the beginning of the neighbours
[in]neighs_endConstant iterator giving the end of the neighbours

Implements comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >.

Member Data Documentation

◆ _dimension

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CoMMAIntType comma::Neighbourhood_Pure_Front< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_dimension
protected

Dimensionality of the problem (_dimension = 2 -> 2D, _dimension = 3 -> 3D)

◆ _q_neighs_w_weights

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::deque<CoMMASetOfPairType> comma::Neighbourhood_Pure_Front< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_q_neighs_w_weights
protected

History of the first-order-neighbourhoods of the fine cells recently agglomerated.


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