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

linearSystemPETSc::printMatlab

parent 8525868c
No related branches found
No related tags found
No related merge requests found
...@@ -341,4 +341,20 @@ double linearSystemPETScBlockDouble::normInfRightHandSide() const ...@@ -341,4 +341,20 @@ double linearSystemPETScBlockDouble::normInfRightHandSide() const
return nor; return nor;
} }
void linearSystemPETScBlockDouble::printMatlab(const char *filename) const
{
_try(MatAssemblyBegin(_a, MAT_FINAL_ASSEMBLY));
_try(MatAssemblyEnd(_a, MAT_FINAL_ASSEMBLY));
_try(VecAssemblyBegin(_b));
_try(VecAssemblyEnd(_b));
PetscViewer viewer;
PetscViewerASCIIOpen(PETSC_COMM_WORLD, filename, &viewer);
PetscViewerSetFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);
printf("export mat to %s\n", filename);
MatView(_a, viewer);
PetscViewerDestroy(&viewer);
return;
}
#endif // HAVE_PETSC #endif // HAVE_PETSC
...@@ -105,6 +105,7 @@ class linearSystemPETScBlockDouble : public linearSystem<fullMatrix<double> > { ...@@ -105,6 +105,7 @@ class linearSystemPETScBlockDouble : public linearSystem<fullMatrix<double> > {
public: public:
void _kspCreate(); void _kspCreate();
void print(); void print();
void printMatlab(const char *filename) const;
virtual void addToMatrix(int row, int col, const fullMatrix<double> &val); virtual void addToMatrix(int row, int col, const fullMatrix<double> &val);
virtual void addToRightHandSide(int row, const fullMatrix<double> &val); virtual void addToRightHandSide(int row, const fullMatrix<double> &val);
virtual void addToSolution(int row, const fullMatrix<double> &val); virtual void addToSolution(int row, const fullMatrix<double> &val);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment