Class documentation of Concepts

Loading...
Searching...
No Matches
extrema.hh
Go to the documentation of this file.
1
7#ifndef extrema_hh
8#define extrema_hh
9
10#include "hp2D.hh"
11
12using concepts::Real;
14
15
16
17namespace alglib
18{
19 // Forward declaration;
20 class real_1d_array;
21}
22
23
24namespace concepts{
25 //template for computing minimum or maximum
26 enum Optimize { MIN, MAX };
27}
28
29
30namespace hp2D{
40// *************************************************************** Extrema **
41template <concepts::Optimize T>
43
65public:
67 const concepts::ElementFormula<Real>& formula,
68 const concepts::ElementFormula<Real2d>* formulaGrad = 0,
69 uint np = 2,
70 bool report = false);
71
72 //return maximum/minimum
73 Real get() const;
74
77
78protected:
79 virtual std::ostream& info(std::ostream& os) const override;
80
81private:
82
83
84 //search points in one cell
85 std::vector<std::string> points_;
86 //the local (possible global) maximum on the underlying elm
87 std::set<Real> extrema_;
88 //space on which ElementFormula is given
90 //ElementFormula
92 //Gradient of ElementFormula
94 //underlying element
95 const hp2D::Quad<Real>* elm_;
96 // np^2 number of start points
97 uint np_;
98 //flag for report of convergence
99 bool report_;
100 //current function max
101 Real curFunc_;
102 //candidates of positions and vals
104
105
106 //returns -1 for T = MAX, 1 for T = MIN
107 Real sign_() const;
108
109 //returns the extrema on one cell
110 Real get_(const concepts::Set<Real>& vals) const;
111
112 //computes the maximum on one cell (of type hp2D::Quad<Real> only)
113 Real compute_(const hp2D::Quad<concepts::Real>& quad);
114
121 void reportOutput_(uint K, const std::string& point, int terminationType) const;
122
123
124 static void Wrapper_To_Call_Grad_(const alglib::real_1d_array &x, double &func, alglib::real_1d_array &grad, void *ptr);
125
126 static void Wrapper_To_Call_Fun_(const alglib::real_1d_array &x, double &func, void *ptr);
127
128 //evaluation of the gradient
129 void evalsG_(const alglib::real_1d_array &x, double &func, alglib::real_1d_array &grad, void *ptr);
130
131 //evaluation of the function
132 void evalsF_(const alglib::real_1d_array &x, double &func, void *ptr);
133
134};
135
136}//namespace hp2D
137
138#endif //minMax_hh
static Extrema< T > * pt2Object
Inner static pointer to object, used by the wrapper.
Definition extrema.hh:76
Extrema(const concepts::SpaceOnCells< Real > &spc, const concepts::ElementFormula< Real > &formula, const concepts::ElementFormula< Real2d > *formulaGrad=0, uint np=2, bool report=false)
virtual std::ostream & info(std::ostream &os) const override
Returns information in an output stream.
double Real
Definition typedefs.hh:39