Debian Codegraph @

src/Algo/defs.hpp

raw symbols SCIP
1 /****************************************************************************/cxx . . $ `<file>/src/Algo/defs.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 : Frederic Hecht
21 // E-MAIL : [email protected]
22
23 #ifndef _DEFS_H_
24 #define _DEFS_H_cxx . . $ `src/Algo/defs.hpp:24:9`!
25
26 #ifndef GLIB
27 #define GLIBcxx . . $ `src/Algo/defs.hpp:27:9`!
28
29 #include <iostream>
30 #include <fstream>
31 #include <cstdlib>
32 #include <cstdio>
33 #include <stddef.h>
34 #include <cmath>
35 #include <cstring>
36 #include <list>
37 using namespace std;
38
39 #endif
40
41 // Define simple constants
42 #ifndef Pi
43 #define Picxx . . $ `src/Algo/defs.hpp:43:9`! (3.141592653589793)
44 #endif
45 #ifndef TINY // used in BrentLS and Matrix
46 #define TINYcxx . . $ `src/Algo/defs.hpp:46:9`! 1.0e-20
47 #endif
48 #ifndef True
49 #define Truecxx . . $ `src/Algo/defs.hpp:49:9`! (1)
50 #endif
51 #ifndef False
52 #define Falsecxx . . $ `src/Algo/defs.hpp:52:9`! (0)
53 #endif
54 #ifndef Yes
55 #define Yescxx . . $ `src/Algo/defs.hpp:55:9`! (1)
56 #endif
57 #ifndef No
58 #define Nocxx . . $ `src/Algo/defs.hpp:58:9`! (0)
59 #endif
60
61 // Define some simple template functions
62 #ifndef Sgn
63 #define Sgncxx . . $ `src/Algo/defs.hpp:63:9`!(x) ((x) < 0 ? -1.0 : 1.0)
64 #endif
65 #ifndef Abs
66 #define Abscxx . . $ `src/Algo/defs.hpp:66:9`!(x) ((x) < 0 ? -(x) : (x))
67 #endif
68 #ifndef Max
69 #define Maxcxx . . $ `src/Algo/defs.hpp:69:9`!(x, y) ((x) > (y) ? (x) : (y))
70 #endif
71 #ifndef Min
72 #define Mincxx . . $ `src/Algo/defs.hpp:72:9`!(x, y) ((x) < (y) ? (x) : (y))
73 #endif
74
75 #ifndef inValidSize
76 #define inValidSizecxx . . $ `src/Algo/defs.hpp:76:9`!( ) cerr << "Warning: incompatible sizes!" << endl;
77 #endif
78
79 // Lists operations
80
81 /*!
82 * \brief Display list
83 * \param l List
84 */
85 template< class Type >
86 void displaycxx . . $ display(98513a4378d5e3ab).(listcxx . . $ list#< Type > l) {
87 typename listcxx . . $ std/__cxx11/list#< Type >::iterator il;
88 for (il = l.begincxx . . $ std/__cxx11/list#begin(ccb24b3dd4984e3f).( ); il !=cxx . . $ std/`operator!=`(bf4c77cd91c4b201). l.endcxx . . $ std/__cxx11/list#end(ccb24b3dd4984e3f).( ); ++il) coutcxx . . $ cout. <<cxx . . $ `operator<<`(9ced1f356fedeebb). (*cxx . . $ `operator*`(ca0d58f853b0940).il) <<cxx . . $ `operator<<`(9ced1f356fedeebb). " ";
89 coutcxx . . $ cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
90 }
91
92 /*!
93 * \brief Normalize list
94 * \param l List
95 */
96 template< class Type >
97 listcxx . . $ list#< Type > normalizecxx . . $ normalize(72faf805eb51adfb).(listcxx . . $ list#< Type > l) {
98 listcxx . . $ list#< Type > v(l);
99 Type scale = l.frontcxx . . $ std/__cxx11/list#front(ebe81142529c1f9a).( );
100 typename listcxx . . $ std/__cxx11/list#< Type >::iterator il;
101
102 if (scale ==cxx . . $ std/`operator==`(bf4c77cd91c4b201). 0) {
103 cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "First element is zero, cannot be normed! \n";
104 return v;
105 } else {
106 for (il = v.begincxx . . $ std/__cxx11/list#begin(ccb24b3dd4984e3f).( ); il !=cxx . . $ std/`operator!=`(bf4c77cd91c4b201). v.endcxx . . $ std/__cxx11/list#end(ccb24b3dd4984e3f).( ); ++il) *cxx . . $ `operator*`(ca0d58f853b0940).il /= scale;
107 return v;
108 }
109 }
110
111 #endif //_DEFS_H_