Commit 92f46830 by Thomas Witkowski

### Periodic boundary condition work for higher elements.

parent 7c73fbed
 ... @@ -77,31 +77,82 @@ namespace AMDiS { ... @@ -77,31 +77,82 @@ namespace AMDiS { Element *nb = const_cast(neighbour_[i]); Element *nb = const_cast(neighbour_[i]); int edgeNo = oppVertex_[i] = mel->getOppVertex(i); int edgeNo = oppVertex_[i] = mel->getOppVertex(i); if (nb->getFirstChild() && (edgeNo != 2)) { // make nb nearest el. if (nb->getFirstChild() && (edgeNo != 2)) { // Search for the next neighbour. In many cases, the neighbour element // may be refinemed in a way, such that there is no new vertex on the // common edge. This situation is shown in the following picture: // // /|\ // / | \ // / | \ // /\ | \ // / \ | \ // / \| \ // ------------- // // nb el // // Note that we know (because of the last if statement), that the // neighbour element has children and the common edge is not the // refinement edge, which has always the number 2, of our element. if (edgeNo == 0) { if (edgeNo == 0) { // The situation is as follows: // // ------- // \ /|\ // \ / | \ // \/ | \ // \ | \ // \ | \ // \| \ // ------- // // nb el // That means, the edge 0 of the same level neighbour is the common // edge, i.e., the direct neighbour is the second child of the same // level neighbour. nb = neighbour_[i] = nb->getSecondChild(); nb = neighbour_[i] = nb->getSecondChild(); } else { } else { // The situation is as shown in the picture above. So the next // neighbour is the first child of the same level neighbour element. nb = neighbour_[i] = nb->getFirstChild(); nb = neighbour_[i] = nb->getFirstChild(); } } // In both cases the opp vertex number is 2, as one can see in the // pictures above. oppVertex_[i] = 2; oppVertex_[i] = 2; if (fill_opp_coords) { if (fill_opp_coords) { if (nb->isNewCoordSet()) { if (nb->isNewCoordSet()) { oppCoord_[i] = *(nb->getNewCoord()); oppCoord_[i] = *(nb->getNewCoord()); } else { } else { oppCoord_[i] = (macroNeighbour->coord[0] + macroNeighbour->coord[1]) * 0.5; // In both cases, that are shown in the pictures above, the opp } // vertex of the neighbour edge is the midpoint of the vertex 0 // and vertex 1 of the same level neighbour element. oppCoord_[i] = (macroNeighbour->coord[0] + macroNeighbour->coord[1]) * 0.5; } switch (i) { switch (i) { case 0: case 0: if (*(macroNeighbour->getElement()->getDOF(2)) == *(element_->getDOF(2))) { // The common edge is the edge 0 of this element. switch (edgeNo) { case 1: neighbourCoord_[i][0] = macroNeighbour->coord[2]; neighbourCoord_[i][0] = macroNeighbour->coord[2]; neighbourCoord_[i][1] = macroNeighbour->coord[0]; neighbourCoord_[i][1] = macroNeighbour->coord[0]; } else if (*(macroNeighbour->getElement()->getDOF(2)) == *(element_->getDOF(1))) { break; case 0: neighbourCoord_[i][0] = macroNeighbour->coord[1]; neighbourCoord_[i][0] = macroNeighbour->coord[1]; neighbourCoord_[i][1] = macroNeighbour->coord[2]; neighbourCoord_[i][1] = macroNeighbour->coord[2]; } else { break; default: ERROR_EXIT("Should not happen!\n"); ERROR_EXIT("Should not happen!\n"); } } ... @@ -109,13 +160,17 @@ namespace AMDiS { ... @@ -109,13 +160,17 @@ namespace AMDiS { break; break; case 1: case 1: if (*(macroNeighbour->getElement()->getDOF(2)) == *(element_->getDOF(2))) { // The commonedge is the edge 1 of this element. switch (edgeNo) { case 0: neighbourCoord_[i][0] = macroNeighbour->coord[1]; neighbourCoord_[i][0] = macroNeighbour->coord[1]; neighbourCoord_[i][1] = macroNeighbour->coord[2]; neighbourCoord_[i][1] = macroNeighbour->coord[2]; } else if (*(macroNeighbour->getElement()->getDOF(2)) == *(element_->getDOF(0))) { break; case 1: neighbourCoord_[i][0] = macroNeighbour->coord[2]; neighbourCoord_[i][0] = macroNeighbour->coord[2]; neighbourCoord_[i][1] = macroNeighbour->coord[0]; neighbourCoord_[i][1] = macroNeighbour->coord[0]; } else { break; default: ERROR_EXIT("Should not happen!\n"); ERROR_EXIT("Should not happen!\n"); } } ... @@ -123,15 +178,10 @@ namespace AMDiS { ... @@ -123,15 +178,10 @@ namespace AMDiS { break; break; case 2: case 2: if (*(macroNeighbour->getElement()->getDOF(2)) == *(element_->getDOF(0))) { // I've deleted here some code, be I think that this case is not neighbourCoord_[i][0] = macroNeighbour->coord[2]; // possible. If an error occurs in this line, please check AMDiS neighbourCoord_[i][1] = macroNeighbour->coord[1]; // revision <= 476 at the same position. } else if (*(macroNeighbour->getElement()->getDOF(2)) == *(element_->getDOF(1))) { ERROR_EXIT("Should not happen!\n"); neighbourCoord_[i][0] = macroNeighbour->coord[0]; neighbourCoord_[i][1] = macroNeighbour->coord[2]; } else { ERROR_EXIT("Should not happen!\n"); } break; break; default: default: ... @@ -146,17 +196,24 @@ namespace AMDiS { ... @@ -146,17 +196,24 @@ namespace AMDiS { } else { } else { std::cout << " Neighbour " << j << ": not existing" << std::endl; std::cout << " Neighbour " << j << ": not existing" << std::endl; } } std::cout << " OppVertex " << j << ": " << static_cast(mel->getOppVertex(j)) << std::endl; std::cout << " OppVertex " << j << ": " std::cout << std::endl; << static_cast(mel->getOppVertex(j)) << std::endl << std::endl; } } ERROR_EXIT("should not happen!\n"); ERROR_EXIT("should not happen!\n"); break; break; } } } } } else { } else { // In this case, we know that the common edge is the refinement edge. // This makes everything much more simpler, because we know that the // next neighbour is equal to the samel level neighbour. If the same // level neighbour would be refinement, also this element must to be // refinement, because they share the refinement edge. if (fill_opp_coords) { if (fill_opp_coords) { oppCoord_[i] = macroNeighbour->coord[edgeNo]; oppCoord_[i] = macroNeighbour->coord[edgeNo]; neighbourCoord_[i] = macroNeighbour->coord; neighbourCoord_[i] = macroNeighbour->coord; } } } } ... ...