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 {
{
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;
// === Get indices mapping from local to global matrix indices. ===
......
......@@ -62,6 +62,7 @@ namespace AMDiS {
MeshDistributor::MeshDistributor()
: probStat(0),
initialized(false),
name("parallel"),
feSpace(NULL),
mesh(NULL),
......@@ -163,6 +164,8 @@ namespace AMDiS {
#if (DEBUG != 0)
ParallelDebug::writeDebugFile(*this, debugOutputDir + "mpi-dbg", "dat");
#endif
initialized = true;
return;
}
......@@ -320,6 +323,8 @@ namespace AMDiS {
// === Remove periodic boundary conditions in sequential problem definition. ===
removePeriodicBoundaryConditions();
initialized = true;
}
......@@ -412,6 +417,12 @@ namespace AMDiS {
}
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 {
}
void MeshDistributor::setRankDofs()
void MeshDistributor::setRankDofs(ProblemVec *probVec)
{
for (unsigned int i = 0; i < probStat.size(); i++) {
int nComponents = probStat[i]->getNumComponents();
for (int j = 0; j < nComponents; j++) {
for (int k = 0; k < nComponents; k++)
if (probStat[i]->getSystemMatrix(j, k))
probStat[i]->getSystemMatrix(j, k)->setRankDofs(isRankDof);
int nComponents = probVec->getNumComponents();
for (int i = 0; i < nComponents; i++) {
for (int j = 0; j < nComponents; j++)
if (probVec->getSystemMatrix(i, j))
probVec->getSystemMatrix(i, j)->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");
probStat[i]->getRhs()->getDOFVector(j)->setRankDofs(isRankDof);
probStat[i]->getSolution()->getDOFVector(j)->setRankDofs(isRankDof);
}
}
void MeshDistributor::setRankDofs()
{
for (unsigned int i = 0; i < probStat.size(); i++)
setRankDofs(probStat[i]);
}
......
......@@ -346,6 +346,10 @@ namespace AMDiS {
*/
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.
void setRankDofs();
......@@ -419,9 +423,12 @@ namespace AMDiS {
}
protected:
///
/// List of all stationary problems that are managed by this mesh distributor.
vector<ProblemVec*> probStat;
/// If true, the mesh distributor is already initialized;
bool initialized;
/// The rank of the current process.
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