diff --git a/_agglomerator_8h_source.html b/_agglomerator_8h_source.html
index 627a030..8b53243 100644
--- a/_agglomerator_8h_source.html
+++ b/_agglomerator_8h_source.html
@@ -152,1252 +152,1345 @@
- 79 CoMMAIntType dimension = 3) :
-
-
-
-
-
- 85 throw std::range_error(
"dimension can only be 2 or 3");
-
-
-
- 89 _compute_AR = [](
const CoMMAWeightType diam,
const CoMMAWeightType area)
- 90 -> CoMMAWeightType {
return diam / sqrt(area); };
-
-
- 93 _compute_AR = [](
const CoMMAWeightType diam,
const CoMMAWeightType vol)
- 94 -> CoMMAWeightType {
return diam / cbrt(vol); };
-
-
-
-
-
+ 79 CoMMAIntType dimension = 3
+
+
+
+
+
+
+ 86 throw std::range_error(
"dimension can only be 2 or 3");
+
+
+
+
+ 91 const CoMMAWeightType diam,
const CoMMAWeightType area
+ 92 ) -> CoMMAWeightType {
return diam / sqrt(area); };
+
+
+
+ 96 const CoMMAWeightType diam,
const CoMMAWeightType vol
+ 97 ) -> CoMMAWeightType {
return diam / cbrt(vol); };
+
+
+
-
-
-
-
-
- 121 const CoMMAIntType goal_card,
- 122 const CoMMAIntType min_card,
- 123 const CoMMAIntType max_card,
- 124 const std::vector<CoMMAWeightType> &priority_weights,
- 125 bool correction_steps) = 0;
-
-
-
-
-
-
-
-
-
- 154 std::shared_ptr<Dual_Graph<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>>
-
-
-
-
- 164 std::shared_ptr<Seeds_Pool<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>>
-
-
-
-
- 177 typename CoMMAIndexType,
- 178 typename CoMMAWeightType,
- 179 typename CoMMAIntType>
-
- 181 public Agglomerator<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
-
-
-
-
-
-
-
- 193 std::set<CoMMAPairType, CustomPairGreaterFunctor<CoMMAPairType>>;
-
-
-
-
-
-
-
-
-
- 227 const CoMMAWeightType threshold_anisotropy,
- 228 const std::vector<CoMMAIndexType> &agglomerationLines_Idx,
- 229 const std::vector<CoMMAIndexType> &agglomerationLines,
- 230 const std::vector<CoMMAWeightType> &priority_weights,
- 231 const bool build_lines,
- 232 const bool odd_line_length,
- 233 const std::optional<CoMMAIndexType> max_cells_in_line,
- 234 CoMMAIntType dimension = 3) :
- 235 Agglomerator<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
- 236 graph, cc_graph, seeds_pool, dimension),
-
-
-
-
-
-
-
-
-
- 246 this->
_nb_lines = std::vector<CoMMAIndexType>(2);
- 247 this->
_v_lines = std::vector<std::vector<AnisotropicLinePtr>>(2);
-
-
- 250 const CoMMAWeightType thr =
- 251 (threshold_anisotropy > 1 || threshold_anisotropy < 0)
- 252 ? threshold_anisotropy
- 253 :
static_cast<CoMMAWeightType
>(1. / threshold_anisotropy);
-
-
-
-
-
-
-
-
-
- 263 for (
auto idx_ptr = agglomerationLines_Idx.cbegin() + 1;
- 264 idx_ptr != agglomerationLines_Idx.cend(); ++idx_ptr) {
- 265 const auto ln_sz = *idx_ptr - (*(idx_ptr - 1));
-
- 267 this->
_v_lines[0].push_back(std::make_shared<AnisotropicLine>(
- 268 agglomerationLines.cbegin() + (*(idx_ptr - 1)),
- 269 agglomerationLines.cbegin() + (*idx_ptr)));
-
-
-
-
-
-
- 276 <<
"CoMMA - No anisotropic line was built (e.g., only one-cell "
- 277 "lines). Skipping anisotropic agglomeration"
-
-
-
-
-
-
-
- 302 const CoMMAIntType goal_card,
- 303 const CoMMAIntType min_card,
- 304 const CoMMAIntType max_card,
- 305 const std::vector<CoMMAWeightType> &priority_weights,
- 306 bool correction_steps)
override {
-
-
-
-
-
-
-
-
-
- 316 constexpr bool is_anisotropic =
true;
- 317 constexpr CoMMAIntType compactness = 1;
-
-
-
-
- 322 auto loop_line = [&](
auto begin,
auto end) {
-
-
- 325 for (
auto line_it = begin; line_it != end; line_it += 2) {
-
-
-
-
-
-
-
-
-
-
-
- 337 std::unordered_set<CoMMAIndexType> s_fc = {*line_it, *(line_it + 1)};
-
-
-
-
-
-
- 344 this->
_fc_graph->neighbours_cbegin(*line_it),
- 345 this->
_fc_graph->neighbours_cend(*line_it));
-
-
- 348 this->
_fc_graph->neighbours_cbegin(*(line_it + 1)),
- 349 this->
_fc_graph->neighbours_cend(*(line_it + 1)));
-
- 351 std::distance(line_it, end) == 3
-
-
-
-
-
- 357 s_fc.insert(*(line_it + 2));
-
-
-
- 361 this->
_fc_graph->neighbours_cbegin(*(line_it + 2)),
- 362 this->
_fc_graph->neighbours_cend(*(line_it + 2)));
-
-
-
-
- 367 const CoMMAIndexType i_cc =
- 368 this->
_cc_graph->create_cc(s_fc, compactness, is_anisotropic);
- 369 line_lvl_p_one->push_back(i_cc);
-
-
- 372 this->
_v_lines[1].push_back(line_lvl_p_one);
-
-
-
- 376 for (
auto line_ptr = this->
_v_lines[0].begin();
- 377 line_ptr != this->
_v_lines[0].end(); line_ptr++) {
-
-
-
-
- 382 auto line = **line_ptr;
- 383 if (line.size() <= 1) {
-
-
-
-
-
-
-
-
-
- 393 const auto l_fr = line.front(), l_bk = line.back();
- 394 const auto bnd_fr = this->
_fc_graph->get_n_boundary_faces(l_fr),
- 395 bnd_bk = this->
_fc_graph->get_n_boundary_faces(l_bk);
- 396 const auto w_fr = priority_weights[l_fr], w_bk = priority_weights[l_bk];
- 397 const bool forward_line =
-
- 399 || (bnd_fr == bnd_bk &&
-
- 401 || (w_fr == w_bk && l_fr < l_bk)
-
-
-
- 405 loop_line(line.cbegin(), line.cend());
-
- 407 loop_line(line.crbegin(), line.crend());
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 427 it != this->_aniso_neighbours.end();) {
- 428 if (this->
_cc_graph->_is_fc_agglomerated[*it])
-
-
-
-
-
-
-
-
-
- 438 this->_aniso_neighbours.front()));
-
-
-
-
-
-
- 445 this->_cc_graph->_is_fc_agglomerated))
-
-
-
-
-
- 458 std::vector<CoMMAIndexType> &aniso_lines_idx,
- 459 std::vector<CoMMAIndexType> &aniso_lines)
const {
-
- 461 aniso_lines_idx.clear();
-
-
-
-
-
-
- 468 CoMMAIndexType number_of_fc_in_agglomeration_lines = 0;
- 469 aniso_lines_idx.push_back(0);
-
- 471 for (
const auto &line_ptr : this->
_v_lines[level]) {
- 472 const auto line = *line_ptr;
- 473 const CoMMAIndexType size_of_line = line.size();
-
-
-
-
- 478 aniso_lines_idx.push_back(
- 479 size_of_line + number_of_fc_in_agglomeration_lines);
-
- 481 for (
const auto cell : line) {
- 482 aniso_lines.push_back(cell);
-
- 484 number_of_fc_in_agglomeration_lines += size_of_line;
-
-
-
-
-
-
- 498 std::vector<std::vector<AnisotropicLinePtr>>
_v_lines;
-
-
+
+
+
+
+
+
+
+ 124 const CoMMAIntType goal_card,
+ 125 const CoMMAIntType min_card,
+ 126 const CoMMAIntType max_card,
+ 127 const std::vector<CoMMAWeightType> &priority_weights,
+ 128 bool correction_steps
+
+
+
+
+
+
+
+
+
+
+ 158 std::shared_ptr<Dual_Graph<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>>
+
+
+
+
+ 168 std::shared_ptr<Seeds_Pool<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>>
+
+
+
+
+ 181 typename CoMMAIndexType,
+ 182 typename CoMMAWeightType,
+ 183 typename CoMMAIntType>
+
+ 185 public Agglomerator<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
+
+
+
+
+
+
+
+ 197 std::set<CoMMAPairType, CustomPairGreaterFunctor<CoMMAPairType>>;
+
+
+
+
+
+
+
+
+
+ 231 const CoMMAWeightType threshold_anisotropy,
+ 232 const std::vector<CoMMAIndexType> &agglomerationLines_Idx,
+ 233 const std::vector<CoMMAIndexType> &agglomerationLines,
+ 234 const std::vector<CoMMAWeightType> &priority_weights,
+ 235 const bool build_lines,
+ 236 const bool odd_line_length,
+ 237 const std::optional<CoMMAIndexType> max_cells_in_line,
+ 238 CoMMAIntType dimension = 3
+
+ 240 Agglomerator<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
+ 241 graph, cc_graph, seeds_pool, dimension
+
+
+
+
+
+
+
+
+
+
+ 252 this->
_nb_lines = std::vector<CoMMAIndexType>(2);
+ 253 this->
_v_lines = std::vector<std::vector<AnisotropicLinePtr>>(2);
+
+
+ 256 const CoMMAWeightType thr =
+ 257 (threshold_anisotropy > 1 || threshold_anisotropy < 0)
+ 258 ? threshold_anisotropy
+ 259 :
static_cast<CoMMAWeightType
>(1. / threshold_anisotropy);
+
+
+
+
+
+
+
+
+
+ 269 for (
auto idx_ptr = agglomerationLines_Idx.cbegin() + 1;
+ 270 idx_ptr != agglomerationLines_Idx.cend();
+
+ 272 const auto ln_sz = *idx_ptr - (*(idx_ptr - 1));
+
+ 274 this->
_v_lines[0].push_back(std::make_shared<AnisotropicLine>(
+ 275 agglomerationLines.cbegin() + (*(idx_ptr - 1)),
+ 276 agglomerationLines.cbegin() + (*idx_ptr)
+
+
+
+
+
+
+
+ 284 <<
"CoMMA - No anisotropic line was built (e.g., only one-cell "
+ 285 "lines). Skipping anisotropic agglomeration"
+
+
+
+
+
+
+
+ 310 const CoMMAIntType goal_card,
+ 311 const CoMMAIntType min_card,
+ 312 const CoMMAIntType max_card,
+ 313 const std::vector<CoMMAWeightType> &priority_weights,
+ 314 bool correction_steps
+
+
+
+
+
+
+
+
+
+
+ 325 constexpr bool is_anisotropic =
true;
+ 326 constexpr CoMMAIntType compactness = 1;
+
+
+
+
+ 331 auto loop_line = [&](
auto begin,
auto end) {
+
+
+ 334 for (
auto line_it = begin; line_it != end; line_it += 2) {
+
+
+
+
+
+
+
+
+
+
+ 345 std::unordered_set<CoMMAIndexType> s_fc = {*line_it, *(line_it + 1)};
+
+
+
+
+
+
+ 352 this->
_fc_graph->neighbours_cbegin(*line_it),
+ 353 this->
_fc_graph->neighbours_cend(*line_it)
+
+
+
+ 357 this->
_fc_graph->neighbours_cbegin(*(line_it + 1)),
+ 358 this->
_fc_graph->neighbours_cend(*(line_it + 1))
+
+
+ 361 std::distance(line_it, end) == 3
+
+
+
+
+
+ 367 s_fc.insert(*(line_it + 2));
+
+
+
+ 371 this->
_fc_graph->neighbours_cbegin(*(line_it + 2)),
+ 372 this->
_fc_graph->neighbours_cend(*(line_it + 2))
+
+
+
+
+
+ 378 const CoMMAIndexType i_cc =
+ 379 this->
_cc_graph->create_cc(s_fc, compactness, is_anisotropic);
+ 380 line_lvl_p_one->push_back(i_cc);
+
+
+ 383 this->
_v_lines[1].push_back(line_lvl_p_one);
+
+
+
+ 387 for (
auto line_ptr = this->
_v_lines[0].begin();
+ 388 line_ptr != this->
_v_lines[0].end();
+
+
+
+
+
+ 394 auto line = **line_ptr;
+ 395 if (line.size() <= 1) {
+
+
+
+
+
+
+
+
+
+ 405 const auto l_fr = line.front(), l_bk = line.back();
+ 406 const auto bnd_fr = this->
_fc_graph->get_n_boundary_faces(l_fr),
+ 407 bnd_bk = this->
_fc_graph->get_n_boundary_faces(l_bk);
+ 408 const auto w_fr = priority_weights[l_fr], w_bk = priority_weights[l_bk];
+ 409 const bool forward_line =
+
+ 411 || (bnd_fr == bnd_bk &&
+
+ 413 || (w_fr == w_bk && l_fr < l_bk)
+
+
+
+ 417 loop_line(line.cbegin(), line.cend());
+
+ 419 loop_line(line.crbegin(), line.crend());
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 439 it != this->_aniso_neighbours.end();) {
+ 440 if (this->
_cc_graph->_is_fc_agglomerated[*it])
+
+
+
+
+
+
+
+
+
+ 450 this->
_fc_graph->get_n_boundary_faces(this->_aniso_neighbours.front())
+
+
+
+
+
+
+
+ 458 this->_cc_graph->_is_fc_agglomerated
+
+
+
+
+
+
+ 472 std::vector<CoMMAIndexType> &aniso_lines_idx,
+ 473 std::vector<CoMMAIndexType> &aniso_lines
+
+
+ 476 aniso_lines_idx.clear();
+
+
+
+
+
+
+ 483 CoMMAIndexType number_of_fc_in_agglomeration_lines = 0;
+ 484 aniso_lines_idx.push_back(0);
+
+ 486 for (
const auto &line_ptr : this->
_v_lines[level]) {
+ 487 const auto line = *line_ptr;
+ 488 const CoMMAIndexType size_of_line = line.size();
+
+
+
+
+ 493 aniso_lines_idx.push_back(
+ 494 size_of_line + number_of_fc_in_agglomeration_lines
+
+
+ 497 for (
const auto cell : line) {
+ 498 aniso_lines.push_back(cell);
+
+ 500 number_of_fc_in_agglomeration_lines += size_of_line;
+
+
+
-
-
- 518 const std::vector<CoMMAWeightType> &priority_weights,
- 519 const CoMMAWeightType threshold_anisotropy) {
- 520 std::deque<CoMMAIndexType> aniso_seeds_pool;
-
-
- 523 std::vector<CoMMAWeightType> max_weights(
-
- 525 std::vector<bool> to_treat(this->
_fc_graph->_number_of_cells,
false);
-
-
-
-
- 530 max_weights, to_treat, aniso_seeds_pool, threshold_anisotropy,
- 531 priority_weights, 0);
- 532 if (aniso_seeds_pool.empty()) {
- 533 std::cout <<
"CoMMA - No anisotropic cell found. Skipping anisotropic "
-
-
-
-
-
- 539 const auto pts_dim = this->
_fc_graph->_centers[0].size();
-
- 541 this->_nb_lines[0] = 0;
-
- 543 for (
auto &i_fc : aniso_seeds_pool) {
-
- 545 if (!to_treat[i_fc]) {
-
-
-
-
-
-
- 552 const auto primal_seed = i_fc;
- 553 std::optional<std::vector<CoMMAWeightType>> primal_dir = std::nullopt;
-
- 555 CoMMAIndexType seed = primal_seed;
-
-
-
- 559 cur_line->push_back(seed);
- 560 to_treat[seed] =
false;
-
-
-
- 564 bool opposite_direction_check =
false;
-
- 566 std::vector<CoMMAWeightType> prev_cen =
-
- 568 std::vector<CoMMAWeightType> prev_dir(pts_dim);
- 569 bool empty_line =
true;
-
-
-
-
-
- 575 const std::vector<CoMMAIndexType> v_neighbours =
-
- 577 const std::vector<CoMMAWeightType> v_w_neighbours =
-
- 579 auto n_it = this->
_fc_graph->neighbours_cbegin(seed);
- 580 auto w_it = this->
_fc_graph->weights_cbegin(seed);
-
-
-
-
-
-
- 587 for (; n_it != this->
_fc_graph->neighbours_cend(seed);
-
- 589 if (to_treat[*n_it] && *w_it > 0.90 * max_weights[seed]) {
- 590 candidates.emplace(*w_it, *n_it);
-
-
-
-
-
- 596 for (; n_it != this->
_fc_graph->neighbours_cend(seed);
-
- 598 if (to_treat[*n_it] && *w_it > 0.90 * max_weights[seed]) {
- 599 std::vector<CoMMAWeightType> cur_dir(pts_dim);
- 600 get_direction<CoMMAWeightType>(
- 601 prev_cen, this->
_fc_graph->_centers[*n_it], cur_dir);
- 602 const auto dot = dot_product<CoMMAWeightType>(prev_dir, cur_dir);
- 603 if (!dot_deviate<CoMMAWeightType>(dot))
- 604 candidates.emplace(fabs(dot), *n_it);
-
-
-
- 608 if (!candidates.empty()) {
-
-
-
-
-
- 617 seed = candidates.begin()->second;
- 618 if (!opposite_direction_check) {
- 619 cur_line->push_back(seed);
-
- 621 cur_line->push_front(seed);
-
- 623 to_treat[seed] =
false;
-
- 625 const auto &cur_cen = this->
_fc_graph->_centers[seed];
- 626 get_direction<CoMMAWeightType>(prev_cen, cur_cen, prev_dir);
-
- 628 if (!primal_dir.has_value()) primal_dir = prev_dir;
-
-
-
-
-
-
-
-
-
-
- 639 for (
auto it = this->
_fc_graph->neighbours_cbegin(seed);
- 640 it != this->_fc_graph->neighbours_cend(seed); ++it) {
-
- 642 std::vector<CoMMAWeightType> cur_dir(pts_dim);
- 643 get_direction<CoMMAWeightType>(
- 644 prev_cen, this->
_fc_graph->_centers[*it], cur_dir);
-
- 646 dot_product<CoMMAWeightType>(prev_dir, cur_dir);
- 647 if (!dot_deviate<CoMMAWeightType>(dot))
- 648 candidates.emplace(fabs(dot), *it);
-
-
- 651 if (!candidates.empty()) {
-
- 653 seed = candidates.begin()->second;
- 654 if (!opposite_direction_check) {
- 655 cur_line->push_back(seed);
-
- 657 cur_line->push_front(seed);
-
- 659 to_treat[seed] =
false;
-
- 661 const auto &cur_cen = this->
_fc_graph->_centers[seed];
- 662 get_direction<CoMMAWeightType>(prev_cen, cur_cen, prev_dir);
-
- 664 if (!primal_dir.has_value()) primal_dir = prev_dir;
-
- 666 if (opposite_direction_check) {
-
-
-
- 670 prev_dir = primal_dir.value();
- 671 prev_cen = this->
_fc_graph->_centers[seed];
- 672 opposite_direction_check =
true;
-
-
-
-
-
-
-
-
-
- 682 if (cur_line->size() > 1) {
- 683 this->_v_lines[0].push_back(cur_line);
- 684 this->_nb_lines[0] += 1;
-
-
-
- 688 if (this->_nb_lines[0] == 0) {
- 689 std::cout <<
"CoMMA - No anisotropic line was built (e.g., only isolated "
- 690 "anisotropic cells). Skipping anisotropic agglomeration"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 720 typename CoMMAIndexType,
- 721 typename CoMMAWeightType,
- 722 typename CoMMAIntType>
-
- 724 public Agglomerator<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 768 CoMMAIntType neighbourhood_type,
- 769 CoMMAIntType fc_iter,
- 770 CoMMAIntType dimension = 3) :
- 771 Agglomerator<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
- 772 graph, cc_graph, seeds_pool, dimension),
-
-
- 775 _neigh_crtor = std::make_shared<NeighbourhoodCreatorExtType>();
-
- 777 _neigh_crtor = std::make_shared<NeighbourhoodCreatorPFType>();
-
-
-
-
-
- 793 CoMMAIntType goal_card = 0,
- 794 CoMMAIntType min_card = 0,
- 795 CoMMAIntType max_card = 0) {
-
-
-
- 799 std::unordered_map<CoMMAIntType, CoMMAIntType> d_default_min_card = {
-
- 801 std::unordered_map<CoMMAIntType, CoMMAIntType> d_default_max_card = {
-
- 803 std::unordered_map<CoMMAIntType, CoMMAIntType> d_default_goal_card = {
-
- 805 std::unordered_map<CoMMAIntType, CoMMAIntType> d_default_threshold_card = {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 821 if (goal_card == 0) {
-
-
-
-
-
-
-
-
-
-
- 855 const CoMMAIntType goal_card,
- 856 const CoMMAIntType min_card,
- 857 const CoMMAIntType max_card,
- 858 const std::vector<CoMMAWeightType> &priority_weights,
- 859 bool correction_steps)
override {
-
- 861 constexpr bool is_anistropic =
false;
-
-
- 864 while (this->
_cc_graph->get_number_of_fc_agglomerated() < nb_of_fc) {
-
- 866 const auto seed = this->
_seeds_pool->choose_new_seed(
-
- 868 assert(seed.has_value());
-
-
- 871 CoMMAIntType compactness = 0;
- 872 const std::unordered_set<CoMMAIndexType> set_current_cc =
-
- 874 seed.value(), priority_weights, compactness);
-
-
-
-
-
-
-
- 882 constexpr bool is_creation_delayed =
false;
-
- 884 set_current_cc, compactness, is_anistropic, is_creation_delayed);
-
-
-
-
- 889 this->
_cc_graph->cc_create_all_delayed_cc();
-
-
-
-
-
-
- 902 const std::vector<CoMMAWeightType> &int_faces)
const {
-
-
-
-
-
-
-
- 910 int_faces.begin(), int_faces.end(), CoMMAWeightType{1.},
- 911 std::multiplies<>()),
- 912 CoMMAWeightType{1.} / int_faces.size());
-
-
-
- 932 const CoMMAIndexType i_fc,
- 933 const CoMMAWeightType cc_diam,
- 934 const CoMMAWeightType cc_vol,
- 935 const std::unordered_set<CoMMAIndexType> &fc_of_cc,
-
- 937 CoMMAIntType &shared_faces,
- 938 CoMMAWeightType &aspect_ratio,
- 939 CoMMAWeightType &new_diam,
- 940 CoMMAWeightType &new_vol)
const {
-
-
- 943 for (
auto it = this->
_fc_graph->neighbours_cbegin(i_fc);
- 944 it != this->_fc_graph->neighbours_cend(i_fc); ++it) {
- 945 if (*it != i_fc && (fc_of_cc.count(*it) != 0)) shared_faces++;
-
-
-
- 949 const std::vector<CoMMAWeightType> &cen_fc =
-
- 951 CoMMAWeightType max_diam = cc_diam * cc_diam;
- 952 for (
const auto i_fc_cc : fc_of_cc) {
- 953 const auto dist = squared_euclidean_distance<CoMMAWeightType>(
- 954 cen_fc, this->
_fc_graph->_centers[i_fc_cc]);
- 955 if (dist > max_diam) max_diam = dist;
-
- 957 new_diam = sqrt(max_diam);
+
+
+ 514 std::vector<std::vector<AnisotropicLinePtr>>
_v_lines;
+
+
+
+
+
+ 534 const std::vector<CoMMAWeightType> &priority_weights,
+ 535 const CoMMAWeightType threshold_anisotropy
+
+ 537 std::deque<CoMMAIndexType> aniso_seeds_pool;
+
+
+ 540 std::vector<CoMMAWeightType> max_weights(
+
+
+ 543 std::vector<bool> to_treat(this->
_fc_graph->_number_of_cells,
false);
+
+
+
+
+
+
+
+ 551 threshold_anisotropy,
+
+
+
+ 555 if (aniso_seeds_pool.empty()) {
+ 556 std::cout <<
"CoMMA - No anisotropic cell found. Skipping anisotropic "
+
+
+
+
+
+ 562 const auto pts_dim = this->
_fc_graph->_centers[0].size();
+
+ 564 this->_nb_lines[0] = 0;
+
+ 566 for (
auto &i_fc : aniso_seeds_pool) {
+
+ 568 if (!to_treat[i_fc]) {
+
+
+
+
+
+
+ 575 const auto primal_seed = i_fc;
+ 576 std::optional<std::vector<CoMMAWeightType>> primal_dir = std::nullopt;
+
+ 578 CoMMAIndexType seed = primal_seed;
+
+
+
+ 582 cur_line->push_back(seed);
+ 583 to_treat[seed] =
false;
+
+
+
+ 587 bool opposite_direction_check =
false;
+
+ 589 std::vector<CoMMAWeightType> prev_cen =
+
+ 591 std::vector<CoMMAWeightType> prev_dir(pts_dim);
+ 592 bool empty_line =
true;
+
+
+
+
+
+ 598 const std::vector<CoMMAIndexType> v_neighbours =
+
+ 600 const std::vector<CoMMAWeightType> v_w_neighbours =
+
+ 602 auto n_it = this->
_fc_graph->neighbours_cbegin(seed);
+ 603 auto w_it = this->
_fc_graph->weights_cbegin(seed);
+
+
+
+
+
+
+ 610 for (; n_it != this->
_fc_graph->neighbours_cend(seed);
+
+ 612 if (to_treat[*n_it] && *w_it > 0.90 * max_weights[seed]) {
+ 613 candidates.emplace(*w_it, *n_it);
+
+
+
+
+
+ 619 for (; n_it != this->
_fc_graph->neighbours_cend(seed);
+
+ 621 if (to_treat[*n_it] && *w_it > 0.90 * max_weights[seed]) {
+ 622 std::vector<CoMMAWeightType> cur_dir(pts_dim);
+ 623 get_direction<CoMMAWeightType>(
+ 624 prev_cen, this->
_fc_graph->_centers[*n_it], cur_dir
+
+ 626 const auto dot = dot_product<CoMMAWeightType>(prev_dir, cur_dir);
+ 627 if (!dot_deviate<CoMMAWeightType>(dot))
+ 628 candidates.emplace(fabs(dot), *n_it);
+
+
+
+ 632 if (!candidates.empty()) {
+
+
+
+
+
+ 641 seed = candidates.begin()->second;
+ 642 if (!opposite_direction_check) {
+ 643 cur_line->push_back(seed);
+
+ 645 cur_line->push_front(seed);
+
+ 647 to_treat[seed] =
false;
+
+ 649 const auto &cur_cen = this->
_fc_graph->_centers[seed];
+ 650 get_direction<CoMMAWeightType>(prev_cen, cur_cen, prev_dir);
+
+ 652 if (!primal_dir.has_value()) primal_dir = prev_dir;
+
+
+
+
+
+
+
+
+
+
+ 663 for (
auto it = this->
_fc_graph->neighbours_cbegin(seed);
+ 664 it != this->_fc_graph->neighbours_cend(seed);
+
+
+ 667 std::vector<CoMMAWeightType> cur_dir(pts_dim);
+ 668 get_direction<CoMMAWeightType>(
+ 669 prev_cen, this->
_fc_graph->_centers[*it], cur_dir
+
+
+ 672 dot_product<CoMMAWeightType>(prev_dir, cur_dir);
+ 673 if (!dot_deviate<CoMMAWeightType>(dot))
+ 674 candidates.emplace(fabs(dot), *it);
+
+
+ 677 if (!candidates.empty()) {
+
+ 679 seed = candidates.begin()->second;
+ 680 if (!opposite_direction_check) {
+ 681 cur_line->push_back(seed);
+
+ 683 cur_line->push_front(seed);
+
+ 685 to_treat[seed] =
false;
+
+ 687 const auto &cur_cen = this->
_fc_graph->_centers[seed];
+ 688 get_direction<CoMMAWeightType>(prev_cen, cur_cen, prev_dir);
+
+ 690 if (!primal_dir.has_value()) primal_dir = prev_dir;
+
+ 692 if (opposite_direction_check) {
+
+
+
+ 696 prev_dir = primal_dir.value();
+ 697 prev_cen = this->
_fc_graph->_centers[seed];
+ 698 opposite_direction_check =
true;
+
+
+
+
+
+
+
+
+
+ 708 if (cur_line->size() > 1) {
+ 709 this->_v_lines[0].push_back(cur_line);
+ 710 this->_nb_lines[0] += 1;
+
+
+
+ 714 if (this->_nb_lines[0] == 0) {
+ 715 std::cout <<
"CoMMA - No anisotropic line was built (e.g., only isolated "
+ 716 "anisotropic cells). Skipping anisotropic agglomeration"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 746 typename CoMMAIndexType,
+ 747 typename CoMMAWeightType,
+ 748 typename CoMMAIntType>
+
+ 750 public Agglomerator<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 794 CoMMAIntType neighbourhood_type,
+ 795 CoMMAIntType fc_iter,
+ 796 CoMMAIntType dimension = 3
+
+ 798 Agglomerator<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
+ 799 graph, cc_graph, seeds_pool, dimension
+
+
+
+ 803 _neigh_crtor = std::make_shared<NeighbourhoodCreatorExtType>();
+
+ 805 _neigh_crtor = std::make_shared<NeighbourhoodCreatorPFType>();
+
+
+
+
+
+ 821 CoMMAIntType goal_card = 0,
+ 822 CoMMAIntType min_card = 0,
+ 823 CoMMAIntType max_card = 0
+
+
+
+
+ 828 std::unordered_map<CoMMAIntType, CoMMAIntType> d_default_min_card = {
+
+
+ 831 std::unordered_map<CoMMAIntType, CoMMAIntType> d_default_max_card = {
+
+
+ 834 std::unordered_map<CoMMAIntType, CoMMAIntType> d_default_goal_card = {
+
+
+ 837 std::unordered_map<CoMMAIntType, CoMMAIntType> d_default_threshold_card = {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 854 if (goal_card == 0) {
+
+
+
+
+
+
+
+
+
+
+ 888 const CoMMAIntType goal_card,
+ 889 const CoMMAIntType min_card,
+ 890 const CoMMAIntType max_card,
+ 891 const std::vector<CoMMAWeightType> &priority_weights,
+ 892 bool correction_steps
+
+
+ 895 constexpr bool is_anistropic =
false;
+
+
+ 898 while (this->
_cc_graph->get_number_of_fc_agglomerated() < nb_of_fc) {
+
+
+
+
+ 903 assert(seed.has_value());
+
+
+ 906 CoMMAIntType compactness = 0;
+ 907 const std::unordered_set<CoMMAIndexType> set_current_cc =
+
+ 909 seed.value(), priority_weights, compactness
+
+
+
+
+
+
+
+
+ 918 constexpr bool is_creation_delayed =
false;
+
+ 920 set_current_cc, compactness, is_anistropic, is_creation_delayed
+
+
+
+
+
+ 926 this->
_cc_graph->cc_create_all_delayed_cc();
+
+ 928 if (correction_steps) {
+
+
+
+
+
+
+ 941 const std::vector<CoMMAWeightType> &int_faces
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 955 CoMMAWeightType{1.} / int_faces.size()
+
+
- 959 new_vol = cc_vol + this->
_fc_graph->_volumes[i_fc];
-
- 961 aspect_ratio = this->
_compute_AR(new_diam, new_vol);
-
-
- 973 virtual std::unordered_set<CoMMAIndexType>
-
- 975 const CoMMAIndexType seed,
- 976 const std::vector<CoMMAWeightType> &priority_weights,
- 977 CoMMAIntType &compactness) = 0;
-
-
-
- 989 typename CoMMAIndexType,
- 990 typename CoMMAWeightType,
- 991 typename CoMMAIntType>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1020 CoMMAIntType neighbourhood_type,
- 1021 CoMMAIntType fc_iter,
- 1022 CoMMAIntType dimension = 3) :
-
- 1024 graph, cc_graph, seeds_pool, neighbourhood_type, fc_iter, dimension) {
-
-
+
+ 976 const CoMMAIndexType i_fc,
+ 977 const CoMMAWeightType cc_diam,
+ 978 const CoMMAWeightType cc_vol,
+ 979 const std::unordered_set<CoMMAIndexType> &fc_of_cc,
+
+ 981 CoMMAIntType &shared_faces,
+ 982 CoMMAWeightType &aspect_ratio,
+ 983 CoMMAWeightType &new_diam,
+ 984 CoMMAWeightType &new_vol
+
+
+
+ 988 for (
auto it = this->
_fc_graph->neighbours_cbegin(i_fc);
+ 989 it != this->_fc_graph->neighbours_cend(i_fc);
+
+ 991 if (*it != i_fc && (fc_of_cc.count(*it) != 0)) shared_faces++;
+
+
+
+ 995 const std::vector<CoMMAWeightType> &cen_fc =
+
+ 997 CoMMAWeightType max_diam = cc_diam * cc_diam;
+ 998 for (
const auto i_fc_cc : fc_of_cc) {
+ 999 const auto dist = squared_euclidean_distance<CoMMAWeightType>(
+ 1000 cen_fc, this->
_fc_graph->_centers[i_fc_cc]
+
+ 1002 if (dist > max_diam) max_diam = dist;
+
+ 1004 new_diam = sqrt(max_diam);
+
+ 1006 new_vol = cc_vol + this->
_fc_graph->_volumes[i_fc];
+
+ 1008 aspect_ratio = this->
_compute_AR(new_diam, new_vol);
+
+
+ 1020 virtual std::unordered_set<CoMMAIndexType>
+
+ 1022 const CoMMAIndexType seed,
+ 1023 const std::vector<CoMMAWeightType> &priority_weights,
+ 1024 CoMMAIntType &compactness
+
+
-
-
-
- 1042 const CoMMAIndexType seed,
- 1043 const std::vector<CoMMAWeightType> &priority_weights,
- 1044 CoMMAIntType &compactness)
override {
- 1045 bool is_order_primary =
false;
-
-
-
-
- 1050 std::unordered_set<CoMMAIndexType> s_current_cc = {seed};
-
-
-
- 1054 std::unordered_map<CoMMAIndexType, CoMMAIntType> d_n_of_seed;
-
-
- 1057 CoMMAIntType size_current_cc = 1;
-
-
- 1060 CoMMAIntType max_order_of_neighbourhood =
-
-
-
- 1064 this->
_fc_graph->compute_neighbourhood_of_cc(
-
- 1066 max_order_of_neighbourhood,
-
-
-
-
-
-
-
-
- 1075 if (d_n_of_seed.empty()) {
-
-
-
-
- 1080 static_cast<CoMMAIntType
>(d_n_of_seed.size() + s_current_cc.size())
- 1081 < this->_goal_card) {
-
-
-
-
-
- 1087 for (
auto &i_k_v : d_n_of_seed) {
- 1088 s_current_cc.insert(i_k_v.first);
-
-
- 1091 this->
_fc_graph->compute_min_fc_compactness_inside_a_cc(s_current_cc);
-
-
-
-
-
-
- 1098 CoMMAWeightType diam_cc{-1.};
-
- 1100 decltype(s_current_cc) tmp_cc = {seed};
-
- 1102 CoMMAWeightType vol_cc = this->
_fc_graph->_volumes[seed];
-
-
-
-
- 1107 CoMMAIntType, std::pair<
- 1108 std::unordered_set<CoMMAIndexType>,
- 1109 std::unordered_map<CoMMAIndexType, CoMMAIntType>>>
- 1110 dict_cc_in_creation;
- 1111 CoMMAIntType min_external_faces =
- 1112 std::numeric_limits<CoMMAIntType>::max();
- 1113 CoMMAIntType max_compact = 0;
- 1114 CoMMAIntType arg_min_card = this->
_min_card;
-
-
-
-
-
- 1120 const CoMMAIntType max_ind = std::min(
- 1121 this->
_max_card,
static_cast<CoMMAIntType
>(d_n_of_seed.size() + 1));
-
- 1123 CoMMAIntType number_of_external_faces_current_cc =
- 1124 this->
_fc_graph->get_nb_of_neighbours(seed)
- 1125 + this->
_fc_graph->get_n_boundary_faces(seed) - 1;
-
-
-
- 1129 const std::unordered_set<CoMMAIndexType> s_neighbours_of_seed =
- 1130 d_keys_to_set<CoMMAIndexType, CoMMAIntType>(d_n_of_seed);
-
-
- 1133 s_neighbours_of_seed, priority_weights, this->
_dimension);
-
-
- 1136 std::unordered_map<CoMMAIndexType, CoMMAIntType> cur_compact_by_fc{};
- 1137 cur_compact_by_fc.reserve(max_ind);
- 1138 cur_compact_by_fc[seed] = 0;
- 1139 constexpr auto second_less = [](
const auto &left,
const auto &right) {
- 1140 return left.second < right.second;
-
- 1142 CoMMAIndexType next_cell = seed;
-
-
- 1145 while (size_current_cc < max_ind) {
-
- 1147 neighbourhood->update(
- 1148 next_cell, this->
_fc_graph->get_neighbours(next_cell));
-
- 1150 CoMMAWeightType min_ar_diam =
- 1151 std::numeric_limits<CoMMAWeightType>::max();
- 1152 CoMMAWeightType min_ar_vol =
- 1153 std::numeric_limits<CoMMAWeightType>::max();
- 1154 CoMMAIntType max_faces_in_common = 0;
-
-
-
-
-
- 1160 std::min(max_ind - size_current_cc, this->
_fc_iter), neighbourhood,
- 1161 d_n_of_seed, is_order_primary, diam_cc, vol_cc, tmp_cc, next_cell,
-
- 1163 max_faces_in_common, min_ar_diam, min_ar_vol);
-
-
- 1166 number_of_external_faces_current_cc +=
- 1167 this->
_fc_graph->get_nb_of_neighbours(next_cell)
- 1168 + this->
_fc_graph->get_n_boundary_faces(next_cell) - 1
- 1169 - 2 * max_faces_in_common;
-
-
- 1172 tmp_cc.insert(next_cell);
-
-
- 1175 CoMMAIntType argmin_compact{0};
- 1176 for (
auto neigh = this->
_fc_graph->neighbours_cbegin(next_cell);
- 1177 neigh != this->_fc_graph->neighbours_cend(next_cell); ++neigh) {
- 1178 if (tmp_cc.find(*neigh) != tmp_cc.end()) {
-
- 1180 ++cur_compact_by_fc[*neigh];
-
-
- 1183 cur_compact_by_fc[next_cell] = argmin_compact;
- 1184 const CoMMAIntType cur_compact =
-
- 1186 cur_compact_by_fc.cbegin(), cur_compact_by_fc.cend(), second_less)
-
-
-
-
-
-
-
-
-
-
- 1197 (this->
_min_card <= size_current_cc) || size_current_cc == max_ind) {
- 1198 if (cur_compact > max_compact) {
- 1199 max_compact = cur_compact;
- 1200 min_external_faces = number_of_external_faces_current_cc;
- 1201 arg_min_card = size_current_cc;
-
- 1203 }
else if (cur_compact == max_compact) {
-
- 1205 (number_of_external_faces_current_cc < min_external_faces) ||
- 1206 (number_of_external_faces_current_cc == min_external_faces &&
-
- 1208 min_external_faces = number_of_external_faces_current_cc;
- 1209 arg_min_card = size_current_cc;
-
-
-
-
- 1214 std::unordered_map<CoMMAIndexType, CoMMAIntType> new_dict;
- 1215 new_dict[next_cell] = d_n_of_seed[next_cell];
-
- 1217 std::unordered_set<CoMMAIndexType>,
- 1218 std::unordered_map<CoMMAIndexType, CoMMAIntType>>
- 1219 tmp_pair = std::make_pair(tmp_cc, new_dict);
- 1220 dict_cc_in_creation[size_current_cc] = tmp_pair;
-
-
-
- 1224 diam_cc = min_ar_diam;
- 1225 vol_cc = min_ar_vol;
-
-
- 1228 d_n_of_seed.erase(next_cell);
-
+
+ 1037 typename CoMMAIndexType,
+ 1038 typename CoMMAWeightType,
+ 1039 typename CoMMAIntType>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1068 CoMMAIntType neighbourhood_type,
+ 1069 CoMMAIntType fc_iter,
+ 1070 CoMMAIntType dimension = 3
+
+
+ 1073 graph, cc_graph, seeds_pool, neighbourhood_type, fc_iter, dimension
+
+
+
+
+
+
+
+ 1092 const CoMMAIndexType seed,
+ 1093 const std::vector<CoMMAWeightType> &priority_weights,
+ 1094 CoMMAIntType &compactness
+
+ 1096 bool is_order_primary =
false;
+
+
+
+
+ 1101 std::unordered_set<CoMMAIndexType> s_current_cc = {seed};
+
+
+
+ 1105 std::unordered_map<CoMMAIndexType, CoMMAIntType> d_n_of_seed;
+
+
+ 1108 CoMMAIntType size_current_cc = 1;
+
+
+ 1111 CoMMAIntType max_order_of_neighbourhood =
+
+
+
+ 1115 this->
_fc_graph->compute_neighbourhood_of_cc(
+
+ 1117 max_order_of_neighbourhood,
+
+
+
+
+
+
+
+
+
+ 1127 if (d_n_of_seed.empty()) {
+
+
+
+ 1131 }
else if (
static_cast<CoMMAIntType
>(
+ 1132 d_n_of_seed.size() + s_current_cc.size()
+
+ 1134 < this->_goal_card) {
+
+
+
+
+
+ 1140 for (
auto &i_k_v : d_n_of_seed) {
+ 1141 s_current_cc.insert(i_k_v.first);
+
+
+ 1144 this->
_fc_graph->compute_min_fc_compactness_inside_a_cc(s_current_cc);
+
+
+
+
+
+
+ 1151 CoMMAWeightType diam_cc{-1.};
+
+ 1153 decltype(s_current_cc) tmp_cc = {seed};
+
+ 1155 CoMMAWeightType vol_cc = this->
_fc_graph->_volumes[seed];
+
+
+
+
+
+
+ 1162 std::unordered_set<CoMMAIndexType>,
+ 1163 std::unordered_map<CoMMAIndexType, CoMMAIntType>>>
+ 1164 dict_cc_in_creation;
+ 1165 CoMMAIntType min_external_faces =
+ 1166 std::numeric_limits<CoMMAIntType>::max();
+ 1167 CoMMAIntType max_compact = 0;
+ 1168 CoMMAIntType arg_min_card = this->
_min_card;
+
+
+
+
+
+ 1174 const CoMMAIntType max_ind = std::min(
+ 1175 this->
_max_card,
static_cast<CoMMAIntType
>(d_n_of_seed.size() + 1)
+
+
+ 1178 CoMMAIntType number_of_external_faces_current_cc =
+ 1179 this->
_fc_graph->get_nb_of_neighbours(seed)
+ 1180 + this->
_fc_graph->get_n_boundary_faces(seed) - 1;
+
+
+
+ 1184 const std::unordered_set<CoMMAIndexType> s_neighbours_of_seed =
+ 1185 d_keys_to_set<CoMMAIndexType, CoMMAIntType>(d_n_of_seed);
+
+
+ 1188 s_neighbours_of_seed, priority_weights, this->
_dimension
+
+
+
+ 1192 std::unordered_map<CoMMAIndexType, CoMMAIntType> cur_compact_by_fc{};
+ 1193 cur_compact_by_fc.reserve(max_ind);
+ 1194 cur_compact_by_fc[seed] = 0;
+ 1195 constexpr auto second_less = [](
const auto &left,
const auto &right) {
+ 1196 return left.second < right.second;
+
+ 1198 CoMMAIndexType next_cell = seed;
+
+
+ 1201 while (size_current_cc < max_ind) {
+
+ 1203 neighbourhood->update(
+ 1204 next_cell, this->
_fc_graph->get_neighbours(next_cell)
+
+
+ 1207 CoMMAWeightType min_ar_diam =
+ 1208 std::numeric_limits<CoMMAWeightType>::max();
+ 1209 CoMMAWeightType min_ar_vol =
+ 1210 std::numeric_limits<CoMMAWeightType>::max();
+ 1211 CoMMAIntType max_faces_in_common = 0;
+
+
+
+
+
+ 1217 std::min(max_ind - size_current_cc, this->
_fc_iter),
+
+
+
+
+
+
+
+
+ 1226 max_faces_in_common,
+
+
+
-
- 1232 s_current_cc = std::move(dict_cc_in_creation[arg_min_card].first);
-
-
-
- 1236 for (
auto i_s = arg_min_card + 1; i_s < max_ind + 1; i_s++) {
-
-
-
- 1240 for (
auto iKV : dict_cc_in_creation[i_s].second) {
- 1241 d_n_of_seed[iKV.first] = iKV.second;
-
-
-
-
-
-
-
-
-
- 1251 const auto cc_neighs = this->
_fc_graph->get_neighbourhood_of_cc(
- 1252 s_current_cc, this->
_cc_graph->_is_fc_agglomerated);
-
- 1254 std::map<CoMMAIntType, std::unordered_set<CoMMAIndexType>>
-
-
- 1257 std::unordered_set<CoMMAIndexType> neighs_not_found{};
- 1258 for (
const auto &neigh : cc_neighs) {
- 1259 if (d_n_of_seed.find(neigh) != d_n_of_seed.end())
- 1260 neighs_by_order[d_n_of_seed.at(neigh)].insert(neigh);
-
- 1262 neighs_not_found.insert(neigh);
-
- 1264 for (
const auto &[o, neighs] : neighs_by_order)
- 1265 if (!neighs.empty())
- 1266 this->
_seeds_pool->order_new_seeds_and_update(neighs);
- 1267 if (!neighs_not_found.empty())
- 1268 this->
_seeds_pool->order_new_seeds_and_update(neighs_not_found);
-
- 1270 assert(arg_min_card ==
static_cast<CoMMAIntType
>(s_current_cc.size()));
-
- 1272 compactness = max_compact;
-
- 1274 return s_current_cc;
-
-
-
- 1303 const CoMMAIntType fc_iter,
- 1304 const std::shared_ptr<
-
-
- 1307 const std::unordered_map<CoMMAIndexType, CoMMAIntType> &d_n_of_seed,
- 1308 const bool &is_order_primary,
- 1309 const CoMMAWeightType &diam_cc,
- 1310 const CoMMAWeightType &vol_cc,
- 1311 const std::unordered_set<CoMMAIndexType> &s_of_fc_for_current_cc,
- 1312 CoMMAIndexType &argmin_ar,
- 1313 CoMMAIntType &max_faces_in_common,
- 1314 CoMMAWeightType &min_ar_diam,
- 1315 CoMMAWeightType &min_ar_vol)
const {
-
-
-
- 1319 CoMMAWeightType min_ar = std::numeric_limits<CoMMAWeightType>::max();
- 1320 const auto neighbours = neighbourhood->get_candidates();
- 1321 CoMMAIndexType arg_max_faces_in_common = neighbours[0];
-
- 1323 for (
const auto &i_fc : neighbours) {
-
-
-
- 1327 CoMMAIntType number_faces_in_common = 0;
- 1328 CoMMAWeightType new_ar = std::numeric_limits<CoMMAWeightType>::min();
- 1329 CoMMAWeightType new_ar_diam = std::numeric_limits<CoMMAWeightType>::min();
- 1330 CoMMAWeightType new_ar_vol = std::numeric_limits<CoMMAWeightType>::min();
-
- 1332 i_fc, diam_cc, vol_cc, s_of_fc_for_current_cc,
-
- 1334 number_faces_in_common, new_ar, new_ar_diam, new_ar_vol);
-
-
-
-
- 1339 const CoMMAIntType &order = d_n_of_seed.at(i_fc);
+
+ 1232 number_of_external_faces_current_cc +=
+ 1233 this->
_fc_graph->get_nb_of_neighbours(next_cell)
+ 1234 + this->
_fc_graph->get_n_boundary_faces(next_cell) - 1
+ 1235 - 2 * max_faces_in_common;
+
+
+ 1238 tmp_cc.insert(next_cell);
+
+
+ 1241 CoMMAIntType argmin_compact{0};
+ 1242 for (
auto neigh = this->
_fc_graph->neighbours_cbegin(next_cell);
+ 1243 neigh != this->_fc_graph->neighbours_cend(next_cell);
+
+ 1245 if (tmp_cc.find(*neigh) != tmp_cc.end()) {
+
+ 1247 ++cur_compact_by_fc[*neigh];
+
+
+ 1250 cur_compact_by_fc[next_cell] = argmin_compact;
+ 1251 const CoMMAIntType cur_compact =
+
+ 1253 cur_compact_by_fc.cbegin(), cur_compact_by_fc.cend(), second_less
+
+
+
+
+
+
+
+
+
+
+ 1264 if ((this->
_min_card <= size_current_cc)
+ 1265 || size_current_cc == max_ind) {
+ 1266 if (cur_compact > max_compact) {
+ 1267 max_compact = cur_compact;
+ 1268 min_external_faces = number_of_external_faces_current_cc;
+ 1269 arg_min_card = size_current_cc;
+
+ 1271 }
else if (cur_compact == max_compact) {
+
+ 1273 (number_of_external_faces_current_cc < min_external_faces) ||
+ 1274 (number_of_external_faces_current_cc == min_external_faces &&
+
+ 1276 min_external_faces = number_of_external_faces_current_cc;
+ 1277 arg_min_card = size_current_cc;
+
+
+
+
+ 1282 std::unordered_map<CoMMAIndexType, CoMMAIntType> new_dict;
+ 1283 new_dict[next_cell] = d_n_of_seed[next_cell];
+
+ 1285 std::unordered_set<CoMMAIndexType>,
+ 1286 std::unordered_map<CoMMAIndexType, CoMMAIntType>>
+ 1287 tmp_pair = std::make_pair(tmp_cc, new_dict);
+ 1288 dict_cc_in_creation[size_current_cc] = tmp_pair;
+
+
+
+ 1292 diam_cc = min_ar_diam;
+ 1293 vol_cc = min_ar_vol;
+
+
+ 1296 d_n_of_seed.erase(next_cell);
+
+
+
+ 1300 s_current_cc = std::move(dict_cc_in_creation[arg_min_card].first);
+
+
+
+ 1304 for (
auto i_s = arg_min_card + 1; i_s < max_ind + 1; i_s++) {
+
+
+
+ 1308 for (
auto iKV : dict_cc_in_creation[i_s].second) {
+ 1309 d_n_of_seed[iKV.first] = iKV.second;
+
+
+
+
+
+
+
+
+
+ 1319 const auto cc_neighs = this->
_fc_graph->get_neighbourhood_of_cc(
+ 1320 s_current_cc, this->
_cc_graph->_is_fc_agglomerated
+
+
+ 1323 std::map<CoMMAIntType, std::unordered_set<CoMMAIndexType>>
+
+
+ 1326 std::unordered_set<CoMMAIndexType> neighs_not_found{};
+ 1327 for (
const auto &neigh : cc_neighs) {
+ 1328 if (d_n_of_seed.find(neigh) != d_n_of_seed.end())
+ 1329 neighs_by_order[d_n_of_seed.at(neigh)].insert(neigh);
+
+ 1331 neighs_not_found.insert(neigh);
+
+ 1333 for (
const auto &[o, neighs] : neighs_by_order)
+ 1334 if (!neighs.empty())
+ 1335 this->
_seeds_pool->order_new_seeds_and_update(neighs);
+ 1336 if (!neighs_not_found.empty())
+ 1337 this->
_seeds_pool->order_new_seeds_and_update(neighs_not_found);
+
+ 1339 assert(arg_min_card ==
static_cast<CoMMAIntType
>(s_current_cc.size()));
-
-
-
-
- 1345 number_faces_in_common >= max_faces_in_common
- 1346 or is_order_primary) {
-
- 1348 if (number_faces_in_common == max_faces_in_common or is_order_primary) {
-
-
-
- 1352 if (order <= d_n_of_seed.at(arg_max_faces_in_common)) {
-
- 1354 if (order == d_n_of_seed.at(arg_max_faces_in_common)) {
- 1355 if (new_ar < min_ar and number_faces_in_common > 0) {
-
-
-
-
- 1360 min_ar_diam = new_ar_diam;
- 1361 min_ar_vol = new_ar_vol;
-
- 1363 arg_max_faces_in_common = i_fc;
-
-
-
-
-
- 1369 arg_max_faces_in_common = i_fc;
-
-
- 1372 min_ar_diam = new_ar_diam;
- 1373 min_ar_vol = new_ar_vol;
-
-
-
-
-
-
- 1380 max_faces_in_common = number_faces_in_common;
- 1381 arg_max_faces_in_common = i_fc;
-
-
- 1384 min_ar_diam = new_ar_diam;
- 1385 min_ar_vol = new_ar_vol;
-
-
-
-
-
-
-
- 1400 typename CoMMAIndexType,
- 1401 typename CoMMAWeightType,
- 1402 typename CoMMAIntType>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1431 CoMMAIntType neighbourhood_type,
- 1432 CoMMAIntType fc_iter,
- 1433 CoMMAIntType dimension = 3) :
-
- 1435 graph, cc_graph, seeds_pool, neighbourhood_type, fc_iter, dimension) {
-
-
+ 1341 compactness = max_compact;
+
+ 1343 return s_current_cc;
+
+
+
+ 1372 const CoMMAIntType fc_iter,
+ 1373 const std::shared_ptr<
+
+
+ 1376 const std::unordered_map<CoMMAIndexType, CoMMAIntType> &d_n_of_seed,
+ 1377 const bool &is_order_primary,
+ 1378 const CoMMAWeightType &diam_cc,
+ 1379 const CoMMAWeightType &vol_cc,
+ 1380 const std::unordered_set<CoMMAIndexType> &s_of_fc_for_current_cc,
+ 1381 CoMMAIndexType &argmin_ar,
+ 1382 CoMMAIntType &max_faces_in_common,
+ 1383 CoMMAWeightType &min_ar_diam,
+ 1384 CoMMAWeightType &min_ar_vol
+
+
+
+
+ 1389 CoMMAWeightType min_ar = std::numeric_limits<CoMMAWeightType>::max();
+ 1390 const auto neighbours = neighbourhood->get_candidates();
+ 1391 CoMMAIndexType arg_max_faces_in_common = neighbours[0];
+
+ 1393 for (
const auto &i_fc : neighbours) {
+
+
+
+ 1397 CoMMAIntType number_faces_in_common = 0;
+ 1398 CoMMAWeightType new_ar = std::numeric_limits<CoMMAWeightType>::min();
+ 1399 CoMMAWeightType new_ar_diam = std::numeric_limits<CoMMAWeightType>::min();
+ 1400 CoMMAWeightType new_ar_vol = std::numeric_limits<CoMMAWeightType>::min();
+
+
+
+
+ 1405 s_of_fc_for_current_cc,
+
+ 1407 number_faces_in_common,
+
+
+
+
+
+
+
+
+ 1416 const CoMMAIntType &order = d_n_of_seed.at(i_fc);
+
+
+
+
+ 1421 if (number_faces_in_common >= max_faces_in_common
+ 1422 or is_order_primary) {
+
+ 1424 if (number_faces_in_common == max_faces_in_common or is_order_primary) {
+
+
+
+ 1428 if (order <= d_n_of_seed.at(arg_max_faces_in_common)) {
+
+ 1430 if (order == d_n_of_seed.at(arg_max_faces_in_common)) {
+ 1431 if (new_ar < min_ar and number_faces_in_common > 0) {
+
+
+
+
+ 1436 min_ar_diam = new_ar_diam;
+ 1437 min_ar_vol = new_ar_vol;
-
-
-
- 1469 const CoMMAIntType fc_iter,
- 1470 const std::shared_ptr<
-
-
- 1473 const std::unordered_map<CoMMAIndexType, CoMMAIntType> &d_n_of_seed,
- 1474 const bool &is_order_primary,
- 1475 const CoMMAWeightType &diam_cc,
- 1476 const CoMMAWeightType &vol_cc,
- 1477 const std::unordered_set<CoMMAIndexType> &s_of_fc_for_current_cc,
- 1478 CoMMAIndexType &argmin_ar,
- 1479 CoMMAIntType &max_faces_in_common,
- 1480 CoMMAWeightType &min_ar_diam,
- 1481 CoMMAWeightType &min_ar_vol)
const override {
- 1482 CoMMAIndexType outer_argmax_faces{0};
- 1483 CoMMAIntType ref_max_faces = max_faces_in_common;
- 1484 CoMMAWeightType outer_ar = std::numeric_limits<CoMMAWeightType>::max();
- 1485 for (
const auto &i_fc : neighbourhood->get_candidates()) {
- 1486 auto cur_neighbourhood = this->
_neigh_crtor->clone(neighbourhood);
- 1487 CoMMAWeightType inner_ar{-1.};
- 1488 CoMMAIntType inner_max_faces_in_common{0};
- 1489 CoMMAWeightType inner_min_ar_diam =
- 1490 std::numeric_limits<CoMMAWeightType>::max();
- 1491 CoMMAWeightType inner_min_ar_vol{0.};
-
- 1493 i_fc, diam_cc, vol_cc, s_of_fc_for_current_cc,
- 1494 inner_max_faces_in_common, inner_ar, inner_min_ar_diam,
-
- 1496 cur_neighbourhood->update(i_fc, this->
_fc_graph->get_neighbours(i_fc));
- 1497 std::unordered_set<CoMMAIndexType> cur_fc{
- 1498 s_of_fc_for_current_cc.begin(), s_of_fc_for_current_cc.end()};
- 1499 cur_fc.insert(i_fc);
-
- 1501 const CoMMAIntType ref_inner_faces = inner_max_faces_in_common;
-
-
- 1504 CoMMAIndexType cur_argmin{0};
- 1505 CoMMAIntType cur_max_faces_in_common{0};
- 1506 CoMMAWeightType cur_min_ar_diam =
- 1507 std::numeric_limits<CoMMAWeightType>::max();
- 1508 CoMMAWeightType cur_min_ar_vol{0.};
- 1509 CoMMAWeightType cur_min_ar{0.};
-
- 1511 fc_iter - 1, cur_neighbourhood, d_n_of_seed, is_order_primary,
- 1512 inner_min_ar_diam, inner_min_ar_vol, cur_fc,
-
- 1514 cur_argmin, cur_max_faces_in_common, cur_min_ar_diam, cur_min_ar_vol);
-
- 1516 if (cur_max_faces_in_common > inner_max_faces_in_common) {
- 1517 inner_max_faces_in_common = cur_max_faces_in_common;
-
- 1519 cur_max_faces_in_common == inner_max_faces_in_common
- 1520 && cur_min_ar < inner_ar) {
- 1521 inner_ar = cur_min_ar;
-
-
-
- 1525 const CoMMAIntType &order = d_n_of_seed.at(i_fc);
-
-
-
-
-
- 1531 inner_max_faces_in_common >= ref_max_faces
- 1532 or is_order_primary) {
-
- 1534 if (inner_max_faces_in_common == ref_max_faces or is_order_primary) {
-
-
-
- 1538 if (order <= d_n_of_seed.at(outer_argmax_faces)) {
-
- 1540 if (order == d_n_of_seed.at(outer_argmax_faces)) {
- 1541 if (inner_ar < outer_ar and inner_max_faces_in_common > 0) {
-
-
-
-
-
-
- 1548 outer_ar = inner_ar;
- 1549 min_ar_diam = inner_min_ar_diam;
- 1550 min_ar_vol = inner_min_ar_vol;
-
- 1552 max_faces_in_common = ref_inner_faces;
-
- 1554 outer_argmax_faces = i_fc;
-
-
-
-
- 1559 outer_argmax_faces = i_fc;
-
-
-
-
- 1564 outer_ar = inner_ar;
- 1565 min_ar_diam = inner_min_ar_diam;
- 1566 min_ar_vol = inner_min_ar_vol;
-
- 1568 max_faces_in_common = ref_inner_faces;
-
-
-
-
-
- 1574 ref_max_faces = inner_max_faces_in_common;
- 1575 outer_argmax_faces = i_fc;
-
-
-
-
- 1580 outer_ar = inner_ar;
- 1581 min_ar_diam = inner_min_ar_diam;
- 1582 min_ar_vol = inner_min_ar_vol;
-
- 1584 max_faces_in_common = ref_inner_faces;
-
-
-
-
-
-
-
-
-
+ 1439 arg_max_faces_in_common = i_fc;
+
+
+
+
+
+ 1445 arg_max_faces_in_common = i_fc;
+
+
+ 1448 min_ar_diam = new_ar_diam;
+ 1449 min_ar_vol = new_ar_vol;
+
+
+
+
+
+
+ 1456 max_faces_in_common = number_faces_in_common;
+ 1457 arg_max_faces_in_common = i_fc;
+
+
+ 1460 min_ar_diam = new_ar_diam;
+ 1461 min_ar_vol = new_ar_vol;
+
+
+
+
+
+
+
+ 1476 typename CoMMAIndexType,
+ 1477 typename CoMMAWeightType,
+ 1478 typename CoMMAIntType>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1507 CoMMAIntType neighbourhood_type,
+ 1508 CoMMAIntType fc_iter,
+ 1509 CoMMAIntType dimension = 3
+
+
+ 1512 graph, cc_graph, seeds_pool, neighbourhood_type, fc_iter, dimension
+
+
+
+
+
+
+
+ 1547 const CoMMAIntType fc_iter,
+ 1548 const std::shared_ptr<
+
+
+ 1551 const std::unordered_map<CoMMAIndexType, CoMMAIntType> &d_n_of_seed,
+ 1552 const bool &is_order_primary,
+ 1553 const CoMMAWeightType &diam_cc,
+ 1554 const CoMMAWeightType &vol_cc,
+ 1555 const std::unordered_set<CoMMAIndexType> &s_of_fc_for_current_cc,
+ 1556 CoMMAIndexType &argmin_ar,
+ 1557 CoMMAIntType &max_faces_in_common,
+ 1558 CoMMAWeightType &min_ar_diam,
+ 1559 CoMMAWeightType &min_ar_vol
+
+ 1561 CoMMAIndexType outer_argmax_faces{0};
+ 1562 CoMMAIntType ref_max_faces = max_faces_in_common;
+ 1563 CoMMAWeightType outer_ar = std::numeric_limits<CoMMAWeightType>::max();
+ 1564 for (
const auto &i_fc : neighbourhood->get_candidates()) {
+ 1565 auto cur_neighbourhood = this->
_neigh_crtor->clone(neighbourhood);
+ 1566 CoMMAWeightType inner_ar{-1.};
+ 1567 CoMMAIntType inner_max_faces_in_common{0};
+ 1568 CoMMAWeightType inner_min_ar_diam =
+ 1569 std::numeric_limits<CoMMAWeightType>::max();
+ 1570 CoMMAWeightType inner_min_ar_vol{0.};
+
+
+
+
+ 1575 s_of_fc_for_current_cc,
+ 1576 inner_max_faces_in_common,
+
+
+
+
+ 1581 cur_neighbourhood->update(i_fc, this->
_fc_graph->get_neighbours(i_fc));
+ 1582 std::unordered_set<CoMMAIndexType> cur_fc{
+ 1583 s_of_fc_for_current_cc.begin(), s_of_fc_for_current_cc.end()
+
+ 1585 cur_fc.insert(i_fc);
+
+ 1587 const CoMMAIntType ref_inner_faces = inner_max_faces_in_common;
+
+
+ 1590 CoMMAIndexType cur_argmin{0};
+ 1591 CoMMAIntType cur_max_faces_in_common{0};
+ 1592 CoMMAWeightType cur_min_ar_diam =
+ 1593 std::numeric_limits<CoMMAWeightType>::max();
+ 1594 CoMMAWeightType cur_min_ar_vol{0.};
+ 1595 CoMMAWeightType cur_min_ar{0.};
+
+
+
+
+
+
+
+
+
+
+ 1606 cur_max_faces_in_common,
+
+
+
+
+ 1611 if (cur_max_faces_in_common > inner_max_faces_in_common) {
+ 1612 inner_max_faces_in_common = cur_max_faces_in_common;
+ 1613 }
else if (cur_max_faces_in_common == inner_max_faces_in_common
+ 1614 && cur_min_ar < inner_ar) {
+ 1615 inner_ar = cur_min_ar;
+
+
+
+ 1619 const CoMMAIntType &order = d_n_of_seed.at(i_fc);
+
+
+
+
+ 1624 if (inner_max_faces_in_common >= ref_max_faces
+ 1625 or is_order_primary) {
+
+ 1627 if (inner_max_faces_in_common == ref_max_faces or is_order_primary) {
+
+
+
+ 1631 if (order <= d_n_of_seed.at(outer_argmax_faces)) {
+
+ 1633 if (order == d_n_of_seed.at(outer_argmax_faces)) {
+ 1634 if (inner_ar < outer_ar and inner_max_faces_in_common > 0) {
+
+
+
+
+
+
+ 1641 outer_ar = inner_ar;
+ 1642 min_ar_diam = inner_min_ar_diam;
+ 1643 min_ar_vol = inner_min_ar_vol;
+
+ 1645 max_faces_in_common = ref_inner_faces;
+
+ 1647 outer_argmax_faces = i_fc;
+
+
+
+
+ 1652 outer_argmax_faces = i_fc;
+
+
+
+
+ 1657 outer_ar = inner_ar;
+ 1658 min_ar_diam = inner_min_ar_diam;
+ 1659 min_ar_vol = inner_min_ar_vol;
+
+ 1661 max_faces_in_common = ref_inner_faces;
+
+
+
+
+
+ 1667 ref_max_faces = inner_max_faces_in_common;
+ 1668 outer_argmax_faces = i_fc;
+
+
+
+
+ 1673 outer_ar = inner_ar;
+ 1674 min_ar_diam = inner_min_ar_diam;
+ 1675 min_ar_vol = inner_min_ar_vol;
+
+ 1677 max_faces_in_common = ref_inner_faces;
+
+
+
+
+
+
+
+
+
#define CoMMAUnused(var)
Convenient function to avoid unused warnings.
Definition: Util.h:34
-Agglomerator_Anisotropic class is a child class of the Agglomerator class that specializes the implem...
Definition: Agglomerator.h:181
-bool build_anisotropic_lines(const std::vector< CoMMAWeightType > &priority_weights, const CoMMAWeightType threshold_anisotropy)
Build the anisotropic lines at the first level (only called at the first level of agglomeration)....
Definition: Agglomerator.h:517
-void export_anisotropic_lines(CoMMAIntType level, std::vector< CoMMAIndexType > &aniso_lines_idx, std::vector< CoMMAIndexType > &aniso_lines) const
Function that prepares the anisotropic lines for output.
Definition: Agglomerator.h:456
-std::pair< CoMMAIndexType, CoMMAWeightType > CoMMAPairType
Type of pair.
Definition: Agglomerator.h:190
-bool _odd_line_length
Whether anisotropic lines with odd length are allowed.
Definition: Agglomerator.h:703
-void update_seeds_pool()
Update the seeds pool with the neighbours of the anisotropic cells agglomerated so far.
Definition: Agglomerator.h:422
-void agglomerate_one_level(const CoMMAIntType goal_card, const CoMMAIntType min_card, const CoMMAIntType max_card, const std::vector< CoMMAWeightType > &priority_weights, bool correction_steps) override
Specialization of the pure virtual function to the class Agglomerator_Anisotropic....
Definition: Agglomerator.h:301
-bool _should_agglomerate
Whether agglomeration is possible: for instance, if anisotropy requested but no anisotropic cells fou...
Definition: Agglomerator.h:503
-std::optional< CoMMAIndexType > _max_cells_in_line
Maximum number of cells in an anisotropic line; when this value is reached, all reaming cells are dis...
Definition: Agglomerator.h:708
-std::deque< CoMMAIndexType > AnisotropicLine
Container for an anisotropic line.
Definition: Agglomerator.h:184
-std::shared_ptr< AnisotropicLine > AnisotropicLinePtr
(Shared) Pointer to an anisotropic line
Definition: Agglomerator.h:187
-std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > > CoMMASetOfPairType
Type of set of pairs.
Definition: Agglomerator.h:193
+Agglomerator_Anisotropic class is a child class of the Agglomerator class that specializes the implem...
Definition: Agglomerator.h:185
+bool build_anisotropic_lines(const std::vector< CoMMAWeightType > &priority_weights, const CoMMAWeightType threshold_anisotropy)
Build the anisotropic lines at the first level (only called at the first level of agglomeration)....
Definition: Agglomerator.h:533
+void export_anisotropic_lines(CoMMAIntType level, std::vector< CoMMAIndexType > &aniso_lines_idx, std::vector< CoMMAIndexType > &aniso_lines) const
Function that prepares the anisotropic lines for output.
Definition: Agglomerator.h:470
+std::pair< CoMMAIndexType, CoMMAWeightType > CoMMAPairType
Type of pair.
Definition: Agglomerator.h:194
+bool _odd_line_length
Whether anisotropic lines with odd length are allowed.
Definition: Agglomerator.h:729
+void update_seeds_pool()
Update the seeds pool with the neighbours of the anisotropic cells agglomerated so far.
Definition: Agglomerator.h:434
+void agglomerate_one_level(const CoMMAIntType goal_card, const CoMMAIntType min_card, const CoMMAIntType max_card, const std::vector< CoMMAWeightType > &priority_weights, bool correction_steps) override
Specialization of the pure virtual function to the class Agglomerator_Anisotropic....
Definition: Agglomerator.h:309
+bool _should_agglomerate
Whether agglomeration is possible: for instance, if anisotropy requested but no anisotropic cells fou...
Definition: Agglomerator.h:519
+std::optional< CoMMAIndexType > _max_cells_in_line
Maximum number of cells in an anisotropic line; when this value is reached, all reaming cells are dis...
Definition: Agglomerator.h:734
+std::deque< CoMMAIndexType > AnisotropicLine
Container for an anisotropic line.
Definition: Agglomerator.h:188
+std::shared_ptr< AnisotropicLine > AnisotropicLinePtr
(Shared) Pointer to an anisotropic line
Definition: Agglomerator.h:191
+std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > > CoMMASetOfPairType
Type of set of pairs.
Definition: Agglomerator.h:197
~Agglomerator_Anisotropic() override=default
Destructor.
-std::vector< std::vector< AnisotropicLinePtr > > _v_lines
_v_lines : Agglomeration lines structure:
Definition: Agglomerator.h:498
-std::deque< CoMMAIndexType > _aniso_neighbours
Neighbours of the anisotropic cells agglomerated. They are used to update the seeds pool.
Definition: Agglomerator.h:700
-Agglomerator_Anisotropic(std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, const CoMMAWeightType threshold_anisotropy, const std::vector< CoMMAIndexType > &agglomerationLines_Idx, const std::vector< CoMMAIndexType > &agglomerationLines, const std::vector< CoMMAWeightType > &priority_weights, const bool build_lines, const bool odd_line_length, const std::optional< CoMMAIndexType > max_cells_in_line, CoMMAIntType dimension=3)
Constructor.
Definition: Agglomerator.h:219
-std::vector< CoMMAIndexType > _nb_lines
Vector of number of Anisotropic agglomeration lines per level.
Definition: Agglomerator.h:490
-Child class of Agglomerator_Isotropic where is implemented a specific biconnected algorithm for the a...
Definition: Agglomerator.h:996
+std::vector< std::vector< AnisotropicLinePtr > > _v_lines
_v_lines : Agglomeration lines structure:
Definition: Agglomerator.h:514
+std::deque< CoMMAIndexType > _aniso_neighbours
Neighbours of the anisotropic cells agglomerated. They are used to update the seeds pool.
Definition: Agglomerator.h:726
+Agglomerator_Anisotropic(std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, const CoMMAWeightType threshold_anisotropy, const std::vector< CoMMAIndexType > &agglomerationLines_Idx, const std::vector< CoMMAIndexType > &agglomerationLines, const std::vector< CoMMAWeightType > &priority_weights, const bool build_lines, const bool odd_line_length, const std::optional< CoMMAIndexType > max_cells_in_line, CoMMAIntType dimension=3)
Constructor.
Definition: Agglomerator.h:223
+std::vector< CoMMAIndexType > _nb_lines
Vector of number of Anisotropic agglomeration lines per level.
Definition: Agglomerator.h:506
+Child class of Agglomerator_Isotropic where is implemented a specific biconnected algorithm for the a...
Definition: Agglomerator.h:1044
~Agglomerator_Biconnected() override=default
Destructor.
-std::unordered_set< CoMMAIndexType > choose_optimal_cc_and_update_seeds_pool(const CoMMAIndexType seed, const std::vector< CoMMAWeightType > &priority_weights, CoMMAIntType &compactness) override
Specialization of the pure virtual function in the parent class, to be used in couple with the agglom...
Definition: Agglomerator.h:1041
-Agglomerator_Biconnected(std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, CoMMAIntType neighbourhood_type, CoMMAIntType fc_iter, CoMMAIntType dimension=3)
Constructor of the class. No specific implementation, it instantiates the base class Agglomerator_Iso...
Definition: Agglomerator.h:1012
-virtual void compute_best_fc_to_add(const CoMMAIntType fc_iter, const std::shared_ptr< Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > neighbourhood, const std::unordered_map< CoMMAIndexType, CoMMAIntType > &d_n_of_seed, const bool &is_order_primary, const CoMMAWeightType &diam_cc, const CoMMAWeightType &vol_cc, const std::unordered_set< CoMMAIndexType > &s_of_fc_for_current_cc, CoMMAIndexType &argmin_ar, CoMMAIntType &max_faces_in_common, CoMMAWeightType &min_ar_diam, CoMMAWeightType &min_ar_vol) const
Computes the best fine cell to add to the coarse cell. The choice depends on: the number of shared fa...
Definition: Agglomerator.h:1302
-Agglomerator_Isotropic class is a child class of the Agglomerator class that specializes the implemen...
Definition: Agglomerator.h:724
+std::unordered_set< CoMMAIndexType > choose_optimal_cc_and_update_seeds_pool(const CoMMAIndexType seed, const std::vector< CoMMAWeightType > &priority_weights, CoMMAIntType &compactness) override
Specialization of the pure virtual function in the parent class, to be used in couple with the agglom...
Definition: Agglomerator.h:1091
+Agglomerator_Biconnected(std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, CoMMAIntType neighbourhood_type, CoMMAIntType fc_iter, CoMMAIntType dimension=3)
Constructor of the class. No specific implementation, it instantiates the base class Agglomerator_Iso...
Definition: Agglomerator.h:1060
+virtual void compute_best_fc_to_add(const CoMMAIntType fc_iter, const std::shared_ptr< Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > neighbourhood, const std::unordered_map< CoMMAIndexType, CoMMAIntType > &d_n_of_seed, const bool &is_order_primary, const CoMMAWeightType &diam_cc, const CoMMAWeightType &vol_cc, const std::unordered_set< CoMMAIndexType > &s_of_fc_for_current_cc, CoMMAIndexType &argmin_ar, CoMMAIntType &max_faces_in_common, CoMMAWeightType &min_ar_diam, CoMMAWeightType &min_ar_vol) const
Computes the best fine cell to add to the coarse cell. The choice depends on: the number of shared fa...
Definition: Agglomerator.h:1371
+Agglomerator_Isotropic class is a child class of the Agglomerator class that specializes the implemen...
Definition: Agglomerator.h:750
virtual std::unordered_set< CoMMAIndexType > choose_optimal_cc_and_update_seeds_pool(const CoMMAIndexType seed, const std::vector< CoMMAWeightType > &priority_weights, CoMMAIntType &compactness)=0
Pure virtual function that must be implemented in child classes to define the optimal coarse cell.
-CoMMAWeightType estimate_boundary_face(const std::vector< CoMMAWeightType > &int_faces) const
Approximate the value of a boundary face using the known internal faces. It uses a (geometric) averag...
Definition: Agglomerator.h:901
-std::shared_ptr< NeighbourhoodCreatorBaseType > _neigh_crtor
Creator responsible for neighborhood objects.
Definition: Agglomerator.h:743
-CoMMAIntType _fc_iter
Number of iterations allowed for the algorithm choosing which fine cell to add next.
Definition: Agglomerator.h:740
-void set_agglomeration_parameter(CoMMAIntType goal_card=0, CoMMAIntType min_card=0, CoMMAIntType max_card=0)
The task of the function is to set the parameters of determine the cardinality limits with respect to...
Definition: Agglomerator.h:792
-void agglomerate_one_level(const CoMMAIntType goal_card, const CoMMAIntType min_card, const CoMMAIntType max_card, const std::vector< CoMMAWeightType > &priority_weights, bool correction_steps) override
Specialization of the pure virtual function to the class Agglomerator_Isotropic. We add the override ...
Definition: Agglomerator.h:854
-Agglomerator_Isotropic(std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, CoMMAIntType neighbourhood_type, CoMMAIntType fc_iter, CoMMAIntType dimension=3)
Constructor. The constructor takes as arguments the same arguments of the father and in this way acti...
Definition: Agglomerator.h:760
-void compute_next_cc_features(const CoMMAIndexType i_fc, const CoMMAWeightType cc_diam, const CoMMAWeightType cc_vol, const std::unordered_set< CoMMAIndexType > &fc_of_cc, CoMMAIntType &shared_faces, CoMMAWeightType &aspect_ratio, CoMMAWeightType &new_diam, CoMMAWeightType &new_vol) const
Computes features of the CC obtained by adding a given fine cell. The features are Aspect-Ratio and n...
Definition: Agglomerator.h:931
+CoMMAWeightType estimate_boundary_face(const std::vector< CoMMAWeightType > &int_faces) const
Approximate the value of a boundary face using the known internal faces. It uses a (geometric) averag...
Definition: Agglomerator.h:940
+std::shared_ptr< NeighbourhoodCreatorBaseType > _neigh_crtor
Creator responsible for neighborhood objects.
Definition: Agglomerator.h:769
+CoMMAIntType _fc_iter
Number of iterations allowed for the algorithm choosing which fine cell to add next.
Definition: Agglomerator.h:766
+void set_agglomeration_parameter(CoMMAIntType goal_card=0, CoMMAIntType min_card=0, CoMMAIntType max_card=0)
The task of the function is to set the parameters of determine the cardinality limits with respect to...
Definition: Agglomerator.h:820
+void agglomerate_one_level(const CoMMAIntType goal_card, const CoMMAIntType min_card, const CoMMAIntType max_card, const std::vector< CoMMAWeightType > &priority_weights, bool correction_steps) override
Specialization of the pure virtual function to the class Agglomerator_Isotropic. We add the override ...
Definition: Agglomerator.h:887
+Agglomerator_Isotropic(std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, CoMMAIntType neighbourhood_type, CoMMAIntType fc_iter, CoMMAIntType dimension=3)
Constructor. The constructor takes as arguments the same arguments of the father and in this way acti...
Definition: Agglomerator.h:786
+void compute_next_cc_features(const CoMMAIndexType i_fc, const CoMMAWeightType cc_diam, const CoMMAWeightType cc_vol, const std::unordered_set< CoMMAIndexType > &fc_of_cc, CoMMAIntType &shared_faces, CoMMAWeightType &aspect_ratio, CoMMAWeightType &new_diam, CoMMAWeightType &new_vol) const
Computes features of the CC obtained by adding a given fine cell. The features are Aspect-Ratio and n...
Definition: Agglomerator.h:975
~Agglomerator_Isotropic() override=default
Destructor.
-Child class of Agglomerator_Isotropic which implements a specialized iterative algorithm for the sear...
Definition: Agglomerator.h:1407
+Child class of Agglomerator_Isotropic which implements a specialized iterative algorithm for the sear...
Definition: Agglomerator.h:1483
~Agglomerator_Iterative() override=default
Destructor.
-Agglomerator_Iterative(std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, CoMMAIntType neighbourhood_type, CoMMAIntType fc_iter, CoMMAIntType dimension=3)
Constructor of the class. No specific implementation, it instantiates the base class Agglomerator_Bic...
Definition: Agglomerator.h:1423
-void compute_best_fc_to_add(const CoMMAIntType fc_iter, const std::shared_ptr< Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > neighbourhood, const std::unordered_map< CoMMAIndexType, CoMMAIntType > &d_n_of_seed, const bool &is_order_primary, const CoMMAWeightType &diam_cc, const CoMMAWeightType &vol_cc, const std::unordered_set< CoMMAIndexType > &s_of_fc_for_current_cc, CoMMAIndexType &argmin_ar, CoMMAIntType &max_faces_in_common, CoMMAWeightType &min_ar_diam, CoMMAWeightType &min_ar_vol) const override
Specialization of the parent function. This is an iterative version. Computes the best fine cell to a...
Definition: Agglomerator.h:1468
+Agglomerator_Iterative(std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, CoMMAIntType neighbourhood_type, CoMMAIntType fc_iter, CoMMAIntType dimension=3)
Constructor of the class. No specific implementation, it instantiates the base class Agglomerator_Bic...
Definition: Agglomerator.h:1499
+void compute_best_fc_to_add(const CoMMAIntType fc_iter, const std::shared_ptr< Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > neighbourhood, const std::unordered_map< CoMMAIndexType, CoMMAIntType > &d_n_of_seed, const bool &is_order_primary, const CoMMAWeightType &diam_cc, const CoMMAWeightType &vol_cc, const std::unordered_set< CoMMAIndexType > &s_of_fc_for_current_cc, CoMMAIndexType &argmin_ar, CoMMAIntType &max_faces_in_common, CoMMAWeightType &min_ar_diam, CoMMAWeightType &min_ar_vol) const override
Specialization of the parent function. This is an iterative version. Computes the best fine cell to a...
Definition: Agglomerator.h:1546
A class responsible to do the interface between the different kinds of agglomerator.
Definition: Agglomerator.h:53
-std::vector< CoMMAIndexType > _l_nb_of_cells
List of number of cells per coarse cell created.
Definition: Agglomerator.h:150
+std::vector< CoMMAIndexType > _l_nb_of_cells
List of number of cells per coarse cell created.
Definition: Agglomerator.h:154
virtual ~Agglomerator()=default
The destructor of the class.
Agglomerator(std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > graph, std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > cc_graph, std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > seeds_pool, CoMMAIntType dimension=3)
The constructor of the interface.
Definition: Agglomerator.h:71
-CoMMAIntType _min_card
Minimum cardinality (default = 0, meaning, equal to the dimension)
Definition: Agglomerator.h:136
-std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _cc_graph
pointer to Coarse_Cell_Container element
Definition: Agglomerator.h:160
-std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _fc_graph
Dual_Graph object determining Fine cells graph and hence the connectivity.
Definition: Agglomerator.h:155
-CoMMAIntType _threshold_card
Threshold cardinality (default = 0, meaning, equal to the dimension)
Definition: Agglomerator.h:148
-CoMMAIntType _min_neighbourhood
Minimum number of neighbourhood we extend to search the neighbourhood in the greedy algorithm....
Definition: Agglomerator.h:133
-CoMMAIntType _dimension
Dimensionality of the problem (_dimension = 2 -> 2D, _dimension = 3 -> 3D)
Definition: Agglomerator.h:130
+CoMMAIntType _min_card
Minimum cardinality (default = 0, meaning, equal to the dimension)
Definition: Agglomerator.h:140
+std::shared_ptr< Coarse_Cell_Container< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _cc_graph
pointer to Coarse_Cell_Container element
Definition: Agglomerator.h:164
+std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _fc_graph
Dual_Graph object determining Fine cells graph and hence the connectivity.
Definition: Agglomerator.h:159
+CoMMAIntType _threshold_card
Threshold cardinality (default = 0, meaning, equal to the dimension)
Definition: Agglomerator.h:152
+CoMMAIntType _min_neighbourhood
Minimum number of neighbourhood we extend to search the neighbourhood in the greedy algorithm....
Definition: Agglomerator.h:137
+CoMMAIntType _dimension
Dimensionality of the problem (_dimension = 2 -> 2D, _dimension = 3 -> 3D)
Definition: Agglomerator.h:134
std::function< CoMMAWeightType(const CoMMAWeightType, const CoMMAWeightType)> _compute_AR
Function which computes the aspect-ratio from a diameter and a volume In 3D: In 2D: (Recall th...
Definition: Agglomerator.h:61
-CoMMAIntType _max_card
Maximum cardinality (default = 0, meaning, 5 or 10 for, resp., 2- and 3D.
Definition: Agglomerator.h:140
-std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _seeds_pool
Seeds_Pool object giving the order in which the fine cells should be considered when agglomerating.
Definition: Agglomerator.h:165
-CoMMAIntType _goal_card
Goal cardinality (default = 0, meaning, 4 or 8 for, resp., 2- and 3D.
Definition: Agglomerator.h:144
-std::vector< CoMMAIndexType > get_fc_2_cc() const
Accessor to retrieve the fine cells to coarse cells from the coarse cell graphs class.
Definition: Agglomerator.h:105
+CoMMAIntType _max_card
Maximum cardinality (default = 0, meaning, 5 or 10 for, resp., 2- and 3D.
Definition: Agglomerator.h:144
+std::shared_ptr< Seeds_Pool< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _seeds_pool
Seeds_Pool object giving the order in which the fine cells should be considered when agglomerating.
Definition: Agglomerator.h:169
+CoMMAIntType _goal_card
Goal cardinality (default = 0, meaning, 4 or 8 for, resp., 2- and 3D.
Definition: Agglomerator.h:148
+std::vector< CoMMAIndexType > get_fc_2_cc() const
Accessor to retrieve the fine cells to coarse cells from the coarse cell graphs class.
Definition: Agglomerator.h:108
virtual void agglomerate_one_level(const CoMMAIntType goal_card, const CoMMAIntType min_card, const CoMMAIntType max_card, const std::vector< CoMMAWeightType > &priority_weights, bool correction_steps)=0
Pure virtual function which implementation is specified in the related child classes and that defines...
Class implementing a custom container where the coarse cells are stored.
Definition: Coarse_Cell_Container.h:41
-A class implementing the CRS global graph representation of the global mesh.
Definition: Dual_Graph.h:517
-Pure abstract class for a creator of Neighbourhood objects. It can create from scratch or by copy.
Definition: Neighbourhood.h:381
-Creator of Neighbourhood_Extended objects. It can create from scratch or by copy.
Definition: Neighbourhood.h:427
+A class implementing the CRS global graph representation of the global mesh.
Definition: Dual_Graph.h:546
+Pure abstract class for a creator of Neighbourhood objects. It can create from scratch or by copy.
Definition: Neighbourhood.h:393
+Creator of Neighbourhood_Extended objects. It can create from scratch or by copy.
Definition: Neighbourhood.h:441
Class representing the neighbourhood of a given cell in the graph. Mind that no information about the...
Definition: Neighbourhood.h:42
-Creator of Neighbourhood_Extended objects. It can create from scratch or by copy.
Definition: Neighbourhood.h:490
-Class representing the pool of all the seeds for creating a coarse cell.
Definition: Seeds_Pool.h:194
+Creator of Neighbourhood_Extended objects. It can create from scratch or by copy.
Definition: Neighbourhood.h:509
+Class representing the pool of all the seeds for creating a coarse cell.
Definition: Seeds_Pool.h:200
Definition: Agglomerator.h:34
@ EXTENDED
Extended, all neighbours of the coarse cell.
Definition: CoMMADefs.h:38
diff --git a/_bimap_8h_source.html b/_bimap_8h_source.html
index b2b3c55..a54f7ac 100644
--- a/_bimap_8h_source.html
+++ b/_bimap_8h_source.html
@@ -150,61 +150,65 @@
69 _mapB.insert(std::move(node));
-
- 78 auto node =
_mapA.extract(b_old);
-
-
- 81 _mapA.insert(std::move(node));
-
-
-
-
-
- 91 auto it =
_mapB.find(a);
- 92 return (*(it->second));
-
-
-
-
-
- 102 auto it =
_mapA.find(b);
- 103 return (*(it->second));
-
-
-
-
-
- 113 auto itB =
_mapB.find(a);
- 114 auto be = *(itB->second);
- 115 auto itA =
_mapA.find(be);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ 79 auto node =
_mapA.extract(b_old);
+
+
+ 82 _mapA.insert(std::move(node));
+
+
+
+
+
+
+ 93 auto it =
_mapB.find(a);
+ 94 return (*(it->second));
+
+
+
+
+
+ 104 auto it =
_mapA.find(b);
+ 105 return (*(it->second));
+
+
+
+
+
+ 115 auto itB =
_mapB.find(a);
+ 116 auto be = *(itB->second);
+ 117 auto itA =
_mapA.find(be);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
An easy and straight forward implementation of a Bimap.
Definition: Bimap.h:28
-void update_nodeA(const B &b_old, const B &b_new)
Update of the key of the map A and hence the value of the node B.
Definition: Bimap.h:77
-B get_B(const A &a)
Getter of the B value starting from a A value.
Definition: Bimap.h:88
+void update_nodeA(const B &b_old, const B &b_new)
Update of the key of the map A and hence the value of the node B.
Definition: Bimap.h:78
+B get_B(const A &a)
Getter of the B value starting from a A value.
Definition: Bimap.h:90
~Bimap()=default
Destructor.
Bimap()=default
Constructor.
void insert(const A &a, const B &b)
Insertion function in the Bimap.
Definition: Bimap.h:44
-bool empty()
Check if the Bimap is empty.
Definition: Bimap.h:122
-void erase_B(const A &a)
Eraser of the value starting from a A value.
Definition: Bimap.h:110
-std::map< A, const B * > _mapB
Right map.
Definition: Bimap.h:132
-A get_A(const B &b)
Getter of the A value starting from a B value.
Definition: Bimap.h:99
+bool empty()
Check if the Bimap is empty.
Definition: Bimap.h:125
+void erase_B(const A &a)
Eraser of the value starting from a A value.
Definition: Bimap.h:112
+std::map< A, const B * > _mapB
Right map.
Definition: Bimap.h:136
+A get_A(const B &b)
Getter of the A value starting from a B value.
Definition: Bimap.h:101
void update_nodeB(const A &a_old, const A &a_new)
Update of the key of the map B and hence the value of the node A.
Definition: Bimap.h:65
-std::map< B, const A * > _mapA
Left map
Definition: Bimap.h:130
+std::map< B, const A * > _mapA
Left map
Definition: Bimap.h:134
void print()
Function to print the map.
Definition: Bimap.h:54
-size_t lung()
Returns the size of the container.
Definition: Bimap.h:126
+size_t lung()
Returns the size of the container.
Definition: Bimap.h:130
Definition: Agglomerator.h:34
diff --git a/_co_m_m_a_8h_source.html b/_co_m_m_a_8h_source.html
index 05df7c6..5ef4295 100644
--- a/_co_m_m_a_8h_source.html
+++ b/_co_m_m_a_8h_source.html
@@ -128,292 +128,336 @@
- 36#define CHECK_INT_TYPE(intT, label) \
-
- 38 std::numeric_limits<intT>::is_integer, \
- 39 "CoMMA works with integer types, but " #intT " (" label ") is not")
-
-
-
-
- 126 typename CoMMAIndexType,
- 127 typename CoMMAWeightType,
- 128 typename CoMMAIntType>
-
-
- 131 const std::vector<CoMMAIndexType> &adjMatrix_row_ptr,
- 132 const std::vector<CoMMAIndexType> &adjMatrix_col_ind,
- 133 const std::vector<CoMMAWeightType> &adjMatrix_areaValues,
- 134 const std::vector<CoMMAWeightType> &volumes,
-
-
- 137 const std::vector<std::vector<CoMMAWeightType>> ¢ers,
- 138 const std::vector<CoMMAWeightType> &priority_weights,
- 139 const std::vector<CoMMAIndexType> &anisotropicCompliantCells,
- 140 const std::vector<CoMMAIntType> &n_bnd_faces,
-
-
- 143 bool build_anisotropic_lines,
-
- 145 bool odd_line_length,
- 146 CoMMAWeightType threshold_anisotropy,
-
-
- 149 const CoMMAIntType seed_ordering_type,
-
-
- 152 std::vector<CoMMAIndexType> &fc_to_cc,
- 153 std::vector<CoMMAIndexType> &agglomerationLines_Idx,
- 154 std::vector<CoMMAIndexType> &agglomerationLines,
-
-
-
- 158 CoMMAIntType dimension,
- 159 CoMMAIntType goal_card,
- 160 CoMMAIntType min_card,
- 161 CoMMAIntType max_card,
- 162 CoMMAIntType singular_card_thresh = 1,
- 163 std::optional<CoMMAIndexType> max_cells_in_line = std::nullopt,
- 164 CoMMAIntType fc_choice_iter = 1,
-
-
-
-
-
-
-
-
- 173 using SeedsPoolType =
-
- 175 using DualGraphType =
-
- 177 using CCContainerType =
-
- 179 using IsotropicPtr = std::unique_ptr<
-
-
-
-
- 184 CHECK_INT_TYPE(CoMMAIndexType,
"first template argument");
- 185 CHECK_INT_TYPE(CoMMAIntType,
"third template argument");
- 186 if (!(dimension == 2 || dimension == 3))
- 187 throw std::invalid_argument(
"CoMMA - Error: dimension must be 2 or 3");
- 188 if (min_card <= 1 || goal_card <= 1 || max_card <= 1)
- 189 throw std::invalid_argument(
- 190 "CoMMA - Error: Cardinalities must be greater than 1");
- 191 if (!(min_card <= goal_card && goal_card <= max_card))
- 192 throw std::invalid_argument(
- 193 "CoMMA - Error: Cardinalities must be in order (min <= goal <= max)");
- 194 if (fc_choice_iter < 1)
+ 36#define CHECK_INT_TYPE(intT, label) \
+
+ 38 std::numeric_limits<intT>::is_integer, \
+ 39 "CoMMA works with integer types, but " #intT " (" label ") is not" \
+
+
+
+
+
+ 127 typename CoMMAIndexType,
+ 128 typename CoMMAWeightType,
+ 129 typename CoMMAIntType>
+
+
+ 132 const std::vector<CoMMAIndexType> &adjMatrix_row_ptr,
+ 133 const std::vector<CoMMAIndexType> &adjMatrix_col_ind,
+ 134 const std::vector<CoMMAWeightType> &adjMatrix_areaValues,
+ 135 const std::vector<CoMMAWeightType> &volumes,
+
+
+ 138 const std::vector<std::vector<CoMMAWeightType>> ¢ers,
+ 139 const std::vector<CoMMAWeightType> &priority_weights,
+ 140 const std::vector<CoMMAIndexType> &anisotropicCompliantCells,
+ 141 const std::vector<CoMMAIntType> &n_bnd_faces,
+
+
+ 144 bool build_anisotropic_lines,
+
+ 146 bool odd_line_length,
+ 147 CoMMAWeightType threshold_anisotropy,
+
+
+ 150 const CoMMAIntType seed_ordering_type,
+
+
+ 153 std::vector<CoMMAIndexType> &fc_to_cc,
+ 154 std::vector<CoMMAIndexType> &agglomerationLines_Idx,
+ 155 std::vector<CoMMAIndexType> &agglomerationLines,
+
+
+
+ 159 CoMMAIntType dimension,
+ 160 CoMMAIntType goal_card,
+ 161 CoMMAIntType min_card,
+ 162 CoMMAIntType max_card,
+ 163 CoMMAIntType singular_card_thresh = 1,
+ 164 std::optional<CoMMAIndexType> max_cells_in_line = std::nullopt,
+ 165 CoMMAIntType fc_choice_iter = 1,
+
+
+
+
+
+
+
+
+
+ 175 using SeedsPoolType =
+
+ 177 using DualGraphType =
+
+ 179 using CCContainerType =
+
+ 181 using IsotropicPtr = std::unique_ptr<
+
+
+
+
+ 186 CHECK_INT_TYPE(CoMMAIndexType,
"first template argument");
+ 187 CHECK_INT_TYPE(CoMMAIntType,
"third template argument");
+ 188 if (!(dimension == 2 || dimension == 3))
+ 189 throw std::invalid_argument(
"CoMMA - Error: dimension must be 2 or 3");
+ 190 if (min_card <= 1 || goal_card <= 1 || max_card <= 1)
+ 191 throw std::invalid_argument(
+ 192 "CoMMA - Error: Cardinalities must be greater than 1"
+
+ 194 if (!(min_card <= goal_card && goal_card <= max_card))
195 throw std::invalid_argument(
- 196 "CoMMA - Error: the number of iteration for the choice of the fine "
- 197 "cells must be at least 1");
-
+ 196 "CoMMA - Error: Cardinalities must be in order (min <= goal <= max)"
+
+ 198 if (fc_choice_iter < 1)
199 throw std::invalid_argument(
200 "CoMMA - Error: the number of iteration for the choice of the fine "
- 201 "cells must be at most "
-
-
- 204 adjMatrix_row_ptr.empty()
- 205 || adjMatrix_row_ptr.back()
- 206 !=
static_cast<CoMMAIndexType
>(adjMatrix_col_ind.size())
- 207 || adjMatrix_row_ptr.back()
- 208 !=
static_cast<CoMMAIndexType
>(adjMatrix_areaValues.size()))
- 209 throw std::invalid_argument(
- 210 "CoMMA - Error: bad CRS graph (sizes do not match)");
- 211 if (is_anisotropic) {
- 212 if (build_anisotropic_lines) {
- 213 if (anisotropicCompliantCells.empty()) {
- 214 std::cout <<
"CoMMA - Warning: building anisotropic line requested, no "
- 215 "compliant cells provided. Switching off anisotropy."
-
-
- 218 if (max_cells_in_line.has_value() && max_cells_in_line.value() <= 0) {
- 219 std::cout <<
"CoMMA - Requested a negative or null maximum number of "
- 220 "cells in line. Dropping the limit."
-
- 222 max_cells_in_line = std::nullopt;
+ 201 "cells must be at least 1"
+
+
+ 204 throw std::invalid_argument(
+ 205 "CoMMA - Error: the number of iteration for the choice of the fine "
+ 206 "cells must be at most "
+
+
+ 209 if (adjMatrix_row_ptr.empty()
+ 210 || adjMatrix_row_ptr.back()
+ 211 !=
static_cast<CoMMAIndexType
>(adjMatrix_col_ind.size())
+ 212 || adjMatrix_row_ptr.back()
+ 213 !=
static_cast<CoMMAIndexType
>(adjMatrix_areaValues.size()))
+ 214 throw std::invalid_argument(
+ 215 "CoMMA - Error: bad CRS graph (sizes do not match)"
+
+ 217 if (is_anisotropic) {
+ 218 if (build_anisotropic_lines) {
+ 219 if (anisotropicCompliantCells.empty()) {
+ 220 std::cout <<
"CoMMA - Warning: building anisotropic line requested, no "
+ 221 "compliant cells provided. Switching off anisotropy."
+
-
-
- 226 if (agglomerationLines_Idx.size() < 2 || agglomerationLines.empty()) {
-
- 228 <<
"CoMMA - Warning: usage of input anisotropic line requested, "
- 229 "but arguments are not enough / invalid to define them. "
- 230 "Switching off anisotropy."
-
- 232 is_anisotropic =
false;
-
- 234 agglomerationLines_Idx.back()
- 235 !=
static_cast<CoMMAIndexType
>(agglomerationLines.size())) {
- 236 throw std::invalid_argument(
- 237 "CoMMA - Error: bad anisotropic lines definition (sizes do not "
-
-
-
-
- 242 auto sing_thresh = singular_card_thresh;
- 243 if (singular_card_thresh <= 0) {
- 244 throw std::invalid_argument(
- 245 "CoMMA - Error: Threshold cardinality for singular cells should be "
- 246 "greater than zero");
+ 224 if (max_cells_in_line.has_value() && max_cells_in_line.value() <= 0) {
+ 225 std::cout <<
"CoMMA - Requested a negative or null maximum number of "
+ 226 "cells in line. Dropping the limit."
+
+ 228 max_cells_in_line = std::nullopt;
+
+
+
+ 232 if (agglomerationLines_Idx.size() < 2 || agglomerationLines.empty()) {
+
+ 234 <<
"CoMMA - Warning: usage of input anisotropic line requested, "
+ 235 "but arguments are not enough / invalid to define them. "
+ 236 "Switching off anisotropy."
+
+ 238 is_anisotropic =
false;
+ 239 }
else if (agglomerationLines_Idx.back()
+ 240 !=
static_cast<CoMMAIndexType
>(agglomerationLines.size())) {
+ 241 throw std::invalid_argument(
+ 242 "CoMMA - Error: bad anisotropic lines definition (sizes do not "
+
+
+
+
- 248 if (singular_card_thresh >= min_card) {
-
- 250 <<
"CoMMA - Warning: Threshold cardinality is equal or larger than "
- 251 "minimum cardinality. Changing it to this latter value."
-
- 253 sing_thresh = min_card - 1;
+ 248 auto sing_thresh = singular_card_thresh;
+ 249 if (singular_card_thresh <= 0) {
+ 250 throw std::invalid_argument(
+ 251 "CoMMA - Error: Threshold cardinality for singular cells should be "
+
+
-
-
-
- 258 const auto nb_fc =
static_cast<CoMMAIndexType
>(adjMatrix_row_ptr.size() - 1);
-
-
-
-
-
- 264 const CoMMAIntType expected_max_n_bnd = dimension;
- 265 std::vector<CoMMAIntType> fixed_n_bnd_faces(n_bnd_faces.size());
- 266 std::replace_copy_if(
- 267 n_bnd_faces.begin(), n_bnd_faces.end(), fixed_n_bnd_faces.begin(),
- 268 [expected_max_n_bnd](
auto n) { return n > expected_max_n_bnd; },
-
-
-
-
-
- 274 std::shared_ptr<SeedsPoolType> seeds_pool =
nullptr;
- 275 switch (seed_ordering_type) {
-
-
- 278 CoMMAIndexType, CoMMAWeightType, CoMMAIntType>>(
- 279 fixed_n_bnd_faces, priority_weights,
false);
-
-
-
- 283 CoMMAIndexType, CoMMAWeightType, CoMMAIntType>>(
- 284 fixed_n_bnd_faces, priority_weights,
false);
-
-
+ 255 if (singular_card_thresh >= min_card) {
+
+ 257 <<
"CoMMA - Warning: Threshold cardinality is equal or larger than "
+ 258 "minimum cardinality. Changing it to this latter value."
+
+ 260 sing_thresh = min_card - 1;
+
+
+
+
+ 265 const auto nb_fc =
static_cast<CoMMAIndexType
>(adjMatrix_row_ptr.size() - 1);
+
+
+
+
+
+ 271 const CoMMAIntType expected_max_n_bnd = dimension;
+ 272 std::vector<CoMMAIntType> fixed_n_bnd_faces(n_bnd_faces.size());
+ 273 std::replace_copy_if(
+
+
+ 276 fixed_n_bnd_faces.begin(),
+ 277 [expected_max_n_bnd](
auto n) { return n > expected_max_n_bnd; },
+
+
+
+
+
+
+ 284 std::shared_ptr<SeedsPoolType> seeds_pool =
nullptr;
+ 285 switch (seed_ordering_type) {
+
- 288 CoMMAIndexType, CoMMAWeightType, CoMMAIntType>>(
- 289 fixed_n_bnd_faces, priority_weights,
true);
-
-
-
- 293 CoMMAIndexType, CoMMAWeightType, CoMMAIntType>>(
- 294 fixed_n_bnd_faces, priority_weights,
true);
-
-
- 297 throw std::invalid_argument(
"CoMMA - Error: Seeds pool type unsupported");
-
-
-
-
-
-
- 304 std::shared_ptr<DualGraphType> fc_graph = std::make_shared<DualGraphType>(
- 305 nb_fc, adjMatrix_row_ptr, adjMatrix_col_ind, adjMatrix_areaValues, volumes,
- 306 centers, fixed_n_bnd_faces, dimension, anisotropicCompliantCells);
-
-
-
-
- 311 std::shared_ptr<CCContainerType> cc_graph =
- 312 std::make_shared<CCContainerType>(fc_graph, sing_thresh);
+
+
+ 290 CoMMAIntType>>(fixed_n_bnd_faces, priority_weights,
false);
+
+
+
+
+
+ 296 CoMMAIntType>>(fixed_n_bnd_faces, priority_weights,
false);
+
+
+
+
+
+ 302 CoMMAIntType>>(fixed_n_bnd_faces, priority_weights,
true);
+
+
+
+
+
+ 308 CoMMAIntType>>(fixed_n_bnd_faces, priority_weights,
true);
+
+
+ 311 throw std::invalid_argument(
"CoMMA - Error: Seeds pool type unsupported");
+
-
+
-
-
-
-
-
-
-
-
-
- 325 if (is_anisotropic) {
-
-
-
- 329 fc_graph, cc_graph, seeds_pool, threshold_anisotropy,
- 330 agglomerationLines_Idx, agglomerationLines, priority_weights,
- 331 build_anisotropic_lines, odd_line_length, max_cells_in_line, dimension);
-
-
-
- 335 goal_card, min_card, max_card, priority_weights,
false);
-
-
-
-
- 340 const CoMMAIntType i_level{1};
-
- 342 i_level, agglomerationLines_Idx, agglomerationLines);
-
- 344 seeds_pool->initialize();
-
-
-
-
-
- 350 IsotropicPtr agg =
nullptr;
-
- 352 if (fc_choice_iter > 1) {
- 353 agg = std::make_unique<
-
- 355 fc_graph, cc_graph, seeds_pool, neighbourhood_type, fc_choice_iter,
-
-
- 358 agg = std::make_unique<
-
- 360 fc_graph, cc_graph, seeds_pool, neighbourhood_type, fc_choice_iter,
-
-
-
-
- 365 goal_card, min_card, max_card, priority_weights, correction);
-
-
- 368 const auto &fccc = cc_graph->_fc_2_cc;
- 369 for (
auto i_fc =
decltype(nb_fc){0}; i_fc < nb_fc; i_fc++) {
- 370 fc_to_cc[i_fc] = fccc[i_fc].value();
-
-
-
-
-
-
-
-
+
+
+ 318 std::shared_ptr<DualGraphType> fc_graph = std::make_shared<DualGraphType>(
+
+
+
+ 322 adjMatrix_areaValues,
+
+
+
+
+ 327 anisotropicCompliantCells
+
+
+
+
+
+ 333 std::shared_ptr<CCContainerType> cc_graph =
+ 334 std::make_shared<CCContainerType>(fc_graph, sing_thresh);
+
+
+
+
+
+
+
+
+
+
+
+
+ 347 if (is_anisotropic) {
+
+
+
+
+
+
+ 354 threshold_anisotropy,
+ 355 agglomerationLines_Idx,
+
+
+ 358 build_anisotropic_lines,
+
+
+
+
+
+
+
+ 366 goal_card, min_card, max_card, priority_weights,
false
+
+
+
+
+
+ 372 const CoMMAIntType i_level{1};
+
+ 374 i_level, agglomerationLines_Idx, agglomerationLines
+
+
+ 377 seeds_pool->initialize();
+
+
+
+
+
+ 383 IsotropicPtr agg =
nullptr;
+
+ 385 if (fc_choice_iter > 1) {
+ 386 agg = std::make_unique<
+
+
+
+
+
+
+
+
+
+ 396 agg = std::make_unique<
+
+
+
+
+
+
+
+
+
+
+
+ 408 goal_card, min_card, max_card, priority_weights, correction
+
+
+
+ 412 const auto &fccc = cc_graph->_fc_2_cc;
+ 413 for (
auto i_fc =
decltype(nb_fc){0}; i_fc < nb_fc; i_fc++) {
+ 414 fc_to_cc[i_fc] = fccc[i_fc].value();
+
+
+
+
+
+
+
+
-Agglomerator_Anisotropic class is a child class of the Agglomerator class that specializes the implem...
Definition: Agglomerator.h:181
-void export_anisotropic_lines(CoMMAIntType level, std::vector< CoMMAIndexType > &aniso_lines_idx, std::vector< CoMMAIndexType > &aniso_lines) const
Function that prepares the anisotropic lines for output.
Definition: Agglomerator.h:456
-void agglomerate_one_level(const CoMMAIntType goal_card, const CoMMAIntType min_card, const CoMMAIntType max_card, const std::vector< CoMMAWeightType > &priority_weights, bool correction_steps) override
Specialization of the pure virtual function to the class Agglomerator_Anisotropic....
Definition: Agglomerator.h:301
-Child class of Agglomerator_Isotropic where is implemented a specific biconnected algorithm for the a...
Definition: Agglomerator.h:996
-Agglomerator_Isotropic class is a child class of the Agglomerator class that specializes the implemen...
Definition: Agglomerator.h:724
-void agglomerate_one_level(const CoMMAIntType goal_card, const CoMMAIntType min_card, const CoMMAIntType max_card, const std::vector< CoMMAWeightType > &priority_weights, bool correction_steps) override
Specialization of the pure virtual function to the class Agglomerator_Isotropic. We add the override ...
Definition: Agglomerator.h:854
-Child class of Agglomerator_Isotropic which implements a specialized iterative algorithm for the sear...
Definition: Agglomerator.h:1407
+Agglomerator_Anisotropic class is a child class of the Agglomerator class that specializes the implem...
Definition: Agglomerator.h:185
+void export_anisotropic_lines(CoMMAIntType level, std::vector< CoMMAIndexType > &aniso_lines_idx, std::vector< CoMMAIndexType > &aniso_lines) const
Function that prepares the anisotropic lines for output.
Definition: Agglomerator.h:470
+void agglomerate_one_level(const CoMMAIntType goal_card, const CoMMAIntType min_card, const CoMMAIntType max_card, const std::vector< CoMMAWeightType > &priority_weights, bool correction_steps) override
Specialization of the pure virtual function to the class Agglomerator_Anisotropic....
Definition: Agglomerator.h:309
+Child class of Agglomerator_Isotropic where is implemented a specific biconnected algorithm for the a...
Definition: Agglomerator.h:1044
+Agglomerator_Isotropic class is a child class of the Agglomerator class that specializes the implemen...
Definition: Agglomerator.h:750
+void agglomerate_one_level(const CoMMAIntType goal_card, const CoMMAIntType min_card, const CoMMAIntType max_card, const std::vector< CoMMAWeightType > &priority_weights, bool correction_steps) override
Specialization of the pure virtual function to the class Agglomerator_Isotropic. We add the override ...
Definition: Agglomerator.h:887
+Child class of Agglomerator_Isotropic which implements a specialized iterative algorithm for the sear...
Definition: Agglomerator.h:1483
Class implementing a custom container where the coarse cells are stored.
Definition: Coarse_Cell_Container.h:41
-A class implementing the CRS global graph representation of the global mesh.
Definition: Dual_Graph.h:517
-Class representing the pool of all the seeds for creating a coarse cell. This derived class gives hig...
Definition: Seeds_Pool.h:430
-Class representing the pool of all the seeds for creating a coarse cell. This derived class gives hig...
Definition: Seeds_Pool.h:583
-Class representing the pool of all the seeds for creating a coarse cell.
Definition: Seeds_Pool.h:194
+A class implementing the CRS global graph representation of the global mesh.
Definition: Dual_Graph.h:546
+Class representing the pool of all the seeds for creating a coarse cell. This derived class gives hig...
Definition: Seeds_Pool.h:452
+Class representing the pool of all the seeds for creating a coarse cell. This derived class gives hig...
Definition: Seeds_Pool.h:612
+Class representing the pool of all the seeds for creating a coarse cell.
Definition: Seeds_Pool.h:200
Definition: Agglomerator.h:34
-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, const CoMMAIntType 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, CoMMAIntType singular_card_thresh=1, std::optional< CoMMAIndexType > max_cells_in_line=std::nullopt, CoMMAIntType fc_choice_iter=1, const CoMMAIntType neighbourhood_type=CoMMANeighbourhoodT::EXTENDED)
Main function of the agglomerator, it is used as an interface to build up all the agglomeration proce...
Definition: CoMMA.h:129
+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, const CoMMAIntType 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, CoMMAIntType singular_card_thresh=1, std::optional< CoMMAIndexType > max_cells_in_line=std::nullopt, CoMMAIntType fc_choice_iter=1, const CoMMAIntType neighbourhood_type=CoMMANeighbourhoodT::EXTENDED)
Main function of the agglomerator, it is used as an interface to build up all the agglomeration proce...
Definition: CoMMA.h:130
@ EXTENDED
Extended, all neighbours of the coarse cell.
Definition: CoMMADefs.h:38
@ BOUNDARY_PRIORITY_ONE_POINT_INIT
Definition: CoMMADefs.h:53
@ BOUNDARY_PRIORITY
Definition: CoMMADefs.h:45
@ NEIGHBOURHOOD_PRIORITY_ONE_POINT_INIT
Definition: CoMMADefs.h:57
@ NEIGHBOURHOOD_PRIORITY
Definition: CoMMADefs.h:49
-constexpr CoMMAIntT iter_agglo_max_iter
Maximum allowed iterations for the iterative algorithm, see Agglomerator_Iterative.
Definition: CoMMA.h:45
+constexpr CoMMAIntT iter_agglo_max_iter
Maximum allowed iterations for the iterative algorithm, see Agglomerator_Iterative.
Definition: CoMMA.h:46
diff --git a/_coarse___cell_8h_source.html b/_coarse___cell_8h_source.html
index 519b69c..808ef46 100644
--- a/_coarse___cell_8h_source.html
+++ b/_coarse___cell_8h_source.html
@@ -134,188 +134,198 @@
56 const std::unordered_set<CoMMAIndexType> &s_fc,
57 CoMMAIntType compactness,
- 58 bool is_isotropic =
true) :
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 86 std::unordered_set<CoMMAIndexType>
_s_fc;
-
-
-
-
- 101 const CoMMAIndexType i_fc,
- 102 const std::optional<CoMMAIntType> new_compactness) {
-
-
-
- 106 ? new_compactness.value()
-
-
-
-
- 116 const std::unordered_set<CoMMAIndexType> &fcs,
- 117 const std::optional<CoMMAIntType> new_compactness) {
- 118 _s_fc.insert(fcs.begin(), fcs.end());
-
-
- 121 ? new_compactness.value()
-
-
-
-
-
- 135 typename CoMMAIndexType,
- 136 typename CoMMAWeightType,
- 137 typename CoMMAIntType>
-
- 139 Coarse_Cell<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
-
-
-
-
-
-
-
-
-
-
-
-
- 166 const std::unordered_set<CoMMAIndexType> &s_fc,
- 167 CoMMAIntType compactness,
- 168 bool is_isotropic =
true) :
- 169 BaseClass(fc_graph, i_cc, s_fc, compactness, is_isotropic),
-
-
-
- 173 CoMMAIndexType position = 0;
- 174 std::vector<CoMMAWeightType> volumes;
- 175 std::vector<CoMMAWeightType> CSR_vals{};
- 176 std::vector<CoMMAIndexType> CSR_row = {0};
- 177 std::vector<CoMMAIndexType> CSR_col{};
- 178 std::vector<CoMMAIndexType> col_ind{};
- 179 std::vector<CoMMAIndexType> mapping{};
- 180 for (
const CoMMAIndexType &i_fc : this->
_s_fc) {
-
- 182 mapping.push_back(i_fc);
-
- 184 const std::vector<CoMMAIndexType> neigh =
-
- 186 const std::vector<CoMMAWeightType> area =
-
- 188 for (
auto it = neigh.begin(); it != neigh.end(); ++it) {
-
- 190 std::find(this->_s_fc.begin(), this->_s_fc.end(), *it)
- 191 != this->_s_fc.end()) {
-
- 193 col_ind.push_back(*it);
- 194 CSR_vals.push_back(area[it - neigh.begin()]);
-
-
- 197 CSR_row.push_back(position);
- 198 volumes.push_back(this->
_fc_graph->_volumes[i_fc]);
-
-
-
- 202 for (
auto it = col_ind.begin(); it != col_ind.end(); ++it) {
- 203 auto indx = std::find(mapping.begin(), mapping.end(), *it);
- 204 CSR_col.push_back(indx - mapping.begin());
-
-
- 207 _cc_graph = std::make_shared<SubGraphType>(
- 208 s_fc.size(), CSR_row, CSR_col, CSR_vals, volumes, mapping, is_isotropic);
-
-
-
- 217 const CoMMAIndexType i_fc,
- 218 const std::optional<CoMMAIntType> new_compactness)
override {
-
- 220 this->
_s_fc.insert(i_fc);
-
-
- 223 new_compactness.has_value()
- 224 ? new_compactness.value()
- 225 : this->
_fc_graph->compute_min_fc_compactness_inside_a_cc(this->
_s_fc);
-
-
- 228 this->
_fc_graph->get_neighbours(i_fc), i_fc,
- 229 this->_fc_graph->_volumes[i_fc], this->_fc_graph->get_weights(i_fc));
-
-
-
- 238 const std::unordered_set<CoMMAIndexType> &fcs,
- 239 const std::optional<CoMMAIntType> new_compactness)
override {
-
- 241 this->
_s_fc.insert(fcs.begin(), fcs.end());
-
-
- 244 new_compactness.has_value()
- 245 ? new_compactness.value()
- 246 : this->
_fc_graph->compute_min_fc_compactness_inside_a_cc(this->
_s_fc);
-
- 248 for (
const auto &i_fc : fcs) {
-
- 250 this->
_fc_graph->get_neighbours(i_fc), i_fc,
- 251 this->_fc_graph->_volumes[i_fc], this->_fc_graph->get_weights(i_fc));
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ 58 bool is_isotropic =
true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 87 std::unordered_set<CoMMAIndexType>
_s_fc;
+
+
+
+
+ 102 const CoMMAIndexType i_fc,
const std::optional<CoMMAIntType> new_compactness
+
+
+
+
+ 107 ? new_compactness.value()
+
+
+
+
+ 117 const std::unordered_set<CoMMAIndexType> &fcs,
+ 118 const std::optional<CoMMAIntType> new_compactness
+
+ 120 _s_fc.insert(fcs.begin(), fcs.end());
+
+
+ 123 ? new_compactness.value()
+
+
+
+
+
+ 137 typename CoMMAIndexType,
+ 138 typename CoMMAWeightType,
+ 139 typename CoMMAIntType>
+
+ 141 Coarse_Cell<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
+
+
+
+
+
+
+
+
+
+
+
+
+ 168 const std::unordered_set<CoMMAIndexType> &s_fc,
+ 169 CoMMAIntType compactness,
+ 170 bool is_isotropic =
true
+
+ 172 BaseClass(fc_graph, i_cc, s_fc, compactness, is_isotropic),
+
+
+
+ 176 CoMMAIndexType position = 0;
+ 177 std::vector<CoMMAWeightType> volumes;
+ 178 std::vector<CoMMAWeightType> CSR_vals{};
+ 179 std::vector<CoMMAIndexType> CSR_row = {0};
+ 180 std::vector<CoMMAIndexType> CSR_col{};
+ 181 std::vector<CoMMAIndexType> col_ind{};
+ 182 std::vector<CoMMAIndexType> mapping{};
+ 183 for (
const CoMMAIndexType &i_fc : this->
_s_fc) {
+
+ 185 mapping.push_back(i_fc);
+
+ 187 const std::vector<CoMMAIndexType> neigh =
+
+ 189 const std::vector<CoMMAWeightType> area =
+
+ 191 for (
auto it = neigh.begin(); it != neigh.end(); ++it) {
+ 192 if (std::find(this->_s_fc.begin(), this->_s_fc.end(), *it)
+ 193 != this->_s_fc.end()) {
+
+ 195 col_ind.push_back(*it);
+ 196 CSR_vals.push_back(area[it - neigh.begin()]);
+
+
+ 199 CSR_row.push_back(position);
+ 200 volumes.push_back(this->
_fc_graph->_volumes[i_fc]);
+
+
+
+ 204 for (
auto it = col_ind.begin(); it != col_ind.end(); ++it) {
+ 205 auto indx = std::find(mapping.begin(), mapping.end(), *it);
+ 206 CSR_col.push_back(indx - mapping.begin());
+
+
+ 209 _cc_graph = std::make_shared<SubGraphType>(
+ 210 s_fc.size(), CSR_row, CSR_col, CSR_vals, volumes, mapping, is_isotropic
+
+
+
+
+ 220 const CoMMAIndexType i_fc,
const std::optional<CoMMAIntType> new_compactness
+
+
+ 223 this->
_s_fc.insert(i_fc);
+
+
+ 226 new_compactness.has_value()
+ 227 ? new_compactness.value()
+ 228 : this->
_fc_graph->compute_min_fc_compactness_inside_a_cc(this->
_s_fc);
+
+
+
+
+ 233 this->_fc_graph->_volumes[i_fc],
+ 234 this->_fc_graph->get_weights(i_fc)
+
+
+
+
+ 244 const std::unordered_set<CoMMAIndexType> &fcs,
+ 245 const std::optional<CoMMAIntType> new_compactness
+
+
+ 248 this->
_s_fc.insert(fcs.begin(), fcs.end());
+
+
+ 251 new_compactness.has_value()
+ 252 ? new_compactness.value()
+ 253 : this->
_fc_graph->compute_min_fc_compactness_inside_a_cc(this->
_s_fc);
+
+ 255 for (
const auto &i_fc : fcs) {
+
+
+
+ 259 this->_fc_graph->_volumes[i_fc],
+ 260 this->_fc_graph->get_weights(i_fc)
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
-Class describing a coarse cell with a full description, that is, it also holds a subgraph describing ...
Definition: Coarse_Cell.h:139
-SubGraphPtr _cc_graph
Shared pointer of the subgraph structure (CSR representation)
Definition: Coarse_Cell.h:262
-void insert_cell(const CoMMAIndexType i_fc, const std::optional< CoMMAIntType > new_compactness) override
Insert a FC in the CC (and update sub-graph if necessary)
Definition: Coarse_Cell.h:216
-void update_connectivity()
Analyse subgraph and update the connectivity.
Definition: Coarse_Cell.h:256
+Class describing a coarse cell with a full description, that is, it also holds a subgraph describing ...
Definition: Coarse_Cell.h:141
+SubGraphPtr _cc_graph
Shared pointer of the subgraph structure (CSR representation)
Definition: Coarse_Cell.h:272
+void insert_cell(const CoMMAIndexType i_fc, const std::optional< CoMMAIntType > new_compactness) override
Insert a FC in the CC (and update sub-graph if necessary)
Definition: Coarse_Cell.h:219
+void update_connectivity()
Analyse subgraph and update the connectivity.
Definition: Coarse_Cell.h:266
std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > DualGraphPtr
Type for a shared pointer to a Dual_Graph object.
Definition: Coarse_Cell.h:41
-bool _is_connectivity_up_to_date
Whether the connectivity has been checked.
Definition: Coarse_Cell.h:268
-void insert_cells(const std::unordered_set< CoMMAIndexType > &fcs, const std::optional< CoMMAIntType > new_compactness) override
Insert several FC in the CC (and update sub-graph if necessary)
Definition: Coarse_Cell.h:237
-bool _is_connected
Whether the cell connected.
Definition: Coarse_Cell.h:265
-std::shared_ptr< SubGraphType > SubGraphPtr
Type for a shared pointer to a Subgraph object.
Definition: Coarse_Cell.h:151
-Coarse_Cell_Subgraph(DualGraphPtr fc_graph, CoMMAIndexType i_cc, const std::unordered_set< CoMMAIndexType > &s_fc, CoMMAIntType compactness, bool is_isotropic=true)
Constructor of the class.
Definition: Coarse_Cell.h:163
+bool _is_connectivity_up_to_date
Whether the connectivity has been checked.
Definition: Coarse_Cell.h:278
+void insert_cells(const std::unordered_set< CoMMAIndexType > &fcs, const std::optional< CoMMAIntType > new_compactness) override
Insert several FC in the CC (and update sub-graph if necessary)
Definition: Coarse_Cell.h:243
+bool _is_connected
Whether the cell connected.
Definition: Coarse_Cell.h:275
+std::shared_ptr< SubGraphType > SubGraphPtr
Type for a shared pointer to a Subgraph object.
Definition: Coarse_Cell.h:153
+Coarse_Cell_Subgraph(DualGraphPtr fc_graph, CoMMAIndexType i_cc, const std::unordered_set< CoMMAIndexType > &s_fc, CoMMAIntType compactness, bool is_isotropic=true)
Constructor of the class.
Definition: Coarse_Cell.h:165
Class describing a coarse cell.
Definition: Coarse_Cell.h:37
-CoMMAIndexType _idx
Index of the coarse cell (It seems to be unused, but useful to have)
Definition: Coarse_Cell.h:71
-CoMMAIntType _cardinality
Number of FC in the CC.
Definition: Coarse_Cell.h:80
+CoMMAIndexType _idx
Index of the coarse cell (It seems to be unused, but useful to have)
Definition: Coarse_Cell.h:72
+CoMMAIntType _cardinality
Number of FC in the CC.
Definition: Coarse_Cell.h:81
std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > DualGraphPtr
Type for a shared pointer to a Dual_Graph object.
Definition: Coarse_Cell.h:41
-bool _is_isotropic
Whether the cell isotropic or anisotropic.
Definition: Coarse_Cell.h:83
+bool _is_isotropic
Whether the cell isotropic or anisotropic.
Definition: Coarse_Cell.h:84
Coarse_Cell(DualGraphPtr fc_graph, CoMMAIndexType i_cc, const std::unordered_set< CoMMAIndexType > &s_fc, CoMMAIntType compactness, bool is_isotropic=true)
Constructor of the class.
Definition: Coarse_Cell.h:53
-virtual void insert_cell(const CoMMAIndexType i_fc, const std::optional< CoMMAIntType > new_compactness)
Insert a FC in the CC (and update sub-graph if necessary)
Definition: Coarse_Cell.h:100
-std::unordered_set< CoMMAIndexType > _s_fc
Set of fine cells composing the Coarse cell.
Definition: Coarse_Cell.h:86
-DualGraphPtr _fc_graph
The global dual graph.
Definition: Coarse_Cell.h:74
-CoMMAIntType _compactness
Compactness degree of the CC.
Definition: Coarse_Cell.h:77
-bool is_connected()
Method that return a boolean determining if the coarse cell is defined by a connected sub-graph or no...
Definition: Coarse_Cell.h:93
+virtual void insert_cell(const CoMMAIndexType i_fc, const std::optional< CoMMAIntType > new_compactness)
Insert a FC in the CC (and update sub-graph if necessary)
Definition: Coarse_Cell.h:101
+std::unordered_set< CoMMAIndexType > _s_fc
Set of fine cells composing the Coarse cell.
Definition: Coarse_Cell.h:87
+DualGraphPtr _fc_graph
The global dual graph.
Definition: Coarse_Cell.h:75
+CoMMAIntType _compactness
Compactness degree of the CC.
Definition: Coarse_Cell.h:78
+bool is_connected()
Method that return a boolean determining if the coarse cell is defined by a connected sub-graph or no...
Definition: Coarse_Cell.h:94
virtual ~Coarse_Cell()=default
Destructor of the class.
-virtual void insert_cells(const std::unordered_set< CoMMAIndexType > &fcs, const std::optional< CoMMAIntType > new_compactness)
Insert several FC in the CC (and update sub-graph if necessary)
Definition: Coarse_Cell.h:115
-A class implementing the CRS subgraph representation. It is used in the framework of CoMMA for the im...
Definition: Dual_Graph.h:302
+virtual void insert_cells(const std::unordered_set< CoMMAIndexType > &fcs, const std::optional< CoMMAIntType > new_compactness)
Insert several FC in the CC (and update sub-graph if necessary)
Definition: Coarse_Cell.h:116
+A class implementing the CRS subgraph representation. It is used in the framework of CoMMA for the im...
Definition: Dual_Graph.h:318
Definition: Agglomerator.h:34
diff --git a/_coarse___cell___container_8h_source.html b/_coarse___cell___container_8h_source.html
index 5ae470e..252d447 100644
--- a/_coarse___cell___container_8h_source.html
+++ b/_coarse___cell___container_8h_source.html
@@ -137,449 +137,459 @@
- 60 DualGraphPtr &fc_graph,
const CoMMAIntType singular_card_thresh) :
-
-
-
- 64 _fc_2_cc(fc_graph->_number_of_cells, std::nullopt),
-
-
-
-
-
-
-
-
- 75 std::map<CoMMAIndexType, CoarseCellPtr>
_ccs;
-
-
-
-
-
- 85 std::vector<std::optional<CoMMAIndexType>>
_fc_2_cc;
-
-
-
-
-
-
-
-
-
-
-
-
- 116 const CoMMAIndexType &i_fc,
const CoMMAIndexType &i_cc)
const {
- 117 std::set<CoMMAIndexType> result;
- 118 for (
auto elem =
_fc_graph->neighbours_cbegin(i_fc);
- 119 elem !=
_fc_graph->neighbours_cend(i_fc); ++elem) {
- 120 const auto cc =
_fc_2_cc[*elem].value();
- 121 if (cc != i_cc) result.insert(cc);
-
-
-
-
-
- 127Not used anymore but we leave it
for example purposes
+ 60 DualGraphPtr &fc_graph,
const CoMMAIntType singular_card_thresh
+
+
+
+
+ 65 _fc_2_cc(fc_graph->_number_of_cells, std::nullopt),
+
+
+
+
+
+
+
+
+ 76 std::map<CoMMAIndexType, CoarseCellPtr>
_ccs;
+
+
+
+
+
+ 86 std::vector<std::optional<CoMMAIndexType>>
_fc_2_cc;
+
+
+
+
+
+
+
+
+
+
+
+
+ 117 const CoMMAIndexType &i_fc,
const CoMMAIndexType &i_cc
+
+ 119 std::set<CoMMAIndexType> result;
+ 120 for (
auto elem =
_fc_graph->neighbours_cbegin(i_fc);
+ 121 elem !=
_fc_graph->neighbours_cend(i_fc);
+
+ 123 const auto cc =
_fc_2_cc[*elem].value();
+ 124 if (cc != i_cc) result.insert(cc);
+
+
+
- 130 using CustomMapItT =
typename std::map<CoMMAIndexType, SubGraphPtr>::iterator;
- 135 CustomMapItT remove_cc(CustomMapItT elim) {
-
-
- 138 CustomMapItT it =
_ccs.erase(elim);
-
- 140 for (
auto i = it; i !=
_ccs.end(); i++) {
- 141 for (
auto const &i_fc : i->second->_mapping_l_to_g) {
-
-
- 144 auto node =
_ccs.extract(i);
-
- 146 node.key() = (i->first) - 1;
- 147 _ccs.insert(std::move(node));
-
-
-
-
-
-
-
-
-
- 163 std::set<
typename decltype(
_singular_cc)::value_type> removed_cc{};
-
-
-
- 167 auto &cur_cc =
_ccs.at(old_cc);
-
- 169 const auto &fcs = cur_cc->_s_fc;
- 170 bool should_remove =
false;
- 171 std::unordered_map<CoMMAIndexType, std::set<CoMMAIndexType>>
-
- 173 neighs_by_fc.reserve(cur_cc->_cardinality);
- 174 for (
const auto &i_fc : fcs) {
-
-
- 177 if (cur_cc->_cardinality > 1) {
-
- 179 std::set<CoMMAIndexType> glob_neighs = {};
- 180 for (
const auto &[i_fc, neighs] : neighs_by_fc) {
- 181 glob_neighs.insert(neighs.begin(), neighs.end());
-
- 183 if (!glob_neighs.empty()) {
- 184 std::optional<CoMMAIntType> new_compactness = std::nullopt;
-
- 186 fcs, glob_neighs, max_card, new_compactness);
- 187 if (new_cc.has_value()) {
-
-
- 190 for (
const auto &i_fc : fcs) {
-
-
- 193 _ccs[new_cc.value()]->insert_cells(fcs, new_compactness);
- 194 should_remove =
true;
-
-
-
- 198 if (!should_remove) {
-
-
- 201 for (
const auto &[i_fc, neighs] : neighs_by_fc) {
- 202 if (!neighs.empty()) {
- 203 std::optional<CoMMAIntType> new_compactness = std::nullopt;
-
- 205 i_fc, neighs, max_card, new_compactness);
- 206 if (new_cc.has_value()) {
-
- 208 _ccs[new_cc.value()]->insert_cell(i_fc, new_compactness);
- 209 should_remove =
true;
-
-
-
-
-
-
-
-
-
-
- 220 removed_cc.emplace(old_cc);
+
+ 130Not used anymore but we leave it
for example purposes
+
+ 133 using CustomMapItT =
typename std::map<CoMMAIndexType, SubGraphPtr>::iterator;
+ 138 CustomMapItT remove_cc(CustomMapItT elim) {
+
+
+ 141 CustomMapItT it =
_ccs.erase(elim);
+
+ 143 for (
auto i = it; i !=
_ccs.end(); i++) {
+ 144 for (
auto const &i_fc : i->second->_mapping_l_to_g) {
+
+
+ 147 auto node =
_ccs.extract(i);
+
+ 149 node.key() = (i->first) - 1;
+ 150 _ccs.insert(std::move(node));
+
+
+
+
+
+
+
+
+
+ 166 std::set<
typename decltype(
_singular_cc)::value_type> removed_cc{};
+
+
+
+ 170 auto &cur_cc =
_ccs.at(old_cc);
+
+ 172 const auto &fcs = cur_cc->_s_fc;
+ 173 bool should_remove =
false;
+ 174 std::unordered_map<CoMMAIndexType, std::set<CoMMAIndexType>>
+
+ 176 neighs_by_fc.reserve(cur_cc->_cardinality);
+ 177 for (
const auto &i_fc : fcs) {
+
+
+ 180 if (cur_cc->_cardinality > 1) {
+
+ 182 std::set<CoMMAIndexType> glob_neighs = {};
+ 183 for (
const auto &[i_fc, neighs] : neighs_by_fc) {
+ 184 glob_neighs.insert(neighs.begin(), neighs.end());
+
+ 186 if (!glob_neighs.empty()) {
+ 187 std::optional<CoMMAIntType> new_compactness = std::nullopt;
+
+ 189 fcs, glob_neighs, max_card, new_compactness
+
+ 191 if (new_cc.has_value()) {
+
+
+ 194 for (
const auto &i_fc : fcs) {
+
+
+ 197 _ccs[new_cc.value()]->insert_cells(fcs, new_compactness);
+ 198 should_remove =
true;
+
+
+
+ 202 if (!should_remove) {
+
+
+ 205 for (
const auto &[i_fc, neighs] : neighs_by_fc) {
+ 206 if (!neighs.empty()) {
+ 207 std::optional<CoMMAIntType> new_compactness = std::nullopt;
+
+ 209 i_fc, neighs, max_card, new_compactness
+
+ 211 if (new_cc.has_value()) {
+
+ 213 _ccs[new_cc.value()]->insert_cell(i_fc, new_compactness);
+ 214 should_remove =
true;
+
+
+
+
+
+
-
-
-
-
- 226 if (!removed_cc.empty()) {
- 227 auto new_ID = *(removed_cc.begin());
-
-
-
-
- 232 auto it_cc =
_ccs.begin();
-
- 234 it_cc =
_ccs.find(new_ID - 1);
-
-
- 237 for (; it_cc !=
_ccs.end(); ++it_cc, ++new_ID) {
-
- 239 for (
auto const &i_fc : it_cc->second->_s_fc) {
-
-
-
- 243 auto node =
_ccs.extract(it_cc);
-
-
- 246 _ccs.insert(std::move(node));
-
-
-
-
-
-
- 267 const std::unordered_set<CoMMAIndexType> &fcs,
- 268 const std::set<CoMMAIndexType> &neighs,
- 269 const CoMMAIntType max_card,
- 270 std::optional<CoMMAIntType> &new_compactness)
const {
-
- 272 std::unordered_map<CoMMAIndexType, CoMMAIntType> card{};
- 273 std::unordered_map<CoMMAIndexType, CoMMAIntType> compact{};
- 274 const auto n_neighs = neighs.size();
- 275 card.reserve(n_neighs);
-
-
- 278 std::deque<CoMMAIndexType> argtrue_compact{};
-
- 280 for (
const auto &cc_idx : neighs) {
- 281 const auto n_cc =
_ccs.at(cc_idx);
- 282 if (n_cc->_is_isotropic) {
-
-
-
-
-
- 288 card[cc_idx] = n_cc->_cardinality;
-
- 290 auto tmp_cc = n_cc->_s_fc;
- 291 tmp_cc.insert(fcs.begin(), fcs.end());
-
- 293 _fc_graph->compute_min_fc_compactness_inside_a_cc(tmp_cc);
- 294 compact[cc_idx] = new_cpt;
- 295 if (new_cpt > n_cc->_compactness) {
- 296 argtrue_compact.push_back(cc_idx);
-
-
-
-
- 301 if (!argtrue_compact.empty()) {
-
- 303 sort(argtrue_compact.begin(), argtrue_compact.end());
- 304 CoMMAIndexType ret_cc{argtrue_compact[0]};
- 305 CoMMAIntType cur_min{card[ret_cc]};
-
- 307 for (
const auto &idx : argtrue_compact) {
- 308 const auto cur_card = card[idx];
- 309 if (cur_card < cur_min) {
-
-
-
-
- 314 new_compactness = compact.at(ret_cc);
-
-
-
-
-
-
- 334 const CoMMAIndexType fc,
- 335 const std::set<CoMMAIndexType> &neighs,
- 336 const CoMMAIntType max_card,
- 337 std::optional<CoMMAIntType> &new_compactness)
const {
-
- 339 std::unordered_map<CoMMAIndexType, CoMMAIntType> card{};
- 340 std::unordered_map<CoMMAIndexType, CoMMAIntType> shared_faces{};
- 341 std::unordered_map<CoMMAIndexType, CoMMAIntType> compact{};
- 342 const auto n_neighs = neighs.size();
- 343 card.reserve(n_neighs);
- 344 shared_faces.reserve(n_neighs);
- 345 CoMMAIntType min_card = std::numeric_limits<CoMMAIntType>::max();
- 346 CoMMAIntType max_shared_f{0};
-
-
- 349 std::deque<CoMMAIndexType> argmin_card{};
- 350 std::deque<CoMMAIndexType> argmax_shared_f{};
- 351 std::deque<CoMMAIndexType> argtrue_compact{};
- 352 std::deque<CoMMAIndexType> iso_neighs{};
-
- 354 for (
const auto &cc_idx : neighs) {
- 355 const auto n_cc =
_ccs.at(cc_idx);
- 356 if (n_cc->_is_isotropic) {
- 357 iso_neighs.push_back(cc_idx);
-
-
-
-
-
- 363 const auto cur_card = n_cc->_cardinality;
- 364 card[cc_idx] = cur_card;
- 365 if (cur_card < min_card) {
-
-
- 368 argmin_card.push_back(cc_idx);
- 369 }
else if (cur_card == min_card) {
- 370 argmin_card.push_back(cc_idx);
-
-
-
- 374 shared_faces[cc_idx] = cur_sf;
- 375 if (cur_sf > max_shared_f) {
- 376 max_shared_f = cur_sf;
- 377 argmax_shared_f.clear();
- 378 argmax_shared_f.push_back(cc_idx);
- 379 }
else if (cur_sf == max_shared_f) {
- 380 argmax_shared_f.push_back(cc_idx);
-
-
- 383 auto tmp_cc = n_cc->_s_fc;
-
-
- 386 _fc_graph->compute_min_fc_compactness_inside_a_cc(tmp_cc);
- 387 compact[cc_idx] = new_cpt;
- 388 if (new_cpt > n_cc->_compactness) {
- 389 argtrue_compact.push_back(cc_idx);
-
-
-
-
-
-
- 396 if (!argtrue_compact.empty()) {
-
- 398 sort(argtrue_compact.begin(), argtrue_compact.end());
- 399 CoMMAIndexType ret_cc{argtrue_compact[0]};
- 400 CoMMAIntType cur_max{shared_faces[ret_cc]};
-
- 402 for (
const auto &idx : argtrue_compact) {
- 403 const auto cur_shf = shared_faces[idx];
- 404 if (cur_shf > cur_max) {
-
-
- 407 }
else if (cur_shf == cur_max && card[idx] < card[ret_cc]) {
-
-
-
- 411 new_compactness = compact.at(ret_cc);
-
-
-
- 415 if (!argmax_shared_f.empty()) {
-
- 417 sort(argmax_shared_f.begin(), argmax_shared_f.end());
- 418 CoMMAIndexType ret_cc{argmax_shared_f[0]};
- 419 CoMMAIntType cur_min{card[ret_cc]};
-
-
- 422 for (
const auto &idx : argmax_shared_f) {
- 423 if (card[idx] < cur_min) {
-
- 425 cur_min = card[ret_cc];
-
-
- 428 new_compactness = compact.at(ret_cc);
-
-
-
- 432 if (!argmin_card.empty()) {
-
-
-
-
-
- 438 *(min_element(argmin_card.begin(), argmin_card.end()));
- 439 new_compactness = compact.at(ret_cc);
-
-
-
- 443 if (!iso_neighs.empty())
return iso_neighs[0];
-
-
-
-
-
-
- 456 CoMMAIntType shared_faces{0};
- 457 for (
const auto &i_fc : cc->_s_fc) {
- 458 shared_faces += count(
-
-
-
-
-
-
-
- 476 const std::unordered_set<CoMMAIndexType> &s_fc,
- 477 const CoMMAIntType compactness,
- 478 bool is_anisotropic =
false,
- 479 bool is_creation_delayed =
false) {
-
- 481 assert((!is_anisotropic) || (!is_creation_delayed));
- 482 for (
const auto &i_fc : s_fc) {
- 483 assert(!
_fc_2_cc[i_fc].has_value());
-
-
-
-
-
-
-
- 491 bool is_mutable =
true;
- 492 if (is_anisotropic) {
-
-
-
-
-
- 498 if (!is_creation_delayed) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 517 for (
const auto &i_fc : s_fc) {
-
- 519 assert(!
_fc_2_cc[i_fc].has_value());
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ 225 removed_cc.emplace(old_cc);
+
+
+
+
+
+ 231 if (!removed_cc.empty()) {
+ 232 auto new_ID = *(removed_cc.begin());
+
+
+
+
+ 237 auto it_cc =
_ccs.begin();
+
+ 239 it_cc =
_ccs.find(new_ID - 1);
+
+
+ 242 for (; it_cc !=
_ccs.end(); ++it_cc, ++new_ID) {
+
+ 244 for (
auto const &i_fc : it_cc->second->_s_fc) {
+
+
+
+ 248 auto node =
_ccs.extract(it_cc);
+
+
+ 251 _ccs.insert(std::move(node));
+
+
+
+
+
+
+ 272 const std::unordered_set<CoMMAIndexType> &fcs,
+ 273 const std::set<CoMMAIndexType> &neighs,
+ 274 const CoMMAIntType max_card,
+ 275 std::optional<CoMMAIntType> &new_compactness
+
+
+ 278 std::unordered_map<CoMMAIndexType, CoMMAIntType> card{};
+ 279 std::unordered_map<CoMMAIndexType, CoMMAIntType> compact{};
+ 280 const auto n_neighs = neighs.size();
+ 281 card.reserve(n_neighs);
+
+
+ 284 std::deque<CoMMAIndexType> argtrue_compact{};
+
+ 286 for (
const auto &cc_idx : neighs) {
+ 287 const auto n_cc =
_ccs.at(cc_idx);
+ 288 if (n_cc->_is_isotropic) {
+
+
+
+
+
+ 294 card[cc_idx] = n_cc->_cardinality;
+
+ 296 auto tmp_cc = n_cc->_s_fc;
+ 297 tmp_cc.insert(fcs.begin(), fcs.end());
+
+ 299 _fc_graph->compute_min_fc_compactness_inside_a_cc(tmp_cc);
+ 300 compact[cc_idx] = new_cpt;
+ 301 if (new_cpt > n_cc->_compactness) {
+ 302 argtrue_compact.push_back(cc_idx);
+
+
+
+
+ 307 if (!argtrue_compact.empty()) {
+
+ 309 sort(argtrue_compact.begin(), argtrue_compact.end());
+ 310 CoMMAIndexType ret_cc{argtrue_compact[0]};
+ 311 CoMMAIntType cur_min{card[ret_cc]};
+
+ 313 for (
const auto &idx : argtrue_compact) {
+ 314 const auto cur_card = card[idx];
+ 315 if (cur_card < cur_min) {
+
+
+
+
+ 320 new_compactness = compact.at(ret_cc);
+
+
+
+
+
+
+ 340 const CoMMAIndexType fc,
+ 341 const std::set<CoMMAIndexType> &neighs,
+ 342 const CoMMAIntType max_card,
+ 343 std::optional<CoMMAIntType> &new_compactness
+
+
+ 346 std::unordered_map<CoMMAIndexType, CoMMAIntType> card{};
+ 347 std::unordered_map<CoMMAIndexType, CoMMAIntType> shared_faces{};
+ 348 std::unordered_map<CoMMAIndexType, CoMMAIntType> compact{};
+ 349 const auto n_neighs = neighs.size();
+ 350 card.reserve(n_neighs);
+ 351 shared_faces.reserve(n_neighs);
+ 352 CoMMAIntType min_card = std::numeric_limits<CoMMAIntType>::max();
+ 353 CoMMAIntType max_shared_f{0};
+
+
+ 356 std::deque<CoMMAIndexType> argmin_card{};
+ 357 std::deque<CoMMAIndexType> argmax_shared_f{};
+ 358 std::deque<CoMMAIndexType> argtrue_compact{};
+ 359 std::deque<CoMMAIndexType> iso_neighs{};
+
+ 361 for (
const auto &cc_idx : neighs) {
+ 362 const auto n_cc =
_ccs.at(cc_idx);
+ 363 if (n_cc->_is_isotropic) {
+ 364 iso_neighs.push_back(cc_idx);
+
+
+
+
+
+ 370 const auto cur_card = n_cc->_cardinality;
+ 371 card[cc_idx] = cur_card;
+ 372 if (cur_card < min_card) {
+
+
+ 375 argmin_card.push_back(cc_idx);
+ 376 }
else if (cur_card == min_card) {
+ 377 argmin_card.push_back(cc_idx);
+
+
+
+ 381 shared_faces[cc_idx] = cur_sf;
+ 382 if (cur_sf > max_shared_f) {
+ 383 max_shared_f = cur_sf;
+ 384 argmax_shared_f.clear();
+ 385 argmax_shared_f.push_back(cc_idx);
+ 386 }
else if (cur_sf == max_shared_f) {
+ 387 argmax_shared_f.push_back(cc_idx);
+
+
+ 390 auto tmp_cc = n_cc->_s_fc;
+
+
+ 393 _fc_graph->compute_min_fc_compactness_inside_a_cc(tmp_cc);
+ 394 compact[cc_idx] = new_cpt;
+ 395 if (new_cpt > n_cc->_compactness) {
+ 396 argtrue_compact.push_back(cc_idx);
+
+
+
+
+
+
+ 403 if (!argtrue_compact.empty()) {
+
+ 405 sort(argtrue_compact.begin(), argtrue_compact.end());
+ 406 CoMMAIndexType ret_cc{argtrue_compact[0]};
+ 407 CoMMAIntType cur_max{shared_faces[ret_cc]};
+
+ 409 for (
const auto &idx : argtrue_compact) {
+ 410 const auto cur_shf = shared_faces[idx];
+ 411 if (cur_shf > cur_max) {
+
+
+ 414 }
else if (cur_shf == cur_max && card[idx] < card[ret_cc]) {
+
+
+
+ 418 new_compactness = compact.at(ret_cc);
+
+
+
+ 422 if (!argmax_shared_f.empty()) {
+
+ 424 sort(argmax_shared_f.begin(), argmax_shared_f.end());
+ 425 CoMMAIndexType ret_cc{argmax_shared_f[0]};
+ 426 CoMMAIntType cur_min{card[ret_cc]};
+
+
+ 429 for (
const auto &idx : argmax_shared_f) {
+ 430 if (card[idx] < cur_min) {
+
+ 432 cur_min = card[ret_cc];
+
+
+ 435 new_compactness = compact.at(ret_cc);
+
+
+
+ 439 if (!argmin_card.empty()) {
+
+
+
+
+
+ 445 *(min_element(argmin_card.begin(), argmin_card.end()));
+ 446 new_compactness = compact.at(ret_cc);
+
+
+
+ 450 if (!iso_neighs.empty())
return iso_neighs[0];
+
+
+
+
+
+
+
+ 464 CoMMAIntType shared_faces{0};
+ 465 for (
const auto &i_fc : cc->_s_fc) {
+ 466 shared_faces += count(
+
+
+
+
+
+
+
+ 484 const std::unordered_set<CoMMAIndexType> &s_fc,
+ 485 const CoMMAIntType compactness,
+ 486 bool is_anisotropic =
false,
+ 487 bool is_creation_delayed =
false
+
+
+ 490 assert((!is_anisotropic) || (!is_creation_delayed));
+ 491 for (
const auto &i_fc : s_fc) {
+ 492 assert(!
_fc_2_cc[i_fc].has_value());
+
+
+
+
+
+
+
+ 500 bool is_mutable =
true;
+ 501 if (is_anisotropic) {
+
+
+
+
+
+
+ 508 if (!is_creation_delayed) {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 527 for (
const auto &i_fc : s_fc) {
+
+ 529 assert(!
_fc_2_cc[i_fc].has_value());
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
- 554 std::vector<std::pair<std::unordered_set<CoMMAIndexType>, CoMMAIntType>>
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ 564 std::vector<std::pair<std::unordered_set<CoMMAIndexType>, CoMMAIntType>>
+
+
+
+
+
+
+
+
#define CoMMAUnused(var)
Convenient function to avoid unused warnings.
Definition: Util.h:34
Class implementing a custom container where the coarse cells are stored.
Definition: Coarse_Cell_Container.h:41
-std::map< CoMMAIndexType, CoarseCellPtr > _ccs
Map containing the CC and their ID.
Definition: Coarse_Cell_Container.h:75
-std::optional< CoMMAIndexType > select_best_cc_to_agglomerate_whole(const std::unordered_set< CoMMAIndexType > &fcs, const std::set< CoMMAIndexType > &neighs, const CoMMAIntType max_card, std::optional< CoMMAIntType > &new_compactness) const
Choose among the neighbouring coarse cells, the one to which a singular coarse cell should be assigne...
Definition: Coarse_Cell_Container.h:266
-std::deque< CoMMAIndexType > _singular_cc
Set of singular coarse cells, that is, composed of only one fine cell.
Definition: Coarse_Cell_Container.h:559
-CoMMAIndexType _nb_of_agglomerated_fc
Number of agglomerated fine cells.
Definition: Coarse_Cell_Container.h:548
-CoMMAIntType _sing_card_thresh
Minimum cardinality for receiver CC when correcting.
Definition: Coarse_Cell_Container.h:92
-std::vector< std::pair< std::unordered_set< CoMMAIndexType >, CoMMAIntType > > _delayed_cc
Vector of the set of fine cells composing the too small coarse cells that will be built at the end of...
Definition: Coarse_Cell_Container.h:555
-std::vector< std::optional< CoMMAIndexType > > _fc_2_cc
Output vector identifying to which coarse cell the fine cell belongs.
Definition: Coarse_Cell_Container.h:85
+std::map< CoMMAIndexType, CoarseCellPtr > _ccs
Map containing the CC and their ID.
Definition: Coarse_Cell_Container.h:76
+std::optional< CoMMAIndexType > select_best_cc_to_agglomerate_whole(const std::unordered_set< CoMMAIndexType > &fcs, const std::set< CoMMAIndexType > &neighs, const CoMMAIntType max_card, std::optional< CoMMAIntType > &new_compactness) const
Choose among the neighbouring coarse cells, the one to which a singular coarse cell should be assigne...
Definition: Coarse_Cell_Container.h:271
+std::deque< CoMMAIndexType > _singular_cc
Set of singular coarse cells, that is, composed of only one fine cell.
Definition: Coarse_Cell_Container.h:569
+CoMMAIndexType _nb_of_agglomerated_fc
Number of agglomerated fine cells.
Definition: Coarse_Cell_Container.h:558
+CoMMAIntType _sing_card_thresh
Minimum cardinality for receiver CC when correcting.
Definition: Coarse_Cell_Container.h:93
+std::vector< std::pair< std::unordered_set< CoMMAIndexType >, CoMMAIntType > > _delayed_cc
Vector of the set of fine cells composing the too small coarse cells that will be built at the end of...
Definition: Coarse_Cell_Container.h:565
+std::vector< std::optional< CoMMAIndexType > > _fc_2_cc
Output vector identifying to which coarse cell the fine cell belongs.
Definition: Coarse_Cell_Container.h:86
std::shared_ptr< CoarseCellType > CoarseCellPtr
Type for a shared pointer to a Dual_Graph object.
Definition: Coarse_Cell_Container.h:48
typename CoarseCellType::DualGraphPtr DualGraphPtr
Type for a shared pointer to a Dual_Graph object.
Definition: Coarse_Cell_Container.h:51
-CoMMAIndexType _cc_counter
Number of coarse cells.
Definition: Coarse_Cell_Container.h:81
-std::optional< CoMMAIndexType > select_best_cc_to_agglomerate(const CoMMAIndexType fc, const std::set< CoMMAIndexType > &neighs, const CoMMAIntType max_card, std::optional< CoMMAIntType > &new_compactness) const
Choose among the neighbouring coarse cells, the one to which a fine cell should be assigned to....
Definition: Coarse_Cell_Container.h:333
-CoMMAIndexType create_cc(const std::unordered_set< CoMMAIndexType > &s_fc, const CoMMAIntType compactness, bool is_anisotropic=false, bool is_creation_delayed=false)
It creates a coarse cell based on the set of fine cells given as input.
Definition: Coarse_Cell_Container.h:475
-CoMMAIndexType get_number_of_fc_agglomerated() const
Helper to get the member variable that defines the number of agglomerated fine cells.
Definition: Coarse_Cell_Container.h:98
-std::vector< bool > _is_fc_agglomerated
Vector of boolean telling whether a fine cell has been agglomerated.
Definition: Coarse_Cell_Container.h:89
-CoMMAIndexType get_nb_of_cc() const
Helper to get the number of coarse cells.
Definition: Coarse_Cell_Container.h:105
-DualGraphPtr _fc_graph
Dual graph representation.
Definition: Coarse_Cell_Container.h:78
-CoMMAIntType get_shared_faces(const CoMMAIndexType fc, const CoarseCellPtr cc) const
Compute the number of faces shared between a fine cell and a coarse one.
Definition: Coarse_Cell_Container.h:454
+CoMMAIndexType _cc_counter
Number of coarse cells.
Definition: Coarse_Cell_Container.h:82
+std::optional< CoMMAIndexType > select_best_cc_to_agglomerate(const CoMMAIndexType fc, const std::set< CoMMAIndexType > &neighs, const CoMMAIntType max_card, std::optional< CoMMAIntType > &new_compactness) const
Choose among the neighbouring coarse cells, the one to which a fine cell should be assigned to....
Definition: Coarse_Cell_Container.h:339
+CoMMAIndexType create_cc(const std::unordered_set< CoMMAIndexType > &s_fc, const CoMMAIntType compactness, bool is_anisotropic=false, bool is_creation_delayed=false)
It creates a coarse cell based on the set of fine cells given as input.
Definition: Coarse_Cell_Container.h:483
+CoMMAIndexType get_number_of_fc_agglomerated() const
Helper to get the member variable that defines the number of agglomerated fine cells.
Definition: Coarse_Cell_Container.h:99
+std::vector< bool > _is_fc_agglomerated
Vector of boolean telling whether a fine cell has been agglomerated.
Definition: Coarse_Cell_Container.h:90
+CoMMAIndexType get_nb_of_cc() const
Helper to get the number of coarse cells.
Definition: Coarse_Cell_Container.h:106
+DualGraphPtr _fc_graph
Dual graph representation.
Definition: Coarse_Cell_Container.h:79
+CoMMAIntType get_shared_faces(const CoMMAIndexType fc, const CoarseCellPtr cc) const
Compute the number of faces shared between a fine cell and a coarse one.
Definition: Coarse_Cell_Container.h:461
~Coarse_Cell_Container()=default
Destructor.
Coarse_Cell_Container(DualGraphPtr &fc_graph, const CoMMAIntType singular_card_thresh)
Create a Coarse_Cell_Container.
Definition: Coarse_Cell_Container.h:59
-std::set< CoMMAIndexType > get_neighs_cc(const CoMMAIndexType &i_fc, const CoMMAIndexType &i_cc) const
Retrieve the indexes of the neighbouring coarse cells to a given fine cell in a coarse cell (excludin...
Definition: Coarse_Cell_Container.h:115
-void correct(const CoMMAIntType max_card)
Implementation of the correction. In this version it implements the correction of singular cells (if ...
Definition: Coarse_Cell_Container.h:161
-void cc_create_all_delayed_cc()
Creates all the delayed coarse cell. It works only when the delayed cell flag is activated in the agg...
Definition: Coarse_Cell_Container.h:539
+std::set< CoMMAIndexType > get_neighs_cc(const CoMMAIndexType &i_fc, const CoMMAIndexType &i_cc) const
Retrieve the indexes of the neighbouring coarse cells to a given fine cell in a coarse cell (excludin...
Definition: Coarse_Cell_Container.h:116
+void correct(const CoMMAIntType max_card)
Implementation of the correction. In this version it implements the correction of singular cells (if ...
Definition: Coarse_Cell_Container.h:164
+void cc_create_all_delayed_cc()
Creates all the delayed coarse cell. It works only when the delayed cell flag is activated in the agg...
Definition: Coarse_Cell_Container.h:549
Class describing a coarse cell.
Definition: Coarse_Cell.h:37
std::shared_ptr< Dual_Graph< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > DualGraphPtr
Type for a shared pointer to a Dual_Graph object.
Definition: Coarse_Cell.h:41
Definition: Agglomerator.h:34
diff --git a/_dual___graph_8h_source.html b/_dual___graph_8h_source.html
index a2f71b3..c70be8e 100644
--- a/_dual___graph_8h_source.html
+++ b/_dual___graph_8h_source.html
@@ -141,628 +141,668 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 104 void DFS(
const CoMMAIndexType &i_fc) {
-
-
-
-
-
-
- 114 void BFS(
const CoMMAIndexType &root) {
- 115 std::deque<CoMMAIndexType> coda;
-
- 117 coda.push_back(root);
-
- 119 visited[root] =
true;
- 120 std::vector<std::optional<CoMMAIndexType>> prev(
-
- 122 while (!coda.empty()) {
- 123 CoMMAIndexType node = coda.front();
-
-
-
-
-
-
-
-
-
-
-
-
- 136 while (retro.has_value()) {
- 137 path.push_back(retro);
-
-
- 140 reverse(path.begin(), path.end());
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 177 const CoMMAIndexType &i_c)
const {
-
-
-
-
- 187 const CoMMAIndexType &i_c)
const {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 214 const CoMMAIndexType &i_c)
const {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 237 if (!
_visited[i]) {
return (
false); }
-
-
-
-
-
- 247 const std::unordered_set<CoMMAIndexType> &s_fc)
const {
-
-
- 250 if (s_fc.size() > 1) {
- 251 std::unordered_map<CoMMAIndexType, CoMMAIntType> dict_fc_compactness =
-
- 253 if (dict_fc_compactness.empty()) {
return 0; }
-
- 255 dict_fc_compactness.begin(), dict_fc_compactness.end(),
- 256 [](
const auto &left,
const auto &right) {
- 257 return left.second < right.second;
-
-
-
-
-
-
- 270 std::unordered_map<CoMMAIndexType, CoMMAIntType>
-
- 272 const std::unordered_set<CoMMAIndexType> &s_fc)
const {
- 273 std::unordered_map<CoMMAIndexType, CoMMAIntType> dict_fc_compactness;
-
- 275 if (s_fc.size() == 1) {
- 276 dict_fc_compactness[*s_fc.begin()] = 0;
-
- 278 for (
const CoMMAIndexType &i_fc : s_fc) {
- 279 dict_fc_compactness[i_fc] = count_if(
- 280 this->_m_CRS_Col_Ind.cbegin() + this->_m_CRS_Row_Ptr[i_fc],
- 281 this->_m_CRS_Col_Ind.cbegin() + this->_m_CRS_Row_Ptr[i_fc + 1],
- 282 [&](
const auto &neigh) { return s_fc.count(neigh) > 0; });
-
-
-
- 286 return dict_fc_compactness;
-
-
-
-
- 299 typename CoMMAIndexType,
- 300 typename CoMMAWeightType,
- 301 typename CoMMAIntType>
- 302class Subgraph :
public Graph<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
-
-
-
-
-
- 324 const CoMMAIndexType &nb_c,
-
-
-
-
-
- 330 const bool &is_isotropic) :
- 331 Graph<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
- 332 nb_c, m_crs_row_ptr, m_crs_col_ind, m_crs_values, volumes),
-
-
-
-
-
- 338 for (
auto c =
decltype(nb_c){0}; c < nb_c; ++c) {
- 339 const auto n_neighs =
- 340 static_cast<CoMMAIntType
>(m_crs_row_ptr[c + 1] - m_crs_row_ptr[c]);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 377 const CoMMAIndexType &i_fc,
- 378 const CoMMAWeightType &volume,
-
-
-
-
-
-
- 385 for (
const auto &elem : v_neigh) {
-
-
-
-
-
-
-
- 393 CoMMAIntType iter_weight = 0;
-
-
-
-
-
-
- 400 for (
const auto &elem : v_l_neigh) {
-
-
-
-
-
- 406 this->
_m_CRS_Col_Ind.begin() + this->_m_CRS_Row_Ptr[elem], local_index);
-
-
- 409 weight[iter_weight]);
-
-
-
- 413 it != this->_m_CRS_Row_Ptr.end(); ++it) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 443 for (
const auto &elem : v_neigh) {
-
-
-
- 447 for (
auto it = pos_col + ind; it != pos_col + ind_p_one; ++it) {
-
-
-
-
-
-
-
- 455 it_bis != this->_m_CRS_Row_Ptr.end(); ++it_bis) {
- 456 *it_bis = *it_bis - 1;
-
-
-
-
-
-
-
-
- 465 for (
auto it = pos_col + ind; it != pos_col + ind_p_one; ++it) {
-
-
-
-
-
-
- 472 it_bis != this->_m_CRS_Row_Ptr.end(); ++it_bis) {
- 473 *it_bis = *it_bis - 1;
-
-
-
-
-
-
- 480 auto volumes_pointer = this->
_volumes.begin() + i_fc;
- 481 this->
_volumes.erase(volumes_pointer);
-
-
-
-
-
- 487 std::vector<std::optional<CoMMAIndexType>> internal_mapping;
-
- 489 CoMMAIndexType indice = 0;
-
-
- 492 if (
static_cast<decltype(i_fc)
>(ix) != i_fc) {
- 493 internal_mapping.push_back(indice);
-
-
- 496 internal_mapping.push_back(std::nullopt);
-
-
-
- 500 assert(internal_mapping[actual].has_value());
- 501 actual = internal_mapping[actual].value();
-
-
-
-
-
- 514 typename CoMMAIndexType,
- 515 typename CoMMAWeightType,
- 516 typename CoMMAIntType>
-
-
-
-
-
-
-
- 529 std::set<CoMMAPairType, CustomPairGreaterFunctor<CoMMAPairType>>;
-
-
- 547 const CoMMAIndexType &nb_c,
-
-
-
-
- 552 const std::vector<std::vector<CoMMAWeightType>> ¢ers,
- 553 const std::vector<CoMMAIntType> &n_bnd_faces,
- 554 const CoMMAIntType dimension,
-
- 556 Graph<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
- 557 nb_c, m_crs_row_ptr, m_crs_col_ind, m_crs_values, volumes),
-
-
- 560 anisotropic_compliant_fc.begin(), anisotropic_compliant_fc.end()),
-
-
-
- 564 ? [](
const CoMMAWeightType min_s,
const CoMMAWeightType max_s)
- 565 -> CoMMAWeightType {
return max_s / min_s; }
- 566 : [](
const CoMMAWeightType min_s,
const CoMMAWeightType max_s)
- 567 -> CoMMAWeightType {
return sqrt(max_s / min_s); };
-
-
-
-
-
-
-
-
- 584 const std::vector<std::vector<CoMMAWeightType>> &
_centers;
-
- 591 std::function<CoMMAWeightType(
const CoMMAWeightType,
const CoMMAWeightType)>
-
-
-
-
-
-
-
-
-
-
-
- 628 std::vector<bool> &is_anisotropic,
- 629 std::deque<CoMMAIndexType> &aniso_seeds_pool,
- 630 const CoMMAWeightType threshold_anisotropy,
-
- 632 const CoMMAIndexType preserving) {
-
- 634 if (threshold_anisotropy < 0) {
-
- 636 aniso_w_weights.emplace(i_fc, priority_weights[i_fc]);
-
-
-
-
-
- 642 CoMMAWeightType min_weight =
- 643 std::numeric_limits<CoMMAWeightType>::max();
- 644 CoMMAWeightType max_weight = 0.0;
-
-
-
-
-
-
-
-
- 653 assert(v_neighbours.size() == v_weights.size());
- 654 auto nb_neighbours = v_neighbours.size();
-
- 656 for (
auto i_n =
decltype(nb_neighbours){0}; i_n < nb_neighbours;
-
-
- 659 if (v_neighbours[i_n] != i_fc) {
- 660 const CoMMAWeightType i_w_fc_n = v_weights[i_n];
- 661 if (max_weight < i_w_fc_n) { max_weight = i_w_fc_n; }
- 662 if (min_weight > i_w_fc_n) { min_weight = i_w_fc_n; }
-
-
-
-
-
- 668 max_weights[i_fc] = max_weight;
-
- 670 const auto ar =
_compute_AR(min_weight, max_weight);
-
- 672 if (ar >= threshold_anisotropy) {
- 673 switch (preserving) {
-
-
-
- 677 || nb_neighbours == 4)
- 678 aniso_w_weights.emplace(i_fc, priority_weights[i_fc]);
-
-
-
-
- 683 || nb_neighbours == 6)
- 684 aniso_w_weights.emplace(i_fc, priority_weights[i_fc]);
-
-
-
-
- 689 aniso_w_weights.emplace(i_fc, priority_weights[i_fc]);
-
-
-
-
-
-
-
- 697 for (
const auto &[i_fc, w] : aniso_w_weights) {
- 698 is_anisotropic[i_fc] =
true;
- 699 aniso_seeds_pool.emplace_back(i_fc);
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 105 void DFS(
const CoMMAIndexType &i_fc) {
+
+
+
+
+
+
+
+
+ 117 void BFS(
const CoMMAIndexType &root) {
+ 118 std::deque<CoMMAIndexType> coda;
+
+ 120 coda.push_back(root);
+
+ 122 visited[root] =
true;
+ 123 std::vector<std::optional<CoMMAIndexType>> prev(
+
+
+ 126 while (!coda.empty()) {
+ 127 CoMMAIndexType node = coda.front();
+
+
+
+
+
+
+
+
+
+
+
+
+ 140 while (retro.has_value()) {
+ 141 path.push_back(retro);
+
+
+ 144 reverse(path.begin(), path.end());
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 257 const std::unordered_set<CoMMAIndexType> &s_fc
+
+
+
+ 261 if (s_fc.size() > 1) {
+ 262 std::unordered_map<CoMMAIndexType, CoMMAIntType> dict_fc_compactness =
+
+ 264 if (dict_fc_compactness.empty()) {
+
+
+
+ 268 dict_fc_compactness.begin(),
+ 269 dict_fc_compactness.end(),
+ 270 [](
const auto &left,
const auto &right) {
+ 271 return left.second < right.second;
+
+
+
+
+
+
+ 284 std::unordered_map<CoMMAIndexType, CoMMAIntType>
+
+ 286 const std::unordered_set<CoMMAIndexType> &s_fc
+
+ 288 std::unordered_map<CoMMAIndexType, CoMMAIntType> dict_fc_compactness;
+
+ 290 if (s_fc.size() == 1) {
+ 291 dict_fc_compactness[*s_fc.begin()] = 0;
+
+ 293 for (
const CoMMAIndexType &i_fc : s_fc) {
+ 294 dict_fc_compactness[i_fc] = count_if(
+ 295 this->_m_CRS_Col_Ind.cbegin() + this->_m_CRS_Row_Ptr[i_fc],
+ 296 this->_m_CRS_Col_Ind.cbegin() + this->_m_CRS_Row_Ptr[i_fc + 1],
+ 297 [&](
const auto &neigh) { return s_fc.count(neigh) > 0; }
+
+
+
+
+ 302 return dict_fc_compactness;
+
+
+
+
+ 315 typename CoMMAIndexType,
+ 316 typename CoMMAWeightType,
+ 317 typename CoMMAIntType>
+ 318class Subgraph :
public Graph<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
+
+
+
+
+
+
+ 341 const CoMMAIndexType &nb_c,
+
+
+
+
+
+ 347 const bool &is_isotropic
+
+ 349 Graph<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
+ 350 nb_c, m_crs_row_ptr, m_crs_col_ind, m_crs_values, volumes
+
+
+
+
+
+
+ 357 for (
auto c =
decltype(nb_c){0}; c < nb_c; ++c) {
+ 358 const auto n_neighs =
+ 359 static_cast<CoMMAIntType
>(m_crs_row_ptr[c + 1] - m_crs_row_ptr[c]);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 398 const CoMMAIndexType &i_fc,
+ 399 const CoMMAWeightType &volume,
+
+
+
+
+
+
+
+ 407 for (
const auto &elem : v_neigh) {
+
+
+
+
+
+
+
+ 415 CoMMAIntType iter_weight = 0;
+
+
+
+
+
+
+ 422 for (
const auto &elem : v_l_neigh) {
+
+
+
+
+
+ 428 this->
_m_CRS_Col_Ind.begin() + this->_m_CRS_Row_Ptr[elem], local_index
+
+
+
+
+
+
+
+
+ 437 it != this->_m_CRS_Row_Ptr.end();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 469 for (
const auto &elem : v_neigh) {
+
+
+
+ 473 for (
auto it = pos_col + ind; it != pos_col + ind_p_one; ++it) {
+
+
+
+
+
+
+
+ 481 it_bis != this->_m_CRS_Row_Ptr.end();
+
+ 483 *it_bis = *it_bis - 1;
+
+
+
+
+
+
+
+
+ 492 for (
auto it = pos_col + ind; it != pos_col + ind_p_one; ++it) {
+
+
+
+
+
+
+ 499 it_bis != this->_m_CRS_Row_Ptr.end();
+
+ 501 *it_bis = *it_bis - 1;
+
+
+
+
+
+
+ 508 auto volumes_pointer = this->
_volumes.begin() + i_fc;
+ 509 this->
_volumes.erase(volumes_pointer);
+
+
+
+
+
+ 515 std::vector<std::optional<CoMMAIndexType>> internal_mapping;
+
+ 517 CoMMAIndexType indice = 0;
+
+
+
+ 521 if (
static_cast<decltype(i_fc)
>(ix) != i_fc) {
+ 522 internal_mapping.push_back(indice);
+
+
+ 525 internal_mapping.push_back(std::nullopt);
+
+
+
+ 529 assert(internal_mapping[actual].has_value());
+ 530 actual = internal_mapping[actual].value();
+
+
+
+
+
+ 543 typename CoMMAIndexType,
+ 544 typename CoMMAWeightType,
+ 545 typename CoMMAIntType>
+
+
+
+
+
+
+
+ 558 std::set<CoMMAPairType, CustomPairGreaterFunctor<CoMMAPairType>>;
+
+
+ 576 const CoMMAIndexType &nb_c,
+
+
+
+
+ 581 const std::vector<std::vector<CoMMAWeightType>> ¢ers,
+ 582 const std::vector<CoMMAIntType> &n_bnd_faces,
+ 583 const CoMMAIntType dimension,
+
+
+ 586 Graph<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
+ 587 nb_c, m_crs_row_ptr, m_crs_col_ind, m_crs_values, volumes
+
+
+
+ 591 anisotropic_compliant_fc.begin(), anisotropic_compliant_fc.end()
+
+
+
+
+
+ 597 const CoMMAWeightType min_s,
const CoMMAWeightType max_s
+ 598 ) -> CoMMAWeightType {
return max_s / min_s; }
+
+ 600 const CoMMAWeightType min_s,
const CoMMAWeightType max_s
+ 601 ) -> CoMMAWeightType {
return sqrt(max_s / min_s); };
+
+
+
+
+
+
+
+
+ 618 const std::vector<std::vector<CoMMAWeightType>> &
_centers;
+
+ 625 std::function<CoMMAWeightType(
const CoMMAWeightType,
const CoMMAWeightType)>
+
+
+
+
+
+
+
+
+
+
+
+
+ 663 std::vector<bool> &is_anisotropic,
+ 664 std::deque<CoMMAIndexType> &aniso_seeds_pool,
+ 665 const CoMMAWeightType threshold_anisotropy,
+
+ 667 const CoMMAIndexType preserving
+
+
+ 670 if (threshold_anisotropy < 0) {
+
+ 672 aniso_w_weights.emplace(i_fc, priority_weights[i_fc]);
+
+
+
+
+
+ 678 CoMMAWeightType min_weight =
+ 679 std::numeric_limits<CoMMAWeightType>::max();
+ 680 CoMMAWeightType max_weight = 0.0;
+
+
+
+
+
+
+
+
+ 689 assert(v_neighbours.size() == v_weights.size());
+ 690 auto nb_neighbours = v_neighbours.size();
+
+ 692 for (
auto i_n =
decltype(nb_neighbours){0}; i_n < nb_neighbours;
+
+
+ 695 if (v_neighbours[i_n] != i_fc) {
+ 696 const CoMMAWeightType i_w_fc_n = v_weights[i_n];
+ 697 if (max_weight < i_w_fc_n) {
+ 698 max_weight = i_w_fc_n;
+
+ 700 if (min_weight > i_w_fc_n) {
+ 701 min_weight = i_w_fc_n;
+
+
+
+
+
-
- 717 const std::unordered_set<CoMMAIndexType> &s_seeds,
- 718 const std::vector<bool> &is_fc_agglomerated_tmp)
const {
- 719 std::unordered_set<CoMMAIndexType> cc_neighs{};
- 720 for (
const auto fc : s_seeds)
-
-
- 723 if (!is_fc_agglomerated_tmp[*n] && s_seeds.find(*n) == s_seeds.end())
-
- 725 cc_neighs.insert(*n);
-
-
-
-
- 744 const std::unordered_set<CoMMAIndexType> &s_seeds,
- 745 CoMMAIntType &nb_of_order_of_neighbourhood,
- 746 std::unordered_map<CoMMAIndexType, CoMMAIntType> &d_n_of_seed,
- 747 const CoMMAIntType max_card,
- 748 const std::vector<bool> &is_fc_agglomerated_tmp)
const {
-
- 750 assert(max_card > 1);
-
- 752 std::unordered_map<CoMMAIndexType, CoMMAIntType> d_n_of_order_o_m_one;
-
- 754 for (
const CoMMAIndexType &i_fc : s_seeds) {
- 755 d_n_of_order_o_m_one[i_fc] = 0;
-
-
- 758 CoMMAIntType i_order = 1;
-
- 760 while ((i_order < nb_of_order_of_neighbourhood + 1)
- 761 ||
static_cast<CoMMAIntType
>(
- 762 d_n_of_seed.size() + d_n_of_order_o_m_one.size())
-
- 764 std::unordered_map<CoMMAIndexType, CoMMAIntType> d_n_of_order_o;
-
-
- 767 for (
auto id_M_one : d_n_of_order_o_m_one) {
- 768 d_n_of_seed[id_M_one.first] = id_M_one.second;
-
-
- 771 for (
const auto &i_k_v : d_n_of_order_o_m_one) {
-
-
- 774 CoMMAIndexType seed_tmp = i_k_v.first;
-
-
-
-
-
-
- 781 (d_n_of_seed.count(*i_fc_n) == 0)
- 782 && ((!is_fc_agglomerated_tmp[*i_fc_n]))) {
-
-
- 785 if (d_n_of_order_o.count(*i_fc_n) == 0) {
-
-
- 788 if (d_n_of_order_o_m_one.count(*i_fc_n)) {
-
-
- 791 if (i_order < d_n_of_order_o_m_one[*i_fc_n]) {
-
-
- 794 d_n_of_order_o[*i_fc_n] = i_order;
-
-
-
- 798 d_n_of_order_o[*i_fc_n] = i_order;
-
-
-
-
-
-
-
- 806 if (d_n_of_order_o.empty()) {
-
-
+ 708 max_weights[i_fc] = max_weight;
+
+ 710 const auto ar =
_compute_AR(min_weight, max_weight);
+
+ 712 if (ar >= threshold_anisotropy) {
+ 713 switch (preserving) {
+
+
+ 716 || nb_neighbours == 4)
+ 717 aniso_w_weights.emplace(i_fc, priority_weights[i_fc]);
+
+
+
+ 721 || nb_neighbours == 6)
+ 722 aniso_w_weights.emplace(i_fc, priority_weights[i_fc]);
+
+
+
+
+ 727 aniso_w_weights.emplace(i_fc, priority_weights[i_fc]);
+
+
+
+
+
+
+
+ 735 for (
const auto &[i_fc, w] : aniso_w_weights) {
+ 736 is_anisotropic[i_fc] =
true;
+ 737 aniso_seeds_pool.emplace_back(i_fc);
+
+
+
+
+
+
+ 755 const std::unordered_set<CoMMAIndexType> &s_seeds,
+ 756 const std::vector<bool> &is_fc_agglomerated_tmp
+
+ 758 std::unordered_set<CoMMAIndexType> cc_neighs{};
+ 759 for (
const auto fc : s_seeds)
+
+
+ 762 if (!is_fc_agglomerated_tmp[*n] && s_seeds.find(*n) == s_seeds.end())
+
+ 764 cc_neighs.insert(*n);
+
+
+
+
+ 783 const std::unordered_set<CoMMAIndexType> &s_seeds,
+ 784 CoMMAIntType &nb_of_order_of_neighbourhood,
+ 785 std::unordered_map<CoMMAIndexType, CoMMAIntType> &d_n_of_seed,
+ 786 const CoMMAIntType max_card,
+ 787 const std::vector<bool> &is_fc_agglomerated_tmp
+
+
+ 790 assert(max_card > 1);
+
+ 792 std::unordered_map<CoMMAIndexType, CoMMAIntType> d_n_of_order_o_m_one;
+
+ 794 for (
const CoMMAIndexType &i_fc : s_seeds) {
+ 795 d_n_of_order_o_m_one[i_fc] = 0;
+
+
+ 798 CoMMAIntType i_order = 1;
+
+ 800 while ((i_order < nb_of_order_of_neighbourhood + 1)
+ 801 ||
static_cast<CoMMAIntType
>(
+ 802 d_n_of_seed.size() + d_n_of_order_o_m_one.size()
+
+ 804 std::unordered_map<CoMMAIndexType, CoMMAIntType> d_n_of_order_o;
+
+
+ 807 for (
auto id_M_one : d_n_of_order_o_m_one) {
+ 808 d_n_of_seed[id_M_one.first] = id_M_one.second;
-
- 812 d_n_of_order_o_m_one.clear();
- 813 for (
auto id : d_n_of_order_o) {
- 814 d_n_of_order_o_m_one[
id.first] =
id.second;
-
-
-
-
-
- 820 for (
auto id_M_one : d_n_of_order_o_m_one) {
- 821 d_n_of_seed[id_M_one.first] = id_M_one.second;
-
-
-
- 825 for (
const CoMMAIndexType &i_fc : s_seeds) {
- 826 d_n_of_seed.erase(i_fc);
-
-
- 829 nb_of_order_of_neighbourhood = i_order;
-
-
-
-
-
-
+ 811 for (
const auto &i_k_v : d_n_of_order_o_m_one) {
+
+
+ 814 CoMMAIndexType seed_tmp = i_k_v.first;
+
+
+
+
+
+
+ 821 if ((d_n_of_seed.count(*i_fc_n) == 0)
+ 822 && ((!is_fc_agglomerated_tmp[*i_fc_n]))) {
+
+
+ 825 if (d_n_of_order_o.count(*i_fc_n) == 0) {
+
+
+ 828 if (d_n_of_order_o_m_one.count(*i_fc_n)) {
+
+
+ 831 if (i_order < d_n_of_order_o_m_one[*i_fc_n]) {
+
+
+ 834 d_n_of_order_o[*i_fc_n] = i_order;
+
+
+
+ 838 d_n_of_order_o[*i_fc_n] = i_order;
+
+
+
+
+
+
+
+ 846 if (d_n_of_order_o.empty()) {
+
+
+
+
+
+ 852 d_n_of_order_o_m_one.clear();
+ 853 for (
auto id : d_n_of_order_o) {
+ 854 d_n_of_order_o_m_one[
id.first] =
id.second;
+
+
+
+
+
+ 860 for (
auto id_M_one : d_n_of_order_o_m_one) {
+ 861 d_n_of_seed[id_M_one.first] = id_M_one.second;
+
+
+
+ 865 for (
const CoMMAIndexType &i_fc : s_seeds) {
+ 866 d_n_of_seed.erase(i_fc);
+
+
+ 869 nb_of_order_of_neighbourhood = i_order;
+
+
+
+
+
+
-A class implementing the CRS global graph representation of the global mesh.
Definition: Dual_Graph.h:517
-CoMMAIntType get_n_boundary_faces(const CoMMAIndexType idx_c) const
Return how many boundary faces a certain cell has.
Definition: Dual_Graph.h:598
-CoMMAIntType get_nb_cells() const
Getter that returns the number of cells.
Definition: Dual_Graph.h:706
-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.
Definition: Dual_Graph.h:743
-bool is_on_boundary(const CoMMAIndexType idx_c) const
Whether a cell is on the boundary.
Definition: Dual_Graph.h:605
-const std::vector< std::vector< CoMMAWeightType > > & _centers
Vector of cell centers.
Definition: Dual_Graph.h:584
-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.
Definition: Dual_Graph.h:546
-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.
Definition: Dual_Graph.h:716
-std::pair< CoMMAIndexType, CoMMAWeightType > CoMMAPairType
Type of pair.
Definition: Dual_Graph.h:526
-const std::vector< CoMMAIntType > & _n_bnd_faces
Vector telling how many boundary faces each cell has.
Definition: Dual_Graph.h:574
+A class implementing the CRS global graph representation of the global mesh.
Definition: Dual_Graph.h:546
+CoMMAIntType get_n_boundary_faces(const CoMMAIndexType idx_c) const
Return how many boundary faces a certain cell has.
Definition: Dual_Graph.h:632
+CoMMAIntType get_nb_cells() const
Getter that returns the number of cells.
Definition: Dual_Graph.h:744
+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.
Definition: Dual_Graph.h:782
+bool is_on_boundary(const CoMMAIndexType idx_c) const
Whether a cell is on the boundary.
Definition: Dual_Graph.h:640
+const std::vector< std::vector< CoMMAWeightType > > & _centers
Vector of cell centers.
Definition: Dual_Graph.h:618
+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.
Definition: Dual_Graph.h:575
+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.
Definition: Dual_Graph.h:754
+std::pair< CoMMAIndexType, CoMMAWeightType > CoMMAPairType
Type of pair.
Definition: Dual_Graph.h:555
+const std::vector< CoMMAIntType > & _n_bnd_faces
Vector telling how many boundary faces each cell has.
Definition: Dual_Graph.h:608
std::vector< CoMMAWeightType > ContainerWeightType
Type for containers of weights.
Definition: Dual_Graph.h:49
std::vector< CoMMAIndexType > ContainerIndexType
Type for containers of indices.
Definition: Dual_Graph.h:47
-std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > > CoMMASetOfPairType
Type of set of pairs.
Definition: Dual_Graph.h:529
+std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > > CoMMASetOfPairType
Type of set of pairs.
Definition: Dual_Graph.h:558
~Dual_Graph() override=default
Destructor of the class.
-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: (Recal...
Definition: Dual_Graph.h:592
-void tag_anisotropic_cells(ContainerWeightType &max_weights, std::vector< bool > &is_anisotropic, std::deque< CoMMAIndexType > &aniso_seeds_pool, const CoMMAWeightType threshold_anisotropy, const ContainerWeightType &priority_weights, const CoMMAIndexType preserving)
Tag cells as anisotropic if their aspect-ratio is over a given threshold and order them according to ...
Definition: Dual_Graph.h:626
-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 an...
Definition: Dual_Graph.h:581
+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: (Recal...
Definition: Dual_Graph.h:626
+void tag_anisotropic_cells(ContainerWeightType &max_weights, std::vector< bool > &is_anisotropic, std::deque< CoMMAIndexType > &aniso_seeds_pool, const CoMMAWeightType threshold_anisotropy, const ContainerWeightType &priority_weights, const CoMMAIndexType preserving)
Tag cells as anisotropic if their aspect-ratio is over a given threshold and order them according to ...
Definition: Dual_Graph.h:661
+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 an...
Definition: Dual_Graph.h:615
An interface class responsible of storing the cell centered dual graph and of acting on it (it is an ...
Definition: Dual_Graph.h:44
-ContainerWeightConstIt weights_cbegin(const CoMMAIndexType &i_c) const
Get constant pointer to the first neighbour of cell i_c.
Definition: Dual_Graph.h:213
-ContainerWeightType _m_CRS_Values
Vector of area weight of CRS representation.
Definition: Dual_Graph.h:96
-void DFS(const CoMMAIndexType &i_fc)
Depth First Search (DFS) recursive function.
Definition: Dual_Graph.h:104
+ContainerWeightConstIt weights_cbegin(const CoMMAIndexType &i_c) const
Get constant pointer to the first neighbour of cell i_c.
Definition: Dual_Graph.h:219
+ContainerWeightType _m_CRS_Values
Vector of area weight of CRS representation.
Definition: Dual_Graph.h:97
+void DFS(const CoMMAIndexType &i_fc)
Depth First Search (DFS) recursive function.
Definition: Dual_Graph.h:105
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.
Definition: Dual_Graph.h:64
-ContainerIndexType get_neighbours(const CoMMAIndexType &i_c) const
Based on the CRS representation retrieves the neighbours of the cell given as an input.
Definition: Dual_Graph.h:160
+ContainerIndexType get_neighbours(const CoMMAIndexType &i_c) const
Based on the CRS representation retrieves the neighbours of the cell given as an input.
Definition: Dual_Graph.h:164
typename ContainerWeightType::const_iterator ContainerWeightConstIt
Type for constant iterators of containers of weights.
Definition: Dual_Graph.h:53
-ContainerIndexConstIt neighbours_cend(const CoMMAIndexType &i_c) const
Get constant pointer to the element following the last neighbour of cell i_c.
Definition: Dual_Graph.h:186
-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.
Definition: Dual_Graph.h:246
-CoMMAIntType get_nb_of_neighbours(CoMMAIndexType i_c) const
Retrieve the number of neighbours.
Definition: Dual_Graph.h:150
-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.
Definition: Dual_Graph.h:271
+ContainerIndexConstIt neighbours_cend(const CoMMAIndexType &i_c) const
Get constant pointer to the element following the last neighbour of cell i_c.
Definition: Dual_Graph.h:191
+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.
Definition: Dual_Graph.h:256
+CoMMAIntType get_nb_of_neighbours(CoMMAIndexType i_c) const
Retrieve the number of neighbours.
Definition: Dual_Graph.h:154
+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.
Definition: Dual_Graph.h:285
typename ContainerIndexType::const_iterator ContainerIndexConstIt
Type for constant iterators of containers of indices.
Definition: Dual_Graph.h:51
-ContainerIndexType _m_CRS_Row_Ptr
Vector of row pointer of CRS representation.
Definition: Dual_Graph.h:90
-bool check_connectivity()
Check the connectivity of the graph.
Definition: Dual_Graph.h:230
-ContainerWeightConstIt weights_cend(const CoMMAIndexType &i_c) const
Get constant pointer to the element following the last neighbour of cell i_c.
Definition: Dual_Graph.h:223
-ContainerIndexType _m_CRS_Col_Ind
Vector of column index of CRS representation.
Definition: Dual_Graph.h:93
+ContainerIndexType _m_CRS_Row_Ptr
Vector of row pointer of CRS representation.
Definition: Dual_Graph.h:91
+bool check_connectivity()
Check the connectivity of the graph.
Definition: Dual_Graph.h:236
+ContainerWeightConstIt weights_cend(const CoMMAIndexType &i_c) const
Get constant pointer to the element following the last neighbour of cell i_c.
Definition: Dual_Graph.h:229
+ContainerIndexType _m_CRS_Col_Ind
Vector of column index of CRS representation.
Definition: Dual_Graph.h:94
std::vector< CoMMAWeightType > ContainerWeightType
Type for containers of weights.
Definition: Dual_Graph.h:49
std::vector< CoMMAIndexType > ContainerIndexType
Type for containers of indices.
Definition: Dual_Graph.h:47
-CoMMAIndexType _number_of_cells
Number of nodes in the Graph (it corresponds to the number of cells in the subgraph or the dual graph...
Definition: Dual_Graph.h:84
+CoMMAIndexType _number_of_cells
Number of nodes in the Graph (it corresponds to the number of cells in the subgraph or the dual graph...
Definition: Dual_Graph.h:85
virtual ~Graph()=default
Destructor of the class.
-ContainerWeightType _volumes
Vector of volumes.
Definition: Dual_Graph.h:99
-ContainerIndexConstIt neighbours_cbegin(const CoMMAIndexType &i_c) const
Get constant pointer to the first neighbour of cell i_c.
Definition: Dual_Graph.h:176
-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...
Definition: Dual_Graph.h:197
-std::vector< bool > _visited
Helper vector for the DFS.
Definition: Dual_Graph.h:87
-void BFS(const CoMMAIndexType &root)
Breadth First Search (BFS) function.
Definition: Dual_Graph.h:114
-A class implementing the CRS subgraph representation. It is used in the framework of CoMMA for the im...
Definition: Dual_Graph.h:302
-bool _is_isotropic
Whether it originates from an isotropic cell.
Definition: Dual_Graph.h:349
-CoMMAIntType _compactness
Compactness of the given subgraph. The compactness is the minimum number of internal neighbours.
Definition: Dual_Graph.h:359
+ContainerWeightType _volumes
Vector of volumes.
Definition: Dual_Graph.h:100
+ContainerIndexConstIt neighbours_cbegin(const CoMMAIndexType &i_c) const
Get constant pointer to the first neighbour of cell i_c.
Definition: Dual_Graph.h:181
+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...
Definition: Dual_Graph.h:202
+std::vector< bool > _visited
Helper vector for the DFS.
Definition: Dual_Graph.h:88
+void BFS(const CoMMAIndexType &root)
Breadth First Search (BFS) function.
Definition: Dual_Graph.h:117
+A class implementing the CRS subgraph representation. It is used in the framework of CoMMA for the im...
Definition: Dual_Graph.h:318
+bool _is_isotropic
Whether it originates from an isotropic cell.
Definition: Dual_Graph.h:370
+CoMMAIntType _compactness
Compactness of the given subgraph. The compactness is the minimum number of internal neighbours.
Definition: Dual_Graph.h:380
~Subgraph() override=default
Destructor of the class.
-void insert_node(const ContainerIndexType &v_neigh, const CoMMAIndexType &i_fc, const CoMMAWeightType &volume, const ContainerWeightType &weight)
Insert a node in the subgraph and add it to the mapping the.
Definition: Dual_Graph.h:375
-ContainerIndexType _mapping_l_to_g
Mapping from the local number of node to the global. Being a subgraph this variable connect the local...
Definition: Dual_Graph.h:365
-Subgraph(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 ContainerIndexType &mapping_l_to_g, const bool &is_isotropic)
Constructor of the class.
Definition: Dual_Graph.h:323
-CoMMAIntType _cardinality
Cardinality of the given subgraph, alias the number of nodes contained.
Definition: Dual_Graph.h:354
+void insert_node(const ContainerIndexType &v_neigh, const CoMMAIndexType &i_fc, const CoMMAWeightType &volume, const ContainerWeightType &weight)
Insert a node in the subgraph and add it to the mapping the.
Definition: Dual_Graph.h:396
+ContainerIndexType _mapping_l_to_g
Mapping from the local number of node to the global. Being a subgraph this variable connect the local...
Definition: Dual_Graph.h:386
+Subgraph(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 ContainerIndexType &mapping_l_to_g, const bool &is_isotropic)
Constructor of the class.
Definition: Dual_Graph.h:340
+CoMMAIntType _cardinality
Cardinality of the given subgraph, alias the number of nodes contained.
Definition: Dual_Graph.h:375
std::vector< CoMMAWeightType > ContainerWeightType
Type for containers of weights.
Definition: Dual_Graph.h:49
-void remove_node(const CoMMAIndexType &elemento)
Remove a node from the CRS representation and automatically adjust the mapping.
Definition: Dual_Graph.h:432
+void remove_node(const CoMMAIndexType &elemento)
Remove a node from the CRS representation and automatically adjust the mapping.
Definition: Dual_Graph.h:458
std::vector< CoMMAIndexType > ContainerIndexType
Type for containers of indices.
Definition: Dual_Graph.h:47
Definition: Agglomerator.h:34
diff --git a/_neighbourhood_8h_source.html b/_neighbourhood_8h_source.html
index 2ff01f0..3cdfca4 100644
--- a/_neighbourhood_8h_source.html
+++ b/_neighbourhood_8h_source.html
@@ -149,352 +149,376 @@
74 const std::unordered_set<CoMMAIndexType> &s_neighbours_of_seed,
- 75 const std::vector<CoMMAWeightType> &weights) :
-
-
-
-
-
-
-
-
-
-
-
-
- 97 const CoMMAIndexType new_fc,
- 98 const std::vector<CoMMAIndexType> &new_neighbours) = 0;
-
-
-
-
-
-
-
-
-
-
- 119 std::unordered_set<CoMMAIndexType>
_s_fc;
-
-
-
-
-
- 131 for (
const auto &[idx, w] : candidates_w_weights)
- 132 this->_candidates.push_back(idx);
-
-
-
-
- 145 typename CoMMAIndexType,
- 146 typename CoMMAWeightType,
- 147 typename CoMMAIntType>
-
- 149 public Neighbourhood<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
-
-
-
-
-
-
-
-
- 169 const std::unordered_set<CoMMAIndexType> &s_neighbours_of_seed,
- 170 const std::vector<CoMMAWeightType> &weights) :
- 171 Neighbourhood<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
- 172 s_neighbours_of_seed, weights) {}
-
-
-
-
+ 75 const std::vector<CoMMAWeightType> &weights
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 98 const CoMMAIndexType new_fc,
+ 99 const std::vector<CoMMAIndexType> &new_neighbours
+
+
+
+
+
+
+
+
+
+
+
+ 121 std::unordered_set<CoMMAIndexType>
_s_fc;
+
+
+
+
+
+
+ 134 for (
const auto &[idx, w] : candidates_w_weights)
+ 135 this->_candidates.push_back(idx);
+
+
+
+
+ 148 typename CoMMAIndexType,
+ 149 typename CoMMAWeightType,
+ 150 typename CoMMAIntType>
+
+ 152 public Neighbourhood<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
+
+
+
+
+
+
+
+
+ 172 const std::unordered_set<CoMMAIndexType> &s_neighbours_of_seed,
+ 173 const std::vector<CoMMAWeightType> &weights
+
+ 175 Neighbourhood<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
+ 176 s_neighbours_of_seed, weights
+
-
-
-
- 190 const CoMMAIndexType new_fc,
- 191 const std::vector<CoMMAIndexType> &new_neighbours)
override {
-
- 193 this->
_s_fc.insert(new_fc);
-
- 195 std::find(this->
_candidates.begin(), this->_candidates.end(), new_fc);
-
-
-
-
-
-
- 202 for (
const CoMMAIndexType &i_fc : new_neighbours) {
-
- 204 (std::find(this->
_candidates.begin(), this->_candidates.end(), i_fc)
- 205 == this->_candidates.end())
- 206 && (this->_s_fc.count(i_fc) == 0)
- 207 && (this->_s_neighbours_of_seed.count(i_fc) > 0)) {
-
-
- 210 neighs.emplace(i_fc, this->
_weights[i_fc]);
-
-
-
-
-
-
-
-
-
-
- 230 typename CoMMAIndexType,
- 231 typename CoMMAWeightType,
- 232 typename CoMMAIntType>
-
- 234 public Neighbourhood<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
-
-
-
-
-
-
-
-
- 255 const std::unordered_set<CoMMAIndexType> &s_neighbours_of_seed,
- 256 const std::vector<CoMMAWeightType> &weights,
- 257 CoMMAIntType dimension) :
- 258 Neighbourhood<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
- 259 s_neighbours_of_seed, weights),
-
-
-
-
-
-
- 267 CoMMAIntType> &other) =
default;
-
-
-
-
- 280 const CoMMAIndexType new_fc,
- 281 const std::vector<CoMMAIndexType> &new_neighbours)
override {
-
-
- 284 this->
_s_fc.insert(new_fc);
-
-
-
-
- 289 auto it = std::find_if(
-
-
- 292 if (it != queue.end()) queue.erase(it);
-
-
-
-
-
- 298 for (
const CoMMAIndexType &i_fc : new_neighbours) {
-
- 300 (this->
_s_fc.count(i_fc) == 0)
- 301 && (this->_s_neighbours_of_seed.count(i_fc) > 0)) {
-
- 303 curr_set.emplace(i_fc, this->
_weights[i_fc]);
-
-
-
- 307 this->_q_neighs_w_weights.push_front(curr_set);
-
-
-
-
-
-
-
- 315 this->_q_neighs_w_weights.size()
-
-
-
-
-
-
-
- 323 for (
auto prev_q = this->_q_neighs_w_weights.begin() + 1;
- 324 prev_q != this->_q_neighs_w_weights.end(); ++prev_q)
- 325 curr_set.insert(prev_q->begin(), prev_q->end());
-
-
- 328 auto cur_front =
decltype(this->_q_neighs_w_weights.size()){0};
- 329 auto cur_back =
decltype(this->_q_neighs_w_weights.size()){
- 330 this->_q_neighs_w_weights.size() - 1};
- 331 while (cur_front <= cur_back) {
-
- 333 auto it = this->_q_neighs_w_weights.begin() + (cur_front++);
-
-
-
-
- 338 it = this->_q_neighs_w_weights.begin() + (cur_back--);
-
-
-
-
-
-
-
-
-
- 353 const CoMMAIntType lvl)
const {
-
-
-
-
-
-
-
-
-
-
-
-
-
- 378 typename CoMMAIndexType,
- 379 typename CoMMAWeightType,
- 380 typename CoMMAIntType>
-
-
-
-
-
-
-
-
-
- 402 virtual std::shared_ptr<NeighbourhoodBaseType>
create(
- 403 const std::unordered_set<CoMMAIndexType> &s_neighbours_of_seed,
- 404 const std::vector<CoMMAWeightType> &priority_weights,
- 405 const CoMMAIntType dimension)
const = 0;
-
- 411 virtual std::shared_ptr<NeighbourhoodBaseType>
clone(
- 412 std::shared_ptr<NeighbourhoodBaseType> other)
const = 0;
-
-
-
- 423 typename CoMMAIndexType,
- 424 typename CoMMAWeightType,
- 425 typename CoMMAIntType>
-
-
-
-
-
-
-
-
-
-
-
-
-
- 456 inline std::shared_ptr<NeighbourhoodBaseType>
create(
- 457 const std::unordered_set<CoMMAIndexType> &s_neighbours_of_seed,
- 458 const std::vector<CoMMAWeightType> &priority_weights,
- 459 const CoMMAIntType dimension)
const override {
-
- 461 return std::make_shared<NeighbourhoodDerivedType>(
- 462 s_neighbours_of_seed, priority_weights);
-
-
- 470 inline std::shared_ptr<NeighbourhoodBaseType>
clone(
- 471 std::shared_ptr<NeighbourhoodBaseType> other)
const override {
-
- 473 return std::make_shared<NeighbourhoodDerivedType>(
- 474 *std::dynamic_pointer_cast<NeighbourhoodDerivedType>(other));
-
-
-
-
- 486 typename CoMMAIndexType,
- 487 typename CoMMAWeightType,
- 488 typename CoMMAIntType>
-
-
-
-
-
-
-
-
-
-
-
-
-
- 519 inline std::shared_ptr<NeighbourhoodBaseType>
create(
- 520 const std::unordered_set<CoMMAIndexType> &s_neighbours_of_seed,
- 521 const std::vector<CoMMAWeightType> &priority_weights,
- 522 const CoMMAIntType dimension)
const override {
- 523 return std::make_shared<NeighbourhoodDerivedType>(
- 524 s_neighbours_of_seed, priority_weights, dimension);
-
-
- 532 inline std::shared_ptr<NeighbourhoodBaseType>
clone(
- 533 std::shared_ptr<NeighbourhoodBaseType> other)
const override {
-
- 535 return std::make_shared<NeighbourhoodDerivedType>(
- 536 *std::dynamic_pointer_cast<NeighbourhoodDerivedType>(other));
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ 196 const CoMMAIndexType new_fc,
+ 197 const std::vector<CoMMAIndexType> &new_neighbours
+
+
+ 200 this->
_s_fc.insert(new_fc);
+
+ 202 std::find(this->
_candidates.begin(), this->_candidates.end(), new_fc);
+
+
+
+
+
+
+ 209 for (
const CoMMAIndexType &i_fc : new_neighbours) {
+ 210 if ((std::find(this->
_candidates.begin(), this->_candidates.end(), i_fc)
+ 211 == this->_candidates.end())
+ 212 && (this->_s_fc.count(i_fc) == 0)
+ 213 && (this->_s_neighbours_of_seed.count(i_fc) > 0)) {
+
+
+ 216 neighs.emplace(i_fc, this->
_weights[i_fc]);
+
+
+
+
+
+
+
+
+
+
+ 236 typename CoMMAIndexType,
+ 237 typename CoMMAWeightType,
+ 238 typename CoMMAIntType>
+
+ 240 public Neighbourhood<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
+
+
+
+
+
+
+
+
+ 261 const std::unordered_set<CoMMAIndexType> &s_neighbours_of_seed,
+ 262 const std::vector<CoMMAWeightType> &weights,
+ 263 CoMMAIntType dimension
+
+ 265 Neighbourhood<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
+ 266 s_neighbours_of_seed, weights
+
+
+
+
+
+
+
+ 275 CoMMAIntType> &other) =
default;
+
+
+
+
+ 288 const CoMMAIndexType new_fc,
+ 289 const std::vector<CoMMAIndexType> &new_neighbours
+
+
+
+ 293 this->
_s_fc.insert(new_fc);
+
+
+
+
+ 298 auto it = std::find_if(
+
+
+
+ 302 if (it != queue.end()) queue.erase(it);
+
+
+
+
+
+ 308 for (
const CoMMAIndexType &i_fc : new_neighbours) {
+ 309 if ((this->
_s_fc.count(i_fc) == 0)
+ 310 && (this->_s_neighbours_of_seed.count(i_fc) > 0)) {
+
+ 312 curr_set.emplace(i_fc, this->
_weights[i_fc]);
+
+
+
+ 316 this->_q_neighs_w_weights.push_front(curr_set);
+
+
+
+
+
+
+ 323 if (this->_q_neighs_w_weights.size()
+
+
+
+
+
+
+
+
+ 332 for (
auto prev_q = this->_q_neighs_w_weights.begin() + 1;
+ 333 prev_q != this->_q_neighs_w_weights.end();
+
+ 335 curr_set.insert(prev_q->begin(), prev_q->end());
+
+
+ 338 auto cur_front =
decltype(this->_q_neighs_w_weights.size()){0};
+ 339 auto cur_back =
decltype(this->_q_neighs_w_weights.size()
+ 340 ){this->_q_neighs_w_weights.size() - 1};
+ 341 while (cur_front <= cur_back) {
+
+ 343 auto it = this->_q_neighs_w_weights.begin() + (cur_front++);
+
+
+
+
+ 348 it = this->_q_neighs_w_weights.begin() + (cur_back--);
+
+
+
+
+
+
+
+
+
+ 363 const CoMMAIntType lvl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 390 typename CoMMAIndexType,
+ 391 typename CoMMAWeightType,
+ 392 typename CoMMAIntType>
+
+
+
+
+
+
+
+
+
+ 414 virtual std::shared_ptr<NeighbourhoodBaseType>
create(
+ 415 const std::unordered_set<CoMMAIndexType> &s_neighbours_of_seed,
+ 416 const std::vector<CoMMAWeightType> &priority_weights,
+ 417 const CoMMAIntType dimension
+
+
+ 424 virtual std::shared_ptr<NeighbourhoodBaseType>
clone(
+ 425 std::shared_ptr<NeighbourhoodBaseType> other
+
+
+
+
+ 437 typename CoMMAIndexType,
+ 438 typename CoMMAWeightType,
+ 439 typename CoMMAIntType>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 471 inline std::shared_ptr<NeighbourhoodBaseType>
create(
+ 472 const std::unordered_set<CoMMAIndexType> &s_neighbours_of_seed,
+ 473 const std::vector<CoMMAWeightType> &priority_weights,
+ 474 const CoMMAIntType dimension
+
+
+ 477 return std::make_shared<NeighbourhoodDerivedType>(
+ 478 s_neighbours_of_seed, priority_weights
+
+
+
+ 487 inline std::shared_ptr<NeighbourhoodBaseType>
clone(
+ 488 std::shared_ptr<NeighbourhoodBaseType> other
+
+
+ 491 return std::make_shared<NeighbourhoodDerivedType>(
+ 492 *std::dynamic_pointer_cast<NeighbourhoodDerivedType>(other)
+
+
+
+
+
+ 505 typename CoMMAIndexType,
+ 506 typename CoMMAWeightType,
+ 507 typename CoMMAIntType>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 539 inline std::shared_ptr<NeighbourhoodBaseType>
create(
+ 540 const std::unordered_set<CoMMAIndexType> &s_neighbours_of_seed,
+ 541 const std::vector<CoMMAWeightType> &priority_weights,
+ 542 const CoMMAIntType dimension
+
+ 544 return std::make_shared<NeighbourhoodDerivedType>(
+ 545 s_neighbours_of_seed, priority_weights, dimension
+
+
+
+ 554 inline std::shared_ptr<NeighbourhoodBaseType>
clone(
+ 555 std::shared_ptr<NeighbourhoodBaseType> other
+
+
+ 558 return std::make_shared<NeighbourhoodDerivedType>(
+ 559 *std::dynamic_pointer_cast<NeighbourhoodDerivedType>(other)
+
+
+
+
+
+
+
#define CoMMAUnused(var)
Convenient function to avoid unused warnings.
Definition: Util.h:34
-Class representing the neighbourhood of a given cell in the graph. In this derived class the neighbou...
Definition: Neighbourhood.h:149
-void update(const CoMMAIndexType new_fc, const std::vector< CoMMAIndexType > &new_neighbours) override
Method that updates the neighbourhood. Given the new_fc, if is in the neighbours, it is deleted....
Definition: Neighbourhood.h:189
+Class representing the neighbourhood of a given cell in the graph. In this derived class the neighbou...
Definition: Neighbourhood.h:152
+void update(const CoMMAIndexType new_fc, const std::vector< CoMMAIndexType > &new_neighbours) override
Method that updates the neighbourhood. Given the new_fc, if is in the neighbours, it is deleted....
Definition: Neighbourhood.h:195
std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > > CoMMASetOfPairType
Type of set of pairs.
Definition: Neighbourhood.h:60
-Neighbourhood_Extended(const std::unordered_set< CoMMAIndexType > &s_neighbours_of_seed, const std::vector< CoMMAWeightType > &weights)
Constructor.
Definition: Neighbourhood.h:168
+Neighbourhood_Extended(const std::unordered_set< CoMMAIndexType > &s_neighbours_of_seed, const std::vector< CoMMAWeightType > &weights)
Constructor.
Definition: Neighbourhood.h:171
~Neighbourhood_Extended() override=default
Destructor.
Neighbourhood_Extended(const Neighbourhood_Extended< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &other)=default
Copy constructor.
-Class representing the neighbourhood of a given cell in the graph. In this derived class,...
Definition: Neighbourhood.h:234
+Class representing the neighbourhood of a given cell in the graph. In this derived class,...
Definition: Neighbourhood.h:240
~Neighbourhood_Pure_Front() override=default
Destructor.
Neighbourhood_Pure_Front(const Neighbourhood_Pure_Front< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &other)=default
Copy constructor.
std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > > CoMMASetOfPairType
Type of set of pairs.
Definition: Neighbourhood.h:60
-const CoMMASetOfPairType & get_neighbours_by_level(const CoMMAIntType lvl) const
Get the neighbours from a previous stage.
Definition: Neighbourhood.h:352
-std::deque< CoMMASetOfPairType > _q_neighs_w_weights
History of the first-order-neighbourhoods of the fine cells recently agglomerated.
Definition: Neighbourhood.h:363
-CoMMAIntType _dimension
Dimensionality of the problem (_dimension = 2 -> 2D, _dimension = 3 -> 3D)
Definition: Neighbourhood.h:367
-void update(const CoMMAIndexType new_fc, const std::vector< CoMMAIndexType > &new_neighbours) override
Method that updates the neighbourhood. Given the new_fc, if is in the neighbours, it is deleted....
Definition: Neighbourhood.h:279
-Neighbourhood_Pure_Front(const std::unordered_set< CoMMAIndexType > &s_neighbours_of_seed, const std::vector< CoMMAWeightType > &weights, CoMMAIntType dimension)
Constructor.
Definition: Neighbourhood.h:254
-Pure abstract class for a creator of Neighbourhood objects. It can create from scratch or by copy.
Definition: Neighbourhood.h:381
+const CoMMASetOfPairType & get_neighbours_by_level(const CoMMAIntType lvl) const
Get the neighbours from a previous stage.
Definition: Neighbourhood.h:362
+std::deque< CoMMASetOfPairType > _q_neighs_w_weights
History of the first-order-neighbourhoods of the fine cells recently agglomerated.
Definition: Neighbourhood.h:375
+CoMMAIntType _dimension
Dimensionality of the problem (_dimension = 2 -> 2D, _dimension = 3 -> 3D)
Definition: Neighbourhood.h:379
+void update(const CoMMAIndexType new_fc, const std::vector< CoMMAIndexType > &new_neighbours) override
Method that updates the neighbourhood. Given the new_fc, if is in the neighbours, it is deleted....
Definition: Neighbourhood.h:287
+Neighbourhood_Pure_Front(const std::unordered_set< CoMMAIndexType > &s_neighbours_of_seed, const std::vector< CoMMAWeightType > &weights, CoMMAIntType dimension)
Constructor.
Definition: Neighbourhood.h:260
+Pure abstract class for a creator of Neighbourhood objects. It can create from scratch or by copy.
Definition: Neighbourhood.h:393
virtual std::shared_ptr< NeighbourhoodBaseType > clone(std::shared_ptr< NeighbourhoodBaseType > other) const =0
Create a new Neighbourhood object by copy.
-Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > NeighbourhoodBaseType
Shortcut for the Neighborhood object type.
Definition: Neighbourhood.h:385
+Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > NeighbourhoodBaseType
Shortcut for the Neighborhood object type.
Definition: Neighbourhood.h:397
virtual ~NeighbourhoodCreator()=default
Destructor.
NeighbourhoodCreator()=default
Constructor.
virtual std::shared_ptr< NeighbourhoodBaseType > create(const std::unordered_set< CoMMAIndexType > &s_neighbours_of_seed, const std::vector< CoMMAWeightType > &priority_weights, const CoMMAIntType dimension) const =0
Create a new Neighbourhood object from scratch using the given arguments.
-Creator of Neighbourhood_Extended objects. It can create from scratch or by copy.
Definition: Neighbourhood.h:427
+Creator of Neighbourhood_Extended objects. It can create from scratch or by copy.
Definition: Neighbourhood.h:441
~NeighbourhoodExtendedCreator() override=default
Destructor.
-std::shared_ptr< NeighbourhoodBaseType > create(const std::unordered_set< CoMMAIndexType > &s_neighbours_of_seed, const std::vector< CoMMAWeightType > &priority_weights, const CoMMAIntType dimension) const override
Create a new Neighbourhood object from scratch using the given arguments.
Definition: Neighbourhood.h:456
-NeighbourhoodExtendedCreator()
Constructor.
Definition: Neighbourhood.h:441
-std::shared_ptr< NeighbourhoodBaseType > clone(std::shared_ptr< NeighbourhoodBaseType > other) const override
Create a new Neighbourhood object by copy.
Definition: Neighbourhood.h:470
+std::shared_ptr< NeighbourhoodBaseType > create(const std::unordered_set< CoMMAIndexType > &s_neighbours_of_seed, const std::vector< CoMMAWeightType > &priority_weights, const CoMMAIntType dimension) const override
Create a new Neighbourhood object from scratch using the given arguments.
Definition: Neighbourhood.h:471
+NeighbourhoodExtendedCreator()
Constructor.
Definition: Neighbourhood.h:455
+std::shared_ptr< NeighbourhoodBaseType > clone(std::shared_ptr< NeighbourhoodBaseType > other) const override
Create a new Neighbourhood object by copy.
Definition: Neighbourhood.h:487
Class representing the neighbourhood of a given cell in the graph. Mind that no information about the...
Definition: Neighbourhood.h:42
-const std::vector< CoMMAWeightType > & _weights
Priority weights.
Definition: Neighbourhood.h:116
+const std::vector< CoMMAWeightType > & _weights
Priority weights.
Definition: Neighbourhood.h:118
PairFindFirstBasedFunctor< CoMMAPairType > CoMMAPairFindFirstBasedType
Functor used if find-like function relying only on first element of the pair.
Definition: Neighbourhood.h:63
Neighbourhood(const std::unordered_set< CoMMAIndexType > &s_neighbours_of_seed, const std::vector< CoMMAWeightType > &weights)
Constructor.
Definition: Neighbourhood.h:73
virtual void update(const CoMMAIndexType new_fc, const std::vector< CoMMAIndexType > &new_neighbours)=0
Method that updates the neighbourhood. Given the new_fc, if is in the neighbours, it is deleted....
-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 neighbo...
Definition: Neighbourhood.h:113
-const CandidatesContainerType & get_candidates() const
Get candidates that should be consider in the next step of the agglomeration.
Definition: Neighbourhood.h:104
-CandidatesContainerType _candidates
Candidates that should be considered when choosing the next fine cell to add to the coarse one.
Definition: Neighbourhood.h:124
+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 neighbo...
Definition: Neighbourhood.h:115
+const CandidatesContainerType & get_candidates() const
Get candidates that should be consider in the next step of the agglomeration.
Definition: Neighbourhood.h:106
+CandidatesContainerType _candidates
Candidates that should be considered when choosing the next fine cell to add to the coarse one.
Definition: Neighbourhood.h:126
std::deque< CoMMAIndexType > CandidatesContainerType
Type for container of candidates.
Definition: Neighbourhood.h:65
std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > > CoMMASetOfPairType
Type of set of pairs.
Definition: Neighbourhood.h:60
Neighbourhood(const Neighbourhood< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > &other)=default
Copy constructor.
-std::unordered_set< CoMMAIndexType > _s_fc
Set of the fine cells composing the coarse cell.
Definition: Neighbourhood.h:119
-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...
Definition: Neighbourhood.h:129
+std::unordered_set< CoMMAIndexType > _s_fc
Set of the fine cells composing the coarse cell.
Definition: Neighbourhood.h:121
+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...
Definition: Neighbourhood.h:131
std::pair< CoMMAIndexType, CoMMAWeightType > CoMMAPairType
Type of pair.
Definition: Neighbourhood.h:57
virtual ~Neighbourhood()=default
Destructor.
-Creator of Neighbourhood_Extended objects. It can create from scratch or by copy.
Definition: Neighbourhood.h:490
-NeighbourhoodPureFrontCreator()
Constructor.
Definition: Neighbourhood.h:504
-std::shared_ptr< NeighbourhoodBaseType > clone(std::shared_ptr< NeighbourhoodBaseType > other) const override
Create a new Neighbourhood object by copy.
Definition: Neighbourhood.h:532
+Creator of Neighbourhood_Extended objects. It can create from scratch or by copy.
Definition: Neighbourhood.h:509
+NeighbourhoodPureFrontCreator()
Constructor.
Definition: Neighbourhood.h:523
+std::shared_ptr< NeighbourhoodBaseType > clone(std::shared_ptr< NeighbourhoodBaseType > other) const override
Create a new Neighbourhood object by copy.
Definition: Neighbourhood.h:554
~NeighbourhoodPureFrontCreator() override=default
Destructor.
-std::shared_ptr< NeighbourhoodBaseType > create(const std::unordered_set< CoMMAIndexType > &s_neighbours_of_seed, const std::vector< CoMMAWeightType > &priority_weights, const CoMMAIntType dimension) const override
Create a new Neighbourhood object from scratch using the given arguments.
Definition: Neighbourhood.h:519
-Functor implementing an operator telling if a given value if the first one of pair.
Definition: Util.h:211
+std::shared_ptr< NeighbourhoodBaseType > create(const std::unordered_set< CoMMAIndexType > &s_neighbours_of_seed, const std::vector< CoMMAWeightType > &priority_weights, const CoMMAIntType dimension) const override
Create a new Neighbourhood object from scratch using the given arguments.
Definition: Neighbourhood.h:539
+Functor implementing an operator telling if a given value if the first one of pair.
Definition: Util.h:213
Definition: Agglomerator.h:34
-Functor for pairs implementing a custom 'greater than'. It relies on the 'greater than' operator for ...
Definition: Util.h:154
+Functor for pairs implementing a custom 'greater than'. It relies on the 'greater than' operator for ...
Definition: Util.h:156
diff --git a/_priority___pair_8h_source.html b/_priority___pair_8h_source.html
index f1b49ef..43c891b 100644
--- a/_priority___pair_8h_source.html
+++ b/_priority___pair_8h_source.html
@@ -123,40 +123,42 @@
-
-
-
-
-
-
- 54 A
first()
const {
return _p.first; }
-
- 59 B
second()
const {
return _p.second; }
-
-
- 69 if (a._p.first > b._p.first)
return true;
- 70 if (a._p.first < b._p.first)
return false;
-
- 72 return a._p.second < b._p.second;
-
-
-
-
- 82 return (a._p.first == b._p.first) && (a._p.second == b._p.second);
-
-
-
-
+
+
+
+
+
+
+
+ 55 A
first()
const {
return _p.first; }
+
+ 60 B
second()
const {
return _p.second; }
+
+
+ 70 if (a._p.first > b._p.first)
return true;
+ 71 if (a._p.first < b._p.first)
return false;
+
+ 73 return a._p.second < b._p.second;
+
+
+
+
+
+ 84 return (a._p.first == b._p.first) && (a._p.second == b._p.second);
+
+
-
+
+
+
Wrapper around the STL pair with custom 'less than' operator: as in the standard case,...
Definition: Priority_Pair.h:30
~Priority_Pair()=default
Destructor.
Priority_Pair(const A &a, const B &b)
Constructor.
Definition: Priority_Pair.h:44
-friend bool operator==(const Priority_Pair &a, const Priority_Pair &b)
Operator 'equal'.
Definition: Priority_Pair.h:80
+friend bool operator==(const Priority_Pair &a, const Priority_Pair &b)
Operator 'equal'.
Definition: Priority_Pair.h:81
Priority_Pair()=default
Constructor.
-friend bool operator<(const Priority_Pair &a, const Priority_Pair &b)
Operator 'less than'. It actually relies on the 'greater than' operator for the first elements and 'l...
Definition: Priority_Pair.h:68
-B second() const
Accessor to the first element.
Definition: Priority_Pair.h:59
-A first() const
Accessor to the first element.
Definition: Priority_Pair.h:54
+friend bool operator<(const Priority_Pair &a, const Priority_Pair &b)
Operator 'less than'. It actually relies on the 'greater than' operator for the first elements and 'l...
Definition: Priority_Pair.h:69
+B second() const
Accessor to the first element.
Definition: Priority_Pair.h:60
+A first() const
Accessor to the first element.
Definition: Priority_Pair.h:55
Definition: Agglomerator.h:34
diff --git a/_queue_8h_source.html b/_queue_8h_source.html
index bd65da3..e78980e 100644
--- a/_queue_8h_source.html
+++ b/_queue_8h_source.html
@@ -125,30 +125,38 @@
- 42 void push(T
const &elem) { _elems.push_back(elem); }
-
- 47 if (_elems.empty()) {
return static_cast<T
>(-1); }
- 48 T elem = _elems.front();
-
-
-
-
- 56 if (_elems.empty()) {
return static_cast<T
>(-1); }
- 57 return _elems.front();
-
- 62 inline bool empty()
const {
return _elems.empty(); }
-
-
-
+
+ 43 void push(T
const &elem) { _elems.push_back(elem); }
+
+
+
+ 50 return static_cast<T
>(-1);
+
+ 52 T elem = _elems.front();
+
+
+
+
+
+
+ 62 return static_cast<T
>(-1);
+
+ 64 return _elems.front();
+
-
+ 70 inline bool empty()
const {
return _elems.empty(); }
+
+
+
+
+
A template class implementing a custom queue data structure.
Definition: Queue.h:29
-T top() const
Scope to the element on the bottom of the queue.
Definition: Queue.h:55
-T pop()
pop an element from the bottom of the queue
Definition: Queue.h:46
+T top() const
Scope to the element on the bottom of the queue.
Definition: Queue.h:60
+T pop()
pop an element from the bottom of the queue
Definition: Queue.h:48
~Queue()=default
Destructor.
-bool empty() const
Whether the queue is empty.
Definition: Queue.h:62
+bool empty() const
Whether the queue is empty.
Definition: Queue.h:70
Queue()=default
Constructor.
-void push(T const &elem)
Push an element on the top of the queue.
Definition: Queue.h:42
+void push(T const &elem)
Push an element on the top of the queue.
Definition: Queue.h:43
Definition: Agglomerator.h:34
diff --git a/_seeds___pool_8h_source.html b/_seeds___pool_8h_source.html
index 4236277..4bdb148 100644
--- a/_seeds___pool_8h_source.html
+++ b/_seeds___pool_8h_source.html
@@ -146,500 +146,538 @@
70 const std::vector<CoMMAWeightType> &priority_weights,
71 const std::vector<CoMMAIntType> &n_bnd_faces,
72 const CoMMAIntType max_bnd,
-
-
-
-
- 83 typename CoMMAIndexType,
- 84 typename CoMMAWeightType,
- 85 typename CoMMAIntType>
-
-
-
-
-
-
-
-
-
-
-
-
- 112 const std::vector<CoMMAWeightType> &priority_weights,
- 113 const std::vector<CoMMAIntType> &n_bnd_faces,
- 114 const CoMMAIntType max_bnd,
-
-
-
-
- 119 for (
auto i_fc =
decltype(n_bnd_faces.size()){0}; i_fc < n_bnd_faces.size();
-
- 121 if (n_bnd_faces[i_fc] >= max_bnd)
- 122 tmp_set.emplace(i_fc, priority_weights[i_fc]);
-
- 124 for (
const auto &idx : tmp_set)
- 125 queue.push_back(idx.first);
-
-
-
-
- 136 typename CoMMAIndexType,
- 137 typename CoMMAWeightType,
- 138 typename CoMMAIntType>
-
- 140 public SPInitializator<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
-
-
-
-
-
-
+
+
+
+
+
+ 84 typename CoMMAIndexType,
+ 85 typename CoMMAWeightType,
+ 86 typename CoMMAIntType>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 114 const std::vector<CoMMAWeightType> &priority_weights,
+ 115 const std::vector<CoMMAIntType> &n_bnd_faces,
+ 116 const CoMMAIntType max_bnd,
+
+
+
+
+
+ 122 for (
auto i_fc =
decltype(n_bnd_faces.size()){0}; i_fc < n_bnd_faces.size();
+
+ 124 if (n_bnd_faces[i_fc] >= max_bnd)
+ 125 tmp_set.emplace(i_fc, priority_weights[i_fc]);
+
+ 127 for (
const auto &idx : tmp_set)
+ 128 queue.push_back(idx.first);
+
+
+
+
+ 139 typename CoMMAIndexType,
+ 140 typename CoMMAWeightType,
+ 141 typename CoMMAIntType>
+
+ 143 public SPInitializator<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
+
+
+
+
-
-
-
- 165 const std::vector<CoMMAWeightType> &priority_weights,
- 166 const std::vector<CoMMAIntType> &n_bnd_faces,
- 167 const CoMMAIntType max_bnd,
-
-
- 170 std::numeric_limits<CoMMAIndexType>::max(),
- 171 std::numeric_limits<CoMMAWeightType>::min()};
-
- 173 for (
auto i_fc =
decltype(n_bnd_faces.size()){0}; i_fc < n_bnd_faces.size();
-
-
- 176 if (n_bnd_faces[i_fc] >= max_bnd && comp_op(cur_pair, cur_max))
- 177 cur_max = std::move(cur_pair);
-
- 179 queue.push_back(cur_max.first);
-
-
-
-
- 191 typename CoMMAIndexType,
- 192 typename CoMMAWeightType,
- 193 typename CoMMAIntType>
-
-
-
-
-
-
-
- 203 using CoMMAContainerPairType = std::deque<CoMMAPairType>;
-
-
-
-
- 209 CoMMAContainerPairType,
-
-
-
-
- 216 std::set<CoMMAPairType, CustomPairGreaterFunctor<CoMMAPairType>>;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 251 const std::vector<CoMMAIntType> &n_bnd_faces,
- 252 const std::vector<CoMMAWeightType> &priority_weights,
- 253 const bool one_point_init) :
-
-
-
-
-
-
-
-
-
- 263 CoMMAIndexType, CoMMAWeightType, CoMMAIntType>>();
-
-
-
-
-
-
-
-
- 279 const std::vector<bool> &is_fc_agglomerated,
CoMMAQueueType &queue) {
-
-
- 282 for (; !queue.empty() && is_fc_agglomerated[queue.front()];
- 283 queue.pop_front()) {}
- 284 if (!queue.empty()) {
- 285 const auto seed = queue.front();
-
-
-
-
-
-
-
- 298 const std::vector<bool> &is_agglomerated) = 0;
-
- 306 virtual void update(
const std::deque<CoMMAIndexType> &new_seeds) = 0;
-
-
- 314 const std::unordered_set<CoMMAIndexType> &new_seeds) = 0;
-
-
- 325 const std::vector<bool> &is_fc_agglomerated,
const CoMMAIntType target) {
-
-
-
-
- 330 if (!is_fc_agglomerated[i_fc] &&
_n_bnd_faces[i_fc] == target)
-
-
- 333 for (
const auto &idx : tmp_set)
-
-
-
-
- 347 const std::vector<bool> &is_fc_agglomerated,
-
- 349 std::optional<CoMMAIntType> max_bnd = std::nullopt;
-
-
- 352 if (!is_fc_agglomerated[i_fc]) {
-
- 354 if (!max_bnd.has_value()) max_bnd = i_fc_bnd;
- 355 if (i_fc_bnd >= expected_max) {
return i_fc_bnd; }
- 356 if (i_fc_bnd > max_bnd) { max_bnd = i_fc_bnd; }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 396 const std::vector<bool> &is_agglomerated) = 0;
-
-
-
-
-
-
-
- 405 this->_priority_weights, this->_n_bnd_faces, this->_cur_top_queue.value(),
- 406 this->_l_of_seeds[this->_cur_top_queue.value()]);
+
+
+
+
+
+
+ 169 const std::vector<CoMMAWeightType> &priority_weights,
+ 170 const std::vector<CoMMAIntType> &n_bnd_faces,
+ 171 const CoMMAIntType max_bnd,
+
+
+
+ 175 std::numeric_limits<CoMMAIndexType>::max(),
+ 176 std::numeric_limits<CoMMAWeightType>::min()
+
+
+ 179 for (
auto i_fc =
decltype(n_bnd_faces.size()){0}; i_fc < n_bnd_faces.size();
+
+
+ 182 if (n_bnd_faces[i_fc] >= max_bnd && comp_op(cur_pair, cur_max))
+ 183 cur_max = std::move(cur_pair);
+
+ 185 queue.push_back(cur_max.first);
+
+
+
+
+ 197 typename CoMMAIndexType,
+ 198 typename CoMMAWeightType,
+ 199 typename CoMMAIntType>
+
+
+
+
+
+
+
+ 209 using CoMMAContainerPairType = std::deque<CoMMAPairType>;
+
+
+
+
+ 215 CoMMAContainerPairType,
+
+
+
+
+ 222 std::set<CoMMAPairType, CustomPairGreaterFunctor<CoMMAPairType>>;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 257 const std::vector<CoMMAIntType> &n_bnd_faces,
+ 258 const std::vector<CoMMAWeightType> &priority_weights,
+ 259 const bool one_point_init
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 287 const std::vector<bool> &is_fc_agglomerated,
CoMMAQueueType &queue
+
+
+
+ 291 for (; !queue.empty() && is_fc_agglomerated[queue.front()];
+ 292 queue.pop_front()) {}
+ 293 if (!queue.empty()) {
+ 294 const auto seed = queue.front();
+
+
+
+
+
+
+
+ 307 const std::vector<bool> &is_agglomerated
+
+
+ 316 virtual void update(
const std::deque<CoMMAIndexType> &new_seeds) = 0;
+
+
+ 324 const std::unordered_set<CoMMAIndexType> &new_seeds
+
+
+
+ 336 const std::vector<bool> &is_fc_agglomerated,
const CoMMAIntType target
+
+
+
+
+
+
+ 343 if (!is_fc_agglomerated[i_fc] &&
_n_bnd_faces[i_fc] == target)
+
+
+ 346 for (
const auto &idx : tmp_set)
+
+
+
+
+ 360 const std::vector<bool> &is_fc_agglomerated,
+
+
+ 363 std::optional<CoMMAIntType> max_bnd = std::nullopt;
+
+
+
+ 367 if (!is_fc_agglomerated[i_fc]) {
+
+ 369 if (!max_bnd.has_value()) max_bnd = i_fc_bnd;
+ 370 if (i_fc_bnd >= expected_max) {
+
+
+ 373 if (i_fc_bnd > max_bnd) {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
- 413 this->_cur_top_queue = q_lvl;
-
-
+
+
-
- 426 typename CoMMAIndexType,
- 427 typename CoMMAWeightType,
- 428 typename CoMMAIntType>
-
- 430 public Seeds_Pool<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
-
-
-
-
-
-
-
- 449 const std::vector<CoMMAIntType> &n_bnd_faces,
- 450 const std::vector<CoMMAWeightType> &priority_weights,
- 451 const bool one_point_init) :
- 452 Seeds_Pool<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
- 453 n_bnd_faces, priority_weights, one_point_init) {}
-
-
-
-
- 464 const std::vector<bool> &is_agglomerated)
override {
-
-
-
-
-
-
-
-
-
-
- 475 if (opt_seed.has_value())
return opt_seed.value();
-
-
- 478 if (opt_top.has_value()) {
- 479 const auto cur_queue = opt_top.value();
-
-
-
-
- 484 if (opt_seed.has_value())
return opt_seed.value();
-
-
-
-
-
- 490 const auto seed = this->
_l_of_seeds[cur_queue].front();
-
-
-
-
-
-
-
-
-
- 506 inline void update(
const std::deque<CoMMAIndexType> &new_seeds)
override {
- 507 if (!new_seeds.empty()) {
- 508 CoMMAIntType max_bnd{0};
- 509 for (
const auto &seed : new_seeds) {
-
- 511 if (n_bnd > max_bnd) max_bnd = n_bnd;
-
-
-
-
-
-
- 518 || max_bnd > this->_cur_top_queue.value())
-
-
-
-
-
- 529 const std::unordered_set<CoMMAIndexType> &new_seeds)
override {
- 530 std::map<CoMMAIntType, CoMMASetOfPairType, std::greater<>> new_seeds_by_bnd;
- 531 if (!new_seeds.empty()) {
- 532 for (
const auto seed : new_seeds) {
-
-
-
- 536 const auto max_bnd = new_seeds_by_bnd.begin()->first;
-
-
- 539 || max_bnd > this->_cur_top_queue.value())
-
- 541 for (
const auto &[n_bnd, seeds] : new_seeds_by_bnd) {
-
-
-
- 545 seeds.cbegin(), seeds.cend(),
- 546 std::back_inserter(this->_l_of_seeds[n_bnd]),
- 547 [](
const auto &pr) { return pr.first; });
-
-
-
-
-
-
-
-
- 562 if (max_bnd.has_value() && max_bnd.value() > this->_cur_top_queue.value()) {
-
-
-
-
-
-
-
-
- 579 typename CoMMAIndexType,
- 580 typename CoMMAWeightType,
- 581 typename CoMMAIntType>
-
- 583 public Seeds_Pool<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
-
-
-
-
-
-
-
- 602 const std::vector<CoMMAIntType> &n_bnd_faces,
- 603 const std::vector<CoMMAWeightType> &priority_weights,
- 604 const bool one_point_init) :
- 605 Seeds_Pool<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
- 606 n_bnd_faces, priority_weights, one_point_init) {}
-
-
-
-
- 617 const std::vector<bool> &is_agglomerated)
override {
-
-
-
-
-
-
-
-
-
-
- 628 + (this->_l_of_seeds.size() - (this->_cur_top_queue.value() + 1));
- 629 queue != this->_l_of_seeds.rend(); ++queue) {
- 630 const auto opt_seed = this->
spoil_queue(is_agglomerated, *queue);
- 631 if (opt_seed.has_value()) {
-
- 633 return opt_seed.value();
-
-
-
-
-
-
- 640 if (opt_top.has_value()) {
- 641 const auto cur_queue = opt_top.value();
-
-
- 644 const auto opt_seed =
-
- 646 if (opt_seed.has_value())
return opt_seed.value();
-
-
-
-
-
- 652 const auto seed = this->
_l_of_seeds[cur_queue].front();
-
-
-
-
-
-
-
-
-
- 668 inline void update(
const std::deque<CoMMAIndexType> &new_seeds)
override {
- 669 for (
const auto &seed : new_seeds) {
-
-
-
-
-
-
-
-
-
-
-
-
-
- 688 const std::unordered_set<CoMMAIndexType> &new_seeds)
override {
- 689 std::map<CoMMAIntType, CoMMASetOfPairType, std::greater<>> new_seeds_by_bnd;
- 690 for (
const auto &seed : new_seeds) {
-
-
-
- 694 for (
auto &[n_bnd, seeds] : new_seeds_by_bnd) {
-
-
-
-
-
-
-
-
- 703 seeds.cbegin(), seeds.cend(),
- 704 std::back_inserter(this->_l_of_seeds[q_lvl]),
- 705 [](
const auto &pr) { return pr.first; });
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ 424 this->_priority_weights,
+
+ 426 this->_cur_top_queue.value(),
+ 427 this->_l_of_seeds[this->_cur_top_queue.value()]
+
+
+
+
+ 435 this->_cur_top_queue = q_lvl;
+
+
+
+
+ 448 typename CoMMAIndexType,
+ 449 typename CoMMAWeightType,
+ 450 typename CoMMAIntType>
+
+ 452 public Seeds_Pool<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
+
+
+
+
+
+
+
+ 471 const std::vector<CoMMAIntType> &n_bnd_faces,
+ 472 const std::vector<CoMMAWeightType> &priority_weights,
+ 473 const bool one_point_init
+
+ 475 Seeds_Pool<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
+ 476 n_bnd_faces, priority_weights, one_point_init
+
+
+
+
+
+ 488 const std::vector<bool> &is_agglomerated
+
+
+
+
+
+
+
+
+
+
+
+
+ 501 if (opt_seed.has_value())
return opt_seed.value();
+
+
+
+ 505 if (opt_top.has_value()) {
+ 506 const auto cur_queue = opt_top.value();
+
+
+
+
+ 511 if (opt_seed.has_value())
return opt_seed.value();
+
+
+
+
+
+ 517 const auto seed = this->
_l_of_seeds[cur_queue].front();
+
+
+
+
+
+
+
+
+
+ 533 inline void update(
const std::deque<CoMMAIndexType> &new_seeds)
override {
+ 534 if (!new_seeds.empty()) {
+ 535 CoMMAIntType max_bnd{0};
+ 536 for (
const auto &seed : new_seeds) {
+
+ 538 if (n_bnd > max_bnd) max_bnd = n_bnd;
+
+
+
+
+
+ 544 || max_bnd > this->_cur_top_queue.value())
+
+
+
+
+
+ 555 const std::unordered_set<CoMMAIndexType> &new_seeds
+
+ 557 std::map<CoMMAIntType, CoMMASetOfPairType, std::greater<>> new_seeds_by_bnd;
+ 558 if (!new_seeds.empty()) {
+ 559 for (
const auto seed : new_seeds) {
+
+
+
+
+ 564 const auto max_bnd = new_seeds_by_bnd.begin()->first;
+
+ 566 || max_bnd > this->_cur_top_queue.value())
+
+ 568 for (
const auto &[n_bnd, seeds] : new_seeds_by_bnd) {
+
+
+
+
+
+ 574 std::back_inserter(this->_l_of_seeds[n_bnd]),
+ 575 [](
const auto &pr) { return pr.first; }
+
+
+
+
+
+
+
+
+
+ 591 if (max_bnd.has_value() && max_bnd.value() > this->_cur_top_queue.value()) {
+
+
+
+
+
+
+
+
+ 608 typename CoMMAIndexType,
+ 609 typename CoMMAWeightType,
+ 610 typename CoMMAIntType>
+
+ 612 public Seeds_Pool<CoMMAIndexType, CoMMAWeightType, CoMMAIntType> {
+
+
+
+
+
+
+
+ 631 const std::vector<CoMMAIntType> &n_bnd_faces,
+ 632 const std::vector<CoMMAWeightType> &priority_weights,
+ 633 const bool one_point_init
+
+ 635 Seeds_Pool<CoMMAIndexType, CoMMAWeightType, CoMMAIntType>(
+ 636 n_bnd_faces, priority_weights, one_point_init
+
+
+
+
+
+ 648 const std::vector<bool> &is_agglomerated
+
+
+
+
+
+
+
+
+
+
+
+ 660 + (this->_l_of_seeds.size() - (this->_cur_top_queue.value() + 1));
+ 661 queue != this->_l_of_seeds.rend();
+
+ 663 const auto opt_seed = this->
spoil_queue(is_agglomerated, *queue);
+ 664 if (opt_seed.has_value()) {
+
+ 666 return opt_seed.value();
+
+
+
+
+
+
+
+ 674 if (opt_top.has_value()) {
+ 675 const auto cur_queue = opt_top.value();
+
+
+ 678 const auto opt_seed =
+
+ 680 if (opt_seed.has_value())
return opt_seed.value();
+
+
+
+
+
+ 686 const auto seed = this->
_l_of_seeds[cur_queue].front();
+
+
+
+
+
+
+
+
+
+ 702 inline void update(
const std::deque<CoMMAIndexType> &new_seeds)
override {
+ 703 for (
const auto &seed : new_seeds) {
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 722 const std::unordered_set<CoMMAIndexType> &new_seeds
+
+ 724 std::map<CoMMAIntType, CoMMASetOfPairType, std::greater<>> new_seeds_by_bnd;
+ 725 for (
const auto &seed : new_seeds) {
+
+
+
+
+ 730 for (
auto &[n_bnd, seeds] : new_seeds_by_bnd) {
+
+
+
+
+
+
+
+
+
+
+ 741 std::back_inserter(this->_l_of_seeds[q_lvl]),
+ 742 [](
const auto &pr) { return pr.first; }
+
+
+
+
+
+
+
+
+
+
+
+
+
#define CoMMAUnused(var)
Convenient function to avoid unused warnings.
Definition: Util.h:34
-Class representing the pool of all the seeds for creating a coarse cell. This derived class gives hig...
Definition: Seeds_Pool.h:430
-void order_new_seeds_and_update(const std::unordered_set< CoMMAIndexType > &new_seeds) override
Add the provided seeds to a seeds pool queue according to the number of boundary faces....
Definition: Seeds_Pool.h:528
-bool need_initialization(const std::vector< bool > &is_agglomerated) override
Whether the seeds pool need to be initialized. It updates the top queue if necessary.
Definition: Seeds_Pool.h:558
-Seeds_Pool_Boundary_Priority(const std::vector< CoMMAIntType > &n_bnd_faces, const std::vector< CoMMAWeightType > &priority_weights, const bool one_point_init)
Constructor.
Definition: Seeds_Pool.h:448
+Class representing the pool of all the seeds for creating a coarse cell. This derived class gives hig...
Definition: Seeds_Pool.h:452
+void order_new_seeds_and_update(const std::unordered_set< CoMMAIndexType > &new_seeds) override
Add the provided seeds to a seeds pool queue according to the number of boundary faces....
Definition: Seeds_Pool.h:554
+bool need_initialization(const std::vector< bool > &is_agglomerated) override
Whether the seeds pool need to be initialized. It updates the top queue if necessary.
Definition: Seeds_Pool.h:587
+Seeds_Pool_Boundary_Priority(const std::vector< CoMMAIntType > &n_bnd_faces, const std::vector< CoMMAWeightType > &priority_weights, const bool one_point_init)
Constructor.
Definition: Seeds_Pool.h:470
~Seeds_Pool_Boundary_Priority() override=default
Destructor.
-void update(const std::deque< CoMMAIndexType > &new_seeds) override
Add the provided seeds to a seeds pool queue according to the number of boundary faces....
Definition: Seeds_Pool.h:506
-std::optional< CoMMAIndexType > choose_new_seed(const std::vector< bool > &is_agglomerated) override
Choose a new seed in the pool.
Definition: Seeds_Pool.h:463
-Class representing the pool of all the seeds for creating a coarse cell. This derived class gives hig...
Definition: Seeds_Pool.h:583
-std::optional< CoMMAIndexType > choose_new_seed(const std::vector< bool > &is_agglomerated) override
Choose a new seed in the pool.
Definition: Seeds_Pool.h:616
-bool need_initialization(const std::vector< bool > &is_agglomerated) override
Whether the seeds pool need to be initialized.
Definition: Seeds_Pool.h:713
-Seeds_Pool_Neighbourhood_Priority(const std::vector< CoMMAIntType > &n_bnd_faces, const std::vector< CoMMAWeightType > &priority_weights, const bool one_point_init)
Constructor.
Definition: Seeds_Pool.h:601
+void update(const std::deque< CoMMAIndexType > &new_seeds) override
Add the provided seeds to a seeds pool queue according to the number of boundary faces....
Definition: Seeds_Pool.h:533
+std::optional< CoMMAIndexType > choose_new_seed(const std::vector< bool > &is_agglomerated) override
Choose a new seed in the pool.
Definition: Seeds_Pool.h:487
+Class representing the pool of all the seeds for creating a coarse cell. This derived class gives hig...
Definition: Seeds_Pool.h:612
+std::optional< CoMMAIndexType > choose_new_seed(const std::vector< bool > &is_agglomerated) override
Choose a new seed in the pool.
Definition: Seeds_Pool.h:647
+bool need_initialization(const std::vector< bool > &is_agglomerated) override
Whether the seeds pool need to be initialized.
Definition: Seeds_Pool.h:751
+Seeds_Pool_Neighbourhood_Priority(const std::vector< CoMMAIntType > &n_bnd_faces, const std::vector< CoMMAWeightType > &priority_weights, const bool one_point_init)
Constructor.
Definition: Seeds_Pool.h:630
~Seeds_Pool_Neighbourhood_Priority() override=default
Destructor.
-void order_new_seeds_and_update(const std::unordered_set< CoMMAIndexType > &new_seeds) override
Add the provided seeds to a seeds pool queue according to the number of boundary faces....
Definition: Seeds_Pool.h:687
-void update(const std::deque< CoMMAIndexType > &new_seeds) override
Add the provided seeds to a seeds pool queue according to the number of boundary faces.
Definition: Seeds_Pool.h:668
-Class representing the pool of all the seeds for creating a coarse cell.
Definition: Seeds_Pool.h:194
+void order_new_seeds_and_update(const std::unordered_set< CoMMAIndexType > &new_seeds) override
Add the provided seeds to a seeds pool queue according to the number of boundary faces....
Definition: Seeds_Pool.h:721
+void update(const std::deque< CoMMAIndexType > &new_seeds) override
Add the provided seeds to a seeds pool queue according to the number of boundary faces.
Definition: Seeds_Pool.h:702
+Class representing the pool of all the seeds for creating a coarse cell.
Definition: Seeds_Pool.h:200
virtual bool need_initialization(const std::vector< bool > &is_agglomerated)=0
Whether the seeds pool need to be initialized.
-std::vector< CoMMAQueueType > _l_of_seeds
List of deque of seeds. For each identifier we have the available seeds. We want the seed to be chose...
Definition: Seeds_Pool.h:223
-std::optional< CoMMAIntType > get_highest_n_bnd_yet_to_agglomerate(const std::vector< bool > &is_fc_agglomerated, const CoMMAIntType expected_max=CoMMACellT::CORNER) const
Compute the highest number of boundary faces of cells which are not agglomerated yet.
Definition: Seeds_Pool.h:346
-const std::vector< CoMMAWeightType > & _priority_weights
Weights used to set the order of the seed to choose.
Definition: Seeds_Pool.h:226
-Seeds_Pool(const std::vector< CoMMAIntType > &n_bnd_faces, const std::vector< CoMMAWeightType > &priority_weights, const bool one_point_init)
Constructor.
Definition: Seeds_Pool.h:250
+std::vector< CoMMAQueueType > _l_of_seeds
List of deque of seeds. For each identifier we have the available seeds. We want the seed to be chose...
Definition: Seeds_Pool.h:229
+std::optional< CoMMAIntType > get_highest_n_bnd_yet_to_agglomerate(const std::vector< bool > &is_fc_agglomerated, const CoMMAIntType expected_max=CoMMACellT::CORNER) const
Compute the highest number of boundary faces of cells which are not agglomerated yet.
Definition: Seeds_Pool.h:359
+const std::vector< CoMMAWeightType > & _priority_weights
Weights used to set the order of the seed to choose.
Definition: Seeds_Pool.h:232
+Seeds_Pool(const std::vector< CoMMAIntType > &n_bnd_faces, const std::vector< CoMMAWeightType > &priority_weights, const bool one_point_init)
Constructor.
Definition: Seeds_Pool.h:256
virtual std::optional< CoMMAIndexType > choose_new_seed(const std::vector< bool > &is_agglomerated)=0
Choose a new seed in the pool.
-bool is_empty(CoMMAIntType i_level=CoMMACellT::N_CELL_TYPES) const
Given the default levels we define if the list of the targeted level is empty.
Definition: Seeds_Pool.h:366
-std::pair< CoMMAIndexType, CoMMAWeightType > CoMMAPairType
Type of pair.
Definition: Seeds_Pool.h:197
+bool is_empty(CoMMAIntType i_level=CoMMACellT::N_CELL_TYPES) const
Given the default levels we define if the list of the targeted level is empty.
Definition: Seeds_Pool.h:385
+std::pair< CoMMAIndexType, CoMMAWeightType > CoMMAPairType
Type of pair.
Definition: Seeds_Pool.h:203
virtual ~Seeds_Pool()=default
Destructor.
-void initialize()
Initialize the seeds pool via a call to its initializator.
Definition: Seeds_Pool.h:399
+void initialize()
Initialize the seeds pool via a call to its initializator.
Definition: Seeds_Pool.h:418
virtual void update(const std::deque< CoMMAIndexType > &new_seeds)=0
Add the provided seeds to a seeds pool queue according to the number of boundary faces.
-std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > > CoMMASetOfPairType
Type of set of pairs.
Definition: Seeds_Pool.h:216
-std::optional< CoMMAIntType > _cur_top_queue
Optional possibly containing the level (0,1,2,3, see Seeds_Pool::_l_of_seeds) of the queue currently ...
Definition: Seeds_Pool.h:231
-std::optional< CoMMAIndexType > spoil_queue(const std::vector< bool > &is_fc_agglomerated, CoMMAQueueType &queue)
Spoil a queue looking for an not-yet-agglomerated seed.
Definition: Seeds_Pool.h:278
-void set_top_queue(const CoMMAIntType q_lvl)
Setter for the top queue member.
Definition: Seeds_Pool.h:412
-std::deque< CoMMAIndexType > CoMMAQueueType
Type of queue which holds seeds.
Definition: Seeds_Pool.h:213
-std::shared_ptr< SPInitializator< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _initializator
Pointer to a SPInitializator.
Definition: Seeds_Pool.h:236
+std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > > CoMMASetOfPairType
Type of set of pairs.
Definition: Seeds_Pool.h:222
+std::optional< CoMMAIntType > _cur_top_queue
Optional possibly containing the level (0,1,2,3, see Seeds_Pool::_l_of_seeds) of the queue currently ...
Definition: Seeds_Pool.h:237
+std::optional< CoMMAIndexType > spoil_queue(const std::vector< bool > &is_fc_agglomerated, CoMMAQueueType &queue)
Spoil a queue looking for an not-yet-agglomerated seed.
Definition: Seeds_Pool.h:286
+void set_top_queue(const CoMMAIntType q_lvl)
Setter for the top queue member.
Definition: Seeds_Pool.h:434
+std::deque< CoMMAIndexType > CoMMAQueueType
Type of queue which holds seeds.
Definition: Seeds_Pool.h:219
+std::shared_ptr< SPInitializator< CoMMAIndexType, CoMMAWeightType, CoMMAIntType > > _initializator
Pointer to a SPInitializator.
Definition: Seeds_Pool.h:242
virtual void order_new_seeds_and_update(const std::unordered_set< CoMMAIndexType > &new_seeds)=0
Add the provided seeds to a seeds pool queue according to the number of boundary faces....
-void build_queue(const std::vector< bool > &is_fc_agglomerated, const CoMMAIntType target)
Build the weight-ordered queue of seed for a given target level. A set of (index, weight) pair with s...
Definition: Seeds_Pool.h:324
-const std::vector< CoMMAIntType > & _n_bnd_faces
Vector of number of faces on boundary per cell.
Definition: Seeds_Pool.h:240
+void build_queue(const std::vector< bool > &is_fc_agglomerated, const CoMMAIntType target)
Build the weight-ordered queue of seed for a given target level. A set of (index, weight) pair with s...
Definition: Seeds_Pool.h:335
+const std::vector< CoMMAIntType > & _n_bnd_faces
Vector of number of faces on boundary per cell.
Definition: Seeds_Pool.h:246
Definition: Agglomerator.h:34
@ N_CELL_TYPES
Total number of values.
Definition: CoMMADefs.h:31
@ CORNER
Corners, three boundary faces.
Definition: CoMMADefs.h:28
@ VALLEY
Valley, one boundary face.
Definition: CoMMADefs.h:26
@ RIDGE
Ridge, two boundary faces.
Definition: CoMMADefs.h:27
@ INTERIOR
Interior cell, no boundary faces.
Definition: CoMMADefs.h:25
-Functor for pairs implementing a custom 'greater than'. It relies on the 'greater than' operator for ...
Definition: Util.h:154
-Functor for pairs implementing a custom 'less than'. It relies on the 'less than' operator for the se...
Definition: Util.h:131
-Functor performing the full initialization of a seeds pool.
Definition: Seeds_Pool.h:87
-SPFullInitializator()
Constructor.
Definition: Seeds_Pool.h:97
+Functor for pairs implementing a custom 'greater than'. It relies on the 'greater than' operator for ...
Definition: Util.h:156
+Functor for pairs implementing a custom 'less than'. It relies on the 'less than' operator for the se...
Definition: Util.h:133
+Functor performing the full initialization of a seeds pool.
Definition: Seeds_Pool.h:88
+SPFullInitializator()
Constructor.
Definition: Seeds_Pool.h:98
~SPFullInitializator() override=default
Destructor.
-void operator()(const std::vector< CoMMAWeightType > &priority_weights, const std::vector< CoMMAIntType > &n_bnd_faces, const CoMMAIntType max_bnd, CoMMAQueueType &queue) override
Initialize a queue of a seeds pool.
Definition: Seeds_Pool.h:111
+void operator()(const std::vector< CoMMAWeightType > &priority_weights, const std::vector< CoMMAIntType > &n_bnd_faces, const CoMMAIntType max_bnd, CoMMAQueueType &queue) override
Initialize a queue of a seeds pool.
Definition: Seeds_Pool.h:113
std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > > CoMMASetOfPairType
Type of set of pairs.
Definition: Seeds_Pool.h:52
std::deque< CoMMAIndexType > CoMMAQueueType
Type of queue which holds seeds.
Definition: Seeds_Pool.h:49
Functor performing the initialization of a seeds pool.
Definition: Seeds_Pool.h:45
@@ -649,11 +687,11 @@
virtual void operator()(const std::vector< CoMMAWeightType > &priority_weights, const std::vector< CoMMAIntType > &n_bnd_faces, const CoMMAIntType max_bnd, CoMMAQueueType &queue)=0
Initialize a queue of a seeds pool.
std::set< CoMMAPairType, CustomPairGreaterFunctor< CoMMAPairType > > CoMMASetOfPairType
Type of set of pairs.
Definition: Seeds_Pool.h:52
std::deque< CoMMAIndexType > CoMMAQueueType
Type of queue which holds seeds.
Definition: Seeds_Pool.h:49
-Functor performing the one-point initialization of a seeds pool.
Definition: Seeds_Pool.h:140
+Functor performing the one-point initialization of a seeds pool.
Definition: Seeds_Pool.h:143
std::pair< CoMMAIndexType, CoMMAWeightType > CoMMAPairType
Type of pair.
Definition: Seeds_Pool.h:47
-void operator()(const std::vector< CoMMAWeightType > &priority_weights, const std::vector< CoMMAIntType > &n_bnd_faces, const CoMMAIntType max_bnd, CoMMAQueueType &queue) override
Initialize a queue of a seeds pool.
Definition: Seeds_Pool.h:164
+void operator()(const std::vector< CoMMAWeightType > &priority_weights, const std::vector< CoMMAIntType > &n_bnd_faces, const CoMMAIntType max_bnd, CoMMAQueueType &queue) override
Initialize a queue of a seeds pool.
Definition: Seeds_Pool.h:168
~SPOnePointInitializator() override=default
Destructor.
-SPOnePointInitializator()
Constructor.
Definition: Seeds_Pool.h:150
+SPOnePointInitializator()
Constructor.
Definition: Seeds_Pool.h:153
std::deque< CoMMAIndexType > CoMMAQueueType
Type of queue which holds seeds.
Definition: Seeds_Pool.h:49
diff --git a/_tree_8h_source.html b/_tree_8h_source.html
index a16dc42..80c23e6 100644
--- a/_tree_8h_source.html
+++ b/_tree_8h_source.html
@@ -143,87 +143,101 @@
- 76 explicit Tree(std::shared_ptr<NodeType> &root) :
_root(root) {}
-
-
-
- 82 std::shared_ptr<NodeType>
_root;
-
-
- 91 const CoMMAIndexType &father_index,
- 92 const CoMMAIndexType &index,
- 93 const CoMMAWeightType &volume,
- 94 const CoMMAIntType &root) {
- 95 std::shared_ptr<NodeType> insertion =
- 96 std::make_shared<NodeType>(index, volume);
-
-
- 99 assert(u_p_father !=
nullptr);
- 100 insertion->_father = u_p_father;
- 101 auto left_idx =
transverse(u_p_father->_left_son_idx);
- 102 if (left_idx ==
nullptr) {
- 103 u_p_father->_left_son_idx = insertion;
-
- 105 insertion->_left_idx = left_idx;
- 106 left_idx->_right_idx = insertion;
-
- 108 u_p_father->_sonc = u_p_father->_sonc + 1;
-
-
-
-
- 118 std::shared_ptr<NodeType> &node,
const CoMMAIndexType &value) {
- 119 if (node->_index == value && node->_father !=
nullptr) {
return node; }
- 120 if (node ==
nullptr || node->_right_idx ==
nullptr) {
return nullptr; }
- 121 return (
search(node->_right_idx, value));
-
-
- 128 std::shared_ptr<NodeType>
transverse(std::shared_ptr<NodeType> &node) {
- 129 if (node ==
nullptr || node->_right_idx ==
nullptr) {
return node; }
-
-
-
-
-
-
-
-
- 145 std::shared_ptr<NodeType> &searched_node,
const CoMMAIndexType &value) {
- 146 if (searched_node ==
nullptr) {
return; }
- 147 if (searched_node->_index == value) {
-
- 149 if (searched_node->_left_idx ==
nullptr) {
- 150 searched_node->_father->_sonc--;
- 151 searched_node->_father->_left_son_idx = searched_node->_right_idx;
- 152 searched_node->_right_idx->_left_idx =
nullptr;
-
-
- 155 else if (searched_node->_right_idx ==
nullptr) {
- 156 searched_node->_father->_sonc = searched_node->_father->_sonc - 1;
- 157 searched_node->_left_idx->_right_idx.reset();
-
- 159 searched_node->_father->_sonc--;
- 160 searched_node->_left_idx->_right_idx = searched_node->_right_idx;
- 161 searched_node->_right_idx->_left_idx = searched_node->_left_idx;
-
-
-
-
-
-
-
-
-
- 175 if (node ==
nullptr) {
return; }
-
-
-
-
-
-
-
-
-
+ 76 explicit Tree(std::shared_ptr<NodeType> &root) :
+
+
+
+
+ 83 std::shared_ptr<NodeType>
_root;
+
+
+ 92 const CoMMAIndexType &father_index,
+ 93 const CoMMAIndexType &index,
+ 94 const CoMMAWeightType &volume,
+ 95 const CoMMAIntType &root
+
+ 97 std::shared_ptr<NodeType> insertion =
+ 98 std::make_shared<NodeType>(index, volume);
+
+
+ 101 assert(u_p_father !=
nullptr);
+ 102 insertion->_father = u_p_father;
+ 103 auto left_idx =
transverse(u_p_father->_left_son_idx);
+ 104 if (left_idx ==
nullptr) {
+ 105 u_p_father->_left_son_idx = insertion;
+
+ 107 insertion->_left_idx = left_idx;
+ 108 left_idx->_right_idx = insertion;
+
+ 110 u_p_father->_sonc = u_p_father->_sonc + 1;
+
+
+
+
+ 120 std::shared_ptr<NodeType> &node,
const CoMMAIndexType &value
+
+ 122 if (node->_index == value && node->_father !=
nullptr) {
+
+
+ 125 if (node ==
nullptr || node->_right_idx ==
nullptr) {
+
+
+ 128 return (
search(node->_right_idx, value));
+
+
+ 135 std::shared_ptr<NodeType>
transverse(std::shared_ptr<NodeType> &node) {
+ 136 if (node ==
nullptr || node->_right_idx ==
nullptr) {
+
+
+
+
+
+
+
+
+
+
+ 154 std::shared_ptr<NodeType> &searched_node,
const CoMMAIndexType &value
+
+ 156 if (searched_node ==
nullptr) {
+
+
+ 159 if (searched_node->_index == value) {
+
+ 161 if (searched_node->_left_idx ==
nullptr) {
+ 162 searched_node->_father->_sonc--;
+ 163 searched_node->_father->_left_son_idx = searched_node->_right_idx;
+ 164 searched_node->_right_idx->_left_idx =
nullptr;
+
+
+ 167 else if (searched_node->_right_idx ==
nullptr) {
+ 168 searched_node->_father->_sonc = searched_node->_father->_sonc - 1;
+ 169 searched_node->_left_idx->_right_idx.reset();
+
+ 171 searched_node->_father->_sonc--;
+ 172 searched_node->_left_idx->_right_idx = searched_node->_right_idx;
+ 173 searched_node->_right_idx->_left_idx = searched_node->_left_idx;
+
+
+
+
+
+
+
+
+
+ 187 if (node ==
nullptr) {
+
+
+
+
+
+
+
+
+
+
+
Node data structure that represent a node of the tree.
Definition: Tree.h:36
std::shared_ptr< Node > _right_idx
Shared pointer to the right element.
Definition: Tree.h:51
std::shared_ptr< Node > _left_son_idx
Shared pointer to the left element.
Definition: Tree.h:53
@@ -234,14 +248,14 @@
Node(CoMMAIndexType index, CoMMAWeightType volume)
Definition: Tree.h:38
CoMMAIndexType _index
Index of the cell.
Definition: Tree.h:41
Tree structure that represent a coarse cell, the fine cell and the neighbours to them.
Definition: Tree.h:68
-void print_nodes(std::shared_ptr< NodeType > &node)
Print the branches starting from a given node.
Definition: Tree.h:174
-std::shared_ptr< NodeType > _root
The Node at the root of the tree.
Definition: Tree.h:82
-void deleteNode(const CoMMAIndexType &value)
Delete a node.
Definition: Tree.h:136
-void insertSon(const CoMMAIndexType &father_index, const CoMMAIndexType &index, const CoMMAWeightType &volume, const CoMMAIntType &root)
Insert a node as child of a given node.
Definition: Tree.h:90
-std::shared_ptr< NodeType > transverse(std::shared_ptr< NodeType > &node)
Traverse the tree.
Definition: Tree.h:128
-void print()
Print the tree.
Definition: Tree.h:169
-std::shared_ptr< NodeType > search(std::shared_ptr< NodeType > &node, const CoMMAIndexType &value)
Look for a node.
Definition: Tree.h:117
-void delete_node(std::shared_ptr< NodeType > &searched_node, const CoMMAIndexType &value)
Delete a node.
Definition: Tree.h:144
+void print_nodes(std::shared_ptr< NodeType > &node)
Print the branches starting from a given node.
Definition: Tree.h:186
+std::shared_ptr< NodeType > _root
The Node at the root of the tree.
Definition: Tree.h:83
+void deleteNode(const CoMMAIndexType &value)
Delete a node.
Definition: Tree.h:145
+void insertSon(const CoMMAIndexType &father_index, const CoMMAIndexType &index, const CoMMAWeightType &volume, const CoMMAIntType &root)
Insert a node as child of a given node.
Definition: Tree.h:91
+std::shared_ptr< NodeType > transverse(std::shared_ptr< NodeType > &node)
Traverse the tree.
Definition: Tree.h:135
+void print()
Print the tree.
Definition: Tree.h:181
+std::shared_ptr< NodeType > search(std::shared_ptr< NodeType > &node, const CoMMAIndexType &value)
Look for a node.
Definition: Tree.h:119
+void delete_node(std::shared_ptr< NodeType > &searched_node, const CoMMAIndexType &value)
Delete a node.
Definition: Tree.h:153
~Tree()=default
Destructor.
Tree(std::shared_ptr< NodeType > &root)
Constructor.
Definition: Tree.h:76
Definition: Agglomerator.h:34
diff --git a/_util_8h_source.html b/_util_8h_source.html
index d976995..b01129b 100644
--- a/_util_8h_source.html
+++ b/_util_8h_source.html
@@ -148,162 +148,170 @@
- 83 const std::vector<T> &a,
const std::vector<T> &b, std::vector<T> &dir) {
-
- 85 for (
auto i =
decltype(a.size()){0}; i < a.size(); ++i) {
- 86 const T di = b[i] - a[i];
-
-
-
-
- 91 const T ov_norm = T{1.} / norm;
-
-
-
-
-
-
-
- 109 const std::vector<T> &a,
const std::vector<T> &b) {
-
-
- 112 transform_reduce(a.cbegin(), a.cend(), b.cbegin(), T{0.},
- 113 [](
const auto sum,
const auto val){return sum + val*val;},
-
-
-
-
- 118 for (
auto i =
decltype(a.size()){0}; i < a.size(); ++i) {
- 119 const auto diff = a[i] - b[i];
-
-
-
-
-
-
-
- 140 inline bool operator()(
const PairT &left,
const PairT &right)
const {
- 141 if (left.second < right.second)
return true;
- 142 if (left.second > right.second)
return false;
-
- 144 return left.first > right.first;
-
-
-
- 153template<
typename PairT>
-
- 163 inline bool operator()(
const PairT &left,
const PairT &right)
const {
-
-
- 166 if (left.second > right.second)
return true;
- 167 if (left.second < right.second)
return false;
-
- 169 return left.first < right.first;
-
-
-
- 177template<
typename PairT>
-
- 185 inline bool operator()(
const PairT &left,
const PairT &right)
const {
- 186 return left.second < right.second;
-
-
-
- 196template<
typename CoMMAContainerPairType>
- 197inline std::vector<typename CoMMAContainerPairType::value_type::first_type>
-
- 199 std::vector<typename CoMMAContainerPairType::value_type::first_type> fe;
- 200 fe.reserve(cont.size());
- 201 for (
const auto &pr : cont)
- 202 fe.emplace_back(pr.first);
-
-
-
- 210template<
typename PairT>
-
-
-
-
-
-
-
- 228 inline bool operator()(
const PairT &pr)
const {
return pr.first == _target; }
-
-
- 232 typename PairT::first_type _target;
-
-
- 241template<
typename KeyT,
typename ValueT>
-
- 243 const std::unordered_map<KeyT, ValueT> &dict) {
- 244 std::unordered_set<KeyT> s_neighbours_of_seed = {};
- 245 for (
const auto &i_k_v : dict) {
- 246 s_neighbours_of_seed.insert(i_k_v.first);
-
- 248 return s_neighbours_of_seed;
-
-
- 272template<
typename IndexT,
typename DistT>
-
- 274 const std::vector<IndexT> &neigh_idxs,
- 275 const std::vector<IndexT> &neighs,
- 276 const std::vector<IndexT> &wall,
- 277 std::vector<DistT> &dist) {
-
- 279 std::is_signed<DistT>::value,
- 280 "The distance type should be signed to allow flags (negative values)");
- 281 dist.resize(neigh_idxs.size() - 1);
- 282 std::fill(dist.begin(), dist.end(), DistT{-1});
- 283 std::queue<IndexT> to_visit{};
- 284 for (
const auto &cell : wall) {
- 285 dist[cell] = DistT{0};
- 286 to_visit.emplace(cell);
-
- 288 while (!to_visit.empty()) {
-
-
-
-
-
-
- 295 const auto cur = to_visit.front();
-
- 297 const auto cur_dist = dist[cur] + DistT{1};
- 298 for (
auto neigh = neighs.cbegin() + neigh_idxs[cur];
- 299 neigh < neighs.cbegin() + neigh_idxs[cur + 1]; ++neigh) {
- 300 if (dist[*neigh] < DistT{0}) {
- 301 dist[*neigh] = cur_dist;
- 302 to_visit.emplace(*neigh);
- 303 }
else if (dist[*neigh] > cur_dist) {
- 304 dist[*neigh] = cur_dist;
-
-
-
-
-
-
-
-
-Functor implementing an operator telling if a given value if the first one of pair.
Definition: Util.h:211
-bool operator()(const PairT &pr) const
Operator telling if the first value of the given pair is equal to the reference one.
Definition: Util.h:228
+ 83 const std::vector<T> &a,
const std::vector<T> &b, std::vector<T> &dir
+
+
+ 86 for (
auto i =
decltype(a.size()){0}; i < a.size(); ++i) {
+ 87 const T di = b[i] - a[i];
+
+
+
+
+ 92 const T ov_norm = T{1.} / norm;
+
+
+
+
+
+
+
+ 110 const std::vector<T> &a,
const std::vector<T> &b
+
+
+
+ 114 transform_reduce(a.cbegin(), a.cend(), b.cbegin(), T{0.},
+ 115 [](
const auto sum,
const auto val){return sum + val*val;},
+
+
+
+
+ 120 for (
auto i =
decltype(a.size()){0}; i < a.size(); ++i) {
+ 121 const auto diff = a[i] - b[i];
+
+
+
+
+
+
+
+ 142 inline bool operator()(
const PairT &left,
const PairT &right)
const {
+ 143 if (left.second < right.second)
return true;
+ 144 if (left.second > right.second)
return false;
+
+ 146 return left.first > right.first;
+
+
+
+ 155template<
typename PairT>
+
+ 165 inline bool operator()(
const PairT &left,
const PairT &right)
const {
+
+
+ 168 if (left.second > right.second)
return true;
+ 169 if (left.second < right.second)
return false;
+
+ 171 return left.first < right.first;
+
+
+
+ 179template<
typename PairT>
+
+ 187 inline bool operator()(
const PairT &left,
const PairT &right)
const {
+ 188 return left.second < right.second;
+
+
+
+ 198template<
typename CoMMAContainerPairType>
+ 199inline std::vector<typename CoMMAContainerPairType::value_type::first_type>
+
+ 201 std::vector<typename CoMMAContainerPairType::value_type::first_type> fe;
+ 202 fe.reserve(cont.size());
+ 203 for (
const auto &pr : cont)
+ 204 fe.emplace_back(pr.first);
+
+
+
+ 212template<
typename PairT>
+
+
+
+
+
+
+
+
+
+ 232 inline bool operator()(
const PairT &pr)
const {
return pr.first == _target; }
+
+
+ 236 typename PairT::first_type _target;
+
+
+ 245template<
typename KeyT,
typename ValueT>
+
+ 247 const std::unordered_map<KeyT, ValueT> &dict
+
+ 249 std::unordered_set<KeyT> s_neighbours_of_seed = {};
+ 250 for (
const auto &i_k_v : dict) {
+ 251 s_neighbours_of_seed.insert(i_k_v.first);
+
+ 253 return s_neighbours_of_seed;
+
+
+ 277template<
typename IndexT,
typename DistT>
+
+ 279 const std::vector<IndexT> &neigh_idxs,
+ 280 const std::vector<IndexT> &neighs,
+ 281 const std::vector<IndexT> &wall,
+ 282 std::vector<DistT> &dist
+
+
+ 285 std::is_signed<DistT>::value,
+ 286 "The distance type should be signed to allow flags (negative values)"
+
+ 288 dist.resize(neigh_idxs.size() - 1);
+ 289 std::fill(dist.begin(), dist.end(), DistT{-1});
+ 290 std::queue<IndexT> to_visit{};
+ 291 for (
const auto &cell : wall) {
+ 292 dist[cell] = DistT{0};
+ 293 to_visit.emplace(cell);
+
+ 295 while (!to_visit.empty()) {
+
+
+
+
+
+
+ 302 const auto cur = to_visit.front();
+
+ 304 const auto cur_dist = dist[cur] + DistT{1};
+ 305 for (
auto neigh = neighs.cbegin() + neigh_idxs[cur];
+ 306 neigh < neighs.cbegin() + neigh_idxs[cur + 1];
+
+ 308 if (dist[*neigh] < DistT{0}) {
+ 309 dist[*neigh] = cur_dist;
+ 310 to_visit.emplace(*neigh);
+ 311 }
else if (dist[*neigh] > cur_dist) {
+ 312 dist[*neigh] = cur_dist;
+
+
+
+
+
+
+
+
+Functor implementing an operator telling if a given value if the first one of pair.
Definition: Util.h:213
+bool operator()(const PairT &pr) const
Operator telling if the first value of the given pair is equal to the reference one.
Definition: Util.h:232
~PairFindFirstBasedFunctor()=default
Destructor.
-PairFindFirstBasedFunctor()
Constructor.
Definition: Util.h:214
-PairFindFirstBasedFunctor(const typename PairT::first_type &target)
Constructor.
Definition: Util.h:219
+PairFindFirstBasedFunctor()
Constructor.
Definition: Util.h:216
+PairFindFirstBasedFunctor(const typename PairT::first_type &target)
Constructor.
Definition: Util.h:222
Definition: Agglomerator.h:34
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.
Definition: Util.h:60
-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 ...
Definition: Util.h:108
+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 ...
Definition: Util.h:109
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.
Definition: Util.h:82
constexpr double deviate_thresh
Threshold used in combination with a dot product to tell whether two vector deviate....
Definition: Util.h:39
-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.
Definition: Util.h:242
+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.
Definition: Util.h:246
bool dot_deviate(const T dot)
Tell whether the dot product given as input comes from two parallel vectors. Compared against deviate...
Definition: Util.h:48
-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.
Definition: Util.h:198
-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 ...
Definition: Util.h:273
-Functor for pairs implementing a custom 'greater than'. It relies on the 'greater than' operator for ...
Definition: Util.h:154
-bool operator()(const PairT &left, const PairT &right) const
Functor for pairs implementing a custom 'greater than'. It relies on the 'greater than' operator for ...
Definition: Util.h:163
-Functor for pairs implementing a custom 'less than'. It relies on the 'less than' operator for the se...
Definition: Util.h:131
-bool operator()(const PairT &left, const PairT &right) const
Functor for pairs implementing a custom 'less than'. It relies on the 'less than' operator for the se...
Definition: Util.h:140
-Functor for pairs implementing a less operator based only on the second element of the pair.
Definition: Util.h:178
-bool operator()(const PairT &left, const PairT &right) const
Functor for pairs implementing a less operator based only on the second element of the pair.
Definition: Util.h:185
+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.
Definition: Util.h:200
+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 ...
Definition: Util.h:278
+Functor for pairs implementing a custom 'greater than'. It relies on the 'greater than' operator for ...
Definition: Util.h:156
+bool operator()(const PairT &left, const PairT &right) const
Functor for pairs implementing a custom 'greater than'. It relies on the 'greater than' operator for ...
Definition: Util.h:165
+Functor for pairs implementing a custom 'less than'. It relies on the 'less than' operator for the se...
Definition: Util.h:133
+bool operator()(const PairT &left, const PairT &right) const
Functor for pairs implementing a custom 'less than'. It relies on the 'less than' operator for the se...
Definition: Util.h:142
+Functor for pairs implementing a less operator based only on the second element of the pair.
Definition: Util.h:180
+bool operator()(const PairT &left, const PairT &right) const
Functor for pairs implementing a less operator based only on the second element of the pair.
Definition: Util.h:187
diff --git a/template_helpers_8h_source.html b/template_helpers_8h_source.html
index e82a23e..34eda24 100644
--- a/template_helpers_8h_source.html
+++ b/template_helpers_8h_source.html
@@ -114,12 +114,14 @@
29template<
bool condition,
typename typeA,
typename typeB>
- 31 if constexpr (condition) { a = b; }
-
-
-
+ 31 if constexpr (condition) {
+
+
+
-
+
+
+
Definition: Agglomerator.h:34
void fill_value(typeA &a, typeB &b)
Assign from type to another only if a compile-time condition is verified.
Definition: templateHelpers.h:30