RecoveryEstimator.h 4.03 KB
Newer Older
1
2
3
4
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
5
// ==  http://www.amdis-fem.org                                              ==
6
7
// ==                                                                        ==
// ============================================================================
8
9
10
11
12
13
14
15
16
17
18
19
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


20
21
22
23
24
25
26
27
28
29
30

/** \file RecoveryEstimator.h */

#ifndef AMDIS_MYRECOVERYESTIMATOR_H
#define AMDIS_MYRECOVERYESTIMATOR_H

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

namespace AMDiS {

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

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

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

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

    protected:
      DOFVector<double> *uh;
    };

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

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

67
68
    /// implements \ref Estimator::init(double).
    void init(double ts);
69

70
71
72
73
74
    /// implements \ref Estimator::estimateElement(ElInfo*, DualElInfo*).
    void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo);

    /// implements \ref Estimator::exit(bool).
    void exit(bool output);
75

76
    /// Sets uh.
77
    inline void setUh(DOFVector<double> *uh_)
78
    {
79
      uh = uh_;
80
    }
81

82
    /// Sets f.
83
84
85
    inline void setFct(AbstractFunction<double, WorldVector<double> > *fct)
    {
      f_vec = fct;
86
    }
87

88
    ///
89
90
91
    inline void setFct(AbstractFunction<double, double> *fct)
    {
      f_scal = fct;
92
    }
93

94
    /// Sets auxiliar vector.
95
96
97
    inline void setAuxVec(DOFVector<double> *uh)
    {
      aux_vec = uh;
98
    }
99

100
101
102
103
    inline void setAddEstimationToOld(bool value)
    {
      addEstimationToOld = value;
    }
104

105
    /// Gets recovery gradient.
106
107
108
    inline DOFVector<WorldVector<double> >* getRecGrd()
    {
      return rec_grd;
109
    }
110

111
    /// Gets higher-order recovery solution.
112
113
114
    inline DOFVector<double>* getRecUh()
    {
      return rec_uh;
115
    }
116
117


118
119
  protected:   
    /// finite element solution
120
    DOFVector<double> *uh;
121

122
    /// absolute or relative error?
123
    int relative;
124

125
    /// constant for scaling the estimator
126
127
    double C;

128
    /// recovery method
129
130
    int method;

131
132
    bool addEstimationToOld;

133
    /// Working finite element space
134
135
    const FiniteElemSpace *feSpace;

136
    /// Degree of corresponding basic functions
137
138
    int degree;

139
    /// Basis functions for recovery vector.
140
141
    const BasisFunction *rec_basFcts;

142
    /// Recovery gradient
143
144
    DOFVector<WorldVector<double> > *rec_grd;

145
    /// Higher-order recovery solution
146
147
    DOFVector<double> *rec_uh;

148
    /// Diffusion coefficient (for flux recovery)
149
150
151
    AbstractFunction<double, WorldVector<double> > *f_vec;
    AbstractFunction<double, double> *f_scal;

152
    /// auxiliar vector
153
154
    DOFVector<double> *aux_vec;

155
    /// Recovery structure.
156
    Recovery *rec_struct;
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173

    /// Number of quadrature points.
    int nPoints;

    Quadrature *quad;
    FastQuadrature *quadFast, *rec_quadFast;

    /// Basis functions 
    const BasisFunction *basFcts;
    
    double h1Norm2;

    WorldVector<double> quad_pt;
    WorldVector<double> *grdAtQP;
    mtl::dense_vector<WorldVector<double> > recoveryGrdAtQP;
    mtl::dense_vector<double> uhAtQP;
    mtl::dense_vector<double> recoveryUhAtQP;
174
175
176
177
178
  };

}

#endif