Commit 92a640fa authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

And tests work now fine.

parent 6fd4d852
...@@ -595,13 +595,11 @@ namespace AMDiS { ...@@ -595,13 +595,11 @@ namespace AMDiS {
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);
MSG("ALLRANKS [LEVEL%d]: %d (%d %d)\n", level, allRanks,
levelRanks.size(), *(levelRanks.begin()));
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 || levelData->getLevelRanks(level).count(elRank))
owner = std::max(owner, elRank); owner = std::max(owner, elRank);
} }
......
...@@ -34,9 +34,11 @@ namespace AMDiS { ...@@ -34,9 +34,11 @@ namespace AMDiS {
Mesh *mesh = elObjDb.getMesh(); Mesh *mesh = elObjDb.getMesh();
TEST_EXIT_DBG(mesh)("Should not happen!\n"); TEST_EXIT_DBG(mesh)("Should not happen!\n");
TEST_EXIT_DBG(level < levelData.getLevelNumber())("Should not happen!\n");
MPI::Intracomm mpiComm = MPI::COMM_WORLD; //levelData.getMpiComm(level); MPI::Intracomm mpiComm = levelData.getMpiComm(level);
int mpiRank = mpiComm.Get_rank(); int levelMpiRank = mpiComm.Get_rank();
int globalMpiRank = MPI::COMM_WORLD.Get_rank();
std::set<int> levelRanks = levelData.getLevelRanks(level); std::set<int> levelRanks = levelData.getLevelRanks(level);
// === Create interior boundary data structure. === // === Create interior boundary data structure. ===
...@@ -47,15 +49,11 @@ namespace AMDiS { ...@@ -47,15 +49,11 @@ namespace AMDiS {
while (elObjDb.iterate(geoIndex)) { while (elObjDb.iterate(geoIndex)) {
map<int, ElementObjectData>& objData = elObjDb.getIterateData(); map<int, ElementObjectData>& objData = elObjDb.getIterateData();
MSG("TEST BOUNDARY: %d, %d %d\n", mpiRank, objData.count(mpiRank), objData.size());
// Test, if this is a boundary object of this rank. // Test, if this is a boundary object of this rank.
if (!(objData.count(mpiRank) && objData.size() > 1)) if (!(objData.count(globalMpiRank) && objData.size() > 1))
continue; continue;
MSG("CREATE BOUNDARY!\n"); #if 1
#if 0
// 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;
...@@ -64,7 +62,7 @@ namespace AMDiS { ...@@ -64,7 +62,7 @@ namespace AMDiS {
} else { } else {
for (map<int, ElementObjectData>::iterator it = objData.begin(); for (map<int, ElementObjectData>::iterator it = objData.begin();
it != objData.end(); ++it) { it != objData.end(); ++it) {
if (it->first != mpiRank && levelRanks.count(it->first)) { if (it->first != globalMpiRank && levelRanks.count(it->first)) {
boundaryWithinMpiGroup == true; boundaryWithinMpiGroup == true;
break; break;
} }
...@@ -75,7 +73,7 @@ namespace AMDiS { ...@@ -75,7 +73,7 @@ namespace AMDiS {
#endif #endif
int owner = elObjDb.getIterateOwner(level); int owner = elObjDb.getIterateOwner(level);
ElementObjectData& rankBoundEl = objData[mpiRank]; ElementObjectData& rankBoundEl = objData[globalMpiRank];
AtomicBoundary bound; AtomicBoundary bound;
bound.maxLevel = elObjDb.getIterateMaxLevel(); bound.maxLevel = elObjDb.getIterateMaxLevel();
...@@ -95,10 +93,10 @@ namespace AMDiS { ...@@ -95,10 +93,10 @@ namespace AMDiS {
} }
if (owner == mpiRank) { if (owner == globalMpiRank) {
for (map<int, ElementObjectData>::iterator it2 = objData.begin(); for (map<int, ElementObjectData>::iterator it2 = objData.begin();
it2 != objData.end(); ++it2) { it2 != objData.end(); ++it2) {
if (it2->first == mpiRank) if (it2->first == globalMpiRank)
continue; continue;
bound.neighObj.el = elObjDb.getElementPtr(it2->second.elIndex); bound.neighObj.el = elObjDb.getElementPtr(it2->second.elIndex);
...@@ -150,11 +148,11 @@ namespace AMDiS { ...@@ -150,11 +148,11 @@ namespace AMDiS {
for (PerBoundMap<DegreeOfFreedom>::iterator it = elObjDb.getPeriodicVertices().begin(); for (PerBoundMap<DegreeOfFreedom>::iterator it = elObjDb.getPeriodicVertices().begin();
it != elObjDb.getPeriodicVertices().end(); ++it) { it != elObjDb.getPeriodicVertices().end(); ++it) {
if (elObjDb.isInRank(it->first.first, mpiRank) == false) if (elObjDb.isInRank(it->first.first, globalMpiRank) == false)
continue; continue;
ElementObjectData& perDofEl0 = ElementObjectData& perDofEl0 =
elObjDb.getElementsInRank(it->first.first)[mpiRank]; elObjDb.getElementsInRank(it->first.first)[globalMpiRank];
for (map<int, ElementObjectData>::iterator elIt = elObjDb.getElementsInRank(it->first.second).begin(); for (map<int, ElementObjectData>::iterator elIt = elObjDb.getElementsInRank(it->first.second).begin();
elIt != elObjDb.getElementsInRank(it->first.second).end(); ++elIt) { elIt != elObjDb.getElementsInRank(it->first.second).end(); ++elIt) {
...@@ -185,10 +183,11 @@ namespace AMDiS { ...@@ -185,10 +183,11 @@ namespace AMDiS {
for (PerBoundMap<DofEdge>::iterator it = elObjDb.getPeriodicEdges().begin(); for (PerBoundMap<DofEdge>::iterator it = elObjDb.getPeriodicEdges().begin();
it != elObjDb.getPeriodicEdges().end(); ++it) { it != elObjDb.getPeriodicEdges().end(); ++it) {
if (elObjDb.isInRank(it->first.first, mpiRank) == false) if (elObjDb.isInRank(it->first.first, globalMpiRank) == false)
continue; continue;
ElementObjectData& perEdgeEl0 = elObjDb.getElementsInRank(it->first.first)[mpiRank]; ElementObjectData& perEdgeEl0 =
elObjDb.getElementsInRank(it->first.first)[globalMpiRank];
for (map<int, ElementObjectData>::iterator elIt = elObjDb.getElementsInRank(it->first.second).begin(); for (map<int, ElementObjectData>::iterator elIt = elObjDb.getElementsInRank(it->first.second).begin();
elIt != elObjDb.getElementsInRank(it->first.second).end(); ++elIt) { elIt != elObjDb.getElementsInRank(it->first.second).end(); ++elIt) {
...@@ -214,7 +213,7 @@ namespace AMDiS { ...@@ -214,7 +213,7 @@ namespace AMDiS {
AtomicBoundary& b = getNewPeriodic(otherElementRank); AtomicBoundary& b = getNewPeriodic(otherElementRank);
b = bound; b = bound;
if (mpiRank > otherElementRank) if (globalMpiRank > otherElementRank)
b.neighObj.reverseMode = b.neighObj.reverseMode =
elObjDb.getEdgeReverseMode(perEdgeEl0, perEdgeEl1); elObjDb.getEdgeReverseMode(perEdgeEl0, perEdgeEl1);
else else
...@@ -226,7 +225,7 @@ namespace AMDiS { ...@@ -226,7 +225,7 @@ namespace AMDiS {
for (PerBoundMap<DofFace>::iterator it = elObjDb.getPeriodicFaces().begin(); for (PerBoundMap<DofFace>::iterator it = elObjDb.getPeriodicFaces().begin();
it != elObjDb.getPeriodicFaces().end(); ++it) { it != elObjDb.getPeriodicFaces().end(); ++it) {
if (elObjDb.isInRank(it->first.first, mpiRank) == false) if (elObjDb.isInRank(it->first.first, globalMpiRank) == false)
continue; continue;
TEST_EXIT_DBG(elObjDb.getElements(it->first.first).size() == 1) TEST_EXIT_DBG(elObjDb.getElements(it->first.first).size() == 1)
...@@ -234,7 +233,8 @@ namespace AMDiS { ...@@ -234,7 +233,8 @@ namespace AMDiS {
TEST_EXIT_DBG(elObjDb.getElements(it->first.second).size() == 1) TEST_EXIT_DBG(elObjDb.getElements(it->first.second).size() == 1)
("Should not happen!\n"); ("Should not happen!\n");
ElementObjectData& perFaceEl0 = elObjDb.getElementsInRank(it->first.first)[mpiRank]; ElementObjectData& perFaceEl0 =
elObjDb.getElementsInRank(it->first.first)[globalMpiRank];
for (map<int, ElementObjectData>::iterator elIt = elObjDb.getElementsInRank(it->first.second).begin(); for (map<int, ElementObjectData>::iterator elIt = elObjDb.getElementsInRank(it->first.second).begin();
elIt != elObjDb.getElementsInRank(it->first.second).end(); ++elIt) { elIt != elObjDb.getElementsInRank(it->first.second).end(); ++elIt) {
...@@ -260,7 +260,7 @@ namespace AMDiS { ...@@ -260,7 +260,7 @@ namespace AMDiS {
AtomicBoundary& b = getNewPeriodic(otherElementRank); AtomicBoundary& b = getNewPeriodic(otherElementRank);
b = bound; b = bound;
if (mpiRank > otherElementRank) if (globalMpiRank > otherElementRank)
b.neighObj.reverseMode = b.neighObj.reverseMode =
elObjDb.getFaceReverseMode(perFaceEl0, perFaceEl1); elObjDb.getFaceReverseMode(perFaceEl0, perFaceEl1);
else else
...@@ -268,7 +268,6 @@ namespace AMDiS { ...@@ -268,7 +268,6 @@ namespace AMDiS {
elObjDb.getFaceReverseMode(perFaceEl0, perFaceEl1); elObjDb.getFaceReverseMode(perFaceEl0, perFaceEl1);
} }
} }
// === Once we have this information, we must care about the order of the === // === Once we have this information, we must care about the order of the ===
// === atomic bounds in the three boundary handling object. Eventually === // === atomic bounds in the three boundary handling object. Eventually ===
...@@ -276,8 +275,24 @@ namespace AMDiS { ...@@ -276,8 +275,24 @@ namespace AMDiS {
// === share the bounday. === // === share the bounday. ===
StdMpi<vector<AtomicBoundary> > stdMpi(mpiComm); StdMpi<vector<AtomicBoundary> > stdMpi(mpiComm);
stdMpi.send(own); if (level == 0) {
stdMpi.recv(other); stdMpi.send(own);
stdMpi.recv(other);
} else {
for (RankToBoundMap::iterator rankIt = own.begin();
rankIt != own.end(); ++rankIt) {
int r = levelData.mapRank(rankIt->first, 0, level);
TEST_EXIT_DBG(r >= 0)("Should not happen!\n");
stdMpi.send(r, rankIt->second);
}
for (RankToBoundMap::iterator rankIt = other.begin();
rankIt != other.end(); ++rankIt) {
int r = levelData.mapRank(rankIt->first, 0, level);
TEST_EXIT_DBG(r >= 0)("Should not happen!\n");
stdMpi.recv(r);
}
}
stdMpi.startCommunication(); stdMpi.startCommunication();
...@@ -297,7 +312,8 @@ namespace AMDiS { ...@@ -297,7 +312,8 @@ namespace AMDiS {
// If the expected object is not at place, search for it. // If the expected object is not at place, search for it.
BoundaryObject &recvedBound = stdMpi.getRecvData()[rankIt->first][j].rankObj; BoundaryObject &recvedBound =
stdMpi.getRecvData()[rankIt->first][j].rankObj;
if ((rankIt->second)[j].neighObj != recvedBound) { if ((rankIt->second)[j].neighObj != recvedBound) {
unsigned int k = j + 1; unsigned int k = j + 1;
...@@ -328,10 +344,10 @@ namespace AMDiS { ...@@ -328,10 +344,10 @@ namespace AMDiS {
for (RankToBoundMap::iterator rankIt = periodic.begin(); for (RankToBoundMap::iterator rankIt = periodic.begin();
rankIt != periodic.end(); ++rankIt) { rankIt != periodic.end(); ++rankIt) {
if (rankIt->first == mpiRank) if (rankIt->first == globalMpiRank)
continue; continue;
if (rankIt->first < mpiRank) if (rankIt->first < globalMpiRank)
sendBounds[rankIt->first] = rankIt->second; sendBounds[rankIt->first] = rankIt->second;
else else
recvBounds[rankIt->first] = rankIt->second; recvBounds[rankIt->first] = rankIt->second;
...@@ -344,7 +360,7 @@ namespace AMDiS { ...@@ -344,7 +360,7 @@ namespace AMDiS {
for (RankToBoundMap::iterator rankIt = periodic.begin(); for (RankToBoundMap::iterator rankIt = periodic.begin();
rankIt != periodic.end(); ++rankIt) { rankIt != periodic.end(); ++rankIt) {
if (rankIt->first <= mpiRank) if (rankIt->first <= globalMpiRank)
continue; continue;
for (unsigned int j = 0; j < rankIt->second.size(); j++) { for (unsigned int j = 0; j < rankIt->second.size(); j++) {
......
...@@ -1515,8 +1515,8 @@ namespace AMDiS { ...@@ -1515,8 +1515,8 @@ namespace AMDiS {
intBoundary.create(levelData, 0, elObjDb); intBoundary.create(levelData, 0, elObjDb);
// if (levelData.getLevelNumber() > 1) if (levelData.getLevelNumber() > 1)
// intBoundarySd.create(levelData, 1, elObjDb); intBoundarySd.create(levelData, 1, elObjDb);
#if (DEBUG != 0) #if (DEBUG != 0)
ParallelDebug::printBoundaryInfo(*this); ParallelDebug::printBoundaryInfo(*this);
...@@ -1545,8 +1545,6 @@ namespace AMDiS { ...@@ -1545,8 +1545,6 @@ namespace AMDiS {
if (!createBoundaryDofFlag.isSet(BOUNDARY_SUBOBJ_SORTED)) if (!createBoundaryDofFlag.isSet(BOUNDARY_SUBOBJ_SORTED))
return; return;
MSG("START CREATE!\n");
int nLevels = levelData.getLevelNumber(); int nLevels = levelData.getLevelNumber();
boundaryDofInfo.resize(nLevels); boundaryDofInfo.resize(nLevels);
...@@ -1555,8 +1553,6 @@ namespace AMDiS { ...@@ -1555,8 +1553,6 @@ namespace AMDiS {
for (int level = 0; level < nLevels; level++) { for (int level = 0; level < nLevels; level++) {
MSG("ONE RUN!\n");
// === Clear data. === // === Clear data. ===
for (int geo = FACE; geo >= VERTEX; geo--) for (int geo = FACE; geo >= VERTEX; geo--)
boundaryDofInfo[level][feSpace].geoDofs[static_cast<GeoIndex>(geo)].clear(); boundaryDofInfo[level][feSpace].geoDofs[static_cast<GeoIndex>(geo)].clear();
...@@ -1699,10 +1695,6 @@ namespace AMDiS { ...@@ -1699,10 +1695,6 @@ namespace AMDiS {
lastMeshChangeIndex = mesh->getChangeIndex(); lastMeshChangeIndex = mesh->getChangeIndex();
MSG("TEST: %d %d\n",
dofComm.getNumberDofs(dofComm.getSendDofs(), 0, feSpaces[0]),
dofComm.getNumberDofs(dofComm.getRecvDofs(), 0, feSpaces[0]));
#if (DEBUG != 0) #if (DEBUG != 0)
ParallelDebug::testDofContainerCommunication(*this); ParallelDebug::testDofContainerCommunication(*this);
......
...@@ -353,8 +353,6 @@ namespace AMDiS { ...@@ -353,8 +353,6 @@ namespace AMDiS {
DofContainerSet& vertices = DofContainerSet& vertices =
meshDistributor->getBoundaryDofInfo(feSpace, meshLevel).geoDofs[VERTEX]; meshDistributor->getBoundaryDofInfo(feSpace, meshLevel).geoDofs[VERTEX];
MSG("SIZE IF VERTEX: %d\n", vertices.size());
DofIndexSet primals; DofIndexSet primals;
for (DofContainerSet::iterator it = vertices.begin(); for (DofContainerSet::iterator it = vertices.begin();
it != vertices.end(); ++it) it != vertices.end(); ++it)
......
...@@ -34,9 +34,10 @@ namespace AMDiS { ...@@ -34,9 +34,10 @@ namespace AMDiS {
using namespace std; using namespace std;
/** \brief /** \brief
* The class StdMpiHelper defines for a type a set of variables, types and functions * The class StdMpiHelper defines for a type a set of variables, types and
* that makes it able to transfer objects of the original type to a buffer which is * functions that makes it able to transfer objects of the original type to
* suitable to be send and received using MPI communication. * a buffer which is suitable to be send and received using MPI
* communication.
* *
* mpiDataType Specifies the MPI data type that should be used for * mpiDataType Specifies the MPI data type that should be used for
* communication. * communication.
......
...@@ -35,8 +35,6 @@ BOOST_AUTO_TEST_CASE(amdis_mpi_feti) ...@@ -35,8 +35,6 @@ BOOST_AUTO_TEST_CASE(amdis_mpi_feti)
feti.initialize(feSpaces); feti.initialize(feSpaces);
feti.createFetiData(); feti.createFetiData();
ParallelDebug::printBoundaryInfo(*meshDist, 0, true);
BOOST_REQUIRE(feti.getNumberOfPrimals() == 21); BOOST_REQUIRE(feti.getNumberOfPrimals() == 21);
BOOST_REQUIRE(feti.getNumberOfDuals() == 48); BOOST_REQUIRE(feti.getNumberOfDuals() == 48);
...@@ -55,7 +53,6 @@ BOOST_AUTO_TEST_CASE(amdis_mpi_feti) ...@@ -55,7 +53,6 @@ BOOST_AUTO_TEST_CASE(amdis_mpi_feti)
BOOST_REQUIRE(data.size() - 1 == testData.size()); BOOST_REQUIRE(data.size() - 1 == testData.size());
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
MSG("TEST FOR %d: %f %f\n", i, data[i + 1], testData[i]);
if (data[i + 1] != testData[i]) { if (data[i + 1] != testData[i]) {
MSG("Wrong data in column %d: %f %f\n", i, data[i + 1], testData[i]); MSG("Wrong data in column %d: %f %f\n", i, data[i + 1], testData[i]);
BOOST_ERROR(""); BOOST_ERROR("");
...@@ -66,8 +63,6 @@ BOOST_AUTO_TEST_CASE(amdis_mpi_feti) ...@@ -66,8 +63,6 @@ BOOST_AUTO_TEST_CASE(amdis_mpi_feti)
meshDist->checkMeshChange(); meshDist->checkMeshChange();
feti.createFetiData(); feti.createFetiData();
ParallelDebug::printBoundaryInfo(*meshDist, 0, true);
sheet.read("data/data0002b"); sheet.read("data/data0002b");
data = sheet.getData()[MPI::COMM_WORLD.Get_rank()]; data = sheet.getData()[MPI::COMM_WORLD.Get_rank()];
...@@ -80,14 +75,11 @@ BOOST_AUTO_TEST_CASE(amdis_mpi_feti) ...@@ -80,14 +75,11 @@ BOOST_AUTO_TEST_CASE(amdis_mpi_feti)
BOOST_REQUIRE(data.size() - 1 == testData.size()); BOOST_REQUIRE(data.size() - 1 == testData.size());
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
MSG("TEST FOR %d: %f %f\n", i, data[i + 1], testData[i]);
if (data[i + 1] != testData[i]) { if (data[i + 1] != testData[i]) {
MSG("Wrong data in column %d: %f %f\n", i, data[i + 1], testData[i]); MSG("Wrong data in column %d: %f %f\n", i, data[i + 1], testData[i]);
BOOST_ERROR(""); BOOST_ERROR("");
} }
} }
// BOOST_REQUIRE(equal(data.begin() + 1, data.end(), testData.begin()));
} }
......
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