~ubuntu-branches/ubuntu/raring/rheolef/raring-proposed

« back to all changes in this revision

Viewing changes to doc/pexamples/sphere.icc

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito, Pierre Saramito, Sylvestre Ledru
  • Date: 2012-05-14 14:02:09 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120514140209-dzbdlidkotyflf9e
Tags: 6.1-1
[ Pierre Saramito ]
* New upstream release 6.1 (minor changes):
  - support arbitrarily polynomial order Pk
  - source code supports g++-4.7 (closes: #671996)

[ Sylvestre Ledru ]
* update of the watch file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
struct p : std::unary_function<point,Float> {
 
2
  Float operator() (const point& x) const {
 
3
    if (d == 2) return 26*(pow(x[0],5) - 10*pow(x[0],3)*sqr(x[1]) 
 
4
                                       + 5*x[0]*pow(x[1],4));
 
5
    else        return 3*sqr(x[0])*x[1] - pow(x[1],3);
 
6
  }
 
7
  p (size_t d1) : d(d1) {}
 
8
  protected: size_t d;
 
9
};
 
10
struct f : std::unary_function<point,Float> {
 
11
  Float operator() (const point& x) const {
 
12
    if (d == 2) return _p(x)/pow(norm(x),5);
 
13
    else        return alpha*_p(x);
 
14
  }
 
15
  f (size_t d1) : d(d1), _p(d1) {
 
16
    Float pi = acos(Float(-1));
 
17
    alpha = -(13./8.)*sqrt(35./pi);
 
18
  }
 
19
  protected: size_t d; p _p; Float alpha;
 
20
};
 
21
struct u : std::unary_function<point,Float> {
 
22
  Float operator() (const point& x) const {
 
23
    if (d == 2) return _f(x)/(25+sqr(norm(x)));
 
24
    else        return sqr(norm(x))/(12+sqr(norm(x)))*_f(x);
 
25
  }
 
26
  u (size_t d1) : d(d1), _f(d1) {}
 
27
  protected: size_t d; f _f;
 
28
};
 
29
Float phi (const point& x) { return norm(x) - 1; }