From aec80a5c9135e0438f5e90607a0db06cc978d6e9 Mon Sep 17 00:00:00 2001 From: Urs Ganse Date: Tue, 18 Jun 2024 19:55:24 +0300 Subject: [PATCH 1/2] Fix override_defines container iteration crash. --- dccrg.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dccrg.hpp b/dccrg.hpp index 4d9fe0c..e185343 100644 --- a/dccrg.hpp +++ b/dccrg.hpp @@ -9933,11 +9933,12 @@ template < this->all_to_all_set(new_donts); } while (new_donts.size() > 0); - for (const auto& cell : old_donts) { - if(!this->is_local(cell)) { - old_donts.erase(cell); - } - } + std::erase_if(old_donts, [this](uint64_t cell)->bool{return !this->is_local(cell);});; + //for (const auto& cell : old_donts) { + // if(!this->is_local(cell)) { + // old_donts.erase(cell); + // } + //} this->cells_not_to_refine = old_donts; this->all_to_all_set(this->cells_not_to_refine); From d17d960de57c207a9a4747a2d393bdaebb0e1475 Mon Sep 17 00:00:00 2001 From: Urs Ganse Date: Wed, 19 Jun 2024 10:23:29 +0300 Subject: [PATCH 2/2] Fix second broken erase loop, formatting fixes. --- dccrg.hpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/dccrg.hpp b/dccrg.hpp index e185343..aff3fe0 100644 --- a/dccrg.hpp +++ b/dccrg.hpp @@ -9619,11 +9619,7 @@ template < unique_induced_refines.clear(); } - for(const auto& cell : this->cells_to_refine) { - if(!this->is_local(cell)) { - this->cells_to_refine.erase(cell); - } - } + std::erase_if(cells_to_refine, [this](uint64_t cell){return !this->is_local(cell);}); // add refines from all processes to cells_to_refine std::vector refines(this->cells_to_refine.begin(), this->cells_to_refine.end()); @@ -9933,12 +9929,7 @@ template < this->all_to_all_set(new_donts); } while (new_donts.size() > 0); - std::erase_if(old_donts, [this](uint64_t cell)->bool{return !this->is_local(cell);});; - //for (const auto& cell : old_donts) { - // if(!this->is_local(cell)) { - // old_donts.erase(cell); - // } - //} + std::erase_if(old_donts, [this](uint64_t cell){return !this->is_local(cell);});; this->cells_not_to_refine = old_donts; this->all_to_all_set(this->cells_not_to_refine);