Advanced Multi-Physics (AMP)
On-Line Documentation
Operator.h
Go to the documentation of this file.
1#ifndef included_AMP_Operator
2#define included_AMP_Operator
3
4#include <memory>
5
6#include "AMP/operators/OperatorParameters.h"
7
8#include "AMP/utils/Utilities.h"
9
10#include "AMP/vectors/Variable.h"
11#include "AMP/vectors/Vector.h"
12
13#include <string>
14
15
16namespace AMP::Operator {
17
18
27{
28public:
29 typedef std::shared_ptr<AMP::Operator::Operator> shared_ptr;
30
32 Operator( void );
33
35 explicit Operator( std::shared_ptr<const OperatorParameters> params );
36
38 virtual ~Operator() {}
39
41 virtual std::string type() const = 0;
42
48 virtual void reset( std::shared_ptr<const OperatorParameters> params );
49
57 virtual void apply( std::shared_ptr<const AMP::LinearAlgebra::Vector> u,
58 std::shared_ptr<AMP::LinearAlgebra::Vector> f ) = 0;
59
66 virtual void residual( std::shared_ptr<const AMP::LinearAlgebra::Vector> f,
67 std::shared_ptr<const AMP::LinearAlgebra::Vector> u,
68 std::shared_ptr<AMP::LinearAlgebra::Vector> r );
69
84 virtual std::shared_ptr<OperatorParameters>
85 getParameters( const std::string &type,
86 std::shared_ptr<const AMP::LinearAlgebra::Vector> u,
87 std::shared_ptr<OperatorParameters> params = nullptr );
88
90
97 virtual void setDebugPrintInfoLevel( int level ) { d_iDebugPrintInfoLevel = level; }
98
100 virtual std::shared_ptr<AMP::LinearAlgebra::Variable> getOutputVariable() const
101 {
102 return nullptr;
103 }
104
106 virtual std::shared_ptr<AMP::LinearAlgebra::Variable> getInputVariable() const
107 {
108 return nullptr;
109 }
110
114 virtual std::shared_ptr<AMP::LinearAlgebra::Vector> createInputVector() const;
115
120 virtual std::shared_ptr<AMP::LinearAlgebra::Vector> createOutputVector() const;
121
123 virtual std::shared_ptr<AMP::LinearAlgebra::VectorSelector> selectOutputVector() const;
124
126 virtual std::shared_ptr<AMP::LinearAlgebra::VectorSelector> selectInputVector() const;
127
129 std::shared_ptr<AMP::LinearAlgebra::Vector>
130 subsetOutputVector( std::shared_ptr<AMP::LinearAlgebra::Vector> vec ) const;
131
133 std::shared_ptr<const AMP::LinearAlgebra::Vector>
134 subsetOutputVector( std::shared_ptr<const AMP::LinearAlgebra::Vector> vec ) const;
135
137 std::shared_ptr<AMP::LinearAlgebra::Vector>
138 subsetInputVector( std::shared_ptr<AMP::LinearAlgebra::Vector> vec ) const;
139
141 std::shared_ptr<const AMP::LinearAlgebra::Vector>
142 subsetInputVector( std::shared_ptr<const AMP::LinearAlgebra::Vector> vec ) const;
143
145 // default behavior is to return true;
146 virtual bool isValidVector( std::shared_ptr<const AMP::LinearAlgebra::Vector> ) { return true; }
147
149 std::shared_ptr<AMP::Mesh::Mesh> getMesh() { return d_Mesh; }
150
152 std::shared_ptr<const AMP::Mesh::Mesh> getMesh() const { return d_Mesh; }
153
161 virtual void makeConsistent( std::shared_ptr<AMP::LinearAlgebra::Vector> vec );
162
167 virtual void reInitializeVector( std::shared_ptr<AMP::LinearAlgebra::Vector> ) {}
168
169protected:
170 void getBackendFromInput( std::shared_ptr<AMP::Database> db );
171
179 virtual std::shared_ptr<OperatorParameters>
180 getJacobianParameters( std::shared_ptr<const AMP::LinearAlgebra::Vector> )
181 {
182 return nullptr;
183 }
184
185 void setMemoryAndBackendParameters( std::shared_ptr<AMP::Database> db );
186
188
190
191 static int d_iInstance_id;
192
193 std::shared_ptr<AMP::Mesh::Mesh> d_Mesh;
194
196
198
199private:
200};
201} // namespace AMP::Operator
202
203#endif
AMP::Utilities::MemoryType getMemoryLocation() const
Definition Operator.h:89
virtual void apply(std::shared_ptr< const AMP::LinearAlgebra::Vector > u, std::shared_ptr< AMP::LinearAlgebra::Vector > f)=0
virtual ~Operator()
Destructor.
Definition Operator.h:38
std::shared_ptr< const AMP::LinearAlgebra::Vector > subsetOutputVector(std::shared_ptr< const AMP::LinearAlgebra::Vector > vec) const
Subset output vector.
void getBackendFromInput(std::shared_ptr< AMP::Database > db)
AMP::Utilities::Backend d_backend
Definition Operator.h:197
virtual std::shared_ptr< AMP::LinearAlgebra::Vector > createOutputVector() const
Get a left vector ( For , is an output vector )
virtual std::shared_ptr< AMP::LinearAlgebra::Vector > createInputVector() const
Get a input vector ( For , is a input vector )
void setMemoryAndBackendParameters(std::shared_ptr< AMP::Database > db)
std::shared_ptr< AMP::LinearAlgebra::Vector > subsetInputVector(std::shared_ptr< AMP::LinearAlgebra::Vector > vec) const
Subset input vector.
virtual void makeConsistent(std::shared_ptr< AMP::LinearAlgebra::Vector > vec)
Operator(std::shared_ptr< const OperatorParameters > params)
Constructor.
virtual std::shared_ptr< AMP::LinearAlgebra::VectorSelector > selectOutputVector() const
Return the selector for output vectors.
static int d_iInstance_id
Definition Operator.h:191
std::shared_ptr< const AMP::Mesh::Mesh > getMesh() const
Return the mesh.
Definition Operator.h:152
std::shared_ptr< AMP::Mesh::Mesh > d_Mesh
Definition Operator.h:193
virtual std::shared_ptr< OperatorParameters > getParameters(const std::string &type, std::shared_ptr< const AMP::LinearAlgebra::Vector > u, std::shared_ptr< OperatorParameters > params=nullptr)
virtual void setDebugPrintInfoLevel(int level)
Definition Operator.h:97
virtual std::shared_ptr< AMP::LinearAlgebra::Variable > getOutputVariable() const
Return the output variable.
Definition Operator.h:100
virtual void reset(std::shared_ptr< const OperatorParameters > params)
Operator(void)
Default constructor.
virtual bool isValidVector(std::shared_ptr< const AMP::LinearAlgebra::Vector >)
given a vector return whether it is valid or not
Definition Operator.h:146
virtual std::string type() const =0
Return the name of the operator.
virtual void residual(std::shared_ptr< const AMP::LinearAlgebra::Vector > f, std::shared_ptr< const AMP::LinearAlgebra::Vector > u, std::shared_ptr< AMP::LinearAlgebra::Vector > r)
std::shared_ptr< AMP::Operator::Operator > shared_ptr
Definition Operator.h:29
virtual std::shared_ptr< OperatorParameters > getJacobianParameters(std::shared_ptr< const AMP::LinearAlgebra::Vector >)
Definition Operator.h:180
std::shared_ptr< AMP::LinearAlgebra::Vector > subsetOutputVector(std::shared_ptr< AMP::LinearAlgebra::Vector > vec) const
Subset output vector.
std::shared_ptr< const AMP::LinearAlgebra::Vector > subsetInputVector(std::shared_ptr< const AMP::LinearAlgebra::Vector > vec) const
Subset input vector.
std::shared_ptr< AMP::Mesh::Mesh > getMesh()
Return the mesh.
Definition Operator.h:149
virtual std::shared_ptr< AMP::LinearAlgebra::VectorSelector > selectInputVector() const
Return the selector for input vectors.
virtual std::shared_ptr< AMP::LinearAlgebra::Variable > getInputVariable() const
Return the input variable.
Definition Operator.h:106
virtual void reInitializeVector(std::shared_ptr< AMP::LinearAlgebra::Vector >)
Definition Operator.h:167
AMP::Utilities::MemoryType d_memory_location
Definition Operator.h:195
Backend
Enum to store the backend used for gpu acceleration.
Definition Backend.h:21
MemoryType
Enum to store pointer type.
Definition Memory.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:41.
Comments on this page