ProblemStatTest.cpp 1.61 KB
Newer Older
1
#include <amdis/AMDiS.hpp>
2
#include <amdis/AdaptStationary.hpp>
3
4
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp>
Praetorius, Simon's avatar
Praetorius, Simon committed
5
#include <amdis/common/QuadMath.hpp>
6

Praetorius, Simon's avatar
Praetorius, Simon committed
7
8
#include <dune/common/version.hh>
#include <dune/grid/yaspgrid.hh>
9

Praetorius, Simon's avatar
Praetorius, Simon committed
10
using namespace AMDiS;
11
12
13
14

template <class T>
void test()
{
Praetorius, Simon's avatar
Praetorius, Simon committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  // use T as coordinate type
  using Grid = Dune::YaspGrid<2, Dune::EquidistantCoordinates<T,2>>;
  Grid grid({T(1), T(1)}, {8,8});

  // use T as range type for basis
  using namespace Dune::Functions::BasisFactory;
#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7)
  auto basis = makeBasis(grid.leafGridView(), power<1>(lagrange<1>(), flatLexicographic()));
#else
  auto basis = makeBasis(grid.leafGridView(), power<1>(lagrange<1,T>(), flatLexicographic()));
#endif
  using Basis = decltype(basis);

  // use T as coefficient type
  using Param = DefaultProblemTraits<Basis, T>;

  ProblemStat<Param> prob("ellipt", grid, basis);
32
33
34
35
36
37
  prob.initialize(INIT_ALL);
  prob.boundaryManager()->setBoxBoundary({1,1,2,2});

  prob.addMatrixOperator(sot(T(1)), 0, 0);
  prob.addVectorOperator(zot(T(1)), 0);
  prob.addDirichletBC(BoundaryType{1}, 0,0, T(0));
38
39
40
41
42
43
44
45
46
47
48
49
50


  AdaptInfo adaptInfo("adapt");

  // test copy constructor of problem
  auto prob2(prob);
  AdaptStationary adaptStat2("adapt", prob2, adaptInfo);
  adaptStat2.adapt();

  // test move constructor of problem
  auto prob3(std::move(prob2));
  AdaptStationary adaptStat3("adapt", prob3, adaptInfo);
  adaptStat3.adapt();
51
52
53
54
}

int main(int argc, char** argv)
{
55
  Environment env(argc, argv);
56
57
58
59
60

  test<float>();
  test<double>();
  test<long double>();

Praetorius, Simon's avatar
Praetorius, Simon committed
61
62
63
64
#if HAVE_QUADMATH
  test<Dune::Float128>();
#endif

65
66
  return 0;
}