This is a thin wrapper around PETSc Mat. More...
#include <NativePetscMatrixData.h>

Public Member Functions | |
| template<class TYPE > | |
| void | addValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, const TYPE *values) |
| Add values to those in the matrix. | |
| void | addValuesByGlobalID (size_t, size_t, const size_t *, const size_t *, const void *, const typeID &) override |
| Add values to those in the matrix. | |
| virtual size_t | beginCol () const |
| Get the global id of first column in diagonal block. | |
| virtual size_t | beginRow () const |
| Get the global id of the beginning row. | |
| std::shared_ptr< MatrixData > | cloneMatrixData () const override |
| Clone the data. | |
| void | copyFromMat (Mat m) |
| Copy data from a PETSc Mat. | |
| std::shared_ptr< Vector > | createInputVector () const |
| std::shared_ptr< Vector > | createOutputVector () const |
| virtual size_t | endCol () const |
| Get the global id of last column in diagonal block. | |
| virtual size_t | endRow () const |
| Get the global id of the ending row. | |
| virtual AMP::Utilities::Backend | getBackend () const |
| Get the backend. | |
| typeID | getCoeffType () const override |
| Return the typeid of the matrix coeffs. | |
| std::vector< size_t > | getColumnIDs (size_t) const override |
| Given a row, retrieve the non-zero column indices of the matrix in compressed format. | |
| AMP_MPI | getComm () const override |
| Get the comm. | |
| uint64_t | getID () const |
| Get a unique id hash for the vector. | |
| std::shared_ptr< Discretization::DOFManager > | getLeftDOFManager () const override |
| Get the DOFManager associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector ) | |
| virtual std::shared_ptr< Variable > | getLeftVariable () const |
| Get the variable associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector ) | |
| Mat | getMat () |
| std::shared_ptr< Discretization::DOFManager > | getRightDOFManager () const override |
| Get the DOFManager associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector ) | |
| virtual std::shared_ptr< Variable > | getRightVariable () const |
| Get the variable associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector ) | |
| void | getRowByGlobalID (size_t, std::vector< size_t > &, std::vector< double > &) const override |
| Retrieve a row of the matrix in compressed format. | |
| template<class TYPE > | |
| void | getValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, TYPE *values) const |
| Get values in the matrix. | |
| void | getValuesByGlobalID (size_t, size_t, const size_t *, const size_t *, void *, const typeID &) const override |
| Get values in the matrix. | |
| void | makeConsistent (AMP::LinearAlgebra::ScatterType t) override |
| Perform communication to ensure values in the matrix are the same across cores. | |
| virtual std::uint16_t | mode () const |
| Return CSR mode of the matrix. | |
| NativePetscMatrixData () | |
| NativePetscMatrixData (Mat m, bool dele=false) | |
| Construct a matrix from a PETSc Mat. | |
| NativePetscMatrixData (std::shared_ptr< MatrixParametersBase > params) | |
| size_t | numberColumnIDs (size_t row) const override |
| Given a row, retrieve the number of non-zero column indices of the matrix. | |
| size_t | numGlobalColumns () const override |
| Get the number of global columns in the matrix. | |
| size_t | numGlobalRows () const override |
| Get the number of global rows in the matrix. | |
| virtual size_t | numLocalColumns () const |
| Get the number of local columns in the matrix. | |
| virtual size_t | numLocalRows () const |
| Get the number of local rows in the matrix. | |
| virtual void | registerChildObjects (AMP::IO::RestartManager *manager) const |
| Register any child objects. | |
| void | removeRange (AMP::Scalar, AMP::Scalar) override |
| Remove matrix entries within given range. | |
| virtual void | setBackend (AMP::Utilities::Backend backend) |
| void | setMat (Mat mat, bool manage=true) |
| template<class TYPE > | |
| void | setValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, const TYPE *values) |
| Set values in the matrix. | |
| void | setValuesByGlobalID (size_t, size_t, const size_t *, const size_t *, const void *, const typeID &) override |
| Set values in the matrix. | |
| std::shared_ptr< MatrixData > | shared_from_this () |
| std::shared_ptr< const MatrixData > | shared_from_this () const |
| std::shared_ptr< MatrixData > | transpose () const override |
| Transpose. | |
| virtual std::string | type () const override |
| Return the type of the matrix. | |
| virtual void | writeRestart (int64_t fid) const |
| Write restart data to file. | |
| virtual | ~NativePetscMatrixData () |
| Destructor. | |
Static Public Member Functions | |
| static std::shared_ptr< MatrixData > | duplicateMat (Mat m) |
| Create a NativePetscMatrixData with the same non-zero structure. | |
Protected Attributes | |
| uint64_t | d_hash = 0 |
| std::shared_ptr< MatrixParametersBase > | d_pParameters |
| std::weak_ptr< MatrixData > | weak_ptr_ |
Private Attributes | |
| Mat | d_Mat = nullptr |
| bool | d_MatCreatedInternally = false |
This is a thin wrapper around PETSc Mat.
Definition at line 13 of file NativePetscMatrixData.h.
| AMP::LinearAlgebra::NativePetscMatrixData::NativePetscMatrixData | ( | ) |
|
explicit |
|
explicit |
Construct a matrix from a PETSc Mat.
| [in] | m | The Mat to wrap |
| [in] | dele | Let this class deallocate the Mat |
|
virtual |
Destructor.
|
inherited |
Add values to those in the matrix.
| [in] | num_rows | The number of rows represented in values |
| [in] | num_cols | The number of cols represented in values |
| [in] | rows | The row ids of values |
| [in] | cols | The column ids of values |
| [in] | values | The values to add to the matrix (row-major ordering) |
This method may fail if the matrix has not allocated a particular (row,col) specified, depending on the actual subclass of matrix used.
|
overridevirtual |
Add values to those in the matrix.
| [in] | num_rows | The number of rows represented in values |
| [in] | num_cols | The number of cols represented in values |
| [in] | rows | The row ids of values |
| [in] | cols | The column ids of values |
| [in] | values | The values to add to the matrix (row-major ordering) |
| [in] | id | typeID of raw data |
This method may fail if the matrix has not allocated a particular (row,col) specified, depending on the actual subclass of matrix used.
Implements AMP::LinearAlgebra::MatrixData.
|
virtualinherited |
Get the global id of first column in diagonal block.
Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.
|
virtualinherited |
Get the global id of the beginning row.
Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.
|
overridevirtual |
Clone the data.
Implements AMP::LinearAlgebra::MatrixData.
| void AMP::LinearAlgebra::NativePetscMatrixData::copyFromMat | ( | Mat | m | ) |
Copy data from a PETSc Mat.
| [in] | m | The matrix with the data |
| std::shared_ptr< Vector > AMP::LinearAlgebra::NativePetscMatrixData::createInputVector | ( | ) | const |
| std::shared_ptr< Vector > AMP::LinearAlgebra::NativePetscMatrixData::createOutputVector | ( | ) | const |
|
static |
Create a NativePetscMatrixData with the same non-zero structure.
| [in] | m | The matrix to duplicate |
|
virtualinherited |
Get the global id of last column in diagonal block.
Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.
|
virtualinherited |
Get the global id of the ending row.
Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.
|
inlinevirtualinherited |
Get the backend.
Definition at line 268 of file MatrixData.h.
References AMP_ASSERT, and AMP::LinearAlgebra::MatrixData::d_pParameters.
|
inlineoverridevirtual |
Return the typeid of the matrix coeffs.
Implements AMP::LinearAlgebra::MatrixData.
Definition at line 80 of file NativePetscMatrixData.h.
References type().
|
overridevirtual |
Given a row, retrieve the non-zero column indices of the matrix in compressed format.
| [in] | row | Which row |
Implements AMP::LinearAlgebra::MatrixData.
|
overridevirtual |
Get the comm.
Reimplemented from AMP::LinearAlgebra::MatrixData.
|
inherited |
Get a unique id hash for the vector.
|
overridevirtual |
Get the DOFManager associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )
Implements AMP::LinearAlgebra::MatrixData.
|
inlinevirtualinherited |
Get the variable associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )
Definition at line 215 of file MatrixData.h.
References AMP::LinearAlgebra::MatrixData::d_pParameters.
|
inline |
Definition at line 72 of file NativePetscMatrixData.h.
References d_Mat.
|
overridevirtual |
Get the DOFManager associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector )
Implements AMP::LinearAlgebra::MatrixData.
|
inlinevirtualinherited |
Get the variable associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector )
Definition at line 205 of file MatrixData.h.
References AMP::LinearAlgebra::MatrixData::d_pParameters.
|
overridevirtual |
Retrieve a row of the matrix in compressed format.
| [in] | row | Which row |
| [out] | cols | The column ids of the returned values |
| [out] | values | The values in the row |
Implements AMP::LinearAlgebra::MatrixData.
|
inherited |
Get values in the matrix.
| [in] | num_rows | The number of rows represented in values |
| [in] | num_cols | The number of cols represented in values |
| [in] | rows | The row ids of values |
| [in] | cols | The column ids of values |
| [out] | values | The values to get from the matrix (row-major ordering) |
This method will return zero for any entries that have not been allocated or are not ghosts on the current processor.
|
overridevirtual |
Get values in the matrix.
| [in] | num_rows | The number of rows represented in values |
| [in] | num_cols | The number of cols represented in values |
| [in] | rows | The row ids of values |
| [in] | cols | The column ids of values |
| [out] | values | The values to get from the matrix (row-major ordering) |
| [in] | id | typeID of raw data |
This method will return zero for any entries that have not been allocated or are not ghosts on the current processor.
Implements AMP::LinearAlgebra::MatrixData.
|
overridevirtual |
Perform communication to ensure values in the matrix are the same across cores.
Implements AMP::LinearAlgebra::MatrixData.
|
inlinevirtualinherited |
Return CSR mode of the matrix.
Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.
Definition at line 57 of file MatrixData.h.
|
overridevirtual |
Given a row, retrieve the number of non-zero column indices of the matrix.
| [in] | row | Which row |
Implements AMP::LinearAlgebra::MatrixData.
|
overridevirtual |
Get the number of global columns in the matrix.
Reimplemented from AMP::LinearAlgebra::MatrixData.
|
overridevirtual |
Get the number of global rows in the matrix.
Reimplemented from AMP::LinearAlgebra::MatrixData.
|
virtualinherited |
Get the number of local columns in the matrix.
Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, and AMP::LinearAlgebra::EpetraMatrixData.
|
virtualinherited |
Get the number of local rows in the matrix.
Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, and AMP::LinearAlgebra::EpetraMatrixData.
|
virtualinherited |
Register any child objects.
This function will register child objects with the manager
| manager | Restart manager |
Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.
|
inlineoverridevirtual |
Remove matrix entries within given range.
Implements AMP::LinearAlgebra::MatrixData.
Definition at line 49 of file NativePetscMatrixData.h.
References AMP_ERROR.
|
inlinevirtualinherited |
Definition at line 274 of file MatrixData.h.
References AMP_ASSERT, and AMP::LinearAlgebra::MatrixData::d_pParameters.
| void AMP::LinearAlgebra::NativePetscMatrixData::setMat | ( | Mat | mat, |
| bool | manage = true |
||
| ) |
|
inherited |
Set values in the matrix.
| [in] | num_rows | The number of rows represented in values |
| [in] | num_cols | The number of cols represented in values |
| [in] | rows | The row ids of values |
| [in] | cols | The column ids of values |
| [in] | values | The values to set to the matrix (row-major ordering) |
This method may fail if the matrix has not allocated a particular (row,col) specified, depending on the actual subclass of matrix used.
|
overridevirtual |
Set values in the matrix.
| [in] | num_rows | The number of rows represented in values |
| [in] | num_cols | The number of cols represented in values |
| [in] | rows | The row ids of values |
| [in] | cols | The column ids of values |
| [in] | values | The values to set to the matrix (row-major ordering) |
| [in] | id | typeID of raw data |
This method may fail if the matrix has not allocated a particular (row,col) specified, depending on the actual subclass of matrix used.
Implements AMP::LinearAlgebra::MatrixData.
|
inlineinherited |
Definition at line 28 of file enable_shared_from_this.h.
|
inlineinherited |
Definition at line 46 of file enable_shared_from_this.h.
|
overridevirtual |
Transpose.
Implements AMP::LinearAlgebra::MatrixData.
|
inlineoverridevirtual |
Return the type of the matrix.
Implements AMP::LinearAlgebra::MatrixData.
Definition at line 43 of file NativePetscMatrixData.h.
Referenced by getCoeffType().
|
virtualinherited |
Write restart data to file.
This function will write the mesh to an HDF5 file
| fid | File identifier to write |
Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.
|
protectedinherited |
Definition at line 311 of file MatrixData.h.
|
private |
Definition at line 87 of file NativePetscMatrixData.h.
Referenced by getMat().
|
private |
Definition at line 88 of file NativePetscMatrixData.h.
|
protectedinherited |
Definition at line 308 of file MatrixData.h.
Referenced by AMP::LinearAlgebra::MatrixData::getBackend(), AMP::LinearAlgebra::MatrixData::getComm(), AMP::LinearAlgebra::MatrixData::getLeftVariable(), AMP::LinearAlgebra::MatrixData::getRightVariable(), and AMP::LinearAlgebra::MatrixData::setBackend().
|
mutableprotectedinherited |
Definition at line 69 of file enable_shared_from_this.h.
|
Advanced Multi-Physics (AMP) Oak Ridge National Laboratory Idaho National Laboratory Los Alamos National Laboratory |
This page automatically produced from the source code by Last updated: Tue Mar 10 2026 13:06:43. Comments on this page |