RecoveryEstimator.h 3.8 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
      Creator() : EstimatorCreator() {}
40

41
      virtual ~Creator() {}
42

43
      /// Returns a new Estimator object.
44
      virtual Estimator* create()
45
      {
Thomas Witkowski's avatar
Thomas Witkowski committed
46
	return new RecoveryEstimator(name, uh, row);
47
      }
48
49
    };

50
    /// constructor
51
    RecoveryEstimator(std::string name, DOFVector<double> *uh_, int r = -1);
52

53
54
    /// destructor.
    virtual ~RecoveryEstimator() {}
55

56
    /// implements \ref Estimator::init(double).
57
    virtual void init(double ts);
58

59
    /// implements \ref Estimator::estimateElement(ElInfo*, DualElInfo*).
60
    virtual void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL);
61
62

    /// implements \ref Estimator::exit(bool).
63
    virtual void exit(bool output = true);
64

65
    /// Sets uh.
66
    inline void setUh(DOFVector<double> *uh_)
67
    {
68
      uh = uh_;
69
    }
70

71
    /// Sets f.
72
73
74
    inline void setFct(AbstractFunction<double, WorldVector<double> > *fct)
    {
      f_vec = fct;
75
    }
76

77
    ///
78
79
80
    inline void setFct(AbstractFunction<double, double> *fct)
    {
      f_scal = fct;
81
    }
82

83
    /// Sets auxiliar vector.
84
85
86
    inline void setAuxVec(DOFVector<double> *uh)
    {
      aux_vec = uh;
87
    }
88

89
    /// Gets recovery gradient.
90
91
92
    inline DOFVector<WorldVector<double> >* getRecGrd()
    {
      return rec_grd;
93
    }
94

95
    /// Gets higher-order recovery solution.
96
97
98
    inline DOFVector<double>* getRecUh()
    {
      return rec_uh;
99
    }
100
101


102
103
  protected:   
    /// finite element solution
104
    DOFVector<double> *uh;
105

106
    /// absolute or relative error?
107
    int relative;
108

109
    /// constant for scaling the estimator
110
111
    double C;

112
    /// recovery method
113
114
    int method;

115
    /// Working finite element space
116
117
    const FiniteElemSpace *feSpace;

118
    /// Degree of corresponding basic functions
119
120
    int degree;

121
    /// Basis functions for recovery vector.
122
123
    const BasisFunction *rec_basFcts;

124
    /// Recovery gradient
125
126
    DOFVector<WorldVector<double> > *rec_grd;

127
    /// Higher-order recovery solution
128
129
    DOFVector<double> *rec_uh;

130
    /// Diffusion coefficient (for flux recovery)
131
132
133
    AbstractFunction<double, WorldVector<double> > *f_vec;
    AbstractFunction<double, double> *f_scal;

134
    /// auxiliar vector
135
136
    DOFVector<double> *aux_vec;

137
    /// Recovery structure.
138
    Recovery *rec_struct;
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

    /// 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;
156
157
158
159
160
  };

}

#endif