Advanced Multi-Physics (AMP)
On-Line Documentation
OnePointSolver.h
Go to the documentation of this file.
1
2#ifndef included_AMP_OnePointSolver
3#define included_AMP_OnePointSolver
4
5#include "AMP/operators/newFrozenVectorDesign/OnePointOperator.h"
6#include "AMP/solvers/SolverStrategy.h"
7#include "AMP/vectors/newFrozenVectorDesign/newFrozenVectorDesignHelpers.h"
8
9namespace AMP::Solver {
10
12{
13public:
14 explicit OnePointSolver( std::shared_ptr<SolverStrategyParameters> params )
15 : SolverStrategy( params ),
16 d_onePointOp( std::dynamic_pointer_cast<AMP::Operator::OnePointOperator>( d_pOperator ) )
17 {
18 }
19
20 std::string type() const override { return "OnePointSolver"; }
21
22 virtual void apply( std::shared_ptr<const AMP::LinearAlgebra::Vector> f,
23 std::shared_ptr<AMP::LinearAlgebra::Vector> u ) override
24 {
25 // Assumption: primaryInputVar = outputVar
26 // General solution: To avoid making the above assumption, we can replace
27 // getInputVariable() with getPrimaryInputVariable() and use it for the u vector.
28 auto myU = u->subsetVectorForVariable( d_onePointOp->getOutputVariable() );
30 myU->zero();
31 } else {
32 myU->makeConsistent();
33 }
34 auto r = myU->clone();
35 d_onePointOp->residual( f, u, r );
36 double inverseConstant = 1.0 / ( d_onePointOp->getConstant() );
37 myU->axpy( inverseConstant, *r, *myU );
38 myU->makeConsistent();
39 // If you want to use an external solver library like Petsc or Trilinos here
40 // then you will need to use the two functions defined in the
41 // vectors/newFrozenVectorDesign/newFrozenVectorDesignHelpers.h file
42 }
43
44protected:
45 std::shared_ptr<AMP::Operator::OnePointOperator> d_onePointOp;
46};
47} // namespace AMP::Solver
48
49#endif
OnePointSolver(std::shared_ptr< SolverStrategyParameters > params)
std::shared_ptr< AMP::Operator::OnePointOperator > d_onePointOp
std::string type() const override
Return the name of the solver.
virtual void apply(std::shared_ptr< const AMP::LinearAlgebra::Vector > f, std::shared_ptr< AMP::LinearAlgebra::Vector > u) override
std::shared_ptr< AMP::Solver::SolverStrategy > shared_ptr
std::shared_ptr< AMP::Operator::Operator > d_pOperator



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