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

* Corrected displacement computation

parent 6aa136b2
......@@ -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);
}
}
......
......@@ -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);
}
......
......@@ -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
......
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