Commit 7f428556 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Fixed coarsening bug with periodic BCs in sequentiell code.

parent 9a62894f
...@@ -313,46 +313,70 @@ namespace AMDiS { ...@@ -313,46 +313,70 @@ namespace AMDiS {
coarsenList.setElement(*n_neigh, neigh); coarsenList.setElement(*n_neigh, neigh);
coarsenList.setElType(*n_neigh, neigh_info->getType()); coarsenList.setElType(*n_neigh, neigh_info->getType());
int n_vertices = mesh->getGeo(VERTEX); int nVertices = mesh->getGeo(VERTEX);
int i, j, k, edge_no;
while (neigh != el) { while (neigh != el) {
for (j = 0; j < n_vertices; j++) // === Find the coarsening edge on the current neighbour element. ===
int i, j, k;
// === First, try to identify the edge DOFs directly. ===
for (j = 0; j < nVertices; j++)
if (neigh->getDof(j) == edge[0]) if (neigh->getDof(j) == edge[0])
break; break;
for (k = 0; k < n_vertices; k++)
for (k = 0; k < nVertices; k++)
if (neigh->getDof(k) == edge[1]) if (neigh->getDof(k) == edge[1])
break; break;
if (j > 3 || k > 3) { // === If one of the edge DOFs was not found, try to make use of periodic ===
for (j = 0; j < n_vertices; j++) // === DOF associations. First, use the direct associations between DOFs. ===
// === If this will not work, continue with testing on indirect ===
// === associations. ===
if (j >= nVertices) {
for (j = 0; j < nVertices; j++)
if (mesh->associated(neigh->getDof(j, 0), edge[0][0])) if (mesh->associated(neigh->getDof(j, 0), edge[0][0]))
break; break;
for (k = 0; k < n_vertices; k++)
if (j >= nVertices)
for (j = 0; j < nVertices; j++)
if (mesh->indirectlyAssociated(neigh->getDof(j, 0), edge[0][0]))
break;
TEST_EXIT_DBG(j < nVertices)
("Process element %d: DOF %d not found on element %d with nodes (%d %d %d %d)\n",
el->getIndex(), edge[0][0], neigh->getIndex(), neigh->getDof(0, 0),
neigh->getDof(1, 0), neigh->getDof(2, 0), neigh->getDof(3, 0));
}
if (k >= nVertices) {
for (k = 0; k < nVertices; k++)
if (mesh->associated(neigh->getDof(k, 0), edge[1][0])) if (mesh->associated(neigh->getDof(k, 0), edge[1][0]))
break; break;
if (k >= nVertices)
for (k = 0; k < nVertices; k++)
if (mesh->indirectlyAssociated(neigh->getDof(k, 0), edge[1][0]))
break;
TEST_EXIT_DBG(j < n_vertices) TEST_EXIT_DBG(k < nVertices)
("dof %d not found on element %d with nodes (%d %d %d %d)\n", ("Process element %d: DOF %d not found on element %d with nodes (%d %d %d %d)\n",
edge[0][0], neigh->getIndex(), neigh->getDof(0, 0), el->getIndex(), edge[1][0], neigh->getIndex(), neigh->getDof(0, 0),
neigh->getDof(1, 0), neigh->getDof(2, 0), neigh->getDof(3, 0));
TEST_EXIT_DBG(k < n_vertices)
("dof %d not found on element %d with nodes (%d %d %d %d)\n",
edge[1][0], neigh->getIndex(), neigh->getDof(0, 0),
neigh->getDof(1, 0), neigh->getDof(2, 0), neigh->getDof(3, 0)); neigh->getDof(1, 0), neigh->getDof(2, 0), neigh->getDof(3, 0));
} }
edge_no = Tetrahedron::edgeOfDofs[j][k];
coarsenList.setCoarsePatch(*n_neigh, edge_no == 0);
/****************************************************************************/ int edgeNo = Tetrahedron::edgeOfDofs[j][k];
/* get the direction of the next neighbour */ coarsenList.setCoarsePatch(*n_neigh, edgeNo == 0);
/****************************************************************************/
// === Get the direction of the next neighbour. ===
if (next_el[edge_no][0] != opp_v) if (next_el[edgeNo][0] != opp_v)
i = next_el[edge_no][0]; i = next_el[edgeNo][0];
else else
i = next_el[edge_no][1]; i = next_el[edgeNo][1];
++*n_neigh; ++*n_neigh;
...@@ -383,7 +407,7 @@ namespace AMDiS { ...@@ -383,7 +407,7 @@ namespace AMDiS {
/* the domain's boundary is reached; loop back to the starting el */ /* the domain's boundary is reached; loop back to the starting el */
/****************************************************************************/ /****************************************************************************/
i = *n_neigh - 1; int i = *n_neigh - 1;
opp_v = coarsenList.getOppVertex(i, 0); opp_v = coarsenList.getOppVertex(i, 0);
do { do {
TEST_EXIT_DBG(neigh_info->getNeighbour(opp_v) && i > 0) TEST_EXIT_DBG(neigh_info->getNeighbour(opp_v) && i > 0)
......
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