~ubuntu-branches/ubuntu/trusty/rheolef/trusty

« back to all changes in this revision

Viewing changes to doc/usrman/transmission-error.cc

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito
  • Date: 2012-04-06 09:12:21 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120406091221-m58me99p1nxqui49
Tags: 6.0-1
* New upstream release 6.0 (major changes):
  - massively distributed and parallel support
  - full FEM characteristic method (Lagrange-Gakerkin method) support
  - enhanced users documentation 
  - source code supports g++-4.7 (closes: #667356)
* debian/control: dependencies for MPI distributed solvers added
* debian/rules: build commands simplified
* debian/librheolef-dev.install: man1/* to man9/* added
* debian/changelog: package description rewritted (closes: #661689)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include "rheolef/rheolef.h"
2
2
using namespace rheolef;
3
3
using namespace std;
4
 
 
 
4
size_t d;
5
5
Float epsilon;
6
 
 
7
6
Float u (const point& x) { 
8
 
  if (x[0] < Float(0.5)) 
9
 
    return x[0]*((1+3*epsilon)/(2*(1+epsilon)) - x[0])/(2*epsilon);
 
7
  Float x0 = (d <= 2) ? x[0] : x[1];
 
8
  if (x0 < Float(0.5))
 
9
    return x0*((1+3*epsilon)/(2*(1+epsilon)) - x0)/(2*epsilon);
10
10
  else
11
 
    return (1-x[0])*(x[0] + (1-epsilon)/(2*(1+epsilon)))/2;
 
11
    return (1-x0)*(x0 + (1-epsilon)/(2*(1+epsilon)))/2;
12
12
}
13
13
int main(int argc, char**argv)
14
14
{
 
15
  Float error_linf_expected = (argc > 1) ? atof(argv[1]) : 1e+38;
15
16
  field uh;
16
17
  cin >> catchmark("epsilon") >> epsilon
17
18
      >> catchmark("u")       >> uh;
 
19
  d = uh.get_geo().dimension();
18
20
  space Vh = uh.get_space();
19
21
  field pi_h_u = interpolate(Vh, u);
20
22
  field eh = pi_h_u - uh;
23
25
  Float error_l2   = sqrt(m(eh,eh));
24
26
  cerr << "error_linf "  << error_linf << endl
25
27
       << "error_l2   "  << error_l2   << endl;
26
 
  Float tol = 1e-5;
27
 
  return (error_linf < tol) && (error_l2 < tol) ? 0 : 1;
 
28
  return (error_linf < error_linf_expected) ? 0 : 1;
28
29
}