File: myfunction2.cpp

package info (click to toggle)
freefem%2B%2B 3.47%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 132,088 kB
  • ctags: 19,726
  • sloc: cpp: 138,951; ansic: 22,605; sh: 4,951; makefile: 2,935; fortran: 1,147; perl: 768; awk: 282; php: 182
file content (21 lines) | stat: -rw-r--r-- 620 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Example C++ function "myfunction", dynamically loaded into "load.edp"
// ---------------------------------------------------------------------
// $Id$
#include <ff++.hpp>
using namespace Fem2D;
double myf(string * s) {
  cout << *s << endl;
  return 0.;
}
double f(const double& x) { return x*x+1;} 
//  Hack to do something at initialisation time
//   to add the name myfunction to the freefem++ table 
/*  class Init { public:
  Init();
};
$1 */
static void Load_Init(){
  Global.Add("Why","(",new OneOperator1<double,string*>(myf));
  Global.Add("f","(",new OneOperator1_<double,double>(f));
}
LOADFUNC(Load_Init)