Advanced Multi-Physics (AMP)
On-Line Documentation
SecondOperator.h
Go to the documentation of this file.
1#ifndef included_AMP_SecondOperator
2#define included_AMP_SecondOperator
3
4#include "AMP/operators/newFrozenVectorDesign/OnePointOperator.h"
5#include "AMP/vectors/MultiVariable.h"
6
7namespace AMP::Operator {
8
10{
11public:
12 explicit SecondOperator( std::shared_ptr<const OperatorParameters> params )
13 : OnePointOperator( params )
14 {
15 d_constant = 3.0;
17 new AMP::LinearAlgebra::Variable( params->d_db->getString( "PrimaryVariable" ) ) );
18 d_secondaryVar.reset(
19 new AMP::LinearAlgebra::Variable( params->d_db->getString( "SecondaryVariable" ) ) );
20 }
21
22 std::string type() const override { return "SecondOperator"; }
23
26 {
27 auto inP = u->subsetVectorForVariable( d_primaryVar );
28 auto inS = u->subsetVectorForVariable( d_secondaryVar );
29 auto out = r->subsetVectorForVariable( d_primaryVar );
30 out->linearSum( d_constant, *inP, 1.0, *inS );
31 }
32
33 std::shared_ptr<AMP::LinearAlgebra::Variable> getInputVariable() const override
34 {
35 auto retVariable = std::make_shared<AMP::LinearAlgebra::MultiVariable>( "MultiVariable" );
38 return retVariable;
39 }
40
41 std::shared_ptr<AMP::LinearAlgebra::Variable> getOutputVariable() const override
42 {
43 return d_primaryVar;
44 }
45
46protected:
47 std::shared_ptr<AMP::LinearAlgebra::Variable> d_primaryVar;
48 std::shared_ptr<AMP::LinearAlgebra::Variable> d_secondaryVar;
49
50private:
51};
52} // namespace AMP::Operator
53
54#endif
A description of the data in the vector.
Definition Variable.h:46
std::shared_ptr< Vector > shared_ptr
Shorthand for shared pointer to Vector.
Definition Vector.h:60
std::shared_ptr< const Vector > const_shared_ptr
Definition Vector.h:65
virtual void reset(std::shared_ptr< const OperatorParameters > params)
std::shared_ptr< AMP::Operator::Operator > shared_ptr
Definition Operator.h:29
std::shared_ptr< AMP::LinearAlgebra::Variable > d_secondaryVar
SecondOperator(std::shared_ptr< const OperatorParameters > params)
std::shared_ptr< AMP::LinearAlgebra::Variable > getInputVariable() const override
Return the input variable.
void apply(AMP::LinearAlgebra::Vector::const_shared_ptr u, AMP::LinearAlgebra::Vector::shared_ptr r) override
std::shared_ptr< AMP::LinearAlgebra::Variable > d_primaryVar
std::string type() const override
Return the name of the operator.
std::shared_ptr< AMP::LinearAlgebra::Variable > getOutputVariable() const override
Return the output variable.



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