Commit 0c1e2d14 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

DOES NOT COMPILE, BUT I MUST MERGE TO WORK HARD ON WEEKEND....

parent 518c24d9
...@@ -122,8 +122,8 @@ namespace AMDiS { ...@@ -122,8 +122,8 @@ namespace AMDiS {
const FiniteElemSpace *rowFeSpace = dofMat->getRowFeSpace(); const FiniteElemSpace *rowFeSpace = dofMat->getRowFeSpace();
const FiniteElemSpace *colFeSpace = dofMat->getColFeSpace(); const FiniteElemSpace *colFeSpace = dofMat->getColFeSpace();
if (rowDofMap.isDefinedFor(rowFeSpace) == false || if (rowDofMap.isDefinedFor(rowComp) == false ||
colDofMap.isDefinedFor(colFeSpace) == false) colDofMap.isDefinedFor(colComp) == false)
continue; continue;
// === Prepare MTL4 iterators for the current DOF matrix. === // === Prepare MTL4 iterators for the current DOF matrix. ===
...@@ -137,8 +137,8 @@ namespace AMDiS { ...@@ -137,8 +137,8 @@ namespace AMDiS {
// === Iterate on all DOFs of the row mapping. === // === Iterate on all DOFs of the row mapping. ===
DofMap::iterator rowIt = rowDofMap[rowFeSpace].begin(); DofMap::iterator rowIt = rowDofMap[rowComp].begin();
DofMap::iterator rowEndIt = rowDofMap[rowFeSpace].end(); DofMap::iterator rowEndIt = rowDofMap[colComp].end();
for (; rowIt != rowEndIt; ++rowIt) { for (; rowIt != rowEndIt; ++rowIt) {
// Go to the corresponding matrix row (note, both the mapping and the // Go to the corresponding matrix row (note, both the mapping and the
...@@ -165,7 +165,7 @@ namespace AMDiS { ...@@ -165,7 +165,7 @@ namespace AMDiS {
perMap->fillAssociations(rowFeSpace, rowIt->second.global, elObjDb, perRowAsc); perMap->fillAssociations(rowFeSpace, rowIt->second.global, elObjDb, perRowAsc);
if (localMatrix || rowDofMap[rowFeSpace].isRankDof(*cursor)) { if (localMatrix || rowDofMap[rowComp].isRankDof(*cursor)) {
// === The current row DOF is a rank DOF, so create the === // === The current row DOF is a rank DOF, so create the ===
// === corresponding nnz values directly on rank's nnz data. === // === corresponding nnz values directly on rank's nnz data. ===
...@@ -178,7 +178,7 @@ namespace AMDiS { ...@@ -178,7 +178,7 @@ namespace AMDiS {
TEST_EXIT_DBG(localPetscRowIdx >= 0 && localPetscRowIdx < nRankRows) TEST_EXIT_DBG(localPetscRowIdx >= 0 && localPetscRowIdx < nRankRows)
("Should not happen! \n Debug info: DOF = %d globalRowIndx = %d petscRowIdx = %d localPetscRowIdx = %d rStart = %d compontens = %d from %d nRankRows = %d\n", ("Should not happen! \n Debug info: DOF = %d globalRowIndx = %d petscRowIdx = %d localPetscRowIdx = %d rStart = %d compontens = %d from %d nRankRows = %d\n",
*cursor, *cursor,
rowDofMap[rowFeSpace][*cursor].global, rowDofMap[rowComp][*cursor].global,
petscRowIdx, petscRowIdx,
localPetscRowIdx, localPetscRowIdx,
rankStartRowIndex, rankStartRowIndex,
...@@ -190,7 +190,7 @@ namespace AMDiS { ...@@ -190,7 +190,7 @@ namespace AMDiS {
if (localMatrix) { if (localMatrix) {
for (icursor_type icursor = begin<nz>(cursor), for (icursor_type icursor = begin<nz>(cursor),
icend = end<nz>(cursor); icursor != icend; ++icursor) icend = end<nz>(cursor); icursor != icend; ++icursor)
if (colDofMap[colFeSpace].isSet(col(*icursor))) if (colDofMap[colComp].isSet(col(*icursor)))
dnnz[localPetscRowIdx]++; dnnz[localPetscRowIdx]++;
} else { } else {
MultiIndex colDofIndex; MultiIndex colDofIndex;
...@@ -198,7 +198,7 @@ namespace AMDiS { ...@@ -198,7 +198,7 @@ namespace AMDiS {
// Traverse all non zero entries in this row. // Traverse all non zero entries in this row.
for (icursor_type icursor = begin<nz>(cursor), for (icursor_type icursor = begin<nz>(cursor),
icend = end<nz>(cursor); icursor != icend; ++icursor) { icend = end<nz>(cursor); icursor != icend; ++icursor) {
if (colDofMap[colFeSpace].find(col(*icursor), colDofIndex) == false) if (colDofMap[colComp].find(col(*icursor), colDofIndex) == false)
continue; continue;
// Set of periodic row associations (is empty, if row DOF is not // Set of periodic row associations (is empty, if row DOF is not
...@@ -208,7 +208,7 @@ namespace AMDiS { ...@@ -208,7 +208,7 @@ namespace AMDiS {
perMap->fillAssociations(colFeSpace, colDofIndex.global, elObjDb, perColAsc); perMap->fillAssociations(colFeSpace, colDofIndex.global, elObjDb, perColAsc);
if (perColAsc.empty()) { if (perColAsc.empty()) {
if (colDofMap[colFeSpace].isRankDof(col(*icursor))) if (colDofMap[colComp].isRankDof(col(*icursor)))
dnnz[localPetscRowIdx]++; dnnz[localPetscRowIdx]++;
else else
onnz[localPetscRowIdx]++; onnz[localPetscRowIdx]++;
...@@ -252,7 +252,7 @@ namespace AMDiS { ...@@ -252,7 +252,7 @@ namespace AMDiS {
for (icursor_type icursor = begin<nz>(cursor), for (icursor_type icursor = begin<nz>(cursor),
icend = end<nz>(cursor); icursor != icend; ++icursor) { icend = end<nz>(cursor); icursor != icend; ++icursor) {
if (colDofMap[colFeSpace].find(col(*icursor), colDofIndex) == false) if (colDofMap[colComp].find(col(*icursor), colDofIndex) == false)
continue; continue;
int petscColIdx = (colDofMap.isMatIndexFromGlobal() ? int petscColIdx = (colDofMap.isMatIndexFromGlobal() ?
......
...@@ -74,7 +74,7 @@ namespace AMDiS { ...@@ -74,7 +74,7 @@ namespace AMDiS {
: problemStat(0), : problemStat(0),
initialized(false), initialized(false),
name("parallel"), name("parallel"),
feSpaces(0), componentSpaces(0),
mesh(NULL), mesh(NULL),
refineManager(NULL), refineManager(NULL),
info(10), info(10),
...@@ -148,7 +148,7 @@ namespace AMDiS { ...@@ -148,7 +148,7 @@ namespace AMDiS {
TEST_EXIT(mpiSize > 1) TEST_EXIT(mpiSize > 1)
("Parallelization does not work with only one process!\n"); ("Parallelization does not work with only one process!\n");
TEST_EXIT(feSpaces.size() > 0) TEST_EXIT(componentSpaces.size() > 0)
("No FE space has been defined for the mesh distributor!\n"); ("No FE space has been defined for the mesh distributor!\n");
TEST_EXIT(mesh)("No mesh has been defined for the mesh distributor!\n"); TEST_EXIT(mesh)("No mesh has been defined for the mesh distributor!\n");
...@@ -158,18 +158,18 @@ namespace AMDiS { ...@@ -158,18 +158,18 @@ namespace AMDiS {
bool doNext = false; bool doNext = false;
do { do {
doNext = false; doNext = false;
for (unsigned int i = 0; i < feSpaces.size() - 1; i++) { for (unsigned int i = 0; i < uniqueFeSpaces.size() - 1; i++) {
if (feSpaces[i]->getBasisFcts()->getDegree() > if (uniqueFeSpaces[i]->getBasisFcts()->getDegree() >
feSpaces[i + 1]->getBasisFcts()->getDegree()) { uniqueFeSpaces[i + 1]->getBasisFcts()->getDegree()) {
const FiniteElemSpace *tmp = feSpaces[i + 1]; const FiniteElemSpace *tmp = uniqueFeSpaces[i + 1];
feSpaces[i + 1] = feSpaces[i]; uniqueFeSpaces[i + 1] = uniqueFeSpaces[i];
feSpaces[i] = tmp; uniqueFeSpaces[i] = tmp;
doNext = true; doNext = true;
} }
} }
} while (doNext); } while (doNext);
elObjDb.setFeSpace(feSpaces[0]); elObjDb.setFeSpace(uniqueFeSpaces[0]);
// If required, create hierarchical mesh level structure. // If required, create hierarchical mesh level structure.
createMeshLevelStructure(); createMeshLevelStructure();
...@@ -191,7 +191,8 @@ namespace AMDiS { ...@@ -191,7 +191,8 @@ namespace AMDiS {
elObjDb.setData(partitionMap, levelData); elObjDb.setData(partitionMap, levelData);
#if (DEBUG != 0) #if (DEBUG != 0)
ParallelDebug::writeDebugFile(feSpaces[feSpaces.size() - 1], dofMap, ParallelDebug::writeDebugFile(uniqueFeSpaces[uniqueFeSpaces.size() - 1],
dofMap,
debugOutputDir + "mpi-dbg", "dat"); debugOutputDir + "mpi-dbg", "dat");
#endif #endif
...@@ -315,7 +316,7 @@ namespace AMDiS { ...@@ -315,7 +316,7 @@ namespace AMDiS {
ParallelDebug::testInteriorBoundary(*this); ParallelDebug::testInteriorBoundary(*this);
ParallelDebug::followBoundary(*this); ParallelDebug::followBoundary(*this);
debug::writeMesh(feSpaces[0], -1, debugOutputDir + "macro_mesh"); debug::writeMesh(uniqueFeSpaces[0], -1, debugOutputDir + "macro_mesh");
MSG("Debug mode tests finished!\n"); MSG("Debug mode tests finished!\n");
#endif #endif
...@@ -363,25 +364,12 @@ namespace AMDiS { ...@@ -363,25 +364,12 @@ namespace AMDiS {
TEST_EXIT_DBG(probStat->getFeSpaces().size()) TEST_EXIT_DBG(probStat->getFeSpaces().size())
("No FE spaces in stationary problem!\n"); ("No FE spaces in stationary problem!\n");
// === Add FE spaces from stationary problem to mesh distributor. === TEST_EXIT(componentSpaces.size() == 0)
("Parallelization of coupled problems is deactived at the moment!\n");
for (unsigned int i = 0; i < probStat->getFeSpaces().size(); i++) { componentSpaces = probStat->getComponentFeSpaces();
bool foundFeSpace = false; uniqueFeSpaces = probStat->getFeSpaces();
for (unsigned int j = 0; j < feSpaces.size(); j++) { mesh = uniqueFeSpaces[0]->getMesh();
if (feSpaces[j] == probStat->getFeSpaces()[i])
foundFeSpace = true;
TEST_EXIT(feSpaces[j]->getMesh() == probStat->getFeSpaces()[i]->getMesh())
("MeshDistributor does not yet support usage of different meshes!\n");
}
if (!foundFeSpace)
feSpaces.push_back(probStat->getFeSpaces()[i]);
}
TEST_EXIT(feSpaces.size() > 0)("Should not happen!\n");
mesh = feSpaces[0]->getMesh();
info = probStat->getInfo(); info = probStat->getInfo();
switch (mesh->getDim()) { switch (mesh->getDim()) {
...@@ -678,8 +666,8 @@ namespace AMDiS { ...@@ -678,8 +666,8 @@ namespace AMDiS {
DofEdge dofEdge1 = edge1.first->getEdge(edge1.second); DofEdge dofEdge1 = edge1.first->getEdge(edge1.second);
WorldVector<double> c0, c1; WorldVector<double> c0, c1;
mesh->getDofIndexCoords(dofEdge0.first, feSpaces[0], c0); mesh->getDofIndexCoords(dofEdge0.first, uniqueFeSpaces[0], c0);
mesh->getDofIndexCoords(dofEdge0.second, feSpaces[0], c1); mesh->getDofIndexCoords(dofEdge0.second, uniqueFeSpaces[0], c1);
MSG("FOUND EDGE %d/%d <-> %d/%d\n", MSG("FOUND EDGE %d/%d <-> %d/%d\n",
edge0.first->getIndex(), edge0.second, edge0.first->getIndex(), edge0.second,
...@@ -976,7 +964,7 @@ namespace AMDiS { ...@@ -976,7 +964,7 @@ namespace AMDiS {
MPI::Wtime() - first); MPI::Wtime() - first);
#if (DEBUG != 0) #if (DEBUG != 0)
debug::writeMesh(feSpaces[0], -1, debugOutputDir + "mesh"); debug::writeMesh(uniqueFeSpaces[0], -1, debugOutputDir + "mesh");
#endif #endif
// Because the mesh has been changed, update the DOF numbering and mappings. // Because the mesh has been changed, update the DOF numbering and mappings.
...@@ -1196,8 +1184,10 @@ namespace AMDiS { ...@@ -1196,8 +1184,10 @@ namespace AMDiS {
int rank = 0; int rank = 0;
SerUtil::deserialize(in, rank); SerUtil::deserialize(in, rank);
for (unsigned int j = 0; j < feSpaces.size(); j++) for (unsigned int j = 0; j < componentSpaces.size(); j++)
deserialize(in, data[rank][feSpaces[j]], dofIndexMap[feSpaces[j]]); deserialize(in,
data[rank][componentSpaces[j]],
dofIndexMap[componentSpaces[j]]);
} }
} }
...@@ -1274,7 +1264,8 @@ namespace AMDiS { ...@@ -1274,7 +1264,8 @@ namespace AMDiS {
Parameters::get("dbg->write part mesh", writePartMesh); Parameters::get("dbg->write part mesh", writePartMesh);
if (writePartMesh > 0 && repartitioningCounter == 0) if (writePartMesh > 0 && repartitioningCounter == 0)
ParallelDebug::writePartitioningFile(debugOutputDir + "partitioning", ParallelDebug::writePartitioningFile(debugOutputDir + "partitioning",
repartitioningCounter, feSpaces[0]); repartitioningCounter,
uniqueFeSpaces[0]);
repartitioningCounter++; repartitioningCounter++;
...@@ -1305,7 +1296,7 @@ namespace AMDiS { ...@@ -1305,7 +1296,7 @@ namespace AMDiS {
// === Run mesh partitioner to calculate a new mesh partitioning. === // === Run mesh partitioner to calculate a new mesh partitioning. ===
partitioner->setLocalGlobalDofMap(&(dofMap[feSpaces[0]].getMap())); partitioner->setLocalGlobalDofMap(&(dofMap[uniqueFeSpaces[0]].getMap()));
bool partitioningSucceed = bool partitioningSucceed =
partitioner->partition(elemWeights, ADAPTIVE_REPART); partitioner->partition(elemWeights, ADAPTIVE_REPART);
if (!partitioningSucceed) { if (!partitioningSucceed) {
...@@ -1482,11 +1473,11 @@ namespace AMDiS { ...@@ -1482,11 +1473,11 @@ namespace AMDiS {
// Note that also if there are no macros to be deleted, this function will // Note that also if there are no macros to be deleted, this function will
// update the number of elements, vertices, etc. of the mesh. // update the number of elements, vertices, etc. of the mesh.
mesh->removeMacroElements(deleteMacroElements, feSpaces); mesh->removeMacroElements(deleteMacroElements, uniqueFeSpaces);
// === Remove double DOFs. === // === Remove double DOFs. ===
MeshManipulation meshManipulation(mesh); MeshManipulation meshManipulation(mesh);
meshManipulation.deleteDoubleDofs(feSpaces, newMacroEl, elObjDb); meshManipulation.deleteDoubleDofs(uniqueFeSpaces, newMacroEl, elObjDb);
mesh->dofCompress(); mesh->dofCompress();
partitioner->createPartitionMap(partitionMap); partitioner->createPartitionMap(partitionMap);
...@@ -1521,7 +1512,8 @@ namespace AMDiS { ...@@ -1521,7 +1512,8 @@ namespace AMDiS {
MSG("AMDiS runs in debug mode, so make some test ...\n"); MSG("AMDiS runs in debug mode, so make some test ...\n");
ParallelDebug::writePartitioningFile(debugOutputDir + "partitioning", ParallelDebug::writePartitioningFile(debugOutputDir + "partitioning",
repartitioningCounter, feSpaces[0]); repartitioningCounter,
uniqueFeSpaces[0]);
ParallelDebug::testAllElements(*this); ParallelDebug::testAllElements(*this);
ParallelDebug::testDoubleDofs(mesh); ParallelDebug::testDoubleDofs(mesh);
ParallelDebug::testInteriorBoundary(*this); ParallelDebug::testInteriorBoundary(*this);
...@@ -1567,11 +1559,11 @@ namespace AMDiS { ...@@ -1567,11 +1559,11 @@ namespace AMDiS {
// === Create DOF communicator. === // === Create DOF communicator. ===
dofComm.init(0, levelData, feSpaces); dofComm.init(0, levelData, uniqueFeSpaces);
dofComm.create(intBoundary); dofComm.create(intBoundary);
if (levelData.getLevelNumber() > 1) { if (levelData.getLevelNumber() > 1) {
dofCommSd.init(0, levelData, feSpaces); dofCommSd.init(0, levelData, uniqueFeSpaces);
dofCommSd.create(intBoundarySd); dofCommSd.create(intBoundarySd);
} }
...@@ -1583,8 +1575,8 @@ namespace AMDiS { ...@@ -1583,8 +1575,8 @@ namespace AMDiS {
int nLevels = levelData.getLevelNumber(); int nLevels = levelData.getLevelNumber();
boundaryDofInfo.resize(nLevels); boundaryDofInfo.resize(nLevels);
for (unsigned int i = 0; i < feSpaces.size(); i++) { for (unsigned int i = 0; i < uniqueFeSpaces.size(); i++) {
const FiniteElemSpace *feSpace = feSpaces[i]; const FiniteElemSpace *feSpace = uniqueFeSpaces[i];
for (int level = 0; level < nLevels; level++) { for (int level = 0; level < nLevels; level++) {
...@@ -1636,7 +1628,7 @@ namespace AMDiS { ...@@ -1636,7 +1628,7 @@ namespace AMDiS {
if (partitioner->getElementInRank()[(*it)->getIndex()] == false) if (partitioner->getElementInRank()[(*it)->getIndex()] == false)
macrosToRemove.insert(*it); macrosToRemove.insert(*it);
mesh->removeMacroElements(macrosToRemove, feSpaces); mesh->removeMacroElements(macrosToRemove, uniqueFeSpaces);
} }
...@@ -1657,13 +1649,13 @@ namespace AMDiS { ...@@ -1657,13 +1649,13 @@ namespace AMDiS {
int nLevels = levelData.getLevelNumber(); int nLevels = levelData.getLevelNumber();
TEST_EXIT_DBG(nLevels >= 1)("Should not happen!\n"); TEST_EXIT_DBG(nLevels >= 1)("Should not happen!\n");
dofMap.init(levelData, feSpaces, feSpaces); dofMap.init(levelData, componentSpaces, uniqueFeSpaces);
dofMap.setMpiComm(levelData.getMpiComm(0), 0); dofMap.setMpiComm(levelData.getMpiComm(0), 0);
dofMap.setDofComm(dofComm); dofMap.setDofComm(dofComm);
dofMap.clear(); dofMap.clear();
if (nLevels > 1) { if (nLevels > 1) {
dofMapSd.init(levelData, feSpaces, feSpaces); dofMapSd.init(levelData, componentSpaces, uniqueFeSpaces);
dofMapSd.setMpiComm(levelData.getMpiComm(1), 1); dofMapSd.setMpiComm(levelData.getMpiComm(1), 1);
dofMapSd.setDofComm(dofCommSd); dofMapSd.setDofComm(dofCommSd);
dofMapSd.clear(); dofMapSd.clear();
...@@ -1671,13 +1663,13 @@ namespace AMDiS { ...@@ -1671,13 +1663,13 @@ namespace AMDiS {
createBoundaryDofs(); createBoundaryDofs();
for (unsigned int i = 0; i < feSpaces.size(); i++) for (unsigned int i = 0; i < uniqueFeSpaces.size(); i++)
updateLocalGlobalNumbering(dofMap, dofComm, feSpaces[i]); updateLocalGlobalNumbering(dofMap, dofComm, uniqueFeSpaces[i]);
dofMap.update(); dofMap.update();
if (nLevels > 1) { if (nLevels > 1) {
for (unsigned int i = 0; i < feSpaces.size(); i++) for (unsigned int i = 0; i < uniqueFeSpaces.size(); i++)
updateLocalGlobalNumbering(dofMapSd, dofCommSd, feSpaces[i]); updateLocalGlobalNumbering(dofMapSd, dofCommSd, uniqueFeSpaces[i]);
dofMapSd.update(); dofMapSd.update();
} }
...@@ -1691,27 +1683,28 @@ namespace AMDiS { ...@@ -1691,27 +1683,28 @@ namespace AMDiS {
MSG("------------- Debug information -------------\n"); MSG("------------- Debug information -------------\n");
MSG("| number of levels: %d\n", nLevels); MSG("| number of levels: %d\n", nLevels);
MSG("| number of FE spaces: %d\n", feSpaces.size()); MSG("| number of FE spaces: %d\n", uniqueFeSpaces.size());
for (unsigned int i = 0; i < feSpaces.size(); i++) { for (unsigned int i = 0; i < uniqueFeSpaces.size(); i++) {
MSG("| FE space = %d (pointer adr %p):\n", i, feSpaces[i]); MSG("| FE space = %d (pointer adr %p):\n", i, uniqueFeSpaces[i]);
MSG("| nRankDofs = %d\n", dofMap[feSpaces[i]].nRankDofs); MSG("| nRankDofs = %d\n", dofMap[uniqueFeSpaces[i]].nRankDofs);
MSG("| nOverallDofs = %d\n", dofMap[feSpaces[i]].nOverallDofs); MSG("| nOverallDofs = %d\n", dofMap[uniqueFeSpaces[i]].nOverallDofs);
MSG("| rStartDofs = %d\n", dofMap[feSpaces[i]].rStartDofs); MSG("| rStartDofs = %d\n", dofMap[uniqueFeSpaces[i]].rStartDofs);
} }
if (nLevels > 1) { if (nLevels > 1) {
for (unsigned int i = 0; i < feSpaces.size(); i++) { for (unsigned int i = 0; i < uniqueFeSpaces.size(); i++) {
MSG("| FE space = %d:\n", i); MSG("| FE space = %d:\n", i);
MSG("| nRankDofs = %d\n", dofMapSd[feSpaces[i]].nRankDofs); MSG("| nRankDofs = %d\n", dofMapSd[uniqueFeSpaces[i]].nRankDofs);
MSG("| nOverallDofs = %d\n", dofMapSd[feSpaces[i]].nOverallDofs); MSG("| nOverallDofs = %d\n", dofMapSd[uniqueFeSpaces[i]].nOverallDofs);
MSG("| rStartDofs = %d\n", dofMapSd[feSpaces[i]].rStartDofs); MSG("| rStartDofs = %d\n", dofMapSd[uniqueFeSpaces[i]].rStartDofs);
} }
} }
// debug::writeElementIndexMesh(mesh, debugOutputDir + "elementIndex-" + // debug::writeElementIndexMesh(mesh, debugOutputDir + "elementIndex-" +
// lexical_cast<string>(mpiRank) + ".vtu"); // lexical_cast<string>(mpiRank) + ".vtu");
ParallelDebug::writeDebugFile(feSpaces[feSpaces.size() - 1], dofMap, ParallelDebug::writeDebugFile(uniqueFeSpaces[uniqueFeSpaces.size() - 1],
dofMap,
debugOutputDir + "mpi-dbg", "dat"); debugOutputDir + "mpi-dbg", "dat");
debug::testSortedDofs(mesh, elMap); debug::testSortedDofs(mesh, elMap);
...@@ -1722,14 +1715,16 @@ namespace AMDiS { ...@@ -1722,14 +1715,16 @@ namespace AMDiS {
ParallelDebug::testGlobalIndexByCoords(*this); ParallelDebug::testGlobalIndexByCoords(*this);
} }
#else #else
for (unsigned int i = 0; i < feSpaces.size(); i++) for (unsigned int i = 0; i < uniqueFeSpaces.size(); i++)
MSG("FE space %d: nRankDofs = %d nOverallDofs = %d\n", MSG("FE space %d: nRankDofs = %d nOverallDofs = %d\n",
i, dofMap[feSpaces[i]].nRankDofs, dofMap[feSpaces[i]].nOverallDofs); i, dofMap[uniqueFeSpaces[i]].nRankDofs,
dofMap[uniqueFeSpaces[i]].nOverallDofs);
int tmp = 0; int tmp = 0;
Parameters::get(name + "->write parallel debug file", tmp); Parameters::get(name + "->write parallel debug file", tmp);
if (tmp) if (tmp)
ParallelDebug::writeDebugFile(feSpaces[feSpaces.size() - 1], dofMap, ParallelDebug::writeDebugFile(uniqueFeSpaces[uniqueFeSpaces.size() - 1],
dofMap,
debugOutputDir + "mpi-dbg", "dat"); debugOutputDir + "mpi-dbg", "dat");
#endif #endif
...@@ -1786,8 +1781,8 @@ namespace AMDiS { ...@@ -1786,8 +1781,8 @@ namespace AMDiS {
// MPI::COMM_WORLD.Barrier(); [TODO: CHANGE BECAUSE NOT ALL RANKS HAVE PERIODIC MAP!!!] // MPI::COMM_WORLD.Barrier(); [TODO: CHANGE BECAUSE NOT ALL RANKS HAVE PERIODIC MAP!!!]
double first = MPI::Wtime(); double first = MPI::Wtime();
for (unsigned int i = 0; i < feSpaces.size(); i++) for (unsigned int i = 0; i < uniqueFeSpaces.size(); i++)
createPeriodicMap(feSpaces[i]); createPeriodicMap(uniqueFeSpaces[i]);
// MPI::COMM_WORLD.Barrier(); // MPI::COMM_WORLD.Barrier();
INFO(info, 8)("Creation of periodic mapping needed %.5f seconds\n", INFO(info, 8)("Creation of periodic mapping needed %.5f seconds\n",
...@@ -2024,14 +2019,14 @@ namespace AMDiS { ...@@ -2024,14 +2019,14 @@ namespace AMDiS {
// Create a map from DOF indices to the corresponding DOF pointers. // Create a map from DOF indices to the corresponding DOF pointers.
map<const FiniteElemSpace*, map<int, const DegreeOfFreedom*> > dofIndexMap; map<const FiniteElemSpace*, map<int, const DegreeOfFreedom*> > dofIndexMap;
for (unsigned int i = 0; i < feSpaces.size(); i++) { for (unsigned int i = 0; i < uniqueFeSpaces.size(); i++) {
ElementDofIterator elDofIter(feSpaces[i]); ElementDofIterator elDofIter(uniqueFeSpaces[i]);
TraverseStack stack; TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL); ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
while (elInfo) { while (elInfo) {
elDofIter.reset(elInfo->getElement()); elDofIter.reset(elInfo->getElement());
do { do {
dofIndexMap[feSpaces[i]][elDofIter.getDof()] = elDofIter.getDofPtr(); dofIndexMap[uniqueFeSpaces[i]][elDofIter.getDof()] = elDofIter.getDofPtr();
} while (elDofIter.next()); } while (elDofIter.next());
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
......
...@@ -132,6 +132,7 @@ namespace AMDiS { ...@@ -132,6 +132,7 @@ namespace AMDiS {
return mesh; return mesh;
} }
#if 0
/// Returns an FE space from \ref feSpaces. /// Returns an FE space from \ref feSpaces.
inline const FiniteElemSpace* getFeSpace(unsigned int i = 0) inline const FiniteElemSpace* getFeSpace(unsigned int i = 0)
{ {
...@@ -147,6 +148,7 @@ namespace AMDiS { ...@@ -147,6 +148,7 @@ namespace AMDiS {
{ {
return feSpaces; return feSpaces;
} }
#endif
/// Returns the DOF mapping object, \ref dofMap. /// Returns the DOF mapping object, \ref dofMap.
inline ParallelDofMapping& getDofMap() inline ParallelDofMapping& getDofMap()
...@@ -486,7 +488,10 @@ namespace AMDiS { ...@@ -486,7 +488,10 @@ namespace AMDiS {
string name; string name;
/// Finite element spaces of the problem. /// Finite element spaces of the problem.
vector<const FiniteElemSpace*> feSpaces; //vector<const FiniteElemSpace*> feSpaces;
vector<const FiniteElemSpace*> componentSpaces;
vector<const FiniteElemSpace*> uniqueFeSpaces;