CoMMA 1.3.2
A geometric agglomerator for unstructured meshes
|
A class implementing the CRS global graph representation of the global mesh. More...
#include <Dual_Graph.h>
Public Types | |
using | BaseClass = Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > |
Parent 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 | ContainerIndexType = std::vector< CoMMAIndexType > |
Type for containers of indices. More... | |
using | ContainerWeightType = std::vector< CoMMAWeightType > |
Type for containers of weights. More... | |
Public Types inherited from comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > | |
using | ContainerIndexType = std::vector< CoMMAIndexType > |
Type for containers of indices. More... | |
using | ContainerWeightType = std::vector< CoMMAWeightType > |
Type for containers of weights. More... | |
using | ContainerIndexConstIt = typename ContainerIndexType::const_iterator |
Type for constant iterators of containers of indices. More... | |
using | ContainerWeightConstIt = typename ContainerWeightType::const_iterator |
Type for constant iterators of containers of weights. More... | |
Public Member Functions | |
Dual_Graph (const CoMMAIndexType &nb_c, const ContainerIndexType &m_crs_row_ptr, const ContainerIndexType &m_crs_col_ind, const ContainerWeightType &m_crs_values, const ContainerWeightType &volumes, const std::vector< std::vector< CoMMAWeightType > > ¢ers, const std::vector< CoMMAIntType > &n_bnd_faces, const CoMMAIntType dimension, const ContainerIndexType &anisotropic_compliant_fc) | |
Constructor of the class. More... | |
~Dual_Graph () override=default | |
Destructor of the class. More... | |
CoMMAIntType | get_n_boundary_faces (const CoMMAIndexType idx_c) const |
Return how many boundary faces a certain cell has. More... | |
CoMMAIntType | get_total_n_faces (const CoMMAIndexType idx_c) const |
Return total number of faces, that is, number of neighbours plus number of boundaries. More... | |
bool | is_on_boundary (const CoMMAIndexType idx_c) const |
Whether a cell is on the boundary. More... | |
CoMMAWeightType | estimated_boundary_weight (const CoMMAIndexType idx_c) const |
Approximate the value of a boundary face using the known internal faces. It uses a (geometric) average, so the result is correct only if the cell is a regular polygon. More... | |
CoMMAWeightType | estimated_total_weight (const CoMMAIndexType idx_c) const |
Sum of wall the weights (faces) of a cell. Since there is no knowledge about boundary faces, the result is correct only if internal cell. More... | |
CoMMAWeightType | get_center_direction (const CoMMAIndexType &a, const CoMMAIndexType &b, std::vector< CoMMAWeightType > &dir) |
Compute the direction from vertex a to vertex b and store it as unit vector in dir . More... | |
void | tag_anisotropic_cells (std::vector< CoMMAWeightType > &alt_weights, ContainerWeightType &max_weights, std::vector< bool > &is_anisotropic, std::deque< CoMMAIndexType > &aniso_seeds_pool, const CoMMAWeightType threshold_anisotropy, const ContainerWeightType &priority_weights, const CoMMACellCouplingT cell_coupling, const CoMMAIndexType preserving) |
Tag cells as anisotropic if their aspect-ratio is over a given threshold and order them according to given priority. More... | |
CoMMAIndexType | get_nb_cells () const |
Getter that returns the number of cells. More... | |
std::unordered_set< CoMMAIndexType > | get_neighbourhood_of_cc (const std::unordered_set< CoMMAIndexType > &s_seeds, const std::vector< bool > &is_fc_agglomerated_tmp) const |
Get the fine cells neighbours of a coarse cell. More... | |
void | compute_neighbourhood_of_cc (const std::unordered_set< CoMMAIndexType > &s_seeds, CoMMAIntType &nb_of_order_of_neighbourhood, std::unordered_map< CoMMAIndexType, CoMMAIntType > &d_n_of_seed, const CoMMAIntType max_card, const std::vector< bool > &is_fc_agglomerated_tmp) const |
Compute the dictionary of compactness of fine cells inside a coarse cell. More... | |
Public Member Functions inherited from comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > | |
Graph (const CoMMAIndexType &nb_c, const ContainerIndexType &m_crs_row_ptr, const ContainerIndexType &m_crs_col_ind, const ContainerWeightType &m_crs_values, const ContainerWeightType &volumes) | |
Constructor of the class. More... | |
virtual | ~Graph ()=default |
Destructor of the class. More... | |
void | DFS (const CoMMAIndexType &i_fc) |
Depth First Search (DFS) recursive function. More... | |
void | BFS (const CoMMAIndexType &root) |
Breadth First Search (BFS) function. More... | |
CoMMAIntType | get_nb_of_neighbours (const CoMMAIndexType i_c) const |
Retrieve the number of neighbours. More... | |
ContainerIndexType | get_neighbours (const CoMMAIndexType &i_c) const |
Based on the CRS representation retrieves the neighbours of the cell given as an input. More... | |
ContainerIndexConstIt | neighbours_cbegin (const CoMMAIndexType &i_c) const |
Get constant pointer to the first neighbour of cell i_c . More... | |
ContainerIndexConstIt | neighbours_cend (const CoMMAIndexType &i_c) const |
Get constant pointer to the element following the last neighbour of cell i_c . More... | |
ContainerWeightType | get_weights (const CoMMAIndexType &i_c) const |
Based on the area of the faces composing the cell given as an input, we retrieve the faces connecting the given cell with the neighbourhood that can be described also as the weight of the graph. More... | |
ContainerWeightConstIt | weights_cbegin (const CoMMAIndexType &i_c) const |
Get constant pointer to the first neighbour of cell i_c . More... | |
ContainerWeightConstIt | weights_cend (const CoMMAIndexType &i_c) const |
Get constant pointer to the element following the last neighbour of cell i_c . More... | |
bool | check_connectivity () |
Check the connectivity of the graph. More... | |
CoMMAIntType | compute_min_fc_compactness_inside_a_cc (const std::unordered_set< CoMMAIndexType > &s_fc) const |
Compute the minimum compactness of fine cells inside a coarse cell. More... | |
std::unordered_map< CoMMAIndexType, CoMMAIntType > | compute_fc_compactness_inside_a_cc (const std::unordered_set< CoMMAIndexType > &s_fc) const |
Compute the dictionary of compactness of fine cells inside a coarse cell. More... | |
Public Attributes | |
const std::vector< CoMMAIntType > & | _n_bnd_faces |
Vector telling how many boundary faces each cell has. More... | |
const std::unordered_set< CoMMAIndexType > | _s_anisotropic_compliant_cells |
Elements that are checked if they are anisotropic. If an element satisfies the condition for being anisotropic (typically, AR > threshold) but it not in this set, it will not considered as anisotropic. We use a set to ensure uniqueness. More... | |
const std::vector< std::vector< CoMMAWeightType > > & | _centers |
Vector of cell centers. More... | |
std::function< CoMMAWeightType(const CoMMAWeightType, const CoMMAWeightType)> | _compute_AR |
Function which computes the aspect-ratio from the minimum and maximum faces In 3D: In 2D: (Recall that in 2D a face is actually an edge) More... | |
Public Attributes inherited from comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > | |
CoMMAIndexType | _number_of_cells |
Number of nodes in the Graph (it corresponds to the number of cells in the subgraph or the dual graph. More... | |
std::vector< bool > | _visited |
Helper vector for the DFS. More... | |
ContainerIndexType | _m_CRS_Row_Ptr |
Vector of row pointer of CRS representation. More... | |
ContainerIndexType | _m_CRS_Col_Ind |
Vector of column index of CRS representation. More... | |
ContainerWeightType | _m_CRS_Values |
Vector of area weight of CRS representation. More... | |
ContainerWeightType | _volumes |
Vector of volumes. More... | |
A class implementing the CRS global graph representation of the global mesh.
CoMMAIndexType | the CoMMA index type for the global index of the mesh |
CoMMAWeightType | the CoMMA weight type for the weights (volume or area) of the nodes or edges of the Mesh |
CoMMAIntType | the CoMMA type for integers |
using comma::Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::BaseClass = Graph<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> |
Parent class.
using comma::Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::CoMMAPairType = std::pair<CoMMAIndexType, CoMMAWeightType> |
Type of pair.
using comma::Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::CoMMASetOfPairType = std::set<CoMMAPairType, CustomPairGreaterFunctor<CoMMAPairType> > |
Type of set of pairs.
using comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::ContainerIndexType = std::vector<CoMMAIndexType> |
Type for containers of indices.
using comma::Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::ContainerWeightType = std::vector<CoMMAWeightType> |
Type for containers of weights.
|
inline |
Constructor of the class.
[in] | nb_c | Number of cells |
[in] | m_crs_row_ptr | The row pointer of the CRS representation |
[in] | m_crs_col_ind | The column index of the CRS representation |
[in] | m_crs_values | The weight of the CRS representation (in CoMMA case will be the area of the faces that in the graph representation are the edges between two nodes represented by the cell centers. |
[in] | volumes | The volumes of the cells |
[in] | centers | Cell centers |
[in] | n_bnd_faces | Vector telling how many boundary faces each cell has |
[in] | dimension | Dimensionality of the problem, 2- or 3D |
[in] | anisotropic_compliant_fc | Set of compliant fc cells (in the most of the case all) |
|
overridedefault |
Destructor of the class.
|
inline |
Compute the dictionary of compactness of fine cells inside a coarse cell.
[in] | s_seeds | Set of seeds for which the neighbourhood must be computed. Generally they are the fine cells composing the coarse cell for which we are trying to compute the neighbourhood. |
[in] | nb_of_order_of_neighbourhood | order Of the neighbourhood at which we want to extend the dictionary |
[out] | d_n_of_seed | Dictionary of the neighbourhood given as an output. The key of the associative structure is the index of the fine cell, the value is the order of the distance. |
[in] | max_card | Maximum cardinality |
[in] | is_fc_agglomerated_tmp | Vector reporting the already agglomerated cell, useful in the algorithm |
|
inline |
Approximate the value of a boundary face using the known internal faces. It uses a (geometric) average, so the result is correct only if the cell is a regular polygon.
[in] | idx_c | Index of the cell |
|
inline |
Sum of wall the weights (faces) of a cell. Since there is no knowledge about boundary faces, the result is correct only if internal cell.
[in] | idx_c | Index of the cell |
|
inline |
Compute the direction from vertex a
to vertex b
and store it as unit vector in dir
.
[in] | a | Starting point |
[in] | b | End point |
[out] | dir | Unit vector of the direction |
|
inline |
Return how many boundary faces a certain cell has.
[in] | idx_c | Index of the cell |
|
inline |
Getter that returns the number of cells.
|
inline |
Get the fine cells neighbours of a coarse cell.
[in] | s_seeds | Set of seeds for which the neighbourhood should be computed. Generally they are the fine cells composing the coarse cell for which we are trying to compute the neighbourhood. |
[in] | is_fc_agglomerated_tmp | Vector reporting the already agglomerated cell, useful in the algorithm |
|
inline |
Return total number of faces, that is, number of neighbours plus number of boundaries.
[in] | idx_c | Index of the cell |
|
inline |
Whether a cell is on the boundary.
[in] | idx_c | Index of the cell |
|
inline |
Tag cells as anisotropic if their aspect-ratio is over a given threshold and order them according to given priority.
[out] | alt_weights | Alternative version of graph edge weights computed if necessary (according to cell_coupling ) |
[out] | max_weights | Array of the maximum weight: the biggest area of the faces composing the given fine cell |
[out] | is_anisotropic | Vector of length equal to the total number of cell telling whether a cell is anisotropic |
[out] | aniso_seeds_pool | Container containing the anisotropic cells in the order they should be considered when computing the lines |
[in] | threshold_anisotropy | Value of the aspect ratio above which a cell is considered anisotropic. If negative, all compliant cells are considered as anisotropic |
[in] | priority_weights | Weights used to set the order telling where to start agglomerating. The higher the weight, the higher the priority |
[in] | cell_coupling | CoMMACellCouplingT indicating the type of coupling to consider when building anisotropic lines |
[in] | preserving | if 0 does not hit only the BL prism to preserve the boundary layer otherwise 2 for 2D or 3 for the 3D to preserve the BL only in the anisotropic agglomeration |
const std::vector<std::vector<CoMMAWeightType> >& comma::Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_centers |
Vector of cell centers.
std::function<CoMMAWeightType(const CoMMAWeightType, const CoMMAWeightType)> comma::Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_compute_AR |
Function which computes the aspect-ratio from the minimum and maximum faces
In 3D:
In 2D:
(Recall that in 2D a face is actually an edge)
const std::vector<CoMMAIntType>& comma::Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_n_bnd_faces |
Vector telling how many boundary faces each cell has.
const std::unordered_set<CoMMAIndexType> comma::Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType >::_s_anisotropic_compliant_cells |
Elements that are checked if they are anisotropic. If an element satisfies the condition for being anisotropic (typically, AR > threshold) but it not in this set, it will not considered as anisotropic. We use a set to ensure uniqueness.