RecoveryEstimator.h 3.92 KB
Newer Older
1
2
3
4
5
6
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
7
// ==  TU Dresden                                                            ==
8
// ==                                                                        ==
9
10
11
// ==  Institut fr Wissenschaftliches Rechnen                               ==
// ==  Zellescher Weg 12-14                                                  ==
// ==  01069 Dresden                                                         ==
12
13
14
15
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
16
// ==  https://gforge.zih.tu-dresden.de/projects/amdis/                      ==
17
18
19
20
21
22
23
24
25
26
27
28
29
// ==                                                                        ==
// ============================================================================

/** \file RecoveryEstimator.h */

#ifndef AMDIS_MYRECOVERYESTIMATOR_H
#define AMDIS_MYRECOVERYESTIMATOR_H

#include "Estimator.h"
#include "Recovery.h"

namespace AMDiS {

30
  /// Error estimator using the recovery gradient of the finite element solution.
31
32
33
  class RecoveryEstimator : public Estimator
  {
  public:
34
    /// Creator class.
35
36
37
    class Creator : public EstimatorCreator
    {
    public:
38
39
40
41
      Creator() 
	: EstimatorCreator(), 
	  uh(NULL) 
      {}
42

43
      virtual ~Creator() {}
44
45
46
47

      inline void setSolution(DOFVector<double> *uh_)
      {
	uh = uh_;
48
      }
49

50
      /// Returns a new Estimator object.
51
52
      Estimator* create()
      {
Thomas Witkowski's avatar
Thomas Witkowski committed
53
	return new RecoveryEstimator(name, uh, row);
54
      }
55
56
57
58
59

    protected:
      DOFVector<double> *uh;
    };

60
    /// constructor
61
    RecoveryEstimator(std::string name, DOFVector<double> *uh, int r = -1);
62

63
64
    /// destructor.
    virtual ~RecoveryEstimator() {}
65

66
    /// implements \ref Estimator::estimate().
67
68
69
    virtual double estimate(double timestep = 0.0);


70
    /// Sets uh.
71
72
73
    inline void setUh(DOFVector<double> *uh)
    {
      uh_ = uh;
74
    }
75

76
    /// Sets f.
77
78
79
    inline void setFct(AbstractFunction<double, WorldVector<double> > *fct)
    {
      f_vec = fct;
80
    }
81

82
    ///
83
84
85
    inline void setFct(AbstractFunction<double, double> *fct)
    {
      f_scal = fct;
86
    }
87

88
    /// Sets auxiliar vector.
89
90
91
    inline void setAuxVec(DOFVector<double> *uh)
    {
      aux_vec = uh;
92
    }
93
94


95
    /// Gets recovery gradient.
96
97
98
    inline DOFVector<WorldVector<double> >* getRecGrd()
    {
      return rec_grd;
99
    }
100

101
    /// Gets higher-order recovery solution.
102
103
104
    inline DOFVector<double>* getRecUh()
    {
      return rec_uh;
105
    }
106
107


108
109
  protected:   
    /// finite element solution
110
111
    DOFVector<double> *uh_;

112
    /// absolute or relative error?
113
114
    int relative_;

115
    /// constant for scaling the estimator
116
117
    double C;

118
    /// recovery method
119
120
    int method;

121
    /// Working finite element space
122
123
    const FiniteElemSpace *feSpace;

124
    /// Degree of corresponding basic functions
125
126
    int degree;

127
    /// Basis functions for recovery vector.
128
129
    const BasisFunction *rec_basFcts;

130
    /// Recovery gradient
131
132
    DOFVector<WorldVector<double> > *rec_grd;

133
    /// Higher-order recovery solution
134
135
    DOFVector<double> *rec_uh;

136
    /// Diffusion coefficient (for flux recovery)
137
138
139
    AbstractFunction<double, WorldVector<double> > *f_vec;
    AbstractFunction<double, double> *f_scal;

140
    /// auxiliar vector
141
142
    DOFVector<double> *aux_vec;

143
    /// Recovery structure.
144
145
146
147
148
149
    Recovery *rec_struct;
  };

}

#endif