OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::opti::OptiCaseAnalytical< S, C > Class Template Reference

Gradient is just passed as a function (and not computed by an own routine) More...

#include <optiCase.h>

+ Inheritance diagram for olb::opti::OptiCaseAnalytical< S, C >:
+ Collaboration diagram for olb::opti::OptiCaseAnalytical< S, C >:

Public Member Functions

 OptiCaseAnalytical (std::function< S(const C &)> function, std::function< void(const C &, C &)> derivative, std::function< void(void)> postEvaluation=[](){})
 
 OptiCaseAnalytical ()
 
void setObjective (std::function< S(const C &)> f)
 
void setDerivative (std::function< void(const C &, C &)> d)
 
evaluateObjective (const C &control, unsigned optiStep=0) override
 
void computeDerivatives (const C &control, C &derivatives, unsigned optiStep=0) override
 
- Public Member Functions inherited from olb::opti::OptiCase< S, C >
 OptiCase ()=default
 
 OptiCase (std::function< void(void)> postEvaluation)
 
void postEvaluation ()
 

Protected Attributes

std::function< S(const C &)> _function
 
std::function< void(const C &, C &)> _derivative
 
- Protected Attributes inherited from olb::opti::OptiCase< S, C >
std::function< void(void)> _postEvaluation
 

Detailed Description

template<typename S, typename C>
class olb::opti::OptiCaseAnalytical< S, C >

Gradient is just passed as a function (and not computed by an own routine)

Definition at line 64 of file optiCase.h.

Constructor & Destructor Documentation

◆ OptiCaseAnalytical() [1/2]

template<typename S , typename C >
olb::opti::OptiCaseAnalytical< S, C >::OptiCaseAnalytical ( std::function< S(const C &)> function,
std::function< void(const C &, C &)> derivative,
std::function< void(void)> postEvaluation = [](){} )
inline

Definition at line 71 of file optiCase.h.

73 {})
75 { }
std::function< S(const C &)> _function
Definition optiCase.h:67
std::function< void(const C &, C &)> _derivative
Definition optiCase.h:68
std::string function(const std::string &body, const std::string &arg)
Print as functions.

◆ OptiCaseAnalytical() [2/2]

template<typename S , typename C >
olb::opti::OptiCaseAnalytical< S, C >::OptiCaseAnalytical ( )
inline

Definition at line 78 of file optiCase.h.

78{}

Member Function Documentation

◆ computeDerivatives()

template<typename S , typename C >
void olb::opti::OptiCaseAnalytical< S, C >::computeDerivatives ( const C & control,
C & derivatives,
unsigned optiStep = 0 )
inlineoverridevirtual

Implements olb::opti::OptiCase< S, C >.

Definition at line 93 of file optiCase.h.

94 {
95 _derivative(control, derivatives);
96 }

References olb::opti::OptiCaseAnalytical< S, C >::_derivative, and olb::opti::control.

◆ evaluateObjective()

template<typename S , typename C >
S olb::opti::OptiCaseAnalytical< S, C >::evaluateObjective ( const C & control,
unsigned optiStep = 0 )
inlineoverridevirtual

Implements olb::opti::OptiCase< S, C >.

Definition at line 88 of file optiCase.h.

89 {
90 return _function(control);
91 }

References olb::opti::OptiCaseAnalytical< S, C >::_function, and olb::opti::control.

◆ setDerivative()

template<typename S , typename C >
void olb::opti::OptiCaseAnalytical< S, C >::setDerivative ( std::function< void(const C &, C &)> d)
inline

Definition at line 84 of file optiCase.h.

84 {
85 _derivative = d;
86 }
constexpr int d() any_platform
Definition functions.h:127

References olb::opti::OptiCaseAnalytical< S, C >::_derivative.

◆ setObjective()

template<typename S , typename C >
void olb::opti::OptiCaseAnalytical< S, C >::setObjective ( std::function< S(const C &)> f)
inline

Definition at line 80 of file optiCase.h.

80 {
81 _function = f;
82 }

References olb::opti::OptiCaseAnalytical< S, C >::_function.

Member Data Documentation

◆ _derivative

template<typename S , typename C >
std::function<void (const C&, C&)> olb::opti::OptiCaseAnalytical< S, C >::_derivative
protected

Definition at line 68 of file optiCase.h.

◆ _function

template<typename S , typename C >
std::function<S (const C&)> olb::opti::OptiCaseAnalytical< S, C >::_function
protected

Definition at line 67 of file optiCase.h.


The documentation for this class was generated from the following file: