Commit ce3ea440 authored by Thomas Witkowski's avatar Thomas Witkowski

Fixed bug in parallel code for coupled problems.

parent a551ea4a
...@@ -183,7 +183,9 @@ namespace AMDiS { ...@@ -183,7 +183,9 @@ namespace AMDiS {
{ {
FUNCNAME("DOFMatrix::addElementMatrix()"); FUNCNAME("DOFMatrix::addElementMatrix()");
TEST_EXIT_DBG(inserter)("DOFMatrix is not in insertion mode"); TEST_EXIT_DBG(inserter)("DOFMatrix is not in insertion mode\n");
TEST_EXIT_DBG(rowFeSpace)("Have now rowFeSpace!\n");
inserter_type &ins= *inserter; inserter_type &ins= *inserter;
// === Get indices mapping from local to global matrix indices. === // === Get indices mapping from local to global matrix indices. ===
......
...@@ -62,6 +62,7 @@ namespace AMDiS { ...@@ -62,6 +62,7 @@ namespace AMDiS {
MeshDistributor::MeshDistributor() MeshDistributor::MeshDistributor()
: probStat(0), : probStat(0),
initialized(false),
name("parallel"), name("parallel"),
feSpace(NULL), feSpace(NULL),
mesh(NULL), mesh(NULL),
...@@ -163,6 +164,8 @@ namespace AMDiS { ...@@ -163,6 +164,8 @@ namespace AMDiS {
#if (DEBUG != 0) #if (DEBUG != 0)
ParallelDebug::writeDebugFile(*this, debugOutputDir + "mpi-dbg", "dat"); ParallelDebug::writeDebugFile(*this, debugOutputDir + "mpi-dbg", "dat");
#endif #endif
initialized = true;
return; return;
} }
...@@ -320,6 +323,8 @@ namespace AMDiS { ...@@ -320,6 +323,8 @@ namespace AMDiS {
// === Remove periodic boundary conditions in sequential problem definition. === // === Remove periodic boundary conditions in sequential problem definition. ===
removePeriodicBoundaryConditions(); removePeriodicBoundaryConditions();
initialized = true;
} }
...@@ -412,6 +417,12 @@ namespace AMDiS { ...@@ -412,6 +417,12 @@ namespace AMDiS {
} }
probStat.push_back(probVec); probStat.push_back(probVec);
// If the mesh distributor is already initialized, don't forgett to set rank
// DOFs object to the matrices and vectors of the added stationary problem.
if (initialized)
setRankDofs(probVec);
} }
...@@ -623,22 +634,27 @@ namespace AMDiS { ...@@ -623,22 +634,27 @@ namespace AMDiS {
} }
void MeshDistributor::setRankDofs() void MeshDistributor::setRankDofs(ProblemVec *probVec)
{ {
for (unsigned int i = 0; i < probStat.size(); i++) { int nComponents = probVec->getNumComponents();
int nComponents = probStat[i]->getNumComponents(); for (int i = 0; i < nComponents; i++) {
for (int j = 0; j < nComponents; j++) { for (int j = 0; j < nComponents; j++)
for (int k = 0; k < nComponents; k++) if (probVec->getSystemMatrix(i, j))
if (probStat[i]->getSystemMatrix(j, k)) probVec->getSystemMatrix(i, j)->setRankDofs(isRankDof);
probStat[i]->getSystemMatrix(j, k)->setRankDofs(isRankDof);
TEST_EXIT_DBG(probVec->getRhs()->getDOFVector(i))("No RHS vector!\n");
TEST_EXIT_DBG(probVec->getSolution()->getDOFVector(i))("No solution vector!\n");
probVec->getRhs()->getDOFVector(i)->setRankDofs(isRankDof);
probVec->getSolution()->getDOFVector(i)->setRankDofs(isRankDof);
}
}
TEST_EXIT_DBG(probStat[i]->getRhs()->getDOFVector(j))("No RHS vector!\n");
TEST_EXIT_DBG(probStat[i]->getSolution()->getDOFVector(j))("No solution vector!\n"); void MeshDistributor::setRankDofs()
{
probStat[i]->getRhs()->getDOFVector(j)->setRankDofs(isRankDof); for (unsigned int i = 0; i < probStat.size(); i++)
probStat[i]->getSolution()->getDOFVector(j)->setRankDofs(isRankDof); setRankDofs(probStat[i]);
}
}
} }
......
...@@ -346,6 +346,10 @@ namespace AMDiS { ...@@ -346,6 +346,10 @@ namespace AMDiS {
*/ */
void repartitionMesh(); void repartitionMesh();
/// Sets \ref isRankDof to all matrices and rhs vectors in a given
/// stationary problem.
void setRankDofs(ProblemVec *probVec);
/// Sets \ref isRankDof to all matrices and rhs vectors in all stationary problems. /// Sets \ref isRankDof to all matrices and rhs vectors in all stationary problems.
void setRankDofs(); void setRankDofs();
...@@ -419,9 +423,12 @@ namespace AMDiS { ...@@ -419,9 +423,12 @@ namespace AMDiS {
} }
protected: protected:
/// /// List of all stationary problems that are managed by this mesh distributor.
vector<ProblemVec*> probStat; vector<ProblemVec*> probStat;
/// If true, the mesh distributor is already initialized;
bool initialized;
/// The rank of the current process. /// The rank of the current process.
int mpiRank; int mpiRank;
......
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