Commit 37868ad3 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

WUA, IT COMPILES....

parent 0c1e2d14
...@@ -132,23 +132,35 @@ namespace AMDiS { ...@@ -132,23 +132,35 @@ 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)
{ {
FUNCNAME("MeshDistributor::getFeSpace()"); FUNCNAME("MeshDistributor::getFeSpace()");
TEST_EXIT_DBG(i < feSpaces.size())("Should not happen!\n"); TEST_EXIT_DBG(i < uniqueFeSpaces.size())("Should not happen!\n");
return feSpaces[i]; return uniqueFeSpaces[i];
} }
/// Returns all FE spaces, thus \ref feSpaces. /// Returns all FE spaces, thus \ref feSpaces.
inline vector<const FiniteElemSpace*>& getFeSpaces() inline vector<const FiniteElemSpace*>& getFeSpaces()
{ {
return feSpaces; return uniqueFeSpaces;
}
inline const FiniteElemSpace* getComponentFeSpace(unsigned int i = 0)
{
FUNCNAME("MeshDistributor::getFeSpace()");
TEST_EXIT_DBG(i < componentSpaces.size())("Should not happen!\n");
return componentSpaces[i];
}
inline vector<const FiniteElemSpace*>& getComponentFeSpaces()
{
return componentSpaces;
} }
#endif
/// Returns the DOF mapping object, \ref dofMap. /// Returns the DOF mapping object, \ref dofMap.
inline ParallelDofMapping& getDofMap() inline ParallelDofMapping& getDofMap()
...@@ -488,8 +500,8 @@ namespace AMDiS { ...@@ -488,8 +500,8 @@ 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*> componentSpaces; vector<const FiniteElemSpace*> componentSpaces;
vector<const FiniteElemSpace*> uniqueFeSpaces; vector<const FiniteElemSpace*> uniqueFeSpaces;
......
...@@ -191,7 +191,7 @@ namespace AMDiS { ...@@ -191,7 +191,7 @@ namespace AMDiS {
TEST_EXIT_DBG(levelData)("No mesh level data object defined!\n"); TEST_EXIT_DBG(levelData)("No mesh level data object defined!\n");
for (ComponentIterator &it = data->getIteratorData(); !it.end(); it.next()) for (ComponentIterator &it = data->getIteratorData(); !it.end(); it.next())
data->clear(); it->clear();
nRankDofs = -1; nRankDofs = -1;
nLocalDofs = -1; nLocalDofs = -1;
...@@ -322,6 +322,8 @@ namespace AMDiS { ...@@ -322,6 +322,8 @@ namespace AMDiS {
// === Create the matrix indices for all component FE spaces. === // === Create the matrix indices for all component FE spaces. ===
vector<const FiniteElemSpace*> &feSpaces = data->getFeSpaces();
for (unsigned int i = 0; i < feSpaces.size(); i++) { for (unsigned int i = 0; i < feSpaces.size(); i++) {
// Traverse all DOFs of the FE space and create for all rank owned DOFs // Traverse all DOFs of the FE space and create for all rank owned DOFs
...@@ -462,12 +464,6 @@ namespace AMDiS { ...@@ -462,12 +464,6 @@ namespace AMDiS {
{ {
FUNCNAME("ParallelDofMapping::createIndexSet()"); FUNCNAME("ParallelDofMapping::createIndexSet()");
TEST_EXIT_DBG(firstComponent + nComponents <= feSpaces.size())
("Should not happen!\n");
TEST_EXIT_DBG(data.count(feSpaces[firstComponent]))
("No data for FE space at address %p!\n", feSpaces[firstComponent]);
int firstRankDof = -1; int firstRankDof = -1;
ComponentDofMap &compMap = (*data)[firstComponent]; ComponentDofMap &compMap = (*data)[firstComponent];
DofMap &dofMap = compMap.getMap(); DofMap &dofMap = compMap.getMap();
......
...@@ -295,6 +295,8 @@ namespace AMDiS { ...@@ -295,6 +295,8 @@ namespace AMDiS {
public: public:
virtual ComponentDofMap& operator*() = 0; virtual ComponentDofMap& operator*() = 0;
virtual ComponentDofMap* operator->() = 0;
virtual bool end() = 0; virtual bool end() = 0;
virtual void next() = 0; virtual void next() = 0;
...@@ -319,6 +321,11 @@ namespace AMDiS { ...@@ -319,6 +321,11 @@ namespace AMDiS {
vector<const FiniteElemSpace*> &f1, vector<const FiniteElemSpace*> &f1,
bool isNonLocal) = 0; bool isNonLocal) = 0;
vector<const FiniteElemSpace*>& getFeSpaces()
{
return feSpaces;
}
protected: protected:
/// The FE spaces for all components. /// The FE spaces for all components.
vector<const FiniteElemSpace*> feSpaces; vector<const FiniteElemSpace*> feSpaces;
...@@ -398,6 +405,10 @@ namespace AMDiS { ...@@ -398,6 +405,10 @@ namespace AMDiS {
{ {
} }
ComponentDofMap* operator->()
{
}
bool end() bool end()
{ {
} }
...@@ -416,6 +427,11 @@ namespace AMDiS { ...@@ -416,6 +427,11 @@ namespace AMDiS {
ComponentDofMap& operator*() ComponentDofMap& operator*()
{ {
} }
ComponentDofMap* operator->()
{
}
bool end() bool end()
{ {
...@@ -478,6 +494,11 @@ namespace AMDiS { ...@@ -478,6 +494,11 @@ namespace AMDiS {
{ {
} }
ComponentDofMap* operator->()
{
}
bool end() bool end()
{ {
} }
...@@ -496,6 +517,11 @@ namespace AMDiS { ...@@ -496,6 +517,11 @@ namespace AMDiS {
ComponentDofMap& operator*() ComponentDofMap& operator*()
{ {
} }
ComponentDofMap* operator->()
{
}
bool end() bool end()
{ {
...@@ -618,11 +644,10 @@ namespace AMDiS { ...@@ -618,11 +644,10 @@ namespace AMDiS {
} }
/// Returns the number of solution components the mapping is defined on. /// Returns the number of solution components the mapping is defined on.
// inline int getNumberOfComponents() const inline int getNumberOfComponents() const
// { {
// ERROR_EXIT("WRITE SOMETHING MEANINGFUL!\n"); return static_cast<int>(data->getFeSpaces().size());
// // return static_cast<int>(feSpaces.size()); }
// }
/// Returns \ref nRankDofs, thus the number of DOFs owned by the rank. /// Returns \ref nRankDofs, thus the number of DOFs owned by the rank.
inline int getRankDofs() inline int getRankDofs()
......
...@@ -200,16 +200,16 @@ namespace AMDiS { ...@@ -200,16 +200,16 @@ namespace AMDiS {
interfaceDofMap.setMpiComm(levelData.getMpiComm(0), 0); interfaceDofMap.setMpiComm(levelData.getMpiComm(0), 0);
} }
for (unsigned int i = 0; i < meshDistributor->getFeSpaces().size(); i++) { for (unsigned int i = 0; i < meshDistributor->getComponentFeSpaces().size(); i++) {
const FiniteElemSpace *feSpace = meshDistributor->getFeSpace(i); const FiniteElemSpace *feSpace = meshDistributor->getComponentFeSpace(i);
createPrimals(feSpace); createPrimals(i, feSpace);
createDuals(feSpace); createDuals(i, feSpace);
createInterfaceNodes(feSpace); createInterfaceNodes(i, feSpace);
createIndexB(feSpace); createIndexB(i, feSpace);
} }
primalDofMap.update(); primalDofMap.update();
...@@ -221,10 +221,10 @@ namespace AMDiS { ...@@ -221,10 +221,10 @@ namespace AMDiS {
if (stokesMode) if (stokesMode)
interfaceDofMap.update(); interfaceDofMap.update();
for (unsigned int i = 0; i < meshDistributor->getFeSpaces().size(); i++) { for (unsigned int i = 0; i < meshDistributor->getComponentFeSpaces().size(); i++) {
const FiniteElemSpace *feSpace = meshDistributor->getFeSpace(i); const FiniteElemSpace *feSpace = meshDistributor->getComponentFeSpace(i);
createLagrange(feSpace); createLagrange(i, feSpace);
createAugmentedLagrange(feSpace); createAugmentedLagrange(i, feSpace);
} }
lagrangeMap.update(); lagrangeMap.update();
...@@ -295,7 +295,8 @@ namespace AMDiS { ...@@ -295,7 +295,8 @@ namespace AMDiS {
} }
void PetscSolverFeti::createPrimals(const FiniteElemSpace *feSpace) void PetscSolverFeti::createPrimals(int component,
const FiniteElemSpace *feSpace)
{ {
FUNCNAME("PetscSolverFeti::createPrimals()"); FUNCNAME("PetscSolverFeti::createPrimals()");
...@@ -338,13 +339,14 @@ namespace AMDiS { ...@@ -338,13 +339,14 @@ namespace AMDiS {
for (DofIndexSet::iterator it = primals.begin(); it != primals.end(); ++it) for (DofIndexSet::iterator it = primals.begin(); it != primals.end(); ++it)
if (meshDistributor->getDofMap()[feSpace].isRankDof(*it)) { if (meshDistributor->getDofMap()[feSpace].isRankDof(*it)) {
primalDofMap[feSpace].insertRankDof(*it); primalDofMap[component].insertRankDof(*it);
} else } else
primalDofMap[feSpace].insertNonRankDof(*it); primalDofMap[component].insertNonRankDof(*it);
} }
void PetscSolverFeti::createDuals(const FiniteElemSpace *feSpace) void PetscSolverFeti::createDuals(int component,
const FiniteElemSpace *feSpace)
{ {
FUNCNAME("PetscSolverFeti::createDuals()"); FUNCNAME("PetscSolverFeti::createDuals()");
...@@ -361,20 +363,21 @@ namespace AMDiS { ...@@ -361,20 +363,21 @@ namespace AMDiS {
if (dirichletRows[feSpace].count(**it)) if (dirichletRows[feSpace].count(**it))
continue; continue;
if (isPrimal(feSpace, **it)) if (isPrimal(component, **it))
continue; continue;
if (meshLevel == 0) { if (meshLevel == 0) {
dualDofMap[feSpace].insertRankDof(**it); dualDofMap[component].insertRankDof(**it);
} else { } else {
if (meshDistributor->getDofMapSd()[feSpace].isRankDof(**it)) if (meshDistributor->getDofMapSd()[feSpace].isRankDof(**it))
dualDofMap[feSpace].insertRankDof(**it); dualDofMap[component].insertRankDof(**it);
} }
} }
} }
void PetscSolverFeti::createInterfaceNodes(const FiniteElemSpace *feSpace) void PetscSolverFeti::createInterfaceNodes(int component,
const FiniteElemSpace *feSpace)
{ {
FUNCNAME("PetscSolverFeti::createInterfaceNodes()"); FUNCNAME("PetscSolverFeti::createInterfaceNodes()");
...@@ -390,14 +393,15 @@ namespace AMDiS { ...@@ -390,14 +393,15 @@ namespace AMDiS {
continue; continue;
if (meshDistributor->getDofMap()[feSpace].isRankDof(**it)) if (meshDistributor->getDofMap()[feSpace].isRankDof(**it))
interfaceDofMap[feSpace].insertRankDof(**it); interfaceDofMap[component].insertRankDof(**it);
else else
interfaceDofMap[feSpace].insertNonRankDof(**it); interfaceDofMap[component].insertNonRankDof(**it);
} }
} }
void PetscSolverFeti::createLagrange(const FiniteElemSpace *feSpace) void PetscSolverFeti::createLagrange(int component,
const FiniteElemSpace *feSpace)
{ {
FUNCNAME("PetscSolverFeti::createLagrange()"); FUNCNAME("PetscSolverFeti::createLagrange()");
...@@ -442,12 +446,12 @@ namespace AMDiS { ...@@ -442,12 +446,12 @@ namespace AMDiS {
meshLevel, feSpace); meshLevel, feSpace);
!it.end(); it.nextRank()) !it.end(); it.nextRank())
for (; !it.endDofIter(); it.nextDof()) for (; !it.endDofIter(); it.nextDof())
if (!isPrimal(feSpace, it.getDofIndex())) if (!isPrimal(component, it.getDofIndex()))
if (stdMpi.getRecvData(it.getRank())[it.getDofCounter()] == 1) if (stdMpi.getRecvData(it.getRank())[it.getDofCounter()] == 1)
sdRankDofs[it.getRank()].insert(it.getDofIndex()); sdRankDofs[it.getRank()].insert(it.getDofIndex());
} }
if (dualDofMap[feSpace].nLocalDofs == 0) if (dualDofMap[component].nLocalDofs == 0)
return; return;
...@@ -459,7 +463,7 @@ namespace AMDiS { ...@@ -459,7 +463,7 @@ namespace AMDiS {
meshLevel, feSpace); meshLevel, feSpace);
!it.end(); it.nextRank()) { !it.end(); it.nextRank()) {
for (; !it.endDofIter(); it.nextDof()) { for (; !it.endDofIter(); it.nextDof()) {
if (!isPrimal(feSpace, it.getDofIndex())) { if (!isPrimal(component, it.getDofIndex())) {
boundaryDofRanks[feSpace][it.getDofIndex()].insert(mpiRank); boundaryDofRanks[feSpace][it.getDofIndex()].insert(mpiRank);
if (meshLevel == 0 || if (meshLevel == 0 ||
...@@ -478,7 +482,7 @@ namespace AMDiS { ...@@ -478,7 +482,7 @@ namespace AMDiS {
for (DofComm::Iterator it(meshDistributor->getDofComm().getSendDofs(), meshLevel, feSpace); for (DofComm::Iterator it(meshDistributor->getDofComm().getSendDofs(), meshLevel, feSpace);
!it.end(); it.nextRank()) !it.end(); it.nextRank())
for (; !it.endDofIter(); it.nextDof()) for (; !it.endDofIter(); it.nextDof())
if (!isPrimal(feSpace, it.getDofIndex())) if (!isPrimal(component, it.getDofIndex()))
if (meshLevel == 0 || if (meshLevel == 0 ||
(meshLevel > 0 && sdRankDofs[it.getRank()].count(it.getDofIndex()))) (meshLevel > 0 && sdRankDofs[it.getRank()].count(it.getDofIndex())))
stdMpi.getSendData(it.getRank()).push_back(boundaryDofRanks[feSpace][it.getDofIndex()]); stdMpi.getSendData(it.getRank()).push_back(boundaryDofRanks[feSpace][it.getDofIndex()]);
...@@ -489,7 +493,7 @@ namespace AMDiS { ...@@ -489,7 +493,7 @@ namespace AMDiS {
!it.end(); it.nextRank()) { !it.end(); it.nextRank()) {
bool recvFromRank = false; bool recvFromRank = false;
for (; !it.endDofIter(); it.nextDof()) { for (; !it.endDofIter(); it.nextDof()) {
if (!isPrimal(feSpace, it.getDofIndex())) { if (!isPrimal(component, it.getDofIndex())) {
if (meshLevel == 0 || if (meshLevel == 0 ||
(meshLevel > 0 && (meshLevel > 0 &&
meshDistributor->getDofMapSd()[feSpace].isRankDof(it.getDofIndex()))) { meshDistributor->getDofMapSd()[feSpace].isRankDof(it.getDofIndex()))) {
...@@ -509,14 +513,14 @@ namespace AMDiS { ...@@ -509,14 +513,14 @@ namespace AMDiS {
!it.end(); it.nextRank()) { !it.end(); it.nextRank()) {
int i = 0; int i = 0;
for (; !it.endDofIter(); it.nextDof()) for (; !it.endDofIter(); it.nextDof())
if (!isPrimal(feSpace, it.getDofIndex())) if (!isPrimal(component, it.getDofIndex()))
if (meshLevel == 0 || if (meshLevel == 0 ||
(meshLevel > 0 && (meshLevel > 0 &&
meshDistributor->getDofMapSd()[feSpace].isRankDof(it.getDofIndex()))) meshDistributor->getDofMapSd()[feSpace].isRankDof(it.getDofIndex())))
boundaryDofRanks[feSpace][it.getDofIndex()] = boundaryDofRanks[feSpace][it.getDofIndex()] =
stdMpi.getRecvData(it.getRank())[i++]; stdMpi.getRecvData(it.getRank())[i++];
else else
lagrangeMap[feSpace].insertNonRankDof(it.getDofIndex()); lagrangeMap[component].insertNonRankDof(it.getDofIndex());
} }
...@@ -527,18 +531,19 @@ namespace AMDiS { ...@@ -527,18 +531,19 @@ namespace AMDiS {
DofMap& dualMap = dualDofMap[feSpace].getMap(); DofMap& dualMap = dualDofMap[feSpace].getMap();
for (DofMap::iterator it = dualMap.begin(); it != dualMap.end(); ++it) { for (DofMap::iterator it = dualMap.begin(); it != dualMap.end(); ++it) {
if (meshDistributor->getDofMap()[feSpace].isRankDof(it->first)) { if (meshDistributor->getDofMap()[feSpace].isRankDof(it->first)) {
lagrangeMap[feSpace].insertRankDof(it->first, nRankLagrange); lagrangeMap[component].insertRankDof(it->first, nRankLagrange);
int degree = boundaryDofRanks[feSpace][it->first].size(); int degree = boundaryDofRanks[feSpace][it->first].size();
nRankLagrange += (degree * (degree - 1)) / 2; nRankLagrange += (degree * (degree - 1)) / 2;
} else { } else {
lagrangeMap[feSpace].insertNonRankDof(it->first); lagrangeMap[component].insertNonRankDof(it->first);
} }
} }
lagrangeMap[feSpace].nRankDofs = nRankLagrange; lagrangeMap[component].nRankDofs = nRankLagrange;
} }
void PetscSolverFeti::createAugmentedLagrange(const FiniteElemSpace *feSpace) void PetscSolverFeti::createAugmentedLagrange(int component,
const FiniteElemSpace *feSpace)
{ {
FUNCNAME("PetscSolverFeti::createAugmentedLagrange()"); FUNCNAME("PetscSolverFeti::createAugmentedLagrange()");
...@@ -547,7 +552,8 @@ namespace AMDiS { ...@@ -547,7 +552,8 @@ namespace AMDiS {
} }
void PetscSolverFeti::createIndexB(const FiniteElemSpace *feSpace) void PetscSolverFeti::createIndexB(int component,
const FiniteElemSpace *feSpace)
{ {
FUNCNAME("PetscSolverFeti::createIndexB()"); FUNCNAME("PetscSolverFeti::createIndexB()");
...@@ -560,14 +566,14 @@ namespace AMDiS { ...@@ -560,14 +566,14 @@ namespace AMDiS {
int nLocalInterior = 0; int nLocalInterior = 0;
for (int i = 0; i < admin->getUsedSize(); i++) { for (int i = 0; i < admin->getUsedSize(); i++) {
if (admin->isDofFree(i) || if (admin->isDofFree(i) ||
isPrimal(feSpace, i) || isPrimal(component, i) ||
isDual(feSpace, i) || isDual(component, i) ||
isInterface(feSpace, i) || isInterface(component, i) ||
dirichletRows[feSpace].count(i)) dirichletRows[feSpace].count(i))
continue; continue;
if (meshLevel == 0) { if (meshLevel == 0) {
localDofMap[feSpace].insertRankDof(i, nLocalInterior); localDofMap[component].insertRankDof(i, nLocalInterior);
if (fetiPreconditioner == FETI_DIRICHLET) if (fetiPreconditioner == FETI_DIRICHLET)
interiorDofMap[feSpace].insertRankDof(i, nLocalInterior); interiorDofMap[feSpace].insertRankDof(i, nLocalInterior);
...@@ -575,9 +581,9 @@ namespace AMDiS { ...@@ -575,9 +581,9 @@ namespace AMDiS {
nLocalInterior++; nLocalInterior++;
} else { } else {
if (meshDistributor->getDofMapSd()[feSpace].isRankDof(i)) if (meshDistributor->getDofMapSd()[feSpace].isRankDof(i))
localDofMap[feSpace].insertRankDof(i); localDofMap[component].insertRankDof(i);
else else
localDofMap[feSpace].insertNonRankDof(i); localDofMap[component].insertNonRankDof(i);
TEST_EXIT_DBG(fetiPreconditioner == FETI_NONE) TEST_EXIT_DBG(fetiPreconditioner == FETI_NONE)
("Not yet implemnted!\n"); ("Not yet implemnted!\n");
...@@ -589,12 +595,12 @@ namespace AMDiS { ...@@ -589,12 +595,12 @@ namespace AMDiS {
for (DofMap::iterator it = dualDofMap[feSpace].getMap().begin(); for (DofMap::iterator it = dualDofMap[feSpace].getMap().begin();
it != dualDofMap[feSpace].getMap().end(); ++it) { it != dualDofMap[feSpace].getMap().end(); ++it) {
if (meshLevel == 0) { if (meshLevel == 0) {
localDofMap[feSpace].insertRankDof(it->first); localDofMap[component].insertRankDof(it->first);
} else { } else {
if (meshDistributor->getDofMapSd()[feSpace].isRankDof(it->first)) if (meshDistributor->getDofMapSd()[feSpace].isRankDof(it->first))
localDofMap[feSpace].insertRankDof(it->first); localDofMap[component].insertRankDof(it->first);
else else
localDofMap[feSpace].insertNonRankDof(it->first); localDofMap[component].insertNonRankDof(it->first);
} }
} }
} }
...@@ -785,19 +791,19 @@ namespace AMDiS { ...@@ -785,19 +791,19 @@ namespace AMDiS {
int rowCounter = rStartEdges; int rowCounter = rStartEdges;
for (std::set<BoundaryObject>::iterator edgeIt = allEdges.begin(); for (std::set<BoundaryObject>::iterator edgeIt = allEdges.begin();
edgeIt != allEdges.end(); ++edgeIt) { edgeIt != allEdges.end(); ++edgeIt) {
for (int i = 0; i < feSpaces.size(); i++) { for (int component = 0; component < feSpaces.size(); component++) {
DofContainer edgeDofs; DofContainer edgeDofs;
edgeIt->el->getAllDofs(feSpaces[i], *edgeIt, edgeDofs); edgeIt->el->getAllDofs(feSpaces[component], *edgeIt, edgeDofs);
for (DofContainer::iterator it = edgeDofs.begin(); for (DofContainer::iterator it = edgeDofs.begin();
it != edgeDofs.end(); ++it) { it != edgeDofs.end(); ++it) {
TEST_EXIT_DBG(isPrimal(feSpaces[i], **it) == false) TEST_EXIT_DBG(isPrimal(component, **it) == false)
("Should not be primal!\n"); ("Should not be primal!\n");