Liebe Gitlab-Nutzer, lieber Gitlab-Nutzer, es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Ein Anmelden über dieses erzeugt ein neues Konto. Das alte Konto ist ü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. Logging in via this will create a new account. The old account can be accessed via the "Standard" tab. The administrators

Commit 530df21a authored by Reuther, Sebastian's avatar Reuther, Sebastian
Browse files

fixed memory leak problem in PetscSolverGlobalMatrix::solvePetscMatrix() if...

fixed memory leak problem in PetscSolverGlobalMatrix::solvePetscMatrix() if initfile option to remove contant nullspace is used
parent e3884e2e
...@@ -408,6 +408,7 @@ namespace AMDiS { namespace Parallel { ...@@ -408,6 +408,7 @@ namespace AMDiS { namespace Parallel {
MatNullSpace matNullspace; MatNullSpace matNullspace;
Vec nullspaceBasis; Vec nullspaceBasis;
SystemVector *basisVec;
if (nullspace.size() > 0 || if (nullspace.size() > 0 ||
hasConstantNullspace || hasConstantNullspace ||
constNullspaceComponent.size() > 0) { constNullspaceComponent.size() > 0) {
...@@ -415,7 +416,7 @@ namespace AMDiS { namespace Parallel { ...@@ -415,7 +416,7 @@ namespace AMDiS { namespace Parallel {
if (constNullspaceComponent.size() > 0) { if (constNullspaceComponent.size() > 0) {
nullspace.clear(); nullspace.clear();
SystemVector *basisVec = new SystemVector(vec); basisVec = new SystemVector(vec);
basisVec->set(0.0); basisVec->set(0.0);
for (unsigned int i = 0; i < constNullspaceComponent.size(); i++) for (unsigned int i = 0; i < constNullspaceComponent.size(); i++)
basisVec->getDOFVector(constNullspaceComponent[i])->set(1.0); basisVec->getDOFVector(constNullspaceComponent[i])->set(1.0);
...@@ -463,12 +464,16 @@ namespace AMDiS { namespace Parallel { ...@@ -463,12 +464,16 @@ namespace AMDiS { namespace Parallel {
// PETSc. // PETSc.
solve(getVecRhsInterior(), getVecSolInterior()); solve(getVecRhsInterior(), getVecSolInterior());
// delete PETSc stuff
if (nullspace.size() > 0) { if (nullspace.size() > 0) {
MatNullSpaceDestroy(&matNullspace); MatNullSpaceDestroy(&matNullspace);
VecDestroy(&nullspaceBasis); VecDestroy(&nullspaceBasis);
} }
// delete allocated memory
if ((nullspace.size() > 0 || hasConstantNullspace) && constNullspaceComponent.size() > 0) {
delete basisVec;
}
// === Transfere values from PETSc's solution vectors to the DOF vectors. === // === Transfere values from PETSc's solution vectors to the DOF vectors. ===
PetscScalar *vecPointer; PetscScalar *vecPointer;
......
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