Advanced Multi-Physics (AMP)
On-Line Documentation
PetscMatrix.h
Go to the documentation of this file.
1#ifndef included_AMP_PetscMatrix
2#define included_AMP_PetscMatrix
3
4#include "AMP/matrices/Matrix.h"
5#include "AMP/vectors/petsc/PetscHelpers.h"
6
7#include "petscmat.h"
8
9
10namespace AMP::LinearAlgebra {
11
12
26class PetscMatrix final
27{
28public:
32 virtual ~PetscMatrix();
33
41 inline Mat &getMat() { return d_Mat; }
42
50 inline const Mat &getMat() const { return d_Mat; }
51
58 static std::shared_ptr<PetscMatrix> view( std::shared_ptr<Matrix> AmpMatrix );
59
66 static std::shared_ptr<const PetscMatrix> constView( std::shared_ptr<const Matrix> AmpMatrix );
67
68
69public:
70 inline Mat &getNativeMat() { return d_Mat; }
71 inline const Mat &getNativeMat() const { return d_Mat; }
72 inline std::shared_ptr<Matrix> getManagedMat() { return d_matrix; }
73 inline std::shared_ptr<const Matrix> getManagedMat() const { return d_matrix; }
74
75
76protected:
79
81 explicit PetscMatrix( std::shared_ptr<Matrix> mat );
82
83protected:
85 std::shared_ptr<Matrix> d_matrix;
86};
87
88
89} // namespace AMP::LinearAlgebra
90
91#endif
struct _p_Mat * Mat
PetscMatrix is a bridge between AMP::LinearAlgebra::Matrix and the PETSc Vec data structure.
Definition PetscMatrix.h:27
std::shared_ptr< Matrix > getManagedMat()
Definition PetscMatrix.h:72
static std::shared_ptr< const PetscMatrix > constView(std::shared_ptr< const Matrix > AmpMatrix)
If needed, create a PETSc wrapper for AmpMatrix. Otherwise, return AmpMatrix.
const Mat & getNativeMat() const
Definition PetscMatrix.h:71
std::shared_ptr< Matrix > d_matrix
Definition PetscMatrix.h:85
PetscMatrix()
Empty constructor.
PetscMatrix(std::shared_ptr< Matrix > mat)
Default constructor.
const Mat & getMat() const
Obtain PETSc Mat for use in PETSc routines.
Definition PetscMatrix.h:50
static std::shared_ptr< PetscMatrix > view(std::shared_ptr< Matrix > AmpMatrix)
If needed, create a PETSc wrapper for AmpMatrix. Otherwise, return AmpMatrix.
std::shared_ptr< const Matrix > getManagedMat() const
Definition PetscMatrix.h:73
virtual ~PetscMatrix()
Destructor.
Mat & getMat()
Obtain PETSc Mat for use in PETSc routines.
Definition PetscMatrix.h:41



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:40.
Comments on this page