bunny.cc 2.12 KB
Newer Older
1
2
3
4
5
6
7
8
9
#include "AMDiS.h"

using namespace std;
using namespace AMDiS;

// ===========================================================================
// ===== function definitions ================================================
// ===========================================================================

10
/// RHS function
11
12
13
class F : public AbstractFunction<double, WorldVector<double> >
{
public:
14
  F(int degree) : AbstractFunction<double, WorldVector<double> >(degree) {}
15

16
17
18
  /// Implementation of AbstractFunction::operator().
  double operator()(const WorldVector<double>& x) const 
  {
19
20
    return -2 * x[0];
  }
21
22
};

23
/// boundary
24
25
26
27
class G : public AbstractFunction<double, WorldVector<double> >
{
public:

28
29
30
  /// Implementation of AbstractFunction::operator().
  double operator()(const WorldVector<double>& x) const 
  {
31
32
    return 10000.0;
  }
33
};
34

35
36
37
38
39
40
41
42
// ===========================================================================
// ===== main program ========================================================
// ===========================================================================

int main(int argc, char* argv[])
{
  FUNCNAME("bunny main");

43
  AMDiS::init(argc, argv);
44
45
46
47

  // ===== create projection =====
  WorldVector<double> ballCenter;
  ballCenter.set(0.0);
48
  new BallProject(1, VOLUME_PROJECTION, ballCenter, 1.0);
49
50

  // ===== create and init the scalar problem ===== 
51
  ProblemStat bunny("bunny");
52
53
54
  bunny.initialize(INIT_ALL);

  // === create adapt info ===
55
  AdaptInfo adaptInfo("bunny->adapt", bunny.getNumComponents());
56
57

  // === create adapt ===
58
  AdaptStationary adapt("bunny->adapt", bunny, adaptInfo);
59
60
  
  // ===== create matrix operator =====
61
  Operator matrixOperator(bunny.getFeSpace());
62
  matrixOperator.addTerm(new Simple_SOT);
63
  bunny.addMatrixOperator(&matrixOperator, 0, 0);
64
65

  // ===== create rhs operator =====
66
  Operator rhsOperator(bunny.getFeSpace());
67

68
  int degree = bunny.getFeSpace()->getBasisFcts()->getDegree();
69

70
  rhsOperator.addTerm(new CoordsAtQP_ZOT(new F(degree)));
71
  bunny.addVectorOperator(&rhsOperator, 0);
72
73

  // ===== start adaption loop =====
74
  adapt.adapt();
75
76
77

  bunny.writeFiles(adaptInfo, true);

78
  AMDiS::finalize();
79
80
81
}