Advanced Multi-Physics (AMP)
On-Line Documentation
EpetraMatrixData.h
Go to the documentation of this file.
1#ifndef included_AMP_EpetraMatrixData
2#define included_AMP_EpetraMatrixData
3
4#include "AMP/matrices/data/MatrixData.h"
5
6
7// Forward declare
8class Epetra_Map;
9class Epetra_CrsMatrix;
10
11namespace AMP::LinearAlgebra {
12
13class Vector;
14
28{
29private:
30 EpetraMatrixData() = delete;
31
32protected:
35 Epetra_CrsMatrix *d_epetraMatrix;
36
39 std::shared_ptr<Epetra_Map> d_RangeMap;
40
43 std::shared_ptr<Epetra_Map> d_DomainMap;
44
48
50 std::map<int, std::map<int, double>> d_OtherData;
51
54
55
61 void VerifyEpetraReturn( int err, const char *func ) const;
62
63public:
64 explicit EpetraMatrixData( std::shared_ptr<MatrixParametersBase> params );
65
67
72 explicit EpetraMatrixData( Epetra_CrsMatrix *inMatrix, bool dele = false );
73
74 std::shared_ptr<MatrixData> cloneMatrixData() const override;
75
76 std::shared_ptr<MatrixData> transpose() const override;
77
78 void removeRange( AMP::Scalar, AMP::Scalar ) override { AMP_ERROR( "Not implemented" ); }
79
86 void setEpetraMaps( std::shared_ptr<Vector> range, std::shared_ptr<Vector> domain );
87
89
93
95 std::string type() const override { return "EpetraMatrixData"; }
96
100 virtual Epetra_CrsMatrix &getEpetra_CrsMatrix();
101
105 virtual const Epetra_CrsMatrix &getEpetra_CrsMatrix() const;
106
111 static std::shared_ptr<EpetraMatrixData> createView( std::shared_ptr<MatrixData> p );
112
116
117 void createValuesByGlobalID( size_t, const std::vector<size_t> & );
118 void addValuesByGlobalID( size_t num_rows,
119 size_t num_cols,
120 const size_t *rows,
121 const size_t *cols,
122 const void *values,
123 const typeID &id ) override;
124 void setValuesByGlobalID( size_t num_rows,
125 size_t num_cols,
126 const size_t *rows,
127 const size_t *cols,
128 const void *values,
129 const typeID &id ) override;
130 void getValuesByGlobalID( size_t num_rows,
131 size_t num_cols,
132 const size_t *rows,
133 const size_t *cols,
134 void *values,
135 const typeID &id ) const override;
136 void getRowByGlobalID( size_t row,
137 std::vector<size_t> &cols,
138 std::vector<double> &values ) const override;
139 size_t numberColumnIDs( size_t row ) const override;
140 std::vector<size_t> getColumnIDs( size_t row ) const override;
142 size_t numLocalRows() const override;
143 size_t numGlobalRows() const override;
144 size_t numLocalColumns() const override;
145 size_t numGlobalColumns() const override;
146 AMP::AMP_MPI getComm() const override;
147 std::shared_ptr<Discretization::DOFManager> getRightDOFManager() const override;
148 std::shared_ptr<Discretization::DOFManager> getLeftDOFManager() const override;
149 std::shared_ptr<Vector> createInputVector() const;
150 std::shared_ptr<Vector> createOutputVector() const;
151
154 typeID getCoeffType() const override
155 {
156 // Epetra matrix are double only for the moment
157 constexpr auto type = getTypeID<double>();
158 return type;
159 }
160};
161
162
163} // namespace AMP::LinearAlgebra
164
165
166#endif
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
A Matrix with an Epetra_CrsMatrix interface.
void getValuesByGlobalID(size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, void *values, const typeID &id) const override
Get values in the matrix.
std::shared_ptr< Discretization::DOFManager > getRightDOFManager() const override
Get the DOFManager associated with a right vector ( For , is a right vector )
void setOtherData()
Update data off-core.
std::vector< size_t > getColumnIDs(size_t row) const override
Given a row, retrieve the non-zero column indices of the matrix in compressed format.
std::string type() const override
Return the type of the matrix.
void VerifyEpetraReturn(int err, const char *func) const
Ensure Epetra methods return correctly.
virtual Epetra_CrsMatrix & getEpetra_CrsMatrix()
Return an Epetra_CrsMatrix.
bool d_DeleteMatrix
Indicates if the destructor calls delete.
std::shared_ptr< Vector > createInputVector() const
size_t numLocalRows() const override
Get the number of local rows in the matrix.
virtual const Epetra_CrsMatrix & getEpetra_CrsMatrix() const
Return an Epetra_CrsMatrix.
void getRowByGlobalID(size_t row, std::vector< size_t > &cols, std::vector< double > &values) const override
Retrieve a row of the matrix in compressed format.
typeID getCoeffType() const override
Return the typeid of the matrix coeffs.
std::shared_ptr< Epetra_Map > d_RangeMap
Range map for the Epetra_CrsMatrix.
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.
std::shared_ptr< Discretization::DOFManager > getLeftDOFManager() const override
Get the DOFManager associated with a left vector ( For , is a left vector )
size_t numLocalColumns() const override
Get the number of local columns in the matrix.
std::shared_ptr< MatrixData > cloneMatrixData() const override
Clone the data.
void addValuesByGlobalID(size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, const void *values, const typeID &id) override
Add values to those in the matrix.
EpetraMatrixData(std::shared_ptr< MatrixParametersBase > params)
virtual ~EpetraMatrixData()
Destructor.
void setEpetraMaps(std::shared_ptr< Vector > range, std::shared_ptr< Vector > domain)
Change the EpetraMaps for the matrix.
std::shared_ptr< Epetra_Map > d_DomainMap
Domain map for the Epetra_CrsMatrix.
void makeConsistent(AMP::LinearAlgebra::ScatterType t) override
Perform communication to ensure values in the matrix are the same across cores.
static std::shared_ptr< EpetraMatrixData > createView(std::shared_ptr< MatrixData > p)
Create an EpetraMatrixData view of an AMP::LinearAlgebra::Matrix.
std::map< int, std::map< int, double > > d_OtherData
storage of off-core data
EpetraMatrixData(const EpetraMatrixData &rhs)
void setValuesByGlobalID(size_t num_rows, size_t num_cols, const size_t *rows, const size_t *cols, const void *values, const typeID &id) override
Set values in the matrix.
void createValuesByGlobalID(size_t, const std::vector< size_t > &)
void removeRange(AMP::Scalar, AMP::Scalar) override
Remove matrix entries within given range.
EpetraMatrixData(Epetra_CrsMatrix *inMatrix, bool dele=false)
Constructor.
size_t numGlobalRows() const override
Get the number of global rows in the matrix.
std::shared_ptr< MatrixData > transpose() const override
Transpose.
std::shared_ptr< Vector > createOutputVector() const
Epetra_CrsMatrix * d_epetraMatrix
Bare pointer to an Epetra_CrsMatrix.
AMP::AMP_MPI getComm() const override
Get the comm.
EpetraMatrixData & operator=(const EpetraMatrixData &)=delete
void fillComplete()
A call-through to Epetra_CrsMatrix fillComplete.
Scalar is a class used to store a scalar variable that may be different types/precision.
Definition Scalar.h:21
#define AMP_ERROR(MSG)
Throw error.
ScatterType
Flag to choose algorithm for makeConsistent.
Definition Variable.h:21
Class to store type info.
Definition typeid.h:210



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