Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Protected Attributes | List of all members
AMP::LinearAlgebra::MatrixData Class Referenceabstract

#include <MatrixData.h>

Inheritance diagram for AMP::LinearAlgebra::MatrixData:
Inheritance graph
[legend]

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.
 
virtual void addValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, const void *values, const typeID &id)=0
 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.
 
virtual std::shared_ptr< MatrixDatacloneMatrixData () const =0
 Clone the data.
 
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.
 
virtual typeID getCoeffType () const =0
 Return the typeid of the matrix coeffs.
 
virtual std::vector< size_t > getColumnIDs (size_t row) const =0
 Given a row, retrieve the non-zero column indices of the matrix in compressed format.
 
virtual AMP_MPI getComm () const
 Get the comm.
 
uint64_t getID () const
 Get a unique id hash for the vector.
 
virtual std::shared_ptr< Discretization::DOFManagergetLeftDOFManager () const =0
 Get the DOFManager associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )
 
virtual std::shared_ptr< VariablegetLeftVariable () const
 Get the variable associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )
 
virtual std::shared_ptr< Discretization::DOFManagergetRightDOFManager () const =0
 Get the DOFManager associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector )
 
virtual std::shared_ptr< VariablegetRightVariable () const
 Get the variable associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector )
 
virtual void getRowByGlobalID (size_t row, std::vector< size_t > &cols, std::vector< double > &values) const =0
 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.
 
virtual void getValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, void *values, const typeID &id) const =0
 Get values in the matrix.
 
virtual void makeConsistent (AMP::LinearAlgebra::ScatterType t)=0
 Perform communication to ensure values in the matrix are the same across cores.
 
 MatrixData ()
 Empty constructor.
 
 MatrixData (const MatrixData &)=delete
 Copy constructor.
 
 MatrixData (int64_t fid, AMP::IO::RestartManager *manager)
 
 MatrixData (std::shared_ptr< MatrixParametersBase > params)
 Constructor.
 
virtual std::uint16_t mode () const
 Return CSR mode of the matrix.
 
virtual size_t numberColumnIDs (size_t row) const =0
 Given a row, retrieve the number of non-zero column indices of the matrix.
 
virtual size_t numGlobalColumns () const
 Get the number of global columns in the matrix.
 
virtual size_t numGlobalRows () const
 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.
 
virtual void removeRange (AMP::Scalar bnd_lo, AMP::Scalar bnd_up)=0
 Remove matrix entries within given range.
 
virtual void setBackend (AMP::Utilities::Backend backend)
 
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.
 
virtual void setValuesByGlobalID (size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, const void *values, const typeID &id)=0
 Set values in the matrix.
 
std::shared_ptr< MatrixDatashared_from_this ()
 
std::shared_ptr< const MatrixDatashared_from_this () const
 
virtual std::shared_ptr< MatrixDatatranspose () const =0
 Transpose.
 
virtual std::string type () const =0
 Return the type of the matrix.
 
virtual void writeRestart (int64_t fid) const
 Write restart data to file.
 
virtual ~MatrixData ()
 Destructor.
 

Protected Attributes

uint64_t d_hash = 0
 
std::shared_ptr< MatrixParametersBased_pParameters
 
std::weak_ptr< MatrixDataweak_ptr_
 

Detailed Description

Definition at line 27 of file MatrixData.h.

Constructor & Destructor Documentation

◆ MatrixData() [1/4]

AMP::LinearAlgebra::MatrixData::MatrixData ( std::shared_ptr< MatrixParametersBase params)
explicit

Constructor.

Parameters
[in]paramsDescription of the matrix

◆ ~MatrixData()

virtual AMP::LinearAlgebra::MatrixData::~MatrixData ( )
virtual

Destructor.

◆ MatrixData() [2/4]

AMP::LinearAlgebra::MatrixData::MatrixData ( )

Empty constructor.

◆ MatrixData() [3/4]

AMP::LinearAlgebra::MatrixData::MatrixData ( const MatrixData )
delete

Copy constructor.

◆ MatrixData() [4/4]

AMP::LinearAlgebra::MatrixData::MatrixData ( int64_t  fid,
AMP::IO::RestartManager manager 
)

