diff --git a/Solver/linearSystemPETSc.cpp b/Solver/linearSystemPETSc.cpp index b458d8b2ba30908f92358a245711347833d69fac..dfd60694135c0c2cbb20f9ca84a17eb14ac4862d 100644 --- a/Solver/linearSystemPETSc.cpp +++ b/Solver/linearSystemPETSc.cpp @@ -29,6 +29,7 @@ void linearSystemPETScBlockDouble::_kspCreate() linearSystemPETScBlockDouble::~linearSystemPETScBlockDouble() { +#if (PETSC_VERSION_RELEASE == 0 || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2))) if (_isAllocated) { MatDestroy(&_a); VecDestroy(&_b); @@ -37,6 +38,16 @@ linearSystemPETScBlockDouble::~linearSystemPETScBlockDouble() if (_kspAllocated) { KSPDestroy(&_ksp); } +#else + if (_isAllocated) { + MatDestroy(_a); + VecDestroy(_b); + VecDestroy(_x); + } + if (_kspAllocated) { + KSPDestroy(_ksp); + } +#endif } void linearSystemPETScBlockDouble::addToMatrix(int row, int col,