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

And tests work now fine.

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