Member Function Documentation

◆ addValuesByGlobalID() [1/2]

template<class TYPE >
void AMP::LinearAlgebra::MatrixData::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.

Parameters
[in]num_rowsThe number of rows represented in values
[in]num_colsThe number of cols represented in values
[in]rowsThe row ids of values
[in]colsThe column ids of values
[in]valuesThe 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.

◆ addValuesByGlobalID() [2/2]

virtual void AMP::LinearAlgebra::MatrixData::addValuesByGlobalID ( size_t  num_rows,
size_t  num_cols,
const size_t *  rows,
const size_t *  cols,
const void *  values,
const typeID id 
)
pure virtual

Add values to those in the matrix.

Parameters
[in]num_rowsThe number of rows represented in values
[in]num_colsThe number of cols represented in values
[in]rowsThe row ids of values
[in]colsThe column ids of values
[in]valuesThe values to add to the matrix (row-major ordering)
[in]idtypeID 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.

Implemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, AMP::LinearAlgebra::EpetraMatrixData, and AMP::LinearAlgebra::NativePetscMatrixData.

◆ beginCol()

virtual size_t AMP::LinearAlgebra::MatrixData::beginCol ( ) const
virtual

Get the global id of first column in diagonal block.

Returns
beginning global column id

Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.

◆ beginRow()

virtual size_t AMP::LinearAlgebra::MatrixData::beginRow ( ) const
virtual

Get the global id of the beginning row.

Returns
beginning global row id

Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.

◆ cloneMatrixData()

virtual std::shared_ptr< MatrixData > AMP::LinearAlgebra::MatrixData::cloneMatrixData ( ) const
pure virtual

◆ endCol()

virtual size_t AMP::LinearAlgebra::MatrixData::endCol ( ) const
virtual

Get the global id of last column in diagonal block.

Returns
ending global column id

Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.

◆ endRow()

virtual size_t AMP::LinearAlgebra::MatrixData::endRow ( ) const
virtual

Get the global id of the ending row.

Returns
ending global row id

Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.

◆ getBackend()

virtual AMP::Utilities::Backend AMP::LinearAlgebra::MatrixData::getBackend ( ) const
inlinevirtual

Get the backend.

Definition at line 268 of file MatrixData.h.

References AMP_ASSERT, and d_pParameters.

◆ getCoeffType()

virtual typeID AMP::LinearAlgebra::MatrixData::getCoeffType ( ) const
pure virtual

◆ getColumnIDs()

virtual std::vector< size_t > AMP::LinearAlgebra::MatrixData::getColumnIDs ( size_t  row) const
pure virtual

Given a row, retrieve the non-zero column indices of the matrix in compressed format.

Parameters
[in]rowWhich row

Implemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, AMP::LinearAlgebra::EpetraMatrixData, and AMP::LinearAlgebra::NativePetscMatrixData.

◆ getComm()

virtual AMP_MPI AMP::LinearAlgebra::MatrixData::getComm ( ) const
inlinevirtual

Get the comm.

Reimplemented in AMP::LinearAlgebra::NativePetscMatrixData, and AMP::LinearAlgebra::EpetraMatrixData.

Definition at line 261 of file MatrixData.h.

References AMP_ASSERT, and d_pParameters.

◆ getID()

uint64_t AMP::LinearAlgebra::MatrixData::getID ( ) const

Get a unique id hash for the vector.

◆ getLeftDOFManager()

virtual std::shared_ptr< Discretization::DOFManager > AMP::LinearAlgebra::MatrixData::getLeftDOFManager ( ) const
pure virtual

Get the DOFManager associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )

Returns
The DOFManager associated with a left vector

Implemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, AMP::LinearAlgebra::NativePetscMatrixData, and AMP::LinearAlgebra::EpetraMatrixData.

◆ getLeftVariable()

virtual std::shared_ptr< Variable > AMP::LinearAlgebra::MatrixData::getLeftVariable ( ) const
inlinevirtual

Get the variable associated with a left vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{y}\) is a left vector )

Returns
The variable associated with a left vector

Definition at line 215 of file MatrixData.h.

References d_pParameters.

◆ getRightDOFManager()

