From bb4cedea433bc49a9aef44521091ca36d14cb562 Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Sun, 18 Jul 2010 15:50:47 +0000 Subject: [PATCH] And fixed second bug provided by Sebastian (dirichlet bc in parallel code). --- AMDiS/src/ProblemVec.cc | 10 ++++--- AMDiS/src/parallel/MeshDistributor.cc | 41 ++++++++++++++++----------- AMDiS/src/parallel/MeshDistributor.h | 3 ++ 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/AMDiS/src/ProblemVec.cc b/AMDiS/src/ProblemVec.cc index 2e545e6c..16f9d83f 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 cb410076..40c26d09 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 e171f73f..67a35521 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(); -- GitLab