Commit 08a7ce8f authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

And fixed the bug with multilevel interior boundary creation.

parent c36321b0
...@@ -581,28 +581,30 @@ namespace AMDiS { ...@@ -581,28 +581,30 @@ namespace AMDiS {
int owner = -1; int owner = -1;
vector<ElementObjectData> *objData; vector<ElementObjectData> *objData;
switch (iterGeoPos) { switch (iterGeoPos) {
case VERTEX: case VERTEX:
objData = &(vertexElements[vertexIter->first]); objData = &(vertexElements[vertexIter->first]);
break; break;
case EDGE: case EDGE:
objData = &(edgeElements[edgeIter->first]); objData = &(edgeElements[edgeIter->first]);
break; break;
case FACE: case FACE:
objData = &(faceElements[faceIter->first]); objData = &(faceElements[faceIter->first]);
break; break;
} }
std::set<int> &levelRanks = levelData->getLevelRanks(level); std::set<int> &levelRanks = levelData->getLevelRanks(level);
bool allRanks = (levelRanks.size() == 1 && *(levelRanks.begin()) == -1); bool allRanks = (levelRanks.size() == 1 && *(levelRanks.begin()) == -1);
for (vector<ElementObjectData>::iterator it = objData->begin(); for (vector<ElementObjectData>::iterator it = objData->begin();
it != objData->end(); ++it) { it != objData->end(); ++it) {
int elRank = (*macroElementRankMap)[it->elIndex]; int elRank = (*macroElementRankMap)[it->elIndex];
if (allRanks || levelData->getLevelRanks(level).count(elRank)) if (allRanks || levelRanks.count(elRank))
owner = std::max(owner, elRank); owner = std::max(owner, elRank);
} }
TEST_EXIT_DBG(owner >= 0)("Cannot find owner on level %d\n", level);
return owner; return owner;
} }
......
...@@ -40,6 +40,7 @@ namespace AMDiS { ...@@ -40,6 +40,7 @@ namespace AMDiS {
int levelMpiRank = mpiComm.Get_rank(); int levelMpiRank = mpiComm.Get_rank();
int globalMpiRank = MPI::COMM_WORLD.Get_rank(); int globalMpiRank = MPI::COMM_WORLD.Get_rank();
std::set<int> levelRanks = levelData.getLevelRanks(level); std::set<int> levelRanks = levelData.getLevelRanks(level);
bool allRanks = (levelRanks.size() == 1 && *(levelRanks.begin()) == -1);
// === Create interior boundary data structure. === // === Create interior boundary data structure. ===
...@@ -53,11 +54,10 @@ namespace AMDiS { ...@@ -53,11 +54,10 @@ namespace AMDiS {
if (!(objData.count(globalMpiRank) && objData.size() > 1)) if (!(objData.count(globalMpiRank) && objData.size() > 1))
continue; continue;
#if 1
// Test, if the boundary object defines an interior boundary within the // Test, if the boundary object defines an interior boundary within the
// ranks of the MPI group. If not, go to next element. // ranks of the MPI group. If not, go to next element.
bool boundaryWithinMpiGroup = false; bool boundaryWithinMpiGroup = false;
if (levelRanks.size() == 1 && *(levelRanks.begin()) == -1) { if (allRanks) {
boundaryWithinMpiGroup = true; boundaryWithinMpiGroup = true;
} else { } else {
for (map<int, ElementObjectData>::iterator it = objData.begin(); for (map<int, ElementObjectData>::iterator it = objData.begin();
...@@ -70,9 +70,9 @@ namespace AMDiS { ...@@ -70,9 +70,9 @@ namespace AMDiS {
} }
if (!boundaryWithinMpiGroup) if (!boundaryWithinMpiGroup)
continue; continue;
#endif
int owner = elObjDb.getIterateOwner(level); int owner = elObjDb.getIterateOwner(level);
MSG("OWNER IN LEVEL %d IS %d\n",level, owner);
ElementObjectData& rankBoundEl = objData[globalMpiRank]; ElementObjectData& rankBoundEl = objData[globalMpiRank];
AtomicBoundary bound; AtomicBoundary bound;
...@@ -98,7 +98,10 @@ namespace AMDiS { ...@@ -98,7 +98,10 @@ namespace AMDiS {
it2 != objData.end(); ++it2) { it2 != objData.end(); ++it2) {
if (it2->first == globalMpiRank) if (it2->first == globalMpiRank)
continue; continue;
if (!allRanks && levelRanks.count(it2->first) == 0)
continue;
bound.neighObj.el = elObjDb.getElementPtr(it2->second.elIndex); bound.neighObj.el = elObjDb.getElementPtr(it2->second.elIndex);
bound.neighObj.elIndex = it2->second.elIndex; bound.neighObj.elIndex = it2->second.elIndex;
bound.neighObj.elType = elObjDb.getElementType(it2->second.elIndex); bound.neighObj.elType = elObjDb.getElementType(it2->second.elIndex);
...@@ -280,17 +283,11 @@ namespace AMDiS { ...@@ -280,17 +283,11 @@ namespace AMDiS {
stdMpi.recv(other); stdMpi.recv(other);
} else { } else {
for (RankToBoundMap::iterator rankIt = own.begin(); for (RankToBoundMap::iterator rankIt = own.begin();
rankIt != own.end(); ++rankIt) { rankIt != own.end(); ++rankIt)
int r = levelData.mapRank(rankIt->first, 0, level); stdMpi.send(levelData.mapRank(rankIt->first, 0, level), rankIt->second);
TEST_EXIT_DBG(r >= 0)("Should not happen!\n");
stdMpi.send(r, rankIt->second);
}
for (RankToBoundMap::iterator rankIt = other.begin(); for (RankToBoundMap::iterator rankIt = other.begin();
rankIt != other.end(); ++rankIt) { rankIt != other.end(); ++rankIt)
int r = levelData.mapRank(rankIt->first, 0, level); stdMpi.recv(levelData.mapRank(rankIt->first, 0, level));
TEST_EXIT_DBG(r >= 0)("Should not happen!\n");
stdMpi.recv(r);
}
} }
stdMpi.startCommunication(); stdMpi.startCommunication();
...@@ -304,16 +301,20 @@ namespace AMDiS { ...@@ -304,16 +301,20 @@ namespace AMDiS {
for (RankToBoundMap::iterator rankIt = other.begin(); for (RankToBoundMap::iterator rankIt = other.begin();
rankIt != other.end(); ++rankIt) { rankIt != other.end(); ++rankIt) {
// === We have received from rank "rankIt->first" the ordered list of === int rank = rankIt->first;
// === element indices. Now, we have to sort the corresponding list in === if (level > 0)
// === this rank to get the same order. === rank = levelData.mapRank(rank, 0, level);
// === We have received from "rank" the ordered list of element ===
// === indices. Now, we have to sort the corresponding list in this ===
// === rank to get the same order. ===
for (unsigned int j = 0; j < rankIt->second.size(); j++) { for (unsigned int j = 0; j < rankIt->second.size(); j++) {
// If the expected object is not at place, search for it. // If the expected object is not at place, search for it.
BoundaryObject &recvedBound = BoundaryObject &recvedBound =
stdMpi.getRecvData()[rankIt->first][j].rankObj; stdMpi.getRecvData()[rank][j].rankObj;
if ((rankIt->second)[j].neighObj != recvedBound) { if ((rankIt->second)[j].neighObj != recvedBound) {
unsigned int k = j + 1; unsigned int k = j + 1;
......
...@@ -115,8 +115,9 @@ namespace AMDiS { ...@@ -115,8 +115,9 @@ namespace AMDiS {
MPI::Group::Translate_ranks(mpiGroups[fromLevel], 1, &fromRank, MPI::Group::Translate_ranks(mpiGroups[fromLevel], 1, &fromRank,
mpiGroups[toLevel], &toRank); mpiGroups[toLevel], &toRank);
if (toRank == MPI::UNDEFINED)
toRank = -1; TEST_EXIT_DBG(toRank != MPI::UNDEFINED)
("Should not happen!\n");
return toRank; return toRank;
} }
......
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