Advanced Multi-Physics (AMP)
On-Line Documentation
FunctionOperator.h
Go to the documentation of this file.
1#ifndef included_AMP_FunctionOperator
2#define included_AMP_FunctionOperator
3
4
5#include "AMP/operators/Operator.h"
6
7
8namespace AMP::Operator {
9
10
12{
13public:
14 FunctionOperator( std::function<double( double )> f ) : d_f( f ) {}
15 std::string type() const override { return "FunctionOperator"; }
16 void apply( std::shared_ptr<const AMP::LinearAlgebra::Vector> f,
17 std::shared_ptr<AMP::LinearAlgebra::Vector> r ) override
18 {
19 auto it_f = f->begin();
20 auto it_r = r->begin();
21 for ( size_t i = 0; i < it_f.size(); ++i, ++it_f, ++it_r )
22 *it_r = d_f( *it_f );
23 }
24
25private:
26 std::function<double( double )> d_f;
27};
28
29
30} // namespace AMP::Operator
31#endif
FunctionOperator(std::function< double(double)> f)
void apply(std::shared_ptr< const AMP::LinearAlgebra::Vector > f, std::shared_ptr< AMP::LinearAlgebra::Vector > r) override
std::function< double(double)> d_f
std::string type() const override
Return the name of the operator.
std::shared_ptr< AMP::Operator::Operator > shared_ptr
Definition Operator.h:29



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