From 16e2f085d78bd1e73ec497f693c20d564947d000 Mon Sep 17 00:00:00 2001 From: Siqi Ling <lsq0473@gmail.com> Date: Fri, 11 Sep 2015 11:24:05 +0000 Subject: [PATCH] fix bug in 3d domain boundary (face dofs) --- AMDiS/src/DOFMatrix.cc | 7 +++++-- AMDiS/src/ProblemStat.cc | 10 ++++++---- AMDiS/src/Tetrahedron.cc | 6 ++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/AMDiS/src/DOFMatrix.cc b/AMDiS/src/DOFMatrix.cc index 64d4b384..eeaad942 100644 --- a/AMDiS/src/DOFMatrix.cc +++ b/AMDiS/src/DOFMatrix.cc @@ -254,17 +254,20 @@ namespace AMDiS { { set_to_zero(elementMatrix); + bool addMatrix = false; std::vector<Operator*>::iterator it = operators.begin(); std::vector<double*>::iterator factorIt = operatorFactor.begin(); for (; it != operators.end(); ++it, ++factorIt) if ((*it)->getNeedDualTraverse() == false && - (*factorIt == NULL || **factorIt != 0.0)) + (*factorIt == NULL || **factorIt != 0.0)) { (*it)->getElementMatrix(elInfo, elementMatrix, *factorIt ? **factorIt : 1.0); + addMatrix = true; + } if (factor != 1.0) elementMatrix *= factor; - if (operators.size()) + if (operators.size() && addMatrix) addElementMatrix(elementMatrix, bound, elInfo, NULL); } diff --git a/AMDiS/src/ProblemStat.cc b/AMDiS/src/ProblemStat.cc index bbb0540d..741025d4 100644 --- a/AMDiS/src/ProblemStat.cc +++ b/AMDiS/src/ProblemStat.cc @@ -1194,8 +1194,9 @@ namespace AMDiS { matrix->assemble2(1.0, mainElInfo, auxElInfo, dualElInfo.smallElInfo, dualElInfo.largeElInfo, bound); - if (matrix && matrix->getBoundaryManager()) - matrix->getBoundaryManager()->fillBoundaryConditions(mainElInfo, matrix); + if (componentMeshes[i] == meshes[0] && newEl0 || componentMeshes[i] == meshes[1] && newEl1) + if (matrix && matrix->getBoundaryManager()) + matrix->getBoundaryManager()->fillBoundaryConditions(mainElInfo, matrix); } else { @@ -1219,8 +1220,9 @@ namespace AMDiS { matrix->assemble(1.0, rowElInfo, colElInfo, dualElInfo.smallElInfo, dualElInfo.largeElInfo, bound); - if (matrix->getBoundaryManager()) - matrix->getBoundaryManager()->fillBoundaryConditions(rowElInfo, matrix); + if (componentMeshes[i] == meshes[0] && newEl0 || componentMeshes[i] == meshes[1] && newEl1) + if (matrix->getBoundaryManager()) + matrix->getBoundaryManager()->fillBoundaryConditions(rowElInfo, matrix); } if (i == j) { diff --git a/AMDiS/src/Tetrahedron.cc b/AMDiS/src/Tetrahedron.cc index 25f0d711..4e89ba35 100644 --- a/AMDiS/src/Tetrahedron.cc +++ b/AMDiS/src/Tetrahedron.cc @@ -279,14 +279,16 @@ namespace AMDiS { child[1]->getNodeDofs(feSpace, nextBound1, dofs, baseDofPtr); if (addDof) - dofs.push_back(&(child[0]->getDof()[3][n0])); + if (std::find(dofs.begin(), dofs.end(), &(child[0]->getDof()[3][n0])) == dofs.end()) + dofs.push_back(&(child[0]->getDof()[3][n0])); child[0]->getNodeDofs(feSpace, nextBound0, dofs, baseDofPtr); } else { child[0]->getNodeDofs(feSpace, nextBound0, dofs, baseDofPtr); if (addDof) - dofs.push_back(&(child[0]->getDof()[3][n0])); + if (std::find(dofs.begin(), dofs.end(), &(child[0]->getDof()[3][n0])) == dofs.end()) + dofs.push_back(&(child[0]->getDof()[3][n0])); child[1]->getNodeDofs(feSpace, nextBound1, dofs, baseDofPtr); } -- GitLab