rheolef  7.0
neumann-laplace-check.cc
Go to the documentation of this file.
1 #include "rheolef.h"
2 using namespace rheolef;
3 using namespace std;
4 size_t N;
5 Float u_ex (const point& x) { return - 1./12 + (x[0]*(1-x[0]) + x[1]*(1-x[1]) + x[2]*(1-x[2]))/(2.*N); }
6 int main(int argc, char**argv) {
7  environment rheolef (argc, argv);
8  Float error_linf_expected = (argc > 1) ? atof(argv[1]) : 1e+38;
9  field uh; din >> uh;
10  const space& Xh = uh.get_space();
11  N = Xh.get_geo().dimension();
12  field pi_h_u = interpolate(Xh, u_ex);
13  field eh = pi_h_u - uh;
14  trial u (Xh); test v (Xh);
15  form m = integrate (u*v);
16  form a = integrate (dot(grad(u),grad(v)));
17  derr << "error_l2 " << sqrt(m(eh,eh)) << endl
18  << "error_h1 " << sqrt(a(eh,eh)) << endl
19  << "error_linf " << eh.max_abs() << endl;
20  return (eh.max_abs() <= error_linf_expected) ? 0 : 1;
21 }
T max_abs() const
Definition: field.h:624
field - piecewise polynomial finite element field
size_t N
Float u_ex(const point &x)
point - vertex of a mesh
Definition: point.h:22
rheolef::std enable_if ::type dot const Expr1 expr1, const Expr2 expr2 dot(const Expr1 &expr1, const Expr2 &expr2)
Definition: vec_expr_v2.h:335
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)
int main(int argc, char **argv)
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
std::enable_if< details::is_field_expr_v2_linear_arg< Expr >::value,details::field_expr_v2_nonlinear_terminal_field_grad< typename Expr::scalar_type,typename Expr::memory_type >>::type grad(const Expr &expr)
idiststream din(cin)
odiststream derr(cerr)
Definition: diststream.h:329
form - representation of a finite element bilinear form
Definition: form.h:98
Float u(const point &x)