You are here:
Concepts
>
Concepts Web
>
Class documentation
Class documentation of Concepts
Loading...
Searching...
No Matches
hp2D
extrema.hh
Go to the documentation of this file.
1
7
#ifndef extrema_hh
8
#define extrema_hh
9
10
#include "hp2D.hh"
11
12
using
concepts::Real
;
13
using
concepts::Real2d
;
14
15
16
17
namespace
alglib
18
{
19
// Forward declaration;
20
class
real_1d_array;
21
}
22
23
24
namespace
concepts
{
25
//template for computing minimum or maximum
26
enum
Optimize { MIN, MAX };
27
}
28
29
30
namespace
hp2D
{
40
// *************************************************************** Extrema **
41
template
<concepts::Optimize T>
42
class
Extrema
:
public
concepts::OutputOperator
{
43
65
public
:
66
Extrema
(
const
concepts::SpaceOnCells<Real>
& spc,
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
76
static
Extrema<T>
*
pt2Object
;
77
78
protected
:
79
virtual
std::ostream&
info
(std::ostream& os)
const override
;
80
81
private
:
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
89
const
concepts::SpaceOnCells<Real>
& spc_;
90
//ElementFormula
91
const
concepts::ElementFormula<Real>
& frm_;
92
//Gradient of ElementFormula
93
const
concepts::ElementFormula<Real2d>
* frmGrad_;
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
103
concepts::Sequence<Real>
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
alglib::real_1d_array
Definition
ap.h:1231
concepts::ElementFormula
Definition
elementFormula.hh:35
concepts::OutputOperator
Definition
outputOperator.hh:42
concepts::Point< Real, 2 >
concepts::Sequence
Definition
sequence.hh:39
concepts::Set
Definition
set.hh:39
concepts::SpaceOnCells
Definition
space.hh:81
hp2D::Extrema
Definition
extrema.hh:42
hp2D::Extrema::pt2Object
static Extrema< T > * pt2Object
Inner static pointer to object, used by the wrapper.
Definition
extrema.hh:76
hp2D::Extrema::Extrema
Extrema(const concepts::SpaceOnCells< Real > &spc, const concepts::ElementFormula< Real > &formula, const concepts::ElementFormula< Real2d > *formulaGrad=0, uint np=2, bool report=false)
hp2D::Extrema::info
virtual std::ostream & info(std::ostream &os) const override
Returns information in an output stream.
hp2D::Quad
Definition
quad.hh:271
concepts
Definition
pml_formula.h:16
concepts::Real
double Real
Definition
typedefs.hh:39
hp2D
Definition
explicitResidual.hh:120
Generated on Wed Sep 13 2023 21:06:20 for Concepts by
1.9.8