Commit 4bb35e1e authored by Thomas Witkowski's avatar Thomas Witkowski

Ich bin so blooooeeed, eh...

parent 59ee4244
...@@ -572,7 +572,7 @@ namespace AMDiS { ...@@ -572,7 +572,7 @@ namespace AMDiS {
} }
int ElementObjectDatabase::getIterateOwner() int ElementObjectDatabase::getIterateOwner(int level)
{ {
FUNCNAME("ElementObjectDatabase::getIterateOwner()"); FUNCNAME("ElementObjectDatabase::getIterateOwner()");
...@@ -593,9 +593,17 @@ namespace AMDiS { ...@@ -593,9 +593,17 @@ namespace AMDiS {
break; break;
} }
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(); for (vector<ElementObjectData>::iterator it = objData->begin();
it != objData->end(); ++it) it != objData->end(); ++it) {
owner = std::max(owner, (*macroElementRankMap)[it->elIndex]); int elRank = (*macroElementRankMap)[it->elIndex];
if (allRanks || levelData->getLevelRanks(level).count(elRank))
owner = std::max(owner, elRank);
}
return owner; return owner;
} }
......
...@@ -230,7 +230,7 @@ namespace AMDiS { ...@@ -230,7 +230,7 @@ namespace AMDiS {
} }
/// Returns the rank owner of the current iterator position. /// Returns the rank owner of the current iterator position.
int getIterateOwner(); int getIterateOwner(int level);
/// Returns the rank owner of the current iterator position. /// Returns the rank owner of the current iterator position.
int getIterateMaxLevel(); int getIterateMaxLevel();
......
...@@ -22,7 +22,8 @@ namespace AMDiS { ...@@ -22,7 +22,8 @@ namespace AMDiS {
using namespace std; using namespace std;
void InteriorBoundary::create(MPI::Intracomm &mpiComm, void InteriorBoundary::create(MeshLevelData &levelData,
int level,
ElementObjectDatabase &elObjDb) ElementObjectDatabase &elObjDb)
{ {
FUNCNAME("InteriorBoundary::clear()"); FUNCNAME("InteriorBoundary::clear()");
...@@ -34,7 +35,9 @@ namespace AMDiS { ...@@ -34,7 +35,9 @@ 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");
int mpiRank = mpiComm.Get_rank(); int mpiRank = levelData.getMpiComm(0);
MPI::Intracomm mpiComm = levelData.getMpiComm(level);
std::set<int> levelRanks = levelData.getLevelRanks(level);
// === Create interior boundary data structure. === // === Create interior boundary data structure. ===
...@@ -43,10 +46,31 @@ namespace AMDiS { ...@@ -43,10 +46,31 @@ namespace AMDiS {
while (elObjDb.iterate(geoIndex)) { while (elObjDb.iterate(geoIndex)) {
map<int, ElementObjectData>& objData = elObjDb.getIterateData(); map<int, ElementObjectData>& objData = elObjDb.getIterateData();
// Test, if this is a boundary object of this rank.
if (!(objData.count(mpiRank) && objData.size() > 1)) if (!(objData.count(mpiRank) && objData.size() > 1))
continue; continue;
int owner = elObjDb.getIterateOwner(); #if 0
// 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;
if (levelRanks.size() == 1 && *(levelRanks.begin()) == -1) {
boundaryWithinMpiGroup = true;
} else {
for (map<int, ElementObjectData>::iterator it = objData.begin();
it != objData.end(); ++it) {
if (it->first != mpiRank && levelRanks.count(it->first)) {
boundaryWithinMpiGroup == true;
break;
}
}
}
if (!boundaryWithinMpiGroup)
continue;
#endif
int owner = elObjDb.getIterateOwner(level);
ElementObjectData& rankBoundEl = objData[mpiRank]; ElementObjectData& rankBoundEl = objData[mpiRank];
AtomicBoundary bound; AtomicBoundary bound;
......
...@@ -41,7 +41,8 @@ namespace AMDiS { ...@@ -41,7 +41,8 @@ namespace AMDiS {
*/ */
class InteriorBoundary { class InteriorBoundary {
public: public:
void create(MPI::Intracomm &mpiComm, void create(MeshLevelData &levelData,
int level,
ElementObjectDatabase &elObjDb); ElementObjectDatabase &elObjDb);
RankToBoundMap& getOwn() RankToBoundMap& getOwn()
...@@ -121,7 +122,7 @@ namespace AMDiS { ...@@ -121,7 +122,7 @@ namespace AMDiS {
{ {
do { do {
++vecIt; ++vecIt;
} while (vecIt->maxLevel < level && vecIt != mapIt->second.end()); } while (vecIt != mapIt->second.end() && vecIt->maxLevel < level);
if (vecIt == mapIt->second.end()) { if (vecIt == mapIt->second.end()) {
++mapIt; ++mapIt;
...@@ -169,7 +170,7 @@ namespace AMDiS { ...@@ -169,7 +170,7 @@ namespace AMDiS {
vecIt = mapIt->second.begin(); vecIt = mapIt->second.begin();
// Search for the next atomic boundary on the mesh level // Search for the next atomic boundary on the mesh level
while (vecIt->maxLevel < level && vecIt != mapIt->second.end()) while (vecIt != mapIt->second.end() && vecIt->maxLevel < level)
++vecIt; ++vecIt;
// If vector iterator is not at the end, we have found one and // If vector iterator is not at the end, we have found one and
...@@ -190,7 +191,7 @@ namespace AMDiS { ...@@ -190,7 +191,7 @@ namespace AMDiS {
RankToBoundMap &bound; RankToBoundMap &bound;
int level; int level;
}; };
}; };
} }
......
...@@ -1511,9 +1511,12 @@ namespace AMDiS { ...@@ -1511,9 +1511,12 @@ namespace AMDiS {
if (firstCall) if (firstCall)
elObjDb.create(partitionMap, levelData); elObjDb.create(partitionMap, levelData);
elObjDb.updateRankData(); elObjDb.updateRankData();
intBoundary.create(mpiComm, elObjDb);
intBoundary.create(levelData, 0, elObjDb);
// if (levelData.getLevelNumber() > 1)
// intBoundarySd.create(levelData, 1, elObjDb);
#if (DEBUG != 0) #if (DEBUG != 0)
ParallelDebug::printBoundaryInfo(*this); ParallelDebug::printBoundaryInfo(*this);
...@@ -1530,10 +1533,12 @@ namespace AMDiS { ...@@ -1530,10 +1533,12 @@ namespace AMDiS {
dofComm.init(0, levelData, feSpaces); dofComm.init(0, levelData, feSpaces);
dofComm.create(intBoundary); dofComm.create(intBoundary);
#if 0
if (levelData.getLevelNumber() > 1) { if (levelData.getLevelNumber() > 1) {
dofCommSd.init(1, levelData, feSpaces); dofCommSd.init(1, levelData, feSpaces);
dofCommSd.create(intBoundary); dofCommSd.create(intBoundary);
} }
#endif
// === If requested, create more information on communication DOFs. === // === If requested, create more information on communication DOFs. ===
...@@ -1690,6 +1695,11 @@ namespace AMDiS { ...@@ -1690,6 +1695,11 @@ 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);
#endif #endif
......
...@@ -471,6 +471,8 @@ namespace AMDiS { ...@@ -471,6 +471,8 @@ namespace AMDiS {
/// partitioning the whole mesh. /// partitioning the whole mesh.
InteriorBoundary intBoundary; InteriorBoundary intBoundary;
InteriorBoundary intBoundarySd;
DofComm dofComm; DofComm dofComm;
DofComm dofCommSd; DofComm dofCommSd;
......
...@@ -578,7 +578,7 @@ namespace AMDiS { ...@@ -578,7 +578,7 @@ namespace AMDiS {
for (map<const FiniteElemSpace*, DofContainer>::iterator dcIt = it->second.begin(); for (map<const FiniteElemSpace*, DofContainer>::iterator dcIt = it->second.begin();
dcIt != it->second.end(); ++dcIt) dcIt != it->second.end(); ++dcIt)
sendNumber[it->first] += dcIt->second.size(); sendNumber[it->first] += dcIt->second.size();
map<int, int> recvNumber; map<int, int> recvNumber;
for (it_type it = pdb.dofComm.getRecvDofs()[0].begin(); for (it_type it = pdb.dofComm.getRecvDofs()[0].begin();
it != pdb.dofComm.getRecvDofs()[0].end(); ++it) it != pdb.dofComm.getRecvDofs()[0].end(); ++it)
...@@ -592,7 +592,7 @@ namespace AMDiS { ...@@ -592,7 +592,7 @@ namespace AMDiS {
it != pdb.dofComm.getRecvDofs()[0].end(); ++it) it != pdb.dofComm.getRecvDofs()[0].end(); ++it)
stdMpi.recv(it->first); stdMpi.recv(it->first);
stdMpi.startCommunication(); stdMpi.startCommunication();
int foundError = 0; int foundError = 0;
for (map<int, int>::iterator it = stdMpi.getRecvData().begin(); for (map<int, int>::iterator it = stdMpi.getRecvData().begin();
it != stdMpi.getRecvData().end(); ++it) { it != stdMpi.getRecvData().end(); ++it) {
......
...@@ -26,12 +26,10 @@ namespace AMDiS { ...@@ -26,12 +26,10 @@ namespace AMDiS {
nonRankDofs.clear(); nonRankDofs.clear();
nonRankDofs.resize(nLevel); nonRankDofs.resize(nLevel);
for (int i = 0; i < nLevel; i++) { nRankDofs.resize(nLevel, 0);
nRankDofs[i] = 0; nLocalDofs.resize(nLevel, 0);
nLocalDofs[i] = 0; nOverallDofs.resize(nLevel, 0);
nOverallDofs[i] = 0; rStartDofs.resize(nLevel, 0);
rStartDofs[i] = 0;
}
} }
......
...@@ -109,11 +109,7 @@ namespace AMDiS { ...@@ -109,11 +109,7 @@ namespace AMDiS {
feSpace(NULL), feSpace(NULL),
dofMap(1), dofMap(1),
needGlobalMapping(false), needGlobalMapping(false),
hasNonLocalDofs(false), hasNonLocalDofs(false)
nRankDofs(1),
nLocalDofs(1),
nOverallDofs(1),
rStartDofs(1)
{ {
clear(); clear();
} }
......
...@@ -39,11 +39,10 @@ BOOST_AUTO_TEST_CASE(amdis_mpi_feti) ...@@ -39,11 +39,10 @@ BOOST_AUTO_TEST_CASE(amdis_mpi_feti)
BOOST_REQUIRE(feti.getNumberOfDuals() == 48); BOOST_REQUIRE(feti.getNumberOfDuals() == 48);
Spreadsheet sheet; Spreadsheet sheet;
sheet.read("data/data0002a"); sheet.read("data/data0002a");
vector<double> data = sheet.getData()[MPI::COMM_WORLD.Get_rank()]; vector<double> data = sheet.getData()[MPI::COMM_WORLD.Get_rank()];
const FiniteElemSpace *feSpace = ellipt.getFeSpace(0); const FiniteElemSpace *feSpace = ellipt.getFeSpace(0);
vector<double> testData; vector<double> testData;
testData.push_back(feti.getNumberOfRankPrimals()); testData.push_back(feti.getNumberOfRankPrimals());
......
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