CoMMA 1.3.2
A geometric agglomerator for unstructured meshes
Loading...
Searching...
No Matches
Args.h
Go to the documentation of this file.
1#ifndef COMMA_PROJECT_PARAMS_H
2#define COMMA_PROJECT_PARAMS_H
3
4/*
5 * CoMMA
6 *
7 * Copyright © 2024 ONERA
8 *
9 * Authors: Nicolas Lantos, Alberto Remigi, and Riccardo Milani
10 * Contributors: Karim Anemiche
11 *
12 * This Source Code Form is subject to the terms of the Mozilla Public
13 * License, v. 2.0. If a copy of the MPL was not distributed with this
14 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
15 */
16
17#include <optional>
18#include <vector>
19
20#include "CoMMA/CoMMADefs.h"
21
22namespace comma {
23
30template<
31 typename CoMMAIndexType,
32 typename CoMMAWeightType,
33 typename CoMMAIntType>
34class GraphArgs {
35public:
37 const std::vector<CoMMAIndexType> &connectivity_indices;
39 const std::vector<CoMMAIndexType> &connectivity;
41 const std::vector<CoMMAWeightType> &connectivity_weights;
43 const std::vector<CoMMAWeightType> &volumes;
45 const std::vector<std::vector<CoMMAWeightType>> &centers;
47 const std::vector<CoMMAWeightType> &priority_weights;
49 const std::vector<CoMMAIntType> &n_bnd_faces;
51 CoMMAIntType dimension;
52
54 GraphArgs() = default;
55
69 const std::vector<CoMMAIndexType> &connectivity_indices,
70 const std::vector<CoMMAIndexType> &connectivity,
71 const std::vector<CoMMAWeightType> &connectivity_weights,
72 const std::vector<CoMMAWeightType> &volumes,
73 const std::vector<std::vector<CoMMAWeightType>> &centers,
74 const std::vector<CoMMAWeightType> &priority_weights,
75 const std::vector<CoMMAIntType> &n_bnd_faces,
76 CoMMAIntType dimension
77 ) :
86};
87
95template<
96 typename CoMMAIndexType,
97 typename CoMMAWeightType,
98 typename CoMMAIntType>
100public:
102 CoMMAIntType goal_card;
104 CoMMAIntType min_card;
106 CoMMAIntType max_card;
110 bool correction{}; // clang-tidy complains without {}
123 CoMMAIntType fc_choice_iter;
128
130 AgglomerationArgs() = default;
131
152 CoMMAIntType goal_card,
153 CoMMAIntType min_card,
154 CoMMAIntType max_card,
155 bool correction,
158 CoMMAIntType singular_card_thresh = 1,
159 CoMMAIntType fc_choice_iter = 1,
161 ) :
171};
172
180template<
181 typename CoMMAIndexType,
182 typename CoMMAWeightType,
183 typename CoMMAIntType>
185public:
189 const std::vector<CoMMAIndexType> &anisotropicCompliantCells;
197 CoMMAWeightType threshold_anisotropy;
199 std::optional<CoMMAIndexType> max_cells_in_line = std::nullopt;
206
225 bool is_anisotropic,
226 const std::vector<CoMMAIndexType> &anisotropicCompliantCells,
227 bool build_lines = true,
228 bool odd_line_length = true,
229 CoMMAWeightType threshold_anisotropy = 4.,
230 std::optional<CoMMAIndexType> max_cells_in_line = std::nullopt,
232 bool line_direction = true
233 ) :
242};
243
244} // end namespace comma
245
246#endif
Convenient class holding arguments for the parametrization of the agglomeration algorithm.
Definition: Args.h:99
CoMMAIntType goal_card
Desired cardinality of the coarse cells.
Definition: Args.h:102
CoMMASeedsPoolT seed_ordering_type
Type of ordering for the seeds of the coarse cells (see CoMMASeedsPoolT)
Definition: Args.h:114
CoMMANeighbourhoodT neighbourhood_type
Type of neighbourhood to use when growing a coarse cell. See CoMMANeighbourhoodT for more details.
Definition: Args.h:127
AgglomerationArgs(CoMMAIntType goal_card, CoMMAIntType min_card, CoMMAIntType max_card, bool correction, CoMMASeedsPoolT seed_ordering_type, CoMMAAspectRatioT aspect_ratio=CoMMAAspectRatioT::DIAMETER_OVER_RADIUS, CoMMAIntType singular_card_thresh=1, CoMMAIntType fc_choice_iter=1, CoMMANeighbourhoodT neighbourhood_type=CoMMANeighbourhoodT::EXTENDED)
Constructor.
Definition: Args.h:151
AgglomerationArgs()=default
Default constructor.
CoMMAIntType min_card
Minimum cardinality accepted for the coarse cells.
Definition: Args.h:104
CoMMAAspectRatioT aspect_ratio
Type of aspect ratio.
Definition: Args.h:116
bool correction
Whether to apply correction step (avoid isolated cells) after agglomeration.
Definition: Args.h:110
CoMMAIntType singular_card_thresh
Cardinality below which a coarse is considered as singular, hence, compliant for correction.
Definition: Args.h:119
CoMMAIntType fc_choice_iter
Number of iterations allowed for the algorithm choosing which fine cell to add next....
Definition: Args.h:123
CoMMAIntType max_card
Maximum cardinality accepted for the coarse cells.
Definition: Args.h:106
Convenient class holding arguments for the parametrization of the anisotropic agglomeration algorithm...
Definition: Args.h:184
CoMMACellCouplingT cell_coupling
Type of coupling to consider when building lines.
Definition: Args.h:201
AnisotropicArgs(bool is_anisotropic, const std::vector< CoMMAIndexType > &anisotropicCompliantCells, bool build_lines=true, bool odd_line_length=true, CoMMAWeightType threshold_anisotropy=4., std::optional< CoMMAIndexType > max_cells_in_line=std::nullopt, CoMMACellCouplingT cell_coupling=CoMMACellCouplingT::MAX_WEIGHT, bool line_direction=true)
Constructor.
Definition: Args.h:224
std::optional< CoMMAIndexType > max_cells_in_line
Maximum number of cells in an anisotropic line.
Definition: Args.h:199
bool is_anisotropic
Whether to consider an anisotropic agglomeration.
Definition: Args.h:187
bool build_lines
Whether lines joining the anisotropic cells should be built.
Definition: Args.h:191
bool line_direction
Whether to force the direction of the anisotropic lines to remain straight.
Definition: Args.h:205
CoMMAWeightType threshold_anisotropy
Value of the aspect-ratio above which a cell is considered as anisotropic.
Definition: Args.h:197
bool odd_line_length
Whether anisotropic lines with odd length are allowed.
Definition: Args.h:193
const std::vector< CoMMAIndexType > & anisotropicCompliantCells
List of cells which have to be looked for anisotropy.
Definition: Args.h:189
Convenient class holding arguments defining the graph.
Definition: Args.h:34
const std::vector< CoMMAWeightType > & priority_weights
Priority weights.
Definition: Args.h:47
const std::vector< CoMMAIndexType > & connectivity_indices
Indices of the CSR representation of the graph.
Definition: Args.h:37
const std::vector< CoMMAIndexType > & connectivity
Values of the CSR representation of the graph.
Definition: Args.h:39
const std::vector< CoMMAIntType > & n_bnd_faces
Number of boundary faces per cell.
Definition: Args.h:49
const std::vector< CoMMAWeightType > & volumes
Volumes of the cells.
Definition: Args.h:43
const std::vector< CoMMAWeightType > & connectivity_weights
Weights of the CSR representation of the graph.
Definition: Args.h:41
GraphArgs()=default
Default constructor.
const std::vector< std::vector< CoMMAWeightType > > & centers
Centers of the cells.
Definition: Args.h:45
CoMMAIntType dimension
Dimensionality of the problem, 2- or 3D.
Definition: Args.h:51
GraphArgs(const std::vector< CoMMAIndexType > &connectivity_indices, const std::vector< CoMMAIndexType > &connectivity, const std::vector< CoMMAWeightType > &connectivity_weights, const std::vector< CoMMAWeightType > &volumes, const std::vector< std::vector< CoMMAWeightType > > &centers, const std::vector< CoMMAWeightType > &priority_weights, const std::vector< CoMMAIntType > &n_bnd_faces, CoMMAIntType dimension)
Constructor.
Definition: Args.h:68
Definition: Agglomerator.h:37
CoMMAAspectRatioT
Type of aspect-ratio. Notation:
Definition: CoMMADefs.h:73
@ DIAMETER_OVER_RADIUS
Definition: CoMMADefs.h:75
CoMMACellCouplingT
Type of coupling between cells in an anisotropic line.
Definition: CoMMADefs.h:103
@ MAX_WEIGHT
Definition: CoMMADefs.h:105
CoMMANeighbourhoodT
Type of neighbourhood (of a coarse cell) considered when agglomerating.
Definition: CoMMADefs.h:37
@ EXTENDED
Extended, all neighbours of the coarse cell.
Definition: CoMMADefs.h:38
CoMMASeedsPoolT
Type of seeds pool ordering.
Definition: CoMMADefs.h:43