Commit c801d84e authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Fixed a small bug for parallel computations + periodic boundaries + global refinements.

parent 340fd949
...@@ -1429,6 +1429,7 @@ namespace AMDiS { ...@@ -1429,6 +1429,7 @@ namespace AMDiS {
{ {
map<BoundaryType, VertexVector*>::iterator it; map<BoundaryType, VertexVector*>::iterator it;
map<BoundaryType, VertexVector*>::iterator end = periodicAssociations.end(); map<BoundaryType, VertexVector*>::iterator end = periodicAssociations.end();
for (it = periodicAssociations.begin(); it != end; ++it) for (it = periodicAssociations.begin(); it != end; ++it)
if ((*(it->second))[dof1] == dof2) if ((*(it->second))[dof1] == dof2)
return true; return true;
......
...@@ -150,22 +150,16 @@ namespace AMDiS { ...@@ -150,22 +150,16 @@ namespace AMDiS {
coarseningManager = cm; coarseningManager = cm;
} }
/** \brief /// Fills \ref rclist[i].neigh and \ref rclist[i].oppVertex infos (0 <= i
* Fills \ref rclist[i].neigh and \ref rclist[i].oppVertex infos (0 <= i /// < n_neigh)
* < n_neigh)
*/
void fillNeighbourRelations(int n_neigh, int bound); void fillNeighbourRelations(int n_neigh, int bound);
/** \brief /// Adds those dof's on the parent that are handed on by the
* Adds those dof's on the parent that are handed on by the /// children and adds the dof in the midpoint of the coarsening edge (3d)
* children and adds the dof in the midpoint of the coarsening edge (3d)
*/
void addDOFParent(int elIndex, DegreeOfFreedom* dof); void addDOFParent(int elIndex, DegreeOfFreedom* dof);
/** \brief /// If DOFs for higher order are been removed on parents during refinement
* If DOFs for higher order are been removed on parents during refinement /// they are now added again (2d)
* they are now added again (2d)
*/
void addDOFParents(int n_neigh); void addDOFParents(int n_neigh);
/// Removes DOFs during refinement (3d) /// Removes DOFs during refinement (3d)
......
...@@ -63,12 +63,14 @@ namespace AMDiS { ...@@ -63,12 +63,14 @@ namespace AMDiS {
ElInfo *elInfo = ElInfo *elInfo =
stack->traverseFirst(mesh, -1, stack->traverseFirst(mesh, -1,
Mesh::CALL_LEAF_EL | Mesh::FILL_NEIGH | Mesh::FILL_BOUND); Mesh::CALL_LEAF_EL | Mesh::FILL_NEIGH | Mesh::FILL_BOUND);
while (elInfo) { while (elInfo) {
if (elInfo->getElement()->getMark() > 0) { if (elInfo->getElement()->getMark() > 0) {
doMoreRecursiveRefine = doMoreRecursiveRefine =
doMoreRecursiveRefine || (elInfo->getElement()->getMark() > 1); doMoreRecursiveRefine || (elInfo->getElement()->getMark() > 1);
elInfo = refineFunction(elInfo); elInfo = refineFunction(elInfo);
} }
elInfo = stack->traverseNext(elInfo); elInfo = stack->traverseNext(elInfo);
} }
} }
......
...@@ -409,14 +409,14 @@ namespace AMDiS { ...@@ -409,14 +409,14 @@ namespace AMDiS {
int localNeighbour = 3 - direction; int localNeighbour = 3 - direction;
Tetrahedron *el = Tetrahedron *el =
dynamic_cast<Tetrahedron*>(const_cast<Element*>((*elInfo)->getElement())); dynamic_cast<Tetrahedron*>(const_cast<Element*>((*elInfo)->getElement()));
if ((*elInfo)->getNeighbour(localNeighbour) == NULL) if ((*elInfo)->getNeighbour(localNeighbour) == NULL)
return true; return true;
int oppVertex = (*elInfo)->getOppVertex(localNeighbour); int oppVertex = (*elInfo)->getOppVertex(localNeighbour);
#if DEBUG #if DEBUG
int testIndex = (*elInfo)->getNeighbour(localNeighbour)->getIndex(); int testIndex = (*elInfo)->getNeighbour(localNeighbour)->getIndex();
#endif #endif
ElInfo *neighInfo = stack->traverseNeighbour3d((*elInfo), localNeighbour); ElInfo *neighInfo = stack->traverseNeighbour3d((*elInfo), localNeighbour);
int neighElType = neighInfo->getType(); int neighElType = neighInfo->getType();
...@@ -562,9 +562,9 @@ namespace AMDiS { ...@@ -562,9 +562,9 @@ namespace AMDiS {
if (neighInfo->getNeighbour(i)) { if (neighInfo->getNeighbour(i)) {
oppVertex = neighInfo->getOppVertex(i); oppVertex = neighInfo->getOppVertex(i);
#if DEBUG #if DEBUG
int testIndex = neighInfo->getNeighbour(i)->getIndex(); int testIndex = neighInfo->getNeighbour(i)->getIndex();
#endif #endif
neighInfo = stack->traverseNeighbour3d(neighInfo, i); neighInfo = stack->traverseNeighbour3d(neighInfo, i);
...@@ -596,9 +596,9 @@ namespace AMDiS { ...@@ -596,9 +596,9 @@ namespace AMDiS {
("While looping back domains boundary was reached or i == 0\n"); ("While looping back domains boundary was reached or i == 0\n");
oppVertex = refineList.getOppVertex(i--, 0); oppVertex = refineList.getOppVertex(i--, 0);
#if DEBUG #if DEBUG
int testIndex = neighInfo->getNeighbour(oppVertex)->getIndex(); int testIndex = neighInfo->getNeighbour(oppVertex)->getIndex();
#endif #endif
neighInfo = stack->traverseNeighbour3d(neighInfo, oppVertex); neighInfo = stack->traverseNeighbour3d(neighInfo, oppVertex);
int edgeDof0, edgeDof1; int edgeDof0, edgeDof1;
...@@ -653,7 +653,7 @@ namespace AMDiS { ...@@ -653,7 +653,7 @@ namespace AMDiS {
edge[0] = const_cast<DegreeOfFreedom*>(el->getDof(1)); edge[0] = const_cast<DegreeOfFreedom*>(el->getDof(1));
} }
#if HAVE_PARALLEL_DOMAIN_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
Element *otherEl = NULL; Element *otherEl = NULL;
int otherEdge = -1; int otherEdge = -1;
FixRefinementPatch::getOtherEl(stack, &otherEl, otherEdge); FixRefinementPatch::getOtherEl(stack, &otherEl, otherEdge);
...@@ -667,7 +667,7 @@ namespace AMDiS { ...@@ -667,7 +667,7 @@ namespace AMDiS {
bound = true; bound = true;
} }
#if HAVE_PARALLEL_DOMAIN_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
// === If the refinement edge must be fixed, add also the other part of this === // === If the refinement edge must be fixed, add also the other part of this ===
// === edge to the refinement patch. === // === edge to the refinement patch. ===
...@@ -739,11 +739,9 @@ namespace AMDiS { ...@@ -739,11 +739,9 @@ namespace AMDiS {
} }
#endif #endif
// fill neighbour information inside the patch in the refinement list // fill neighbour information inside the patch in the refinement list
refineList.fillNeighbourRelations(n_neigh, bound); refineList.fillNeighbourRelations(n_neigh, bound);
// ============ Check for periodic boundary ============ // ============ Check for periodic boundary ============
DegreeOfFreedom *next_edge[2]; DegreeOfFreedom *next_edge[2];
...@@ -803,7 +801,7 @@ namespace AMDiS { ...@@ -803,7 +801,7 @@ namespace AMDiS {
} }
} }
} }
stack->update(); stack->update();
return elInfo; return elInfo;
......
...@@ -525,9 +525,9 @@ namespace AMDiS { ...@@ -525,9 +525,9 @@ namespace AMDiS {
{ {
FUNCNAME("TraverseStack::traverseNeighbour3d()"); FUNCNAME("TraverseStack::traverseNeighbour3d()");
Element *el2; Element *el2 = NULL;
ElInfo *elinfo2; ElInfo *elinfo2 = NULL;
int stack2_used; int stack2_used = 0;
int sav_neighbour = neighbour; int sav_neighbour = neighbour;
// father.neigh[coarse_nb[i][j]] == child[i - 1].neigh[j] // father.neigh[coarse_nb[i][j]] == child[i - 1].neigh[j]
...@@ -611,10 +611,12 @@ namespace AMDiS { ...@@ -611,10 +611,12 @@ namespace AMDiS {
if (traverse_mel == NULL) if (traverse_mel == NULL)
return NULL; return NULL;
if (nb < 2 && save_stack_used > 1) if (nb < 2 && save_stack_used > 1) {
stack2_used = 2; /* go down one level in OLD hierarchy */ // go down one level in OLD hierarchy
else stack2_used = 2;
} else {
stack2_used = 1; stack2_used = 1;
}
elinfo2 = save_elinfo_stack[stack2_used]; elinfo2 = save_elinfo_stack[stack2_used];
el2 = elinfo2->getElement(); el2 = elinfo2->getElement();
...@@ -625,9 +627,11 @@ namespace AMDiS { ...@@ -625,9 +627,11 @@ namespace AMDiS {
} else { } else {
// Goto other child. // Goto other child.
stack2_used = stack_used + 1; stack2_used = stack_used + 1;
if (save_stack_used > stack2_used) if (save_stack_used > stack2_used) {
stack2_used++; /* go down one level in OLD hierarchy */ // go down one level in OLD hierarchy
stack2_used++;
}
elinfo2 = save_elinfo_stack[stack2_used]; elinfo2 = save_elinfo_stack[stack2_used];
el2 = elinfo2->getElement(); el2 = elinfo2->getElement();
...@@ -680,7 +684,8 @@ namespace AMDiS { ...@@ -680,7 +684,8 @@ namespace AMDiS {
if (save_stack_used > stack2_used) { if (save_stack_used > stack2_used) {
// `refine' both el and el2. // `refine' both el and el2.
TEST_EXIT_DBG(el->getChild(0))("invalid new refinement?\n"); TEST_EXIT_DBG(el->getChild(0))
("Element %d has no children!\n", el->getIndex());
int i = 0; int i = 0;
if (el->getDof(0) == el2->getDof(0)) if (el->getDof(0) == el2->getDof(0))
...@@ -730,11 +735,12 @@ namespace AMDiS { ...@@ -730,11 +735,12 @@ namespace AMDiS {
if (save_stack_used > stack2_used) { if (save_stack_used > stack2_used) {
const DegreeOfFreedom *dof = el2->getDof(1); const DegreeOfFreedom *dof = el2->getDof(1);
if (dof != el->getDof(1) && dof != el->getDof(2) && if (dof != el->getDof(1) && dof != el->getDof(2) &&
!traverse_mesh->associated(dof[0], el->getDof(1, 0)) && !traverse_mesh->associated(dof[0], el->getDof(1, 0)) &&
!traverse_mesh->associated(dof[0], el->getDof(2, 0))) { !traverse_mesh->associated(dof[0], el->getDof(2, 0))) {
// go down one level in OLD hierarchy
stack2_used++; /* go down one level in OLD hierarchy */ stack2_used++;
elinfo2 = save_elinfo_stack[stack2_used]; elinfo2 = save_elinfo_stack[stack2_used];
el2 = elinfo2->getElement(); el2 = elinfo2->getElement();
} }
...@@ -782,9 +788,9 @@ namespace AMDiS { ...@@ -782,9 +788,9 @@ namespace AMDiS {
{ {
FUNCNAME("TraverseStack::traverseNeighbour2d()"); FUNCNAME("TraverseStack::traverseNeighbour2d()");
Triangle *el2; Triangle *el2 = NULL;
ElInfo *elinfo2; ElInfo *elinfo2 = NULL;
int stack2_used; int stack2_used = 0;
int sav_neighbour = neighbour; int sav_neighbour = neighbour;
// father.neigh[coarse_nb[i][j]] == child[i-1].neigh[j] // father.neigh[coarse_nb[i][j]] == child[i-1].neigh[j]
......
...@@ -314,10 +314,12 @@ namespace AMDiS { ...@@ -314,10 +314,12 @@ namespace AMDiS {
MSG("Debug mode tests finished!\n"); MSG("Debug mode tests finished!\n");
#endif #endif
// === Create periodic DOF mapping, if there are periodic boundaries. === // Create periodic DOF mapping, if there are periodic boundaries.
createPeriodicMap(); createPeriodicMap();
// Remove periodic boundary conditions in sequential problem definition.
removePeriodicBoundaryConditions();
#if (DEBUG != 0) #if (DEBUG != 0)
ParallelDebug::testPeriodicBoundary(*this); ParallelDebug::testPeriodicBoundary(*this);
#endif #endif
...@@ -331,11 +333,10 @@ namespace AMDiS { ...@@ -331,11 +333,10 @@ namespace AMDiS {
refineManager->globalRefine(mesh, globalRefinement); refineManager->globalRefine(mesh, globalRefinement);
updateLocalGlobalNumbering(); updateLocalGlobalNumbering();
// === Update periodic mapping, if there are periodic boundaries. === // === Update periodic mapping, if there are periodic boundaries. ===
createPeriodicMap(); createPeriodicMap();
#if (DEBUG != 0) #if (DEBUG != 0)
ParallelDebug::testPeriodicBoundary(*this); ParallelDebug::testPeriodicBoundary(*this);
#endif #endif
...@@ -344,9 +345,6 @@ namespace AMDiS { ...@@ -344,9 +345,6 @@ namespace AMDiS {
// Set DOF rank information to all matrices and vectors. // Set DOF rank information to all matrices and vectors.
setRankDofs(); setRankDofs();
// Remove periodic boundary conditions in sequential problem definition.
removePeriodicBoundaryConditions();
initialized = true; initialized = true;
} }
......
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