From a259e8ab53cb000416233940207972badafd7daa Mon Sep 17 00:00:00 2001 From: StefanoPetrilli Date: Sat, 23 Jul 2022 11:34:43 -0500 Subject: [PATCH] extractUChunch optimization --- amgprec/impl/aggregator/extractUChunk.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/amgprec/impl/aggregator/extractUChunk.cpp b/amgprec/impl/aggregator/extractUChunk.cpp index b5bc1f5f..e26d1011 100644 --- a/amgprec/impl/aggregator/extractUChunk.cpp +++ b/amgprec/impl/aggregator/extractUChunk.cpp @@ -11,14 +11,18 @@ void extractUChunk( { if (U.empty() && !privateU.empty()) // If U is empty but there are nodes in private U + { while (!privateU.empty()) - U.push_back(privateU.pop_front()); - - for (int i = 0; i < UCHUNK; i++) - { // Pop the new nodes - if (U.empty()) - break; - UChunkBeingProcessed.push_back(U.pop_front()); + UChunkBeingProcessed.push_back(privateU.pop_back()); + } + else + { + for (int i = 0; i < UCHUNK; i++) + { // Pop the new nodes + if (U.empty()) + break; + UChunkBeingProcessed.push_back(U.pop_back()); + } } } // End of critical U