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 {
new DirichletBC(type, b, componentSpaces[row], componentSpaces[col], false);
for (int i = 0; i < nComponents; i++)
if (systemMatrix && (*systemMatrix)[row][i])
if (systemMatrix && (*systemMatrix)[row][i]) {
if (i == col)
(*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletApply);
else
(*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletNotApply);
}
if (rhs)
rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(dirichletApply);
......@@ -1213,11 +1214,12 @@ namespace AMDiS {
DirichletBC *dirichletNotApply = new DirichletBC(type, vec, false);
for (int i = 0; i < nComponents; i++)
if (systemMatrix && (*systemMatrix)[row][i])
if (systemMatrix && (*systemMatrix)[row][i]) {
if (i == col)
(*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletApply);
else
(*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletNotApply);
}
if (rhs)
rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(dirichletApply);
......
......@@ -73,10 +73,13 @@ namespace AMDiS {
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
// periodic boundary conditions (if there are some).
// If the problem has been already read from a file, we need only to set
// isRankDofs to all matrices and rhs vector and to remove periodic
// boundary conditions (if there are some).
if (deserialized) {
setRankDofs();
removePeriodicBoundaryConditions();
return;
}
......@@ -177,20 +180,7 @@ namespace AMDiS {
/// === Set DOF rank information to all matrices and vectors. ===
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);
}
}
setRankDofs();
// === Remove periodic boundary conditions in sequential problem definition. ===
......@@ -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()
{
// Remove periodic boundaries in boundary manager on matrices and vectors.
......
......@@ -324,6 +324,9 @@ namespace AMDiS {
*/
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
/// vectors of all stationary problems and from the mesh itself.
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