Skip to content
Snippets Groups Projects
Commit 3a085360 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

PETSc : remove function imcompatible with recent PETSc and add the

destructor of the block solver
parent 33179040
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,18 @@ void linearSystemPETScBlockDouble::_kspCreate()
_kspAllocated = true;
}
linearSystemPETScBlockDouble::~linearSystemPETScBlockDouble()
{
if (_isAllocated) {
MatDestroy(&_a);
VecDestroy(&_b);
VecDestroy(&_x);
}
if (_kspAllocated) {
KSPDestroy(&_ksp);
}
}
void linearSystemPETScBlockDouble::addToMatrix(int row, int col,
const fullMatrix<double> &val)
{
......
......@@ -84,7 +84,7 @@ class linearSystemPETSc : public linearSystem<scalar> {
virtual void zeroSolution();
virtual int systemSolve();
Mat &getMatrix(){ return _a; }
std::vector<scalar> getData();
//std::vector<scalar> getData();
std::vector<int> getRowPointers();
std::vector<int> getColumnsIndices();
#ifndef SWIG
......@@ -122,6 +122,7 @@ class linearSystemPETScBlockDouble : public linearSystem<fullMatrix<double> > {
double normInfRightHandSide() const;
void insertInSparsityPattern (int i, int j);
linearSystemPETScBlockDouble(bool sequential = false);
~linearSystemPETScBlockDouble();
};
#else
......
......@@ -349,7 +349,7 @@ int linearSystemPETSc<scalar>::systemSolve()
return 1;
}
template <class scalar>
/*template <class scalar>
std::vector<scalar> linearSystemPETSc<scalar>::getData()
{
_try(MatAssemblyBegin(_a, MAT_FINAL_ASSEMBLY));
......@@ -369,15 +369,15 @@ std::vector<scalar> linearSystemPETSc<scalar>::getData()
#endif
_try(MatRestoreArray(_a,&v));
return data;
}
}*/
template <class scalar>
std::vector<int> linearSystemPETSc<scalar>::getRowPointers()
{
_try(MatAssemblyBegin(_a, MAT_FINAL_ASSEMBLY));
_try(MatAssemblyEnd(_a, MAT_FINAL_ASSEMBLY));
PetscInt *rows;
PetscInt *columns;
const PetscInt *rows;
const PetscInt *columns;
PetscInt n;
PetscTruth done;
_try(MatGetRowIJ(_a,0,PETSC_FALSE,PETSC_FALSE,&n,&rows,&columns,&done)); //case done == PETSC_FALSE should be handled
......@@ -393,8 +393,8 @@ std::vector<int> linearSystemPETSc<scalar>::getColumnsIndices()
{
_try(MatAssemblyBegin(_a, MAT_FINAL_ASSEMBLY));
_try(MatAssemblyEnd(_a, MAT_FINAL_ASSEMBLY));
PetscInt *rows;
PetscInt *columns;
const PetscInt *rows;
const PetscInt *columns;
PetscInt n;
PetscTruth done;
_try(MatGetRowIJ(_a,0,PETSC_FALSE,PETSC_FALSE,&n,&rows,&columns,&done)); //case done == PETSC_FALSE should be handled
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment