Commit 190e139b authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* Corrected displacement computation

parent 6aa136b2
...@@ -152,10 +152,8 @@ namespace AMDiS { ...@@ -152,10 +152,8 @@ namespace AMDiS {
if (rest == 1.0) { if (rest == 1.0) {
if (*elInfo1 == *elInfoSmall) { if (*elInfo1 == *elInfoSmall) {
stack1.startDisplacementCalculation((*elInfo2)->getLevel()); stack1.startDisplacementCalculation((*elInfo2)->getLevel());
// (*elInfo1)->setDisplacement(0);
} else { } else {
stack2.startDisplacementCalculation((*elInfo1)->getLevel()); stack2.startDisplacementCalculation((*elInfo1)->getLevel());
// (*elInfo2)->setDisplacement(0);
} }
} }
......
...@@ -365,7 +365,7 @@ namespace AMDiS { ...@@ -365,7 +365,7 @@ namespace AMDiS {
el = elinfo_stack[stack_used]->getElement(); el = elinfo_stack[stack_used]->getElement();
if (calcDisplacement) { if (calcDisplacement) {
displacementStackPos--; displacementStack.pop();
} }
} }
...@@ -404,12 +404,11 @@ namespace AMDiS { ...@@ -404,12 +404,11 @@ namespace AMDiS {
stack_used++; stack_used++;
if (calcDisplacement) { if (calcDisplacement) {
displacementStackPos++; if (i == 0) {
if (displacementStackPos < static_cast<int>(displacementStack.size())) { displacementStack.push(displacementStack.top() * 2);
displacementStack[displacementStackPos]++;
} else { } else {
displacementStack.push_back(2 * (displacementStack[displacementStackPos - 1] - 1) + 1); displacementStack.push(displacementStack.top() * 2 + 1);
} }
} }
...@@ -421,7 +420,7 @@ namespace AMDiS { ...@@ -421,7 +420,7 @@ namespace AMDiS {
} }
if (calcDisplacement) { if (calcDisplacement) {
elinfo_stack[stack_used]->setDisplacement(displacementStack[displacementStackPos]); elinfo_stack[stack_used]->setDisplacement(displacementStack.top());
} }
return elinfo_stack[stack_used]; return elinfo_stack[stack_used];
...@@ -1111,12 +1110,11 @@ namespace AMDiS { ...@@ -1111,12 +1110,11 @@ namespace AMDiS {
{ {
calcDisplacement = true; calcDisplacement = true;
displacementStack.resize(elinfo_stack[stack_used]->getLevel() - level + 1); displacementStack.empty();
for (int i = 0; i < static_cast<int>(displacementStack.size()); i++) { for (int i = 0; i <= elinfo_stack[stack_used]->getLevel() - level; i++) {
displacementStack[i] = 0; displacementStack.push(0);
} }
displacementStackPos = displacementStack.size() - 1;
elinfo_stack[stack_used]->setDisplacement(0); elinfo_stack[stack_used]->setDisplacement(0);
} }
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "OpenMP.h" #include "OpenMP.h"
#include <vector> #include <vector>
#include <deque> #include <deque>
#include <stack>
namespace AMDiS { namespace AMDiS {
...@@ -70,9 +71,7 @@ namespace AMDiS { ...@@ -70,9 +71,7 @@ namespace AMDiS {
stack_size(0), stack_size(0),
stack_used(0), stack_used(0),
save_stack_used(0), save_stack_used(0),
displacementStack(0),
calcDisplacement(false), calcDisplacement(false),
displacementStackPos(-1),
myThreadId_(0), myThreadId_(0),
maxThreads_(1) maxThreads_(1)
{ {
...@@ -298,18 +297,13 @@ namespace AMDiS { ...@@ -298,18 +297,13 @@ namespace AMDiS {
/** \brief /** \brief
* Stack for counting the deplacement information for dual traverse. * Stack for counting the deplacement information for dual traverse.
*/ */
std::vector<int> displacementStack; std::stack<int> displacementStack;
/** \brief /** \brief
* True, if \ref displacementStack should be calculated. * True, if \ref displacementStack should be calculated.
*/ */
bool calcDisplacement; bool calcDisplacement;
/** \brief
* Current position within the \ref displacementStack.
*/
int displacementStackPos;
/** \brief /** \brief
* Is used for parallel mesh traverse. The thread with the id * Is used for parallel mesh traverse. The thread with the id
* myThreadId is only allowed to access coarse elements, which id * myThreadId is only allowed to access coarse elements, which id
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment