Debian Codegraph @

src/Algo/NRJ.hpp

raw symbols SCIP
1 /****************************************************************************/cxx . . $ `<file>/src/Algo/NRJ.hpp`/
2 /* This file is part of FreeFEM. */
3 /* */
4 /* FreeFEM is free software: you can redistribute it and/or modify */
5 /* it under the terms of the GNU Lesser General Public License as */
6 /* published by the Free Software Foundation, either version 3 of */
7 /* the License, or (at your option) any later version. */
8 /* */
9 /* FreeFEM is distributed in the hope that it will be useful, */
10 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
11 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
12 /* GNU Lesser General Public License for more details. */
13 /* */
14 /* You should have received a copy of the GNU Lesser General Public License */
15 /* along with FreeFEM. If not, see <http://www.gnu.org/licenses/>. */
16 /****************************************************************************/
17 // SUMMARY : ...
18 // LICENSE : LGPLv3
19 // ORG : LJLL Universite Pierre et Marie Curie, Paris, FRANCE
20 // AUTHORS : ...
21 // E-MAIL : ...
22
23 #ifndef NRJ_HH
24 #define NRJ_HHcxx . . $ `src/Algo/NRJ.hpp:24:9`!
25
26 #include "defs.hpp"cxx . . $ `<file>/src/Algo/defs.hpp`/
27
28 // Warning :
29 // - no copy operator
30 // - no = operator
31
32 template< class Param, class Vect, class Mat, class Real >
33 class tNRJcxx . . $ tNRJ# {
34 protected:
35 int nappel_valcxx . . $ tNRJ#nappel_val.;
36 int nappel_gradcxx . . $ tNRJ#nappel_grad.;
37 int nappel_hesscxx . . $ tNRJ#nappel_hess.;
38 int nparamcxx . . $ tNRJ#nparam.;
39
40 Real valcxx . . $ tNRJ#val.;
41 Vect *gradcxx . . $ tNRJ#grad.;
42 Mat *hesscxx . . $ tNRJ#hess.;
43
44 public:
45 // Warning:
46 // In the tNRJ constructor, you must initialize grad and/or hess if you use it
47 // That is not done automatically as it depends on type
48 tNRJcxx . . $ tNRJ#`tNRJ<Param, Vect, Mat, Real>`(d4f767463ce0a6b3).(int);
49 virtual ~cxx . . $ tNRJ#`~tNRJ<Param, Vect, Mat, Real>`(49f6e7a06ebc5aa8).tNRJ( );
50
51 // To precise for each function of tNRJ
52 virtual Real Valcxx . . $ tNRJ#Val(f500175d9f5e9e70).(const Param &) = 0;
53
54 Real getValcxx . . $ tNRJ#getVal(f500175d9f5e9e70).(const Param &);
55
56 // To precise if needed, else return null
57 virtual Vect *Gradientcxx . . $ tNRJ#Gradient(b8803fc2f699eb8b).(const Param &);
58
59 Vect *getGradientcxx . . $ tNRJ#getGradient(b8803fc2f699eb8b).(const Param &);
60
61 // To precise if needed, else return null
62 virtual Mat *Hessiancxx . . $ tNRJ#Hessian(41e6e37e6163bc37).(const Param &);
63
64 Mat *getHessiancxx . . $ tNRJ#getHessian(41e6e37e6163bc37).(const Param &);
65
66 int Appel_Valcxx . . $ tNRJ#Appel_Val(455f465bc33b4cdf).( ) const { return nappel_valcxx . . $ tNRJ#nappel_val.; };
67 int Appel_Gradcxx . . $ tNRJ#Appel_Grad(455f465bc33b4cdf).( ) const { return nappel_gradcxx . . $ tNRJ#nappel_grad.; };
68 int Appel_Hesscxx . . $ tNRJ#Appel_Hess(455f465bc33b4cdf).( ) const { return nappel_hesscxx . . $ tNRJ#nappel_hess.; };
69 };
70
71 template< class Param, class Vect, class Mat, class Real >
72 tNRJcxx . . $ tNRJ#< Param, Vect, Mat, Real >::~cxx . . $ tNRJ#`~tNRJ<Param, Vect, Mat, Real>`(49f6e7a06ebc5aa8).tNRJ( ) {
73 if (gradcxx . . $ tNRJ#grad. !=cxx . . $ std/`operator!=`(bf4c77cd91c4b201). NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!) delete gradcxx . . $ tNRJ#grad.;
74 if (hesscxx . . $ tNRJ#hess. !=cxx . . $ std/`operator!=`(bf4c77cd91c4b201). NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!) delete hesscxx . . $ tNRJ#hess.;
75 }
76
77 template< class Param, class Vect, class Mat, class Real >
78 tNRJcxx . . $ tNRJ#< Param, Vect, Mat, Real >::tNRJcxx . . $ tNRJ#`tNRJ<Param, Vect, Mat, Real>`(d4f767463ce0a6b3).(int n) : valcxx . . $ tNRJ#val.(0.) {
79 nparamcxx . . $ tNRJ#nparam. = n;
80 nappel_valcxx . . $ tNRJ#nappel_val. = 0;
81 nappel_gradcxx . . $ tNRJ#nappel_grad. = 0;
82 nappel_hesscxx . . $ tNRJ#nappel_hess. = 0;
83 gradcxx . . $ tNRJ#grad. = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!;
84 hesscxx . . $ tNRJ#hess. = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!;
85 }
86
87 template< class Param, class Vect, class Mat, class Real >
88 Real tNRJcxx . . $ tNRJ#< Param, Vect, Mat, Real >::getValcxx . . $ tNRJ#getVal(f500175d9f5e9e70).(const Param &p) {
89 nappel_valcxx . . $ tNRJ#nappel_val.++;
90 return Valcxx . . $ tNRJ#Val(f500175d9f5e9e70).(p);
91 }
92
93 template< class Param, class Vect, class Mat, class Real >
94 Vect *tNRJcxx . . $ tNRJ#< Param, Vect, Mat, Real >::getGradientcxx . . $ tNRJ#getGradient(b8803fc2f699eb8b).(const Param &p) {
95 nappel_gradcxx . . $ tNRJ#nappel_grad.++;
96 return Gradientcxx . . $ tNRJ#Gradient(b8803fc2f699eb8b).(p);
97 }
98
99 template< class Param, class Vect, class Mat, class Real >
100 Vect *tNRJcxx . . $ tNRJ#< Param, Vect, Mat, Real >::Gradientcxx . . $ tNRJ#Gradient(b8803fc2f699eb8b).(const Param &) {
101 return NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!;
102 }
103
104 template< class Param, class Vect, class Mat, class Real >
105 Mat *tNRJcxx . . $ tNRJ#< Param, Vect, Mat, Real >::getHessiancxx . . $ tNRJ#getHessian(41e6e37e6163bc37).(const Param &p) {
106 nappel_hesscxx . . $ tNRJ#nappel_hess.++;
107 return Hessiancxx . . $ tNRJ#Hessian(41e6e37e6163bc37).(p);
108 }
109
110 template< class Param, class Vect, class Mat, class Real >
111 Mat *tNRJcxx . . $ tNRJ#< Param, Vect, Mat, Real >::Hessiancxx . . $ tNRJ#Hessian(41e6e37e6163bc37).(const Param &) {
112 return NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!;
113 }
114
115 #endif