Advanced Multi-Physics (AMP)
On-Line Documentation
PetscVector.h
Go to the documentation of this file.
1#ifndef included_AMP_PetscVector
2#define included_AMP_PetscVector
3
4#include "AMP/vectors/Vector.h"
5#include "AMP/vectors/petsc/PetscHelpers.h"
6
7#include "petscvec.h"
8
9
10namespace AMP::LinearAlgebra {
11
12
26class PetscVector final
27{
28public:
32 virtual ~PetscVector();
33
56 inline Vec &getVec() { return d_Vec; }
57
80 inline const Vec &getVec() const { return d_Vec; }
81
88 static std::shared_ptr<PetscVector> view( Vector::shared_ptr AmpVector );
89
96 static std::shared_ptr<const PetscVector> constView( Vector::const_shared_ptr AmpVector );
97
98
99public:
100 inline Vec &getNativeVec() { return d_Vec; }
101 inline const Vec &getNativeVec() const { return d_Vec; }
102 inline std::shared_ptr<Vector> getManagedVec() { return d_vector; }
103 inline std::shared_ptr<const Vector> getManagedVec() const { return d_vector; }
104
105
106protected:
109
111 explicit PetscVector( std::shared_ptr<Vector> vec );
112
113protected:
115 std::shared_ptr<Vector> d_vector;
116};
117
118
119} // namespace AMP::LinearAlgebra
120
121#endif
PetscVector is a bridge between AMP::LinearAlgebra::Vector and the PETSc Vec data structure.
Definition PetscVector.h:27
const Vec & getNativeVec() const
PetscVector()
Empty constructor.
const Vec & getVec() const
Obtain PETSc Vec for use in PETSc routines.
Definition PetscVector.h:80
static std::shared_ptr< PetscVector > view(Vector::shared_ptr AmpVector)
If needed, create a PETSc wrapper for AmpVector. Otherwise, return AmpVector.
std::shared_ptr< const Vector > getManagedVec() const
std::shared_ptr< Vector > getManagedVec()
static std::shared_ptr< const PetscVector > constView(Vector::const_shared_ptr AmpVector)
If needed, create a PETSc wrapper for AmpVector. Otherwise, return AmpVector.
Vec & getVec()
Obtain PETSc Vec for use in PETSc routines.
Definition PetscVector.h:56
std::shared_ptr< Vector > d_vector
PetscVector(std::shared_ptr< Vector > vec)
Default constructor.
virtual ~PetscVector()
Destructor.
std::shared_ptr< Vector > shared_ptr
Shorthand for shared pointer to Vector.
Definition Vector.h:60
std::shared_ptr< const Vector > const_shared_ptr
Definition Vector.h:65
PETSc vector.



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:41.
Comments on this page