Commit 694a35a3 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Bugfix in petsc solver global matrix with periodic bc.

parent fe7df386
...@@ -238,10 +238,10 @@ namespace AMDiS { ...@@ -238,10 +238,10 @@ namespace AMDiS {
if (condition->applyBoundaryCondition()) { if (condition->applyBoundaryCondition()) {
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if (dofMap->isRankDof(rowIndices[i])) { if (dofMap->isRankDof(rowIndices[i])) {
applyDBCs.insert(row); applyDBCs.insert(row);
// dirichletDofs.push_back(row); // dirichletDofs.push_back(row);
} }
#else #else
applyDBCs.insert(row); applyDBCs.insert(row);
#endif #endif
......
...@@ -76,9 +76,9 @@ namespace AMDiS { ...@@ -76,9 +76,9 @@ namespace AMDiS {
if (dofVec) if (dofVec)
value = (*dofVec)[dofIndices[i]]; value = (*dofVec)[dofIndices[i]];
// #ifdef HAVE_PARALLEL_DOMAIN_AMDIS //#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
// vector->setDirichletDofValue(dofIndices[i], value); // vector->setDirichletDofValue(dofIndices[i], value);
// #else //#else
(*vector)[dofIndices[i]] = value; (*vector)[dofIndices[i]] = value;
//#endif //#endif
} }
......
...@@ -92,7 +92,7 @@ namespace AMDiS { ...@@ -92,7 +92,7 @@ namespace AMDiS {
for (int i = 0; i < mesh->getGeo(EDGE); i++) for (int i = 0; i < mesh->getGeo(EDGE); i++)
dof[mesh->getNode(EDGE) + i] = mesh->getDof(EDGE); dof[mesh->getNode(EDGE) + i] = mesh->getDof(EDGE);
if (mesh->getNumberOfDofs(FACE)) if (mesh->getDim() == 3 && mesh->getNumberOfDofs(FACE))
for (int i = 0; i < mesh->getGeo(FACE); i++) for (int i = 0; i < mesh->getGeo(FACE); i++)
dof[mesh->getNode(FACE) + i] = mesh->getDof(FACE); dof[mesh->getNode(FACE) + i] = mesh->getDof(FACE);
......
...@@ -160,6 +160,7 @@ namespace AMDiS { ...@@ -160,6 +160,7 @@ namespace AMDiS {
/// Returns nDof[i] of the mesh /// Returns nDof[i] of the mesh
inline const int getNumberOfDofs(int i) const inline const int getNumberOfDofs(int i) const
{ {
TEST_EXIT_DBG(i <= dim)("Wrong index: %d %d\n", i, dim);
return nDof[i]; return nDof[i];
} }
...@@ -181,12 +182,10 @@ namespace AMDiS { ...@@ -181,12 +182,10 @@ namespace AMDiS {
return node[i]; return node[i];
} }
/** \brief /// Allocates the number of DOFs needed at position and registers the DOFs
* Allocates the number of DOFs needed at position and registers the DOFs /// at the DOFAdmins. The number of needed DOFs is the sum over the needed
* at the DOFAdmins. The number of needed DOFs is the sum over the needed /// DOFs of all DOFAdmin objects belonging to this mesh.
* DOFs of all DOFAdmin objects belonging to this mesh. /// The return value is a pointer to the first allocated DOF.
* The return value is a pointer to the first allocated DOF.
*/
DegreeOfFreedom *getDof(GeoIndex position); DegreeOfFreedom *getDof(GeoIndex position);
/// Returns *(\ref admin[i]) of the mesh /// Returns *(\ref admin[i]) of the mesh
...@@ -195,26 +194,20 @@ namespace AMDiS { ...@@ -195,26 +194,20 @@ namespace AMDiS {
return *(admin[i]); return *(admin[i]);
} }
/** \brief /// Creates a DOFAdmin with name lname. nDof specifies how many DOFs
* Creates a DOFAdmin with name lname. nDof specifies how many DOFs /// are needed at the different positions (see \ref DOFAdmin::nrDOF).
* are needed at the different positions (see \ref DOFAdmin::nrDOF). /// A pointer to the created DOFAdmin is returned.
* A pointer to the created DOFAdmin is returned.
*/
const DOFAdmin* createDOFAdmin(string lname, DimVec<int> nDof); const DOFAdmin* createDOFAdmin(string lname, DimVec<int> nDof);
/** \brief /// Returns the size of \ref admin which is the number of the DOFAdmins
* Returns the size of \ref admin which is the number of the DOFAdmins /// belonging to this mesh
* belonging to this mesh
*/
const int getNumberOfDOFAdmin() const const int getNumberOfDOFAdmin() const
{ {
return admin.size(); return admin.size();
} }
/** \brief /// Returns the size of \ref macroElements which is the number of
* Returns the size of \ref macroElements which is the number of /// of macro elements of this mesh
* of macro elements of this mesh
*/
const int getNumberOfMacros() const const int getNumberOfMacros() const
{ {
return macroElements.size(); return macroElements.size();
......
...@@ -340,7 +340,6 @@ namespace AMDiS { ...@@ -340,7 +340,6 @@ namespace AMDiS {
// DOFs in the first FE spaces is the smalled global index of a DOF that is // DOFs in the first FE spaces is the smalled global index of a DOF that is
// owned by the rank. // owned by the rank.
int offset = rStartDofs; int offset = rStartDofs;
// === Create the matrix indices for all component FE spaces. === // === Create the matrix indices for all component FE spaces. ===
...@@ -358,7 +357,7 @@ namespace AMDiS { ...@@ -358,7 +357,7 @@ namespace AMDiS {
dofToMatIndex.add(i, it->first, globalMatIndex); dofToMatIndex.add(i, it->first, globalMatIndex);
} }
} }
// Increase the offset for the next FE space by the number of DOFs owned // Increase the offset for the next FE space by the number of DOFs owned
// by the rank in the current FE space. // by the rank in the current FE space.
offset += data[feSpaces[i]].nRankDofs; offset += data[feSpaces[i]].nRankDofs;
...@@ -399,7 +398,7 @@ namespace AMDiS { ...@@ -399,7 +398,7 @@ namespace AMDiS {
stdMpi.recv(rank); stdMpi.recv(rank);
} }
stdMpi.startCommunication(); stdMpi.startCommunication();
for (DofComm::Iterator it(dofComm->getRecvDofs(), 0, feSpaces[i]); for (DofComm::Iterator it(dofComm->getRecvDofs(), 0, feSpaces[i]);
...@@ -461,9 +460,13 @@ namespace AMDiS { ...@@ -461,9 +460,13 @@ namespace AMDiS {
for (; !it.endDofIter(); it.nextDof()) for (; !it.endDofIter(); it.nextDof())
if (dofMap.count(it.getDofIndex())) { if (dofMap.count(it.getDofIndex())) {
if (globalIndex) { if (globalIndex) {
TEST_EXIT_DBG(counter + 2 <= stdMpi.getRecvData(it.getRank()).size())
("Should not happen!\n");
dofToMatIndex.add(i, dofToMatIndex.add(i,
stdMpi.getRecvData(it.getRank())[counter++], stdMpi.getRecvData(it.getRank())[counter],
stdMpi.getRecvData(it.getRank())[counter++]); stdMpi.getRecvData(it.getRank())[counter + 1]);
counter += 2;
} else { } else {
dofToMatIndex.add(i, it.getDofIndex(), dofToMatIndex.add(i, it.getDofIndex(),
stdMpi.getRecvData(it.getRank())[counter++]); stdMpi.getRecvData(it.getRank())[counter++]);
......
...@@ -989,12 +989,13 @@ namespace AMDiS { ...@@ -989,12 +989,13 @@ namespace AMDiS {
int localPetscRowIdx = petscRowIdx - rankStartIndex; int localPetscRowIdx = petscRowIdx - rankStartIndex;
TEST_EXIT_DBG(localPetscRowIdx >= 0 && localPetscRowIdx < nRankRows) TEST_EXIT_DBG(localPetscRowIdx >= 0 && localPetscRowIdx < nRankRows)
("Should not happen! \n Debug info: localRowIdx = %d globalRowIndx = %d petscRowIdx = %d localPetscRowIdx = %d rStart = %d nCompontens = %d nRankRows = %d\n", ("Should not happen! \n Debug info: DOF = %d globalRowIndx = %d petscRowIdx = %d localPetscRowIdx = %d rStart = %d compontens = %d from %d nRankRows = %d\n",
*cursor, *cursor,
(*interiorMap)[feSpaces[i]][*cursor].global, (*interiorMap)[feSpaces[i]][*cursor].global,
petscRowIdx, petscRowIdx,
localPetscRowIdx, localPetscRowIdx,
rankStartIndex, rankStartIndex,
i,
nComponents, nComponents,
nRankRows); nRankRows);
......
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