CoMMA 1.3.2
A geometric agglomerator for unstructured meshes
Loading...
Searching...
No Matches
comma::ARComputer< IndexT, RealT, IntT > Class Template Referenceabstract

Similar to a functor, the key point is the method that computes the AR and update the features of a cell. Here, AR is used lightly, and might be any quantity which should be minimized in the coarsening process. This is an abstract class. More...

#include <ARComputer.h>

Inheritance diagram for comma::ARComputer< IndexT, RealT, IntT >:
comma::ARDiamOverMinEdge< IndexT, RealT, IntT > comma::ARDiamOverRadius< IndexT, RealT, IntT, dim > comma::ARDiameter< IndexT, RealT, IntT > comma::ARExternalWeightOverRadius< IndexT, RealT, IntT, dim > comma::ARExternalWeights< IndexT, RealT, IntT > comma::ARMaxBaryDistanceOverRadius< IndexT, RealT, IntT, dim > comma::ARMaxOverMinBaryDistance< IndexT, RealT, IntT > comma::AROverInternalWeights< IndexT, RealT, IntT > comma::AROverMeasure< IndexT, RealT, IntT >

Public Member Functions

 ARComputer (std::shared_ptr< Dual_Graph< IndexT, RealT, IntT > > graph)
 Constructor. More...
 
virtual ~ARComputer ()=default
 The destructor of the class. More...
 
virtual void compute_and_update_features (const IndexT i_fc, const CellFeatures< IndexT, RealT, IntT > &cc_feats, const std::unordered_set< IndexT > &fc_of_cc, IntT &shared_faces, RealT &aspect_ratio, CellFeatures< IndexT, RealT, IntT > &new_feats) const =0
 Computes features of the CC obtained by adding a given fine cell. The features are Aspect-Ratio, number of face shared with other cells already agglomerated (Current coarse cell means without i_fc) and those of CellFeatures. More...
 

Protected Member Functions

void compute_shared_faces (const IndexT i_fc, const std::unordered_set< IndexT > &fc_of_cc, RealT &shared_weights, std::unordered_set< IndexT > &shared_faces) const
 Computes number of shared faces and features of the CC obtained by adding a given fine cell. The features are Aspect-Ratio and number of face shared with other cells already agglomerated (Current coarse cell means without i_fc) More...
 
void update_approximated_geometric_features (const IndexT i_fc, const CellFeatures< IndexT, RealT, IntT > &cc_feats, const std::unordered_set< IndexT > &fc_of_cc, CellFeatures< IndexT, RealT, IntT > &new_feats) const
 Compute approximated geometric features (e.g., diameter) More...
 
std::vector< RealT > compute_and_update_barycenter (const IndexT i_fc, const CellFeatures< IndexT, RealT, IntT > &cc_feats, const std::unordered_set< IndexT > &fc_of_cc, CellFeatures< IndexT, RealT, IntT > &new_feats) const
 Compute the barycenter and update the features accordingly. More...
 
template<bool compute_weights = false, bool update_facets = false>
void update_basic_features (const IndexT i_fc, const CellFeatures< IndexT, RealT, IntT > &cc_feats, const std::unordered_set< IndexT > &fc_of_cc, IntT &n_shared_faces, CellFeatures< IndexT, RealT, IntT > &new_feats) const
 Compute approximated geometric features (e.g., diameter) More...
 
template<unsigned int dim>
RealT constexpr x_over_radius (const RealT sqx, const CellFeatures< IndexT, RealT, IntT > &feats) const
 Given a squared quantity and cell features, compute the ratio between the quantity and the radius of the cell (that is $ \sqrt[dim](vol(CC)) $), or an approximation of it where the numerator and denominator are raised to certain powers (instead of taking roots) to ensure non-dimensionality. More...
 

Protected Attributes

std::shared_ptr< Dual_Graph< IndexT, RealT, IntT > > _graph
 Dual_Graph object determining Fine cells graph and hence the connectivity. More...
 

Detailed Description

template<typename IndexT, typename RealT, typename IntT>
class comma::ARComputer< IndexT, RealT, IntT >

Similar to a functor, the key point is the method that computes the AR and update the features of a cell. Here, AR is used lightly, and might be any quantity which should be minimized in the coarsening process. This is an abstract class.

Template Parameters
IndexTtype used for indices
RealTtype used for features
IntTtype used for integers (e.g., number of cells, faces,...)

Constructor & Destructor Documentation

◆ ARComputer()

template<typename IndexT , typename RealT , typename IntT >
comma::ARComputer< IndexT, RealT, IntT >::ARComputer ( std::shared_ptr< Dual_Graph< IndexT, RealT, IntT > >  graph)
inlineexplicit

Constructor.

Parameters
[in]graphDual_Graph object that determines the connectivity

◆ ~ARComputer()

template<typename IndexT , typename RealT , typename IntT >
virtual comma::ARComputer< IndexT, RealT, IntT >::~ARComputer ( )
virtualdefault

The destructor of the class.

Member Function Documentation

◆ compute_and_update_barycenter()

template<typename IndexT , typename RealT , typename IntT >
std::vector< RealT > comma::ARComputer< IndexT, RealT, IntT >::compute_and_update_barycenter ( const IndexT  i_fc,
const CellFeatures< IndexT, RealT, IntT > &  cc_feats,
const std::unordered_set< IndexT > &  fc_of_cc,
CellFeatures< IndexT, RealT, IntT > &  new_feats 
) const
inlineprotected

Compute the barycenter and update the features accordingly.

Parameters
[in]i_fcIndex of the fine cell to add to the coarse cell
[in]cc_featsFeatures of the current coarse cell
[in]fc_of_ccIndex of the fine cells already agglomerated in the coarse cell
[out]new_featsFeatures of the (final) coarse cell
Returns
the barycenter

