Commit bb4cedea authored by Thomas Witkowski's avatar Thomas Witkowski

And fixed second bug provided by Sebastian (dirichlet bc in parallel code).

parent e82f87e3
...@@ -1186,11 +1186,12 @@ namespace AMDiS { ...@@ -1186,11 +1186,12 @@ namespace AMDiS {
new DirichletBC(type, b, componentSpaces[row], componentSpaces[col], false); new DirichletBC(type, b, componentSpaces[row], componentSpaces[col], false);
for (int i = 0; i < nComponents; i++) for (int i = 0; i < nComponents; i++)
if (systemMatrix && (*systemMatrix)[row][i]) if (systemMatrix && (*systemMatrix)[row][i]) {
if (i == col) if (i == col)
(*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletApply); (*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletApply);
else else
(*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletNotApply); (*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletNotApply);
}
if (rhs) if (rhs)
rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(dirichletApply); rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(dirichletApply);
...@@ -1213,11 +1214,12 @@ namespace AMDiS { ...@@ -1213,11 +1214,12 @@ namespace AMDiS {
DirichletBC *dirichletNotApply = new DirichletBC(type, vec, false); DirichletBC *dirichletNotApply = new DirichletBC(type, vec, false);
for (int i = 0; i < nComponents; i++) for (int i = 0; i < nComponents; i++)
if (systemMatrix && (*systemMatrix)[row][i]) if (systemMatrix && (*systemMatrix)[row][i]) {
if (i == col) if (i == col)
(*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletApply); (*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletApply);
else else
(*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletNotApply); (*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletNotApply);
}
if (rhs) if (rhs)
rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(dirichletApply); rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(dirichletApply);
......
...@@ -73,10 +73,13 @@ namespace AMDiS { ...@@ -73,10 +73,13 @@ namespace AMDiS {
TEST_EXIT(mesh)("No mesh has been defined for mesh distribution!\n"); TEST_EXIT(mesh)("No mesh has been defined for mesh distribution!\n");
// If the problem has been already read from a file, we need only to remove // If the problem has been already read from a file, we need only to set
// periodic boundary conditions (if there are some). // isRankDofs to all matrices and rhs vector and to remove periodic
// boundary conditions (if there are some).
if (deserialized) { if (deserialized) {
setRankDofs();
removePeriodicBoundaryConditions(); removePeriodicBoundaryConditions();
return; return;
} }
...@@ -177,20 +180,7 @@ namespace AMDiS { ...@@ -177,20 +180,7 @@ namespace AMDiS {
/// === Set DOF rank information to all matrices and vectors. === /// === Set DOF rank information to all matrices and vectors. ===
for (unsigned int i = 0; i < probStat.size(); i++) { setRankDofs();
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);
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);
}
}
// === Remove periodic boundary conditions in sequential problem definition. === // === Remove periodic boundary conditions in sequential problem definition. ===
...@@ -413,6 +403,25 @@ namespace AMDiS { ...@@ -413,6 +403,25 @@ namespace AMDiS {
} }
void MeshDistributor::setRankDofs()
{
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);
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::removePeriodicBoundaryConditions() void MeshDistributor::removePeriodicBoundaryConditions()
{ {
// Remove periodic boundaries in boundary manager on matrices and vectors. // Remove periodic boundaries in boundary manager on matrices and vectors.
......
...@@ -324,6 +324,9 @@ namespace AMDiS { ...@@ -324,6 +324,9 @@ namespace AMDiS {
*/ */
void writePartitioningMesh(std::string filename); void writePartitioningMesh(std::string filename);
/// Sets \ref isRankDof to all matrices and rhs vectors in all stationary problems.
void setRankDofs();
/// Removes all periodic boundary condition information from all matrices and /// Removes all periodic boundary condition information from all matrices and
/// vectors of all stationary problems and from the mesh itself. /// vectors of all stationary problems and from the mesh itself.
void removePeriodicBoundaryConditions(); void removePeriodicBoundaryConditions();
......
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