rheolef  7.0
transmission_error.cc
Go to the documentation of this file.
1 #include "rheolef.h"
2 using namespace rheolef;
3 using namespace std;
4 size_t d;
6 Float u (const point& x) {
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  else
11  return (1-x0)*(x0 + (1-epsilon)/(2*(1+epsilon)))/2;
12 }
13 int main(int argc, char**argv) {
14  environment rheolef (argc, argv);
15  Float error_linf_expected = (argc > 1) ? atof(argv[1]) : 1e+38;
16  field uh;
17  din >> catchmark("epsilon") >> epsilon
18  >> catchmark("u") >> uh;
19  d = uh.get_geo().dimension();
20  space Xh = uh.get_space();
21  field pi_h_u = interpolate(Xh, u);
22  field eh = pi_h_u - uh;
23  trial u (Xh); test v (Xh);
24  form m = integrate (u*v);
25  derr << "error_linf " << eh.max_abs() << endl
26  << "error_l2 " << sqrt(m(eh,eh)) << endl;
27  return (eh.max_abs() < error_linf_expected) ? 0 : 1;
28 }
T max_abs() const
Definition: field.h:624
field - piecewise polynomial finite element field
point - vertex of a mesh
Definition: point.h:22
STL namespace.
irheostream, orheostream - large data streams
Definition: compiler.h:7
static field_basic< T, sequential > interpolate(const space_basic< T, sequential > &Vh, const field_basic< T, sequential > &uh)
std::enable_if< details::is_field_expr_v2_nonlinear_arg< Expr >::value &&! is_undeterminated< Result >::value, Result >::type integrate(const geo_basic< T, M > &omega, const Expr &expr, const quadrature_option &qopt, Result dummy=Result())
integrate - integrate a function or an expression
Definition: integrate.h:107
space – piecewise polynomial finite element space
Definition: space.h:229
double Float
Definition: compiler.h:160
idiststream din(cin)
Definition: rotating-hill.h:1
int main(int argc, char **argv)
catchmark - iostream manipulator
Definition: catchmark.h:30
Float epsilon
size_t d
odiststream derr(cerr)
Definition: diststream.h:329
form - representation of a finite element bilinear form
Definition: form.h:98
Float u(const point &x)