rheolef  6.6
cosinusprod_error.cc
Go to the documentation of this file.
1 #include "rheolef.h"
2 using namespace rheolef;
3 using namespace std;
4 #include "cosinusprod.icc"
5 int main(int argc, char**argv) {
6  environment rheolef(argc, argv);
7  Float error_linf_expected = (argc > 1) ? atof(argv[1]) : 1e+38;
8  field uh; din >> uh;
9  space Xh = uh.get_space();
10  size_t d = Xh.get_geo().dimension();
11  field pi_h_u = interpolate(Xh, u_exact(d));
12  field eh = uh - pi_h_u;
13  trial u (Xh); test v (Xh);
14  form m = integrate (u*v);
15  form a = integrate (dot(grad(u),grad(v)));
16  dout << "error_l2 " << sqrt(m(eh,eh)) << endl
17  << "error_linf " << eh.max_abs() << endl
18  << "error_h1 " << sqrt(a(eh,eh)) << endl;
19  return (eh.max_abs() <= error_linf_expected) ? 0 : 1;
20 }
field - piecewise polynomial finite element field
Definition: field.h:225
field_vf_expr< field_vf_expr_grad< test_basic< T, M, VfTag > >> grad(const test_basic< T, M, VfTag > &x)
Definition: operators2.h:74
int main(int argc, char **argv)
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)
space – piecewise polynomial finite element space
Definition: space.h:229
double Float
Definition: compiler.h:177
size_t d
field_nonlinear_expr< field_nonlinear_expr_uf< details::sqrt_,field_expr_terminal_field< T, M > > > sqrt(const field_basic< T, M > &x)
idiststream din(cin)
T dot(const vec< T, M > &x, const int &y)
form - representation of a finite element bilinear form
Definition: form.h:98
Float u(const point &x)
T max_abs() const
Definition: field.h:598
odiststream dout(cout)
Definition: diststream.h:317
field_basic< T, M > integrate(const geo_basic< T, M > &domain, const test_basic< T, M, details::vf_tag_01 > &expr, const quadrature_option_type &qopt=quadrature_option_type())
integrate - integrate a function or an expression
Definition: integrate.h:90