diff --git a/AMDiS/src/DualTraverse.cc b/AMDiS/src/DualTraverse.cc index 1a9585b3ef50309826087df1003f8a651e6f904f..214df2cbe9f66a4067238f123ab108054ec384fe 100644 --- a/AMDiS/src/DualTraverse.cc +++ b/AMDiS/src/DualTraverse.cc @@ -152,10 +152,8 @@ namespace AMDiS { if (rest == 1.0) { if (*elInfo1 == *elInfoSmall) { stack1.startDisplacementCalculation((*elInfo2)->getLevel()); - // (*elInfo1)->setDisplacement(0); } else { stack2.startDisplacementCalculation((*elInfo1)->getLevel()); - // (*elInfo2)->setDisplacement(0); } } diff --git a/AMDiS/src/Traverse.cc b/AMDiS/src/Traverse.cc index 2b55cbfabfecc7d8a3c7311cb9bedc843215caa1..20981eb35444cd852abd3ceaec5d022983c841b3 100644 --- a/AMDiS/src/Traverse.cc +++ b/AMDiS/src/Traverse.cc @@ -365,7 +365,7 @@ namespace AMDiS { el = elinfo_stack[stack_used]->getElement(); if (calcDisplacement) { - displacementStackPos--; + displacementStack.pop(); } } @@ -404,12 +404,11 @@ namespace AMDiS { stack_used++; if (calcDisplacement) { - displacementStackPos++; - if (displacementStackPos < static_cast<int>(displacementStack.size())) { - displacementStack[displacementStackPos]++; + if (i == 0) { + displacementStack.push(displacementStack.top() * 2); } else { - displacementStack.push_back(2 * (displacementStack[displacementStackPos - 1] - 1) + 1); - } + displacementStack.push(displacementStack.top() * 2 + 1); + } } @@ -421,7 +420,7 @@ namespace AMDiS { } if (calcDisplacement) { - elinfo_stack[stack_used]->setDisplacement(displacementStack[displacementStackPos]); + elinfo_stack[stack_used]->setDisplacement(displacementStack.top()); } return elinfo_stack[stack_used]; @@ -1111,12 +1110,11 @@ namespace AMDiS { { calcDisplacement = true; - displacementStack.resize(elinfo_stack[stack_used]->getLevel() - level + 1); - for (int i = 0; i < static_cast<int>(displacementStack.size()); i++) { - displacementStack[i] = 0; + displacementStack.empty(); + for (int i = 0; i <= elinfo_stack[stack_used]->getLevel() - level; i++) { + displacementStack.push(0); } - displacementStackPos = displacementStack.size() - 1; elinfo_stack[stack_used]->setDisplacement(0); } diff --git a/AMDiS/src/Traverse.h b/AMDiS/src/Traverse.h index e798cb3fba9acc375367cc9bca7a2c4335046f7c..f85388ee7a0909608b1b7ed08c3b6203192f8389 100644 --- a/AMDiS/src/Traverse.h +++ b/AMDiS/src/Traverse.h @@ -37,6 +37,7 @@ #include "OpenMP.h" #include <vector> #include <deque> +#include <stack> namespace AMDiS { @@ -70,9 +71,7 @@ namespace AMDiS { stack_size(0), stack_used(0), save_stack_used(0), - displacementStack(0), calcDisplacement(false), - displacementStackPos(-1), myThreadId_(0), maxThreads_(1) { @@ -298,18 +297,13 @@ namespace AMDiS { /** \brief * Stack for counting the deplacement information for dual traverse. */ - std::vector<int> displacementStack; + std::stack<int> displacementStack; /** \brief * True, if \ref displacementStack should be calculated. */ bool calcDisplacement; - /** \brief - * Current position within the \ref displacementStack. - */ - int displacementStackPos; - /** \brief * Is used for parallel mesh traverse. The thread with the id * myThreadId is only allowed to access coarse elements, which id