virtual std::shared_ptr< Discretization::DOFManager > AMP::LinearAlgebra::MatrixData::getRightDOFManager ( ) const
pure virtual

Get the DOFManager associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector )

Returns
The DOFManager associated with a right vector

Implemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, AMP::LinearAlgebra::NativePetscMatrixData, and AMP::LinearAlgebra::EpetraMatrixData.

◆ getRightVariable()

virtual std::shared_ptr< Variable > AMP::LinearAlgebra::MatrixData::getRightVariable ( ) const
inlinevirtual

Get the variable associated with a right vector ( For \(\mathbf{y}^T\mathbf{Ax}\), \(\mathbf{x}\) is a right vector )

Returns
The variable associated with a right vector

Definition at line 205 of file MatrixData.h.

References d_pParameters.

◆ getRowByGlobalID()

virtual void AMP::LinearAlgebra::MatrixData::getRowByGlobalID ( size_t  row,
std::vector< size_t > &  cols,
std::vector< double > &  values 
) const
pure virtual

Retrieve a row of the matrix in compressed format.

Parameters
[in]rowWhich row
[out]colsThe column ids of the returned values
[out]valuesThe values in the row

Implemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, AMP::LinearAlgebra::EpetraMatrixData, and AMP::LinearAlgebra::NativePetscMatrixData.

◆ getValuesByGlobalID() [1/2]

template<class TYPE >
void AMP::LinearAlgebra::MatrixData::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.

Parameters
[in]num_rowsThe number of rows represented in values
[in]num_colsThe number of cols represented in values
[in]rowsThe row ids of values
[in]colsThe column ids of values
[out]valuesThe 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.

◆ getValuesByGlobalID() [2/2]

virtual void AMP::LinearAlgebra::MatrixData::getValuesByGlobalID ( size_t  num_rows,
size_t  num_cols,
const size_t *  rows,
const size_t *  cols,
void *  values,
const typeID id 
) const
pure virtual

Get values in the matrix.

Parameters
[in]num_rowsThe number of rows represented in values
[in]num_colsThe number of cols represented in values
[in]rowsThe row ids of values
[in]colsThe column ids of values
[out]valuesThe values to get from the matrix (row-major ordering)
[in]idtypeID of raw data

This method will return zero for any entries that have not been allocated or are not ghosts on the current processor.

Implemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, AMP::LinearAlgebra::EpetraMatrixData, and AMP::LinearAlgebra::NativePetscMatrixData.

◆ makeConsistent()

virtual void AMP::LinearAlgebra::MatrixData::makeConsistent ( AMP::LinearAlgebra::ScatterType  t)
pure virtual

Perform communication to ensure values in the matrix are the same across cores.

Implemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::NativePetscMatrixData, AMP::LinearAlgebra::EpetraMatrixData, and AMP::LinearAlgebra::DenseSerialMatrixData.

◆ mode()

virtual std::uint16_t AMP::LinearAlgebra::MatrixData::mode ( ) const
inlinevirtual

Return CSR mode of the matrix.

Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.

Definition at line 57 of file MatrixData.h.

◆ numberColumnIDs()

virtual size_t AMP::LinearAlgebra::MatrixData::numberColumnIDs ( size_t  row) const
pure virtual

Given a row, retrieve the number of non-zero column indices of the matrix.

Parameters
[in]rowWhich row

Implemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, AMP::LinearAlgebra::NativePetscMatrixData, and AMP::LinearAlgebra::EpetraMatrixData.

◆ numGlobalColumns()

virtual size_t AMP::LinearAlgebra::MatrixData::numGlobalColumns ( ) const
virtual

Get the number of global columns in the matrix.

Returns
The number of global columns

Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, AMP::LinearAlgebra::NativePetscMatrixData, and AMP::LinearAlgebra::EpetraMatrixData.

◆ numGlobalRows()

virtual size_t AMP::LinearAlgebra::MatrixData::numGlobalRows ( ) const
virtual

Get the number of global rows in the matrix.

Returns
The number of global rows

Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, AMP::LinearAlgebra::NativePetscMatrixData, and AMP::LinearAlgebra::EpetraMatrixData.

◆ numLocalColumns()

