Commit 37322782 authored by Thomas Witkowski's avatar Thomas Witkowski

* OpenMP bug fix

parent 8817dab1
......@@ -114,12 +114,10 @@ namespace AMDiS {
TEST_EXIT_DBG(dimOfWorld == 3)
("dim != dim_of_world ! use parametric elements!\n");
int myRank = omp_get_thread_num();
WorldVector<double> *e1 = &tmpWorldVecs[myRank][0];
WorldVector<double> *e2 = &tmpWorldVecs[myRank][1];
WorldVector<double> *e3 = &tmpWorldVecs[myRank][2];
WorldVector<double> *v0 = &tmpWorldVecs[myRank][3];
WorldVector<double> *e1 = &tmpWorldVecs[0];
WorldVector<double> *e2 = &tmpWorldVecs[1];
WorldVector<double> *e3 = &tmpWorldVecs[2];
WorldVector<double> *v0 = &tmpWorldVecs[3];
double det, adet;
double a11, a12, a13, a21, a22, a23, a31, a32, a33;
......@@ -318,9 +316,9 @@ namespace AMDiS {
int myRank = omp_get_thread_num();
WorldVector<double> *e0 = &tmpWorldVecs[myRank][0];
WorldVector<double> *e1 = &tmpWorldVecs[myRank][1];
WorldVector<double> *e2 = &tmpWorldVecs[myRank][2];
WorldVector<double> *e0 = &tmpWorldVecs[0];
WorldVector<double> *e1 = &tmpWorldVecs[1];
WorldVector<double> *e2 = &tmpWorldVecs[2];
if (dimOfWorld == 3) {
int i0 = (face + 1) % 4;
......
......@@ -48,11 +48,7 @@ namespace AMDiS {
ElInfo3d(Mesh* aMesh)
: ElInfo(aMesh)
{
tmpWorldVecs.resize(omp_get_max_threads());
for (int i = 0; i < static_cast<int>(tmpWorldVecs.size()); i++) {
tmpWorldVecs[i].resize(4);
}
tmpWorldVecs.resize(4);
};
/** \brief
......@@ -138,9 +134,8 @@ namespace AMDiS {
/** \brief
* Tmp vectors used for calculations in calcGrdLambda and getNormal().
* Thread safe!
*/
::std::vector< ::std::vector< WorldVector<double> > > tmpWorldVecs;
::std::vector< WorldVector<double> > tmpWorldVecs;
};
}
......
......@@ -736,7 +736,7 @@ namespace AMDiS {
if (useGetBound_) {
bound = GET_MEMORY(BoundaryType, componentSpaces_[i]->getBasisFcts()->getNumber());
}
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(componentMeshes_[i], -1, assembleFlag);
......@@ -750,7 +750,7 @@ namespace AMDiS {
if (matrix->getBoundaryManager()) {
matrix->
getBoundaryManager()->
getBoundaryManager()->
fillBoundaryConditions(elInfo, matrix);
}
}
......@@ -761,13 +761,14 @@ namespace AMDiS {
elInfo = stack.traverseNext(elInfo);
}
if (assembleMatrix && matrix->getBoundaryManager())
matrix->getBoundaryManager()->exitMatrix(matrix);
matrix->getBoundaryManager()->exitMatrix(matrix);
if (useGetBound_) {
FREE_MEMORY(bound, BoundaryType, componentSpaces_[i]->getBasisFcts()->getNumber());
}
}
}
assembledMatrix_[i][j] = true;
......@@ -796,7 +797,7 @@ namespace AMDiS {
if (rhs_->getDOFVector(i)->getBoundaryManager())
rhs_->getDOFVector(i)->getBoundaryManager()->exitVector(rhs_->getDOFVector(i));
if (solution_->getDOFVector(i)->getBoundaryManager())
solution_->getDOFVector(i)->getBoundaryManager()->exitVector(solution_->getDOFVector(i));
solution_->getDOFVector(i)->getBoundaryManager()->exitVector(solution_->getDOFVector(i));
}
#ifdef _OPENMP
......
......@@ -40,17 +40,16 @@ namespace AMDiS {
traverse_mel = NULL;
stack_used = 0;
return(traverseNext(NULL));
}
ElInfo* TraverseStack::traverseNext(ElInfo* elinfo_old)
{
FUNCNAME("TraverseStack::traverseNext()");
\
ElInfo *elinfo = NULL;
ElInfo::traverseId = id;
Parametric *parametric = traverse_mesh->getParametric();
if (stack_used) {
......@@ -63,9 +62,9 @@ namespace AMDiS {
TEST_EXIT_DBG(elinfo_old == NULL)("invalid old elinfo != nil\n");
}
if (traverse_fill_flag.isSet(Mesh::CALL_LEAF_EL))
if (traverse_fill_flag.isSet(Mesh::CALL_LEAF_EL)) {
elinfo = traverseLeafElement();
else
} else {
if (traverse_fill_flag.isSet(Mesh::CALL_LEAF_EL_LEVEL))
elinfo = traverseLeafElementLevel();
else if (traverse_fill_flag.isSet(Mesh::CALL_EL_LEVEL))
......@@ -81,6 +80,7 @@ namespace AMDiS {
elinfo = traverseEveryElementPostorder();
else
ERROR_EXIT("invalid traverse_flag\n");
}
if (elinfo) {
if (parametric) {
......@@ -114,12 +114,11 @@ namespace AMDiS {
int Traverse::recursive(ElInfo *elinfo)
{
FUNCNAME("Traverse::recursive");
Element *el = elinfo->getElement();
int mg_level,sum=0;
FUNCNAME("Traverse::recursive()");
Element *el = elinfo->getElement();
int mg_level, sum=0;
Parametric *parametric = mesh->getParametric();
ElInfo::traverseId = id;
if (flag.isSet(Mesh::CALL_LEAF_EL)) {
......@@ -376,7 +375,7 @@ namespace AMDiS {
}
}
}
/* go down tree until leaf */
while (el->getFirstChild()) {
if (stack_used >= stack_size-1)
......
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