RecoveryEstimator.h 4.63 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file RecoveryEstimator.h */

#ifndef AMDIS_MYRECOVERYESTIMATOR_H
#define AMDIS_MYRECOVERYESTIMATOR_H

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

namespace AMDiS {

  // ============================================================================
  // ===== class RecoveryEstimator ============================================
  // ============================================================================

  /** \brief
   * Error estimator using the recovery gradient of the finite element solution.
   */
  class RecoveryEstimator : public Estimator
  {
  public:
    /** \brief
     * Creator class.
     */
    class Creator : public EstimatorCreator
    {
    public:
      Creator() : EstimatorCreator(), uh(NULL) {};

      virtual ~Creator() {};

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

      /** \brief
       * Returns a new Estimator object.
       */
      Estimator* create()
      {
Thomas Witkowski's avatar
Thomas Witkowski committed
60
	return new RecoveryEstimator(name, uh, row);
61
62
63
64
65
66
67
68
69
      };

    protected:
      DOFVector<double> *uh;
    };

    /** \brief
     * constructor
     */
70
    RecoveryEstimator(std::string name, DOFVector<double> *uh, int r = -1);
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190

    /** \brief
     * destructor.
     */
    virtual ~RecoveryEstimator() {};

    /** \brief
     * implements \ref Estimator::estimate().
     */
    virtual double estimate(double timestep = 0.0);


    /*----- Setting functions -----*/

    // Sets uh.
    inline void setUh(DOFVector<double> *uh)
    {
      uh_ = uh;
    };

    // Sets f.
    inline void setFct(AbstractFunction<double, WorldVector<double> > *fct)
    {
      f_vec = fct;
    };

    inline void setFct(AbstractFunction<double, double> *fct)
    {
      f_scal = fct;
    };

    // Sets auxiliar vector.
    inline void setAuxVec(DOFVector<double> *uh)
    {
      aux_vec = uh;
    };


    /*----- Getting functions -----*/

    // Gets recovery gradient.
    inline DOFVector<WorldVector<double> >* getRecGrd()
    {
      return rec_grd;
    };

    // Gets higher-order recovery solution.
    inline DOFVector<double>* getRecUh()
    {
      return rec_uh;
    };


  protected:     // protected members

    /** \brief
     * finite element solution
     */
    DOFVector<double> *uh_;

    /** \brief
     * absolute or relative error?
     */
    int relative_;

    /** \brief
     * constant for scaling the estimator
     */
    double C;

    /** \brief
     * recovery method
     */
    int method;

    /** \brief
     * Working finite element space
     */
    const FiniteElemSpace *feSpace;

    /** \brief
     * Degree of corresponding basic functions
     */
    int degree;

    /** \brief
     * Basis functions for recovery vector.
     */
    const BasisFunction *rec_basFcts;

    /** \brief
     * Recovery gradient
     */
    DOFVector<WorldVector<double> > *rec_grd;

    /** \brief
     * Higher-order recovery solution
     */
    DOFVector<double> *rec_uh;

    /** \brief
     * Diffusion coefficient (for flux recovery)
     */
    AbstractFunction<double, WorldVector<double> > *f_vec;
    AbstractFunction<double, double> *f_scal;

    /** \brief
     * auxiliar vector
     */
    DOFVector<double> *aux_vec;

    /** \brief
     * Recovery structure.
     */
    Recovery *rec_struct;
  };

}

#endif