Commit ebc999c1 authored by Praetorius, Simon's avatar Praetorius, Simon

Merge branch 'dev' into 'master'

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

Closes #4

See merge request !22
parents 8435b852 225b2813
......@@ -408,6 +408,7 @@ namespace AMDiS { namespace Parallel {
MatNullSpace matNullspace;
Vec nullspaceBasis;
SystemVector *basisVec = NULL;
if (nullspace.size() > 0 ||
hasConstantNullspace ||
constNullspaceComponent.size() > 0) {
......@@ -415,7 +416,7 @@ namespace AMDiS { namespace Parallel {
if (constNullspaceComponent.size() > 0) {
nullspace.clear();
SystemVector *basisVec = new SystemVector(vec);
basisVec = new SystemVector(vec);
basisVec->set(0.0);
for (unsigned int i = 0; i < constNullspaceComponent.size(); i++)
basisVec->getDOFVector(constNullspaceComponent[i])->set(1.0);
......@@ -463,12 +464,14 @@ namespace AMDiS { namespace Parallel {
// PETSc.
solve(getVecRhsInterior(), getVecSolInterior());
// delete PETSc stuff
if (nullspace.size() > 0) {
MatNullSpaceDestroy(&matNullspace);
VecDestroy(&nullspaceBasis);
}
// delete allocated memory
delete basisVec;
// === Transfere values from PETSc's solution vectors to the DOF vectors. ===
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