virtual size_t AMP::LinearAlgebra::MatrixData::numLocalColumns ( ) const
virtual

Get the number of local columns in the matrix.

Returns
The number of local columns

Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, and AMP::LinearAlgebra::EpetraMatrixData.

◆ numLocalRows()

virtual size_t AMP::LinearAlgebra::MatrixData::numLocalRows ( ) const
virtual

Get the number of local rows in the matrix.

Returns
The number of local rows

Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, and AMP::LinearAlgebra::EpetraMatrixData.

◆ registerChildObjects()

virtual void AMP::LinearAlgebra::MatrixData::registerChildObjects ( AMP::IO::RestartManager manager) const
virtual

Register any child objects.

This function will register child objects with the manager

Parameters
managerRestart manager

Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.

◆ removeRange()

virtual void AMP::LinearAlgebra::MatrixData::removeRange ( AMP::Scalar  bnd_lo,
AMP::Scalar  bnd_up 
)
pure virtual

◆ setBackend()

virtual void AMP::LinearAlgebra::MatrixData::setBackend ( AMP::Utilities::Backend  backend)
inlinevirtual

Definition at line 274 of file MatrixData.h.

References AMP_ASSERT, and d_pParameters.

◆ setValuesByGlobalID() [1/2]

template<class TYPE >
void AMP::LinearAlgebra::MatrixData::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.

Parameters
[in]num_rowsThe number of rows represented in values
[in]num_colsThe number of cols represented in values
[in]rowsThe row ids of values
[in]colsThe column ids of values
[in]valuesThe 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.

◆ setValuesByGlobalID() [2/2]

virtual void AMP::LinearAlgebra::MatrixData::setValuesByGlobalID ( size_t  num_rows,
size_t  num_cols,
const size_t *  rows,
const size_t *  cols,
const void *  values,
const typeID id 
)
pure virtual

Set values in the matrix.

Parameters
[in]num_rowsThe number of rows represented in values
[in]num_colsThe number of cols represented in values
[in]rowsThe row ids of values
[in]colsThe column ids of values
[in]valuesThe values to set to the matrix (row-major ordering)
[in]idtypeID 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.

Implemented in AMP::LinearAlgebra::CSRMatrixData< Config >, AMP::LinearAlgebra::DenseSerialMatrixData, AMP::LinearAlgebra::EpetraMatrixData, and AMP::LinearAlgebra::NativePetscMatrixData.

◆ shared_from_this() [1/2]

std::shared_ptr< MatrixData > AMP::enable_shared_from_this< MatrixData >::shared_from_this ( )
inlineinherited

Definition at line 28 of file enable_shared_from_this.h.

◆ shared_from_this() [2/2]

std::shared_ptr< const MatrixData > AMP::enable_shared_from_this< MatrixData >::shared_from_this ( ) const
inlineinherited

Definition at line 46 of file enable_shared_from_this.h.

◆ transpose()

virtual std::shared_ptr< MatrixData > AMP::LinearAlgebra::MatrixData::transpose ( ) const
pure virtual

◆ type()

virtual std::string AMP::LinearAlgebra::MatrixData::type ( ) const
pure virtual

◆ writeRestart()

virtual void AMP::LinearAlgebra::MatrixData::writeRestart ( int64_t  fid) const
virtual

Write restart data to file.

This function will write the mesh to an HDF5 file

Parameters
fidFile identifier to write

Reimplemented in AMP::LinearAlgebra::CSRMatrixData< Config >.

Member Data Documentation

◆ d_hash

uint64_t AMP::LinearAlgebra::MatrixData::d_hash = 0
protected

Definition at line 311 of file MatrixData.h.

◆ d_pParameters

std::shared_ptr<MatrixParametersBase> AMP::LinearAlgebra::MatrixData::d_pParameters
protected

Definition at line 308 of file MatrixData.h.

Referenced by getBackend(), getComm(), getLeftVariable(), getRightVariable(), and setBackend().

◆ weak_ptr_

std::weak_ptr<MatrixData > AMP::enable_shared_from_this< MatrixData >::weak_ptr_
mutableprotectedinherited

Definition at line 69 of file enable_shared_from_this.h.


The documentation for this class was generated from the following file:



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