CoMMA 1.3.2
A geometric agglomerator for unstructured meshes
|
Classes | |
class | AgglomerationArgs |
Convenient class holding arguments for the parametrization of the agglomeration algorithm. More... | |
class | Agglomerator |
A class responsible to do the interface between the different kinds of agglomerator. More... | |
class | Agglomerator_Anisotropic |
Agglomerator_Anisotropic class is a child class of the Agglomerator class that specializes the implementation to the case of Anisotropic agglomeration. More... | |
class | Agglomerator_Biconnected |
Child class of Agglomerator_Isotropic where is implemented a specific biconnected algorithm for the agglomeration. We call it biconnected case, but it is the greedy algorithm in reality. More... | |
class | Agglomerator_Isotropic |
Agglomerator_Isotropic class is a child class of the Agglomerator class that specializes the implementation to the case of Isotropic agglomeration. More... | |
class | Agglomerator_Iterative |
Child class of Agglomerator_Isotropic which implements a specialized iterative algorithm for the search of fine cells. More... | |
class | AnisotropicArgs |
Convenient class holding arguments for the parametrization of the anisotropic agglomeration algorithm. More... | |
class | ARComputer |
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... | |
class | ARDiameter |
ARComputer. Here, AR is the approximated diameter. More... | |
class | ARDiamOverMinEdge |
ARComputer. Here, AR is the ratio of the diameter over the smallest edge. More... | |
class | ARDiamOverRadius |
ARComputer. Here, AR is the ratio of the diameter over the estimated one (typically, in 2D, the squared root of the surface). It is the definition used in CoMMA from 1.1 up to 1.3.2. More... | |
class | ARExternalWeightOverRadius |
ARComputer. Here, AR is the ratio of the external weights over the measure. With dim equal to 2, it is roughly equivalent to the ration of the perimeter and the surface of the cell. Moreover, with dim = 2, it is equivalent to the definition used by CoMMA up to version 1.0. For an algebraic version (where no concern is given to adimensionalize the AR), use dim equal to 1. More... | |
class | ARExternalWeights |
ARComputer. Here, AR is the total external weights (that is, from a geometric point of view, the perimeter). Looking for the minimum leads in graph terms to a min-cut. More... | |
class | ARMaxBaryDistanceOverRadius |
ARComputer. Here, AR is the ratio of the maximum over minimum distance of the cell centers from the barycenter (computed as weighted average of centers). If a cell is totally internal, it won't be included in the computations. More... | |
class | ARMaxOverMinBaryDistance |
ARComputer. Here, AR is the ratio of the maximum over minimum distance of the cell centers from the barycenter (computed as weighted average of centers). If a cell is totally internal, it won't be included in the computations. More... | |
class | AROverInternalWeights |
ARComputer. Here, AR is one over the internal weights (looking for the minimum leads to the maximization of the internal weights). More... | |
class | AROverMeasure |
ARComputer. Here, AR is the reciprocal of the measure, hence the optimal solution should be the one with the max measure. More... | |
class | Bimap |
An easy and straight forward implementation of a Bimap. More... | |
class | CellFeatures |
Convenient class containing salient features of a cell. According to to the chosen AR computation (see ARComputer), some features may be outdated. More... | |
class | Coarse_Cell |
Class describing a coarse cell. More... | |
class | Coarse_Cell_Container |
Class implementing a custom container where the coarse cells are stored. More... | |
class | Coarse_Cell_Subgraph |
Class describing a coarse cell with a full description, that is, it also holds a subgraph describing how the fine cells are connected inside the coarse one. More... | |
struct | CustomPairGreaterFunctor |
Functor for pairs implementing a custom 'greater than'. It relies on the 'greater than' operator for the second elements and 'less than' for the first ones. More... | |
struct | CustomPairLessFunctor |
Functor for pairs implementing a custom 'less than'. It relies on the 'less than' operator for the second elements and 'greater than' for the first ones. More... | |
class | Dual_Graph |
A class implementing the CRS global graph representation of the global mesh. More... | |
class | Graph |
An interface class responsible of storing the cell centered dual graph and of acting on it (it is an interface for the global Dual_Graph and the Subgraph) More... | |
class | GraphArgs |
Convenient class holding arguments defining the graph. More... | |
class | Neighbourhood |
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... | |
class | Neighbourhood_Extended |
Class representing the neighbourhood of a given cell in the graph. In this derived class the neighbourhood is extended, meaning that all the neighbours seen so far are candidates. More... | |
class | Neighbourhood_Pure_Front |
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... | |
class | NeighbourhoodCreator |
Pure abstract class for a creator of Neighbourhood objects. It can create from scratch or by copy. More... | |
class | NeighbourhoodExtendedCreator |
Creator of Neighbourhood_Extended objects. It can create from scratch or by copy. More... | |
class | NeighbourhoodPureFrontCreator |
Creator of Neighbourhood_Extended objects. It can create from scratch or by copy. More... | |
class | Node |
Node data structure that represent a node of the tree. More... | |
class | PairFindFirstBasedFunctor |
Functor implementing an operator telling if a given value if the first one of pair. More... | |
struct | PairSecondBasedLessFunctor |
Functor for pairs implementing a less operator based only on the second element of the pair. More... | |
class | Priority_Pair |
Wrapper around the STL pair with custom 'less than' operator: as in the standard case, first we compare the first elements, then the second ones; however it relies on the 'greater than' on the first elements, e.g., (4,X) < (3,Y), whereas standard rules apply to second elements, e.g., (4,3) < (4,4). More... | |
class | Queue |
A template class implementing a custom queue data structure. More... | |
class | Seeds_Pool |
Class representing the pool of all the seeds for creating a coarse cell. More... | |
class | Seeds_Pool_Boundary_Priority |
Class representing the pool of all the seeds for creating a coarse cell. This derived class gives higher priority to cells that are on the border. More... | |
class | Seeds_Pool_Neighbourhood_Priority |
Class representing the pool of all the seeds for creating a coarse cell. This derived class gives higher priority to cells that are neighbours of already existing coarse cells. More... | |
struct | SPFullInitializator |
Functor performing the full initialization of a seeds pool. More... | |
struct | SPInitializator |
Functor performing the initialization of a seeds pool. More... | |
struct | SPOnePointInitializator |
Functor performing the one-point initialization of a seeds pool. More... | |
class | Subgraph |
A class implementing the CRS subgraph representation. It is used in the framework of CoMMA for the implementation of the CSR representation of the coarse cells. More... | |
class | Tree |
Tree structure that represent a coarse cell, the fine cell and the neighbours to them. More... | |
Enumerations | |
enum | CoMMACellT : CoMMAIntT { INTERIOR = 0 , VALLEY = 1 , RIDGE = 2 , CORNER = 3 , EXTREME = 4 , N_CELL_TYPES = 4 } |
Type of an element according to its boundary faces / edges The terms come from the NIA paper: Nishikawa, Diskin, Thomas... More... | |
enum | CoMMANeighbourhoodT : CoMMAIntT { EXTENDED = 0 , PURE_FRONT = 1 } |
Type of neighbourhood (of a coarse cell) considered when agglomerating. More... | |
enum | CoMMASeedsPoolT : CoMMAIntT { BOUNDARY_PRIORITY = 0 , NEIGHBOURHOOD_PRIORITY = 1 , BOUNDARY_PRIORITY_ONE_POINT_INIT = 10 , NEIGHBOURHOOD_PRIORITY_ONE_POINT_INIT = 11 } |
Type of seeds pool ordering. More... | |
enum | CoMMAAspectRatioT : CoMMAIntT { DIAMETER_OVER_RADIUS = 0 , DIAMETER_OVER_MIN_EDGE , DIAMETER , ONE_OVER_MEASURE , ONE_OVER_INTERNAL_WEIGHTS , PERIMETER_OVER_RADIUS , EXTERNAL_WEIGHTS , MAX_BARY_DIST_OVER_RADIUS , MAX_OVER_MIN_BARY_DIST , ALGEBRAIC_PERIMETER_OVER_MEASURE } |
Type of aspect-ratio. Notation: More... | |
enum | CoMMACellCouplingT : CoMMAIntT { MAX_WEIGHT = 0 , MIN_DISTANCE = 1 } |
Type of coupling between cells in an anisotropic line. More... | |
Functions | |
template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType > | |
void | agglomerate_one_level (const std::vector< CoMMAIndexType > &adjMatrix_row_ptr, const std::vector< CoMMAIndexType > &adjMatrix_col_ind, const std::vector< CoMMAWeightType > &adjMatrix_areaValues, const std::vector< CoMMAWeightType > &volumes, const std::vector< std::vector< CoMMAWeightType > > ¢ers, const std::vector< CoMMAWeightType > &priority_weights, const std::vector< CoMMAIndexType > &anisotropicCompliantCells, const std::vector< CoMMAIntType > &n_bnd_faces, bool build_anisotropic_lines, bool is_anisotropic, bool odd_line_length, CoMMAWeightType threshold_anisotropy, CoMMASeedsPoolT seed_ordering_type, std::vector< CoMMAIndexType > &fc_to_cc, std::vector< CoMMAIndexType > &agglomerationLines_Idx, std::vector< CoMMAIndexType > &agglomerationLines, bool correction, CoMMAIntType dimension, CoMMAIntType goal_card, CoMMAIntType min_card, CoMMAIntType max_card, CoMMAAspectRatioT aspect_ratio=CoMMAAspectRatioT::DIAMETER_OVER_RADIUS, CoMMAIntType singular_card_thresh=1, std::optional< CoMMAIndexType > max_cells_in_line=std::nullopt, CoMMACellCouplingT aniso_cell_coupling=CoMMACellCouplingT::MAX_WEIGHT, bool force_line_direction=true, CoMMAIntType fc_choice_iter=1, CoMMANeighbourhoodT neighbourhood_type=CoMMANeighbourhoodT::EXTENDED) |
Main function of the agglomerator, it is used as an interface to build up all the agglomeration process. The result will be the definition of the agglomerated cells fc_to_cc . More... | |
template<typename CoMMAIndexType , typename CoMMAWeightType , typename CoMMAIntType > | |
void | agglomerate_one_level (const GraphArgs< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &graph, const AgglomerationArgs< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &agglo, const AnisotropicArgs< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &aniso, std::vector< CoMMAIndexType > &fc_to_cc, std::vector< CoMMAIndexType > &aniso_lines_indices, std::vector< CoMMAIndexType > &aniso_lines) |
Main function of the agglomerator, it is used as an interface to build up all the agglomeration process. The result will be the definition of the agglomerated cells fc_to_cc . More... | |
template<bool condition, typename typeA , typename typeB > | |
void | fill_value (typeA &a, typeB &b) |
Assign from type to another only if a compile-time condition is verified. More... | |
template<typename T > | |
T constexpr | _sq (const T x) |
Square. More... | |
template<typename T > | |
T constexpr | _cb (const T x) |
Cube. More... | |
template<unsigned int p, typename T > | |
T constexpr | int_power (const T x) |
Raise a quantity to an integer power. More... | |
template<typename T > | |
bool constexpr | dot_deviate (const T dot) |
Tell whether the dot product given as input comes from two parallel vectors. Compared against deviate_thresh. More... | |
template<typename T > | |
T | dot_product (const std::vector< T > &a, const std::vector< T > &b) |
Compute the dot product between two vectors. No check on size is performed. More... | |
template<typename T > | |
T | get_direction (const std::vector< T > &a, const std::vector< T > &b, std::vector< T > &dir) |
Compute the direction from point a to point b and store it as unit vector in dir . More... | |
template<typename T > | |
T | squared_euclidean_distance (const std::vector< T > &a, const std::vector< T > &b) |
Compute the squared Euclidean distance between two points seen as vectors. We use vectors because we can have both 2- and 3D points (also we can have 3D points even if the dimension given to CoMMA is 2D, e.g., with CODA pseudo-2D meshes). The dimension used as reference is the one of the first point. More... | |
template<typename CoMMAContainerPairType > | |
std::vector< typename CoMMAContainerPairType::value_type::first_type > | vector_of_first_elements (const CoMMAContainerPairType &cont) |
Given a container of pairs, return a vector with first elements only. More... | |
template<typename KeyT , typename ValueT > | |
std::unordered_set< KeyT > | d_keys_to_set (const std::unordered_map< KeyT, ValueT > &dict) |
Utility function for creating a set out of the keys of a map. More... | |
template<typename IndexT , typename IntT > | |
void | filter_cells_by_n_edges (const std::vector< IndexT > &indices, const std::vector< IntT > &n_bnd_faces, const std::unordered_set< IntT > &allowed, std::vector< IndexT > &filtered) |
Given the connectivity of the graph, filter cells keeping only those with the desired number of edges / neighbours. More... | |
template<typename IndexT , typename DistT > | |
void | compute_neighbourhood_based_wall_distance (const std::vector< IndexT > &neigh_idxs, const std::vector< IndexT > &neighs, const std::vector< IndexT > &wall, std::vector< DistT > &dist) |
Compute a neighbourhood-base wall-distance, that is, the distance of a given cell from a wall is the number of cells though which the minimum path starting from the cell and ending at the wall. For example, in a Cartesian grids this is equivalent to the minimum of the Manhattan distance. If the vector defining the wall is empty, return negative values. If a cell is unconnected to the domain with the wall, its distance will be negative. It takes a compressed version of the connectivity of the mesh. It uses a BFS algorithm to visit all the cells. More... | |
template<typename IndexT , typename RealT , typename IntT > | |
void | build_coarse_graph (const std::vector< IndexT > &f2c, const std::vector< IndexT > &f_adj_idx, const std::vector< IndexT > &f_adj, const std::vector< RealT > &f_weights, const std::vector< RealT > &f_volumes, const std::vector< std::vector< RealT > > &f_centers, const std::vector< RealT > &f_priority, const std::vector< IntT > &f_n_bnd, std::vector< IndexT > &c_adj_idx, std::vector< IndexT > &c_adj, std::vector< RealT > &c_weights, std::vector< RealT > &c_volumes, std::vector< std::vector< RealT > > &c_centers, std::vector< RealT > &c_priority, std::vector< IntT > &c_n_bnd) |
Build a coarse graph from the fine graph and the result of a previous agglomeration. More... | |
Variables | |
constexpr CoMMAIntT | iter_agglo_max_iter = 4 |
Maximum allowed iterations for the iterative algorithm, see Agglomerator_Iterative. More... | |
constexpr double | deviate_thresh = 0.9396926207859084 |
Threshold used in combination with a dot product to tell whether two vector deviate. It is set to . More... | |
enum comma::CoMMAAspectRatioT : CoMMAIntT |
Type of aspect-ratio. Notation:
enum comma::CoMMACellCouplingT : CoMMAIntT |
enum comma::CoMMACellT : CoMMAIntT |
Type of an element according to its boundary faces / edges The terms come from the NIA paper: Nishikawa, Diskin, Thomas...
enum comma::CoMMANeighbourhoodT : CoMMAIntT |
enum comma::CoMMASeedsPoolT : CoMMAIntT |
Type of seeds pool ordering.
|
inlineconstexpr |
Cube.
T | The type of the quantity |
[in] | x | The quantity |
x
|
inlineconstexpr |
Square.
T | The type of the quantity |
[in] | x | The quantity |
x
|
inline |
Main function of the agglomerator, it is used as an interface to build up all the agglomeration process. The result will be the definition of the agglomerated cells fc_to_cc
.
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 |
[in] | graph | Definition of the graph, see GraphArgs. |
[in] | agglo | Parametrization of the isotropic agglomeration algorithm, see AgglomerationArgs. |
[in] | aniso | Parametrization of the anisotropic agglomeration algorithm, see AnisotropicArgs. |
[out] | fc_to_cc | Vector telling the ID of the coarse cell to which a fine cell belongs after agglomeration. |
[in,out] | aniso_lines_indices | Connectivity for the agglomeration lines |
[in,out] | aniso_lines | Vector storing all the elements of the anisotropic lines |
void comma::agglomerate_one_level | ( | const std::vector< CoMMAIndexType > & | adjMatrix_row_ptr, |
const std::vector< CoMMAIndexType > & | adjMatrix_col_ind, | ||
const std::vector< CoMMAWeightType > & | adjMatrix_areaValues, | ||
const std::vector< CoMMAWeightType > & | volumes, | ||
const std::vector< std::vector< CoMMAWeightType > > & | centers, | ||
const std::vector< CoMMAWeightType > & | priority_weights, | ||
const std::vector< CoMMAIndexType > & | anisotropicCompliantCells, | ||
const std::vector< CoMMAIntType > & | n_bnd_faces, | ||
bool | build_anisotropic_lines, | ||
bool | is_anisotropic, | ||
bool | odd_line_length, | ||
CoMMAWeightType | threshold_anisotropy, | ||
CoMMASeedsPoolT | seed_ordering_type, | ||
std::vector< CoMMAIndexType > & | fc_to_cc, | ||
std::vector< CoMMAIndexType > & | agglomerationLines_Idx, | ||
std::vector< CoMMAIndexType > & | agglomerationLines, | ||
bool | correction, | ||
CoMMAIntType | dimension, | ||
CoMMAIntType | goal_card, | ||
CoMMAIntType | min_card, | ||
CoMMAIntType | max_card, | ||
CoMMAAspectRatioT | aspect_ratio = CoMMAAspectRatioT::DIAMETER_OVER_RADIUS , |
||
CoMMAIntType | singular_card_thresh = 1 , |
||
std::optional< CoMMAIndexType > | max_cells_in_line = std::nullopt , |
||
CoMMACellCouplingT | aniso_cell_coupling = CoMMACellCouplingT::MAX_WEIGHT , |
||
bool | force_line_direction = true , |
||
CoMMAIntType | fc_choice_iter = 1 , |
||
CoMMANeighbourhoodT | neighbourhood_type = CoMMANeighbourhoodT::EXTENDED |
||
) |
Main function of the agglomerator, it is used as an interface to build up all the agglomeration process. The result will be the definition of the agglomerated cells fc_to_cc
.
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 |
[in] | adjMatrix_row_ptr | the row pointer of the CRS representation |
[in] | adjMatrix_col_ind | the column index of the CRS representation |
[in] | adjMatrix_areaValues | 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] | priority_weights | Weights used to set the order telling where to start agglomerating. The higher the weight, the higher the priority |
[in] | anisotropicCompliantCells | List of cells which have to be looked for anisotropy |
[in] | n_bnd_faces | Vector telling how many boundary faces each cell has |
[in] | build_anisotropic_lines | Whether lines joining the anisotropic cells should be built, otherwise, if the anisotropic agglomeration is activated, the lines should be provided, see agglomerationLines_Idx and agglomerationLines |
[in] | is_anisotropic | Whether to consider an anisotropic agglomeration |
[in] | odd_line_length | Whether anisotropic lines with odd length are allowed |
[in] | threshold_anisotropy | Value of the aspect-ratio above which a cell is considered as anisotropic. If negative, all compliant cells are considered as anisotropic |
[in] | seed_ordering_type | Type of ordering for the seeds of the coarse cells. Possible values (see CoMMASeedsPoolT):
|
[out] | fc_to_cc | Vector telling the ID of the coarse cell to which a fine cell belongs after agglomeration. The vector is cleared and then resized to the right size. |
[in,out] | agglomerationLines_Idx | Connectivity for the agglomeration lines: each element points to a particular element in the vector agglomerationLines . The vector is cleared and then resized to the right size. |
[in,out] | agglomerationLines | Vector storing all the elements of the anisotropic lines. The vector is cleared and then resized to the right size. |
[in] | correction | Whether to apply correction step (avoid isolated cells) after agglomeration |
[in] | dimension | Dimensionality of the problem, 2- or 3D |
[in] | goal_card | Desired cardinality of the coarse cells (might not be ensured) |
[in] | min_card | Minimum cardinality accepted for the coarse cells |
[in] | max_card | Maximum cardinality accepted for the coarse cells |
[in] | aspect_ratio | Type of aspect-ratio (see CoMMAAspectRatioT) |
[in] | singular_card_thresh | (optional, default=1) Cardinality below which a coarse is considered as singular, hence, compliant for correction |
[in] | max_cells_in_line | [Optional] Maximum number of cells in an anisotropic line; when this value is reached, all reaming cells are discarded, hence considered as isotropic |
[in] | aniso_cell_coupling | CoMMACellCouplingT indicating the type of coupling to consider when building anisotropic lines |
[in] | force_line_direction | Whether to force the direction of the anisotropic lines to remain straight |
[in] | fc_choice_iter | (optional, default=1) Number of iterations allowed for the algorithm choosing which fine cell to add next. The cost grows exponentially, hence use small values. |
[in] | neighbourhood_type | (optional, default=Extended) Type of neighbourhood to use when growing a coarse cell. See CoMMANeighbourhoodT for more details. Two alternatives:
|
invalid_argument | whenever dimension is not 2 nor 3, cardinalities are smaller than 1 or not in order, line building is disabled but lines are not provided, or number of iterations is negative or greater than iter_agglo_max_iter. |
void comma::build_coarse_graph | ( | const std::vector< IndexT > & | f2c, |
const std::vector< IndexT > & | f_adj_idx, | ||
const std::vector< IndexT > & | f_adj, | ||
const std::vector< RealT > & | f_weights, | ||
const std::vector< RealT > & | f_volumes, | ||
const std::vector< std::vector< RealT > > & | f_centers, | ||
const std::vector< RealT > & | f_priority, | ||
const std::vector< IntT > & | f_n_bnd, | ||
std::vector< IndexT > & | c_adj_idx, | ||
std::vector< IndexT > & | c_adj, | ||
std::vector< RealT > & | c_weights, | ||
std::vector< RealT > & | c_volumes, | ||
std::vector< std::vector< RealT > > & | c_centers, | ||
std::vector< RealT > & | c_priority, | ||
std::vector< IntT > & | c_n_bnd | ||
) |
Build a coarse graph from the fine graph and the result of a previous agglomeration.
IndexT | Type for indices |
RealT | Type for reals |
IntT | Type for integers |
[in] | f2c | Result of the previous agglomeration |
[in] | f_adj_idx | Adjacency indices of the fine graph |
[in] | f_adj | Adjacency of the fine graph |
[in] | f_weights | Adjacency weights of the fine graph |
[in] | f_volumes | Volumes of the previous graph |
[in] | f_centers | Centers of the cells of the fine graph |
[in] | f_priority | Priorities of the cells of the fine graph |
[in] | f_n_bnd | Number of boundary faces of the cells of the fine graph |
[out] | c_adj_idx | Adjacency indices of the coarse graph |
[out] | c_adj | Adjacency of the coarse graph |
[out] | c_weights | Adjacency weights of the coarse graph |
[out] | c_volumes | Volumes of the previous graph |
[out] | c_centers | Centers of the cells of the coarse graph |
[out] | c_priority | Priorities of the cells of the coarse graph (computed as maximum of the priorities of the fine cells) |
[out] | c_n_bnd | Number of boundary faces of the cells of the coarse graph |
void comma::compute_neighbourhood_based_wall_distance | ( | const std::vector< IndexT > & | neigh_idxs, |
const std::vector< IndexT > & | neighs, | ||
const std::vector< IndexT > & | wall, | ||
std::vector< DistT > & | dist | ||
) |
Compute a neighbourhood-base wall-distance, that is, the distance of a given cell from a wall is the number of cells though which the minimum path starting from the cell and ending at the wall. For example, in a Cartesian grids this is equivalent to the minimum of the Manhattan distance.
If the vector defining the wall is empty, return negative values.
If a cell is unconnected to the domain with the wall, its distance will be negative.
It takes a compressed version of the connectivity of the mesh. It uses a BFS algorithm to visit all the cells.
IndexT | Type for cell indices |
DistT | Type for distance (should be signed) |
[in] | neigh_idxs | Indices used to recover the neighbours of each cells provided in neighs . The length is |
[in] | neighs | Neighbours of the cells |
[in] | wall | Cells composing the wall from which the distance is computed |
[out] | dist | Distance from the wall. This vector is resized inside the function to hold all the cells |
|
inline |
Utility function for creating a set out of the keys of a map.
KeyT | Type of the keys of the map |
ValueT | Type of the values of the map |
[in] | dict | A map |
|
inlineconstexpr |
Tell whether the dot product given as input comes from two parallel vectors. Compared against deviate_thresh.
T | Input type |
[in] | dot | Dot product |
|
inline |
Compute the dot product between two vectors. No check on size is performed.
T | Input type |
[in] | a | First vector |
[in] | b | Second vector |
void comma::fill_value | ( | typeA & | a, |
typeB & | b | ||
) |
Assign from type to another only if a compile-time condition is verified.
condition | Boolean telling if the assignment should be done. It has to be a constexpr |
typeA | Type of the destination of the assignment |
typeB | Type of the source of the assignment |
[in] | a | Destination of the assignment |
[in] | b | Source of the assignment |
|
inline |
Given the connectivity of the graph, filter cells keeping only those with the desired number of edges / neighbours.
IndexT | Type for indices. |
IntT | Type for integers. |
[in] | indices | Indices of the connectivity of the graph. |
[in] | n_bnd_faces | Number of boundary faces per cell. |
[in] | allowed | Set with the accepted number of edges. |
[out] | filtered | Filtered cells. |
|
inline |
Compute the direction from point a
to point b
and store it as unit vector in dir
.
T | Input type |
[in] | a | Starting point |
[in] | b | End point |
[out] | dir | Unit vector of the direction |
|
inlineconstexpr |
Raise a quantity to an integer power.
p | The power |
T | The type of the quantity |
[in] | x | The quantity |
|
inline |
Compute the squared Euclidean distance between two points seen as vectors. We use vectors because we can have both 2- and 3D points (also we can have 3D points even if the dimension given to CoMMA is 2D, e.g., with CODA pseudo-2D meshes). The dimension used as reference is the one of the first point.
T | Type for real numbers |
[in] | a | First point |
[in] | b | Second point |
|
inline |
Given a container of pairs, return a vector with first elements only.
CoMMAContainerPairType | Type of the input container |
[in] | cont | A container of pairs from which the first elements will be extracted |
|
constexpr |
Threshold used in combination with a dot product to tell whether two vector deviate. It is set to .
|
constexpr |
Maximum allowed iterations for the iterative algorithm, see Agglomerator_Iterative.