◆ compute_and_update_features()

template<typename IndexT , typename RealT , typename IntT >
virtual void comma::ARComputer< IndexT, RealT, IntT >::compute_and_update_features ( const IndexT  i_fc,
const CellFeatures< IndexT, RealT, IntT > &  cc_feats,
const std::unordered_set< IndexT > &  fc_of_cc,
IntT &  shared_faces,
RealT &  aspect_ratio,
CellFeatures< IndexT, RealT, IntT > &  new_feats 
) const
pure virtual

Computes features of the CC obtained by adding a given fine cell. The features are Aspect-Ratio, number of face shared with other cells already agglomerated (Current coarse cell means without i_fc) and those of CellFeatures.

Parameters
[in]i_fcIndex of the fine cell to add to the coarse cell
[in]cc_featsFeatures of the current coarse cell
[in]fc_of_ccIndex of the fine cells already agglomerated in the coarse cell
[out]shared_facesNumber of faces shared by the fine cell with the current coarse cell
[out]aspect_ratioAspect-Ratio of the (final) coarse cell
[out]new_featsFeatures of the (final) coarse cell

Implemented in comma::ARDiamOverRadius< IndexT, RealT, IntT, dim >, comma::AROverMeasure< IndexT, RealT, IntT >, comma::ARDiamOverMinEdge< IndexT, RealT, IntT >, comma::ARExternalWeightOverRadius< IndexT, RealT, IntT, dim >, comma::ARDiameter< IndexT, RealT, IntT >, comma::ARExternalWeights< IndexT, RealT, IntT >, comma::AROverInternalWeights< IndexT, RealT, IntT >, comma::ARMaxBaryDistanceOverRadius< IndexT, RealT, IntT, dim >, and comma::ARMaxOverMinBaryDistance< IndexT, RealT, IntT >.

◆ compute_shared_faces()

template<typename IndexT , typename RealT , typename IntT >
void comma::ARComputer< IndexT, RealT, IntT >::compute_shared_faces ( const IndexT  i_fc,
const std::unordered_set< IndexT > &  fc_of_cc,
RealT &  shared_weights,
std::unordered_set< IndexT > &  shared_faces 
) const
inlineprotected

Computes number of shared faces and features of the CC obtained by adding a given fine cell. The features are Aspect-Ratio and number of face shared with other cells already agglomerated (Current coarse cell means without i_fc)

Parameters
[in]i_fcIndex of the fine cell to add to the coarse cell
[in]fc_of_ccIndex of the fine cells already agglomerated in the coarse cell
[out]shared_weightsSum of the weights of the shared faces
[out]shared_facesFaces shared by the fine cell with the coarse one

◆ update_approximated_geometric_features()

template<typename IndexT , typename RealT , typename IntT >
void comma::ARComputer< IndexT, RealT, IntT >::update_approximated_geometric_features ( const IndexT  i_fc,
const CellFeatures< IndexT, RealT, IntT > &  cc_feats,
const std::unordered_set< IndexT > &  fc_of_cc,
CellFeatures< IndexT, RealT, IntT > &  new_feats 
) const
inlineprotected

Compute approximated geometric features (e.g., diameter)

Parameters
[in]i_fcIndex of the fine cell to add to the coarse cell
[in]cc_featsFeatures of the current coarse cell
[in]fc_of_ccIndex of the fine cells already agglomerated in the coarse cell
[out]new_featsFeatures of the (final) coarse cell

◆ update_basic_features()

template<typename IndexT , typename RealT , typename IntT >
template<bool compute_weights = false, bool update_facets = false>
void comma::ARComputer< IndexT, RealT, IntT >::update_basic_features ( const IndexT  i_fc,
const CellFeatures< IndexT, RealT, IntT > &  cc_feats,
const std::unordered_set< IndexT > &  fc_of_cc,
IntT &  n_shared_faces,
CellFeatures< IndexT, RealT, IntT > &  new_feats 
) const
inlineprotected

Compute approximated geometric features (e.g., diameter)

Template Parameters
compute_weightsWhether algebraic features should be computed (e.g., weights)
update_facetsWhether to update external facets
Parameters
[in]i_fcIndex of the fine cell to add to the coarse cell
[in]cc_featsFeatures of the current coarse cell
[in]fc_of_ccIndex of the fine cells already agglomerated in the coarse cell
[out]n_shared_facesNumber of faces shared by the fine cell with the current coarse cell
[out]new_featsFeatures of the (final) coarse cell

◆ x_over_radius()

template<typename IndexT , typename RealT , typename IntT >
template<unsigned int dim>
RealT constexpr comma::ARComputer< IndexT, RealT, IntT >::x_over_radius ( const RealT  sqx,
const CellFeatures< IndexT, RealT, IntT > &  feats 
) const
inlineconstexprprotected

Given a squared quantity and cell features, compute the ratio between the quantity and the radius of the cell (that is $ \sqrt[dim](vol(CC)) $), or an approximation of it where the numerator and denominator are raised to certain powers (instead of taking roots) to ensure non-dimensionality.

Parameters
[in]sqxSquare of the quantity used as numerator
[in]featsFeatures of the cell
Returns
$ sqx^{dim} / vol(CC)^2 $

Member Data Documentation

◆ _graph

template<typename IndexT , typename RealT , typename IntT >
std::shared_ptr<Dual_Graph<IndexT, RealT, IntT> > comma::ARComputer< IndexT, RealT, IntT >::_graph
protected

Dual_Graph object determining Fine cells graph and hence the connectivity.


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