diff --git a/AMDiS/src/ProblemVec.cc b/AMDiS/src/ProblemVec.cc index 2e545e6cf73ef15ef81976bf49bec65e3a804dc8..16f9d83f52ad5539044c2f552b9557b825989fd4 100644 --- a/AMDiS/src/ProblemVec.cc +++ b/AMDiS/src/ProblemVec.cc @@ -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); + (*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); + (*systemMatrix)[row][i]->getBoundaryManager()->addBoundaryCondition(dirichletNotApply); + } if (rhs) rhs->getDOFVector(row)->getBoundaryManager()->addBoundaryCondition(dirichletApply); diff --git a/AMDiS/src/parallel/MeshDistributor.cc b/AMDiS/src/parallel/MeshDistributor.cc index cb41007680083da5730e29a2b9cafd2db058ac55..40c26d09a6951b6cdfa4cec94d03ee232229a87c 100644 --- a/AMDiS/src/parallel/MeshDistributor.cc +++ b/AMDiS/src/parallel/MeshDistributor.cc @@ -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. diff --git a/AMDiS/src/parallel/MeshDistributor.h b/AMDiS/src/parallel/MeshDistributor.h index e171f73fe1a941cf724eb4c57cba779a6ee350e3..67a355210ad98f557465e57c7a2d56e8e1f8aac5 100644 --- a/AMDiS/src/parallel/MeshDistributor.h +++ b/AMDiS/src/parallel/MeshDistributor.h @@ -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();