Liebe Gitlab-Nutzer, lieber Gitlab-Nutzer,
es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Die Konten der externen Nutzer:innen sind über den Reiter "Standard" erreichbar.
Die Administratoren

Dear Gitlab user,
it is now possible to log in to our service using the ZIH login/LDAP. The accounts of external users can be accessed via the "Standard" tab.
The administrators

Commit aa82de2b authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Fixed problem for Dirichlet boundary conditions on non diagonal blocks in parallel.

parent 99bb590e
......@@ -108,10 +108,8 @@ namespace AMDiS {
/// DOFVector containing the boundary values
DOFVectorBase<double> *dofVec;
/** \brief
* Defines, if the boundary condition must be applied to the matrix. See
* comment of \ref BoundaryCondition::applyBoundaryCondition.
/// Defines, if the boundary condition must be applied to the matrix. See
/// comment of \ref BoundaryCondition::applyBoundaryCondition.
bool applyBC;
......@@ -476,33 +476,65 @@ namespace AMDiS {
int nComponents = seqMat->getSize();
vector<PetscInt> zeroRows;
vector<int> dirichletRows;
vector<int> dirichletCols;
vector<double> dirichletValues;
for (int i = 0; i < nComponents; i++) {
DOFMatrix *dofMat = (*seqMat)[i][i];
if (!dofMat)
bool dirichletRow = false;
int dirichletMainCol = -1;
for (int j = 0; j < nComponents; j++) {
DOFMatrix *dofMat = (*seqMat)[i][j];
if (!dofMat)
BoundaryIndexMap& bounds =
for (BoundaryIndexMap::iterator bIt = bounds.begin(); bIt != bounds.end(); ++bIt) {
if (bIt->second && bIt->second->isDirichlet()) {
dirichletRow = true;
if ((dynamic_cast<DirichletBC*>(bIt->second))->applyBoundaryCondition()) {
TEST_EXIT_DBG(dirichletMainCol == -1)("Should not happen!\n");
dirichletMainCol = j;
if (!dirichletRow)
DOFMatrix *dofMat = (*seqMat)[i][dirichletMainCol];
const FiniteElemSpace *feSpace = dofMat->getRowFeSpace();
TEST_EXIT(dofMat->getRowFeSpace() == dofMat->getColFeSpace())
("I have to think about this scenario! Really possible?\n");
std::set<DegreeOfFreedom> &dRows = dofMat->getDirichletRows();
for (std::set<DegreeOfFreedom>::iterator dofIt = dRows.begin();
dofIt != dRows.end(); ++dofIt) {
MultiIndex multiIndex;
if (dofMap[feSpace].find(*dofIt, multiIndex) &&
dofMap[feSpace].isRankDof(*dofIt)) {
int rowIndex = dofMap.getMatIndex(i,;
int colIndex = dofMap.getMatIndex(dirichletMainCol,;
MatZeroRows(mpiMat, zeroRows.size(), &(zeroRows[0]), 1.0,
MatZeroRows(mpiMat, dirichletRows.size(), &(dirichletRows[0]), 1.0,
PetscViewer view;
PetscViewerBinaryOpen(PETSC_COMM_WORLD, "interior.mat",
MatView(mpiMat, view);
for (int i = 0; i < static_cast<int>(dirichletRows.size()); i++) {
MatSetValue(mpiMat, dirichletRows[i], dirichletCols[i], dirichletValues[i], INSERT_VALUES);
MatAssemblyBegin(mpiMat, MAT_FINAL_ASSEMBLY);
MatAssemblyEnd(mpiMat, MAT_FINAL_ASSEMBLY);
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