Advanced Multi-Physics (AMP)
On-Line Documentation
MatrixParametersBase.h
Go to the documentation of this file.
1#ifndef included_AMP_MatrixParametersBase
2#define included_AMP_MatrixParametersBase
3
4#include "AMP/utils/AMP_MPI.h"
5#include "AMP/utils/Utilities.h"
6#include "AMP/vectors/Variable.h"
7
8namespace AMP::LinearAlgebra {
9
10
15{
16public:
18
20
24 explicit MatrixParametersBase( const AMP_MPI &comm )
25 : d_comm( comm ),
26 d_VariableLeft( std::make_shared<Variable>( "MatrixParametersBase_default" ) ),
27 d_VariableRight( std::make_shared<Variable>( "MatrixParametersBase_default" ) ),
28 d_backend( AMP::Utilities::Backend::Serial ),
29 d_hash( reinterpret_cast<uint64_t>( this ) )
30 {
31 }
32
37 explicit MatrixParametersBase( const AMP_MPI &comm, AMP::Utilities::Backend backend )
38 : d_comm( comm ),
39 d_VariableLeft( std::make_shared<Variable>( "MatrixParametersBase_default" ) ),
40 d_VariableRight( std::make_shared<Variable>( "MatrixParametersBase_default" ) ),
41 d_backend( backend ),
42 d_hash( reinterpret_cast<uint64_t>( this ) )
43 {
44 }
45
51 explicit MatrixParametersBase( const AMP_MPI &comm,
52 std::shared_ptr<Variable> varLeft,
53 std::shared_ptr<Variable> varRight )
54 : d_comm( comm ),
55 d_VariableLeft( varLeft ),
56 d_VariableRight( varRight ),
57 d_backend( AMP::Utilities::Backend::Serial ),
58 d_hash( reinterpret_cast<uint64_t>( this ) )
59 {
60 }
61
68 explicit MatrixParametersBase( const AMP_MPI &comm,
69 std::shared_ptr<Variable> varLeft,
70 std::shared_ptr<Variable> varRight,
72 : d_comm( comm ),
73 d_VariableLeft( varLeft ),
74 d_VariableRight( varRight ),
75 d_backend( backend ),
76 d_hash( reinterpret_cast<uint64_t>( this ) )
77 {
78 }
79
81 virtual ~MatrixParametersBase() = default;
82
84 uint64_t getID() const { return d_hash; }
85
87 virtual std::string type() const { return "MatrixParametersBase"; }
88
91
92 void setLeftVariable( std::shared_ptr<Variable> var ) { d_VariableLeft = var; }
93
94 void setRightVariable( std::shared_ptr<Variable> var ) { d_VariableRight = var; }
95
96 std::shared_ptr<Variable> getLeftVariable() const { return d_VariableLeft; }
97
98 std::shared_ptr<Variable> getRightVariable() const { return d_VariableRight; }
99
100public: // Write/read restart data
106 virtual void registerChildObjects( AMP::IO::RestartManager *manager ) const;
107
113 virtual void writeRestart( int64_t fid ) const;
114
121
122protected:
123 // The comm of the matrix
125
128 std::shared_ptr<Variable> d_VariableLeft;
129
132 std::shared_ptr<Variable> d_VariableRight;
133
134public:
135 // The backend used for cpus and/or gpu acceleration
137
138 // unique hash to identify this object
139 uint64_t d_hash = 0;
140};
141} // namespace AMP::LinearAlgebra
142
143#endif
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
Class to manage reading/writing restart data.
A class used to hold basic parameters for a matrix.
AMP::AMP_MPI & getComm()
Get the communicator for the matrix.
virtual void writeRestart(int64_t fid) const
Write restart data to file.
void setRightVariable(std::shared_ptr< Variable > var)
MatrixParametersBase(const AMP_MPI &comm)
Constructor, variable names set to default.
MatrixParametersBase(const AMP_MPI &comm, std::shared_ptr< Variable > varLeft, std::shared_ptr< Variable > varRight, AMP::Utilities::Backend backend)
Constructor, variable names provided.
void setLeftVariable(std::shared_ptr< Variable > var)
std::shared_ptr< Variable > getLeftVariable() const
uint64_t getID() const
Get a unique id hash.
std::shared_ptr< Variable > getRightVariable() const
MatrixParametersBase(int64_t fid, AMP::IO::RestartManager *manager)
Read restart data from file.
virtual ~MatrixParametersBase()=default
Deconstructor.
MatrixParametersBase(const MatrixParametersBase &other)=default
virtual void registerChildObjects(AMP::IO::RestartManager *manager) const
Register any child objects.
MatrixParametersBase(const AMP_MPI &comm, std::shared_ptr< Variable > varLeft, std::shared_ptr< Variable > varRight)
Constructor, variable names provided.
virtual std::string type() const
type of this object
MatrixParametersBase(const AMP_MPI &comm, AMP::Utilities::Backend backend)
Constructor, variable names set to default.
A description of the data in the vector.
Definition Variable.h:46
Backend
Enum to store the backend used for gpu acceleration.
Definition Backend.h:21



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