1#ifndef included_AMP_MatrixData_h
2#define included_AMP_MatrixData_h
6#include "AMP/matrices/MatrixParametersBase.h"
7#include "AMP/utils/AMP_MPI.h"
8#include "AMP/utils/Utilities.h"
9#include "AMP/utils/enable_shared_from_this.h"
10#include "AMP/utils/typeid.h"
11#include "AMP/vectors/CommunicationList.h"
12#include "AMP/vectors/Scalar.h"
13#include "AMP/vectors/Variable.h"
33 explicit MatrixData( std::shared_ptr<MatrixParametersBase> params );
48 virtual std::shared_ptr<MatrixData>
transpose()
const = 0;
54 virtual std::string
type()
const = 0;
57 virtual std::uint16_t
mode()
const {
return std::numeric_limits<std::uint16_t>::max(); }
107 TYPE *values )
const;
115 std::vector<size_t> &cols,
116 std::vector<double> &values )
const = 0;
169 const typeID &
id )
const = 0;
316#include "AMP/matrices/data/MatrixData.hpp"
Provides C++ wrapper around MPI routines.
Class to manage reading/writing restart data.
virtual size_t numLocalColumns() const
Get the number of local columns in the matrix.
virtual std::uint16_t mode() const
Return CSR mode of the matrix.
virtual std::shared_ptr< Discretization::DOFManager > getRightDOFManager() const =0
Get the DOFManager associated with a right vector ( For , is a right vector )
virtual size_t numLocalRows() const
Get the number of local rows in the matrix.
virtual std::shared_ptr< Variable > getLeftVariable() const
Get the variable associated with a left vector ( For , is a left vector )
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 makeConsistent(AMP::LinearAlgebra::ScatterType t)=0
Perform communication to ensure values in the matrix are the same across cores.
uint64_t getID() const
Get a unique id hash for the vector.
virtual std::shared_ptr< Discretization::DOFManager > getLeftDOFManager() const =0
Get the DOFManager associated with a left vector ( For , is a left vector )
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 AMP_MPI getComm() const
Get the comm.
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 size_t beginRow() const
Get the global id of the beginning row.
virtual AMP::Utilities::Backend getBackend() const
Get the backend.
virtual void removeRange(AMP::Scalar bnd_lo, AMP::Scalar bnd_up)=0
Remove matrix entries within given range.
MatrixData()
Empty constructor.
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 size_t endRow() const
Get the global id of the ending row.
std::shared_ptr< MatrixParametersBase > d_pParameters
virtual std::string type() const =0
Return the type of the matrix.
virtual void registerChildObjects(AMP::IO::RestartManager *manager) const
Register any child objects.
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.
virtual ~MatrixData()
Destructor.
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 size_t endCol() const
Get the global id of last column in diagonal block.
MatrixData(std::shared_ptr< MatrixParametersBase > params)
Constructor.
virtual size_t numGlobalColumns() const
Get the number of global columns in the matrix.
virtual std::shared_ptr< MatrixData > cloneMatrixData() const =0
Clone the data.
virtual size_t numberColumnIDs(size_t row) const =0
Given a row, retrieve the number of non-zero column indices of the matrix.
virtual void setBackend(AMP::Utilities::Backend backend)
virtual std::shared_ptr< MatrixData > transpose() const =0
Transpose.
virtual void writeRestart(int64_t fid) const
Write restart data to file.
virtual size_t numGlobalRows() const
Get the number of global rows 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.
virtual typeID getCoeffType() const =0
Return the typeid of the matrix coeffs.
virtual size_t beginCol() const
Get the global id of first column in diagonal block.
MatrixData(const MatrixData &)=delete
Copy constructor.
MatrixData(int64_t fid, AMP::IO::RestartManager *manager)
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 std::shared_ptr< Variable > getRightVariable() const
Get the variable associated with a right vector ( For , is a right vector )
Scalar is a class used to store a scalar variable that may be different types/precision.
Enhancement of std::enable_shared_from_this.
#define AMP_ASSERT(EXP)
Assert error.
ScatterType
Flag to choose algorithm for makeConsistent.
Backend
Enum to store the backend used for gpu acceleration.
Class to store type info.