IntegrateTest.cpp 889 Bytes
Newer Older
Praetorius, Simon's avatar
Praetorius, Simon committed
1
2
3
4
5
6
7
8
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:

#include <iostream>

#include <dune/geometry/type.hh>

#include <amdis/AMDiS.hpp>
9
#include <amdis/Integrate.hpp>
Praetorius, Simon's avatar
Praetorius, Simon committed
10
11
12
13
#include <amdis/ProblemStat.hpp>

#include "Tests.hpp"

14
15
#include <dune/grid/yaspgrid.hh>

Praetorius, Simon's avatar
Praetorius, Simon committed
16
17
using namespace AMDiS;

18
using ElliptParam   = LagrangeBasis<Dune::YaspGrid<2>, 1>;
Praetorius, Simon's avatar
Praetorius, Simon committed
19
20
21
22
using ElliptProblem = ProblemStat<ElliptParam>;

int main(int argc, char** argv)
{
23
  Environment env(argc, argv);
Praetorius, Simon's avatar
Praetorius, Simon committed
24
25
26
27

  ElliptProblem prob("ellipt");
  prob.initialize(INIT_ALL);

28
  auto u = prob.solution();
Praetorius, Simon's avatar
Praetorius, Simon committed
29
  auto gv = u.basis().gridView();
Praetorius, Simon's avatar
Praetorius, Simon committed
30
31

  u << 1.0;
32
33
34
  double i1 = integrate(1.0, gv);
  double i2 = integrate(u, gv);
  double i3 = integrate([](auto const& x) { return 1.0; }, gv, 0);
Praetorius, Simon's avatar
Praetorius, Simon committed
35

36
37
38
  AMDIS_TEST_APPROX(i1, 1.0);
  AMDIS_TEST_APPROX(i2, 1.0);
  AMDIS_TEST_APPROX(i3, 1.0);
Praetorius, Simon's avatar
Praetorius, Simon committed
39

40
  return report_errors();
Praetorius, Simon's avatar
Praetorius, Simon committed
41
}