Advanced Multi-Physics (AMP)
On-Line Documentation
PetscHelpers.h
Go to the documentation of this file.
1// This file contains so definitions and wrapper functions for PETSc
2#ifndef PETSC_HELPERS
3#define PETSC_HELPERS
4
5#include "AMP/utils/AMP_MPI.h"
6#include "AMP/utils/enable_shared_from_this.h"
7#include "AMP/vectors/data/DataChangeListener.h"
8
9#include <memory>
10
11
12// Forward declare a few types for PETSc
13typedef int PetscErrorCode;
14typedef struct _p_Vec *Vec;
15typedef struct _p_Mat *Mat;
16typedef struct _p_PetscRandom *PetscRandom;
17
18
19namespace AMP::LinearAlgebra {
20class Vector;
21class Matrix;
22} // namespace AMP::LinearAlgebra
23
24namespace PETSC {
25
26
27/********************************************************
28 * Destructors *
29 ********************************************************/
33
34
35/********************************************************
36 * Create random number generator *
37 ********************************************************/
38std::shared_ptr<PetscRandom> genPetscRandom( const AMP::AMP_MPI &comm );
39
40
41/********************************************************
42 * Reset petsc vector operations *
43 ********************************************************/
45
46
47/********************************************************
48 * Get the AMP vector from the PETSc Vec or Mat *
49 ********************************************************/
50std::shared_ptr<AMP::LinearAlgebra::Vector> getAMP( Vec t );
51std::shared_ptr<AMP::LinearAlgebra::Matrix> getAMP( Mat t );
52
53
54/********************************************************
55 * Get a PETSc Vec or Mat from an AMP vector/matrix *
56 ********************************************************/
57Vec getVec( std::shared_ptr<AMP::LinearAlgebra::Vector> v );
58Mat getMat( std::shared_ptr<AMP::LinearAlgebra::Matrix> m );
59
60
61} // namespace PETSC
62
63#endif
struct _p_Mat * Mat
struct _p_Mat * Mat
struct _p_PetscRandom * PetscRandom
int PetscErrorCode
struct _p_Vec * Vec
int PetscErrorCode
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
PetscErrorCode matDestroy(Mat *mat)
std::shared_ptr< AMP::LinearAlgebra::Vector > getAMP(Vec t)
Mat getMat(std::shared_ptr< AMP::LinearAlgebra::Matrix > m)
std::shared_ptr< PetscRandom > genPetscRandom(const AMP::AMP_MPI &comm)
Vec getVec(std::shared_ptr< AMP::LinearAlgebra::Vector > v)
PetscErrorCode vecDestroy(Vec *v)
PetscErrorCode randomDestroy(PetscRandom *random)
void reset_vec_ops(Vec t)
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