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

Class representing the neighbourhood of a given cell in the graph. Mind that no information about the element being already agglomerated or not is known here. More...

#include <Neighbourhood.h>

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

Public Types

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 (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 Member Functions

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...
 

Protected Attributes

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...
 

Detailed Description

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

Class representing the neighbourhood of a given cell in the graph. Mind that no information about the element being already agglomerated or not is known here.

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

◆ CandidatesContainerType

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
using comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::CandidatesContainerType = std::deque<CoMMAIndexType>

Type for container of candidates.

◆ 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.

Constructor & Destructor Documentation

◆ Neighbourhood() [1/2]

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::Neighbourhood ( const std::unordered_set< CoMMAIndexType > &  s_neighbours_of_seed,
const std::vector< CoMMAWeightType > &  weights 
)
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

◆ Neighbourhood() [2/2]

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

Copy constructor.

◆ ~Neighbourhood()

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

Destructor.

Member Function Documentation

◆ extract_and_update_candidates()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::extract_and_update_candidates ( const CoMMASetOfPairType candidates_w_weights)
inlineprotected

Extract the indices from a list of index-weight pairs and add them at the back of the candidates list.

◆ get_candidates()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
const CandidatesContainerType & comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::get_candidates ( ) const
inline

Get candidates that should be consider in the next step of the agglomeration.

Returns
The candidates

◆ update()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
void comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::update ( const CoMMAIndexType  new_fc,
const ContainerIndexType new_neighbours 
)
inline

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.

Parameters
[in]new_fcIndex of the new fine cell to be added to the set of fine cells
[in]new_neighboursVector of the new neighbours to be analysed

◆ update_it()

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
virtual void comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::update_it ( const CoMMAIndexType  new_fc,
ContainerIndexConstIt  neighs_begin,
ContainerIndexConstIt  neighs_end 
)
pure virtual

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.

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

Implemented in comma::Neighbourhood_Extended< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >, and comma::Neighbourhood_Pure_Front< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >.

Member Data Documentation

◆ _candidates

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
CandidatesContainerType comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_candidates
protected

Candidates that should be considered when choosing the next fine cell to add to the coarse one.

◆ _s_fc

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
std::unordered_set<CoMMAIndexType> comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_s_fc
protected

Set of the fine cells composing the coarse cell.

◆ _s_neighbours_of_seed

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
const std::unordered_set<CoMMAIndexType> comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_s_neighbours_of_seed
protected

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.

◆ _weights

template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType >
const std::vector<CoMMAWeightType>& comma::Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_weights
protected

Priority weights.


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