RecoveryEstimator.h 3.31 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
    /// implements \ref Estimator::estimate().
68
69
70
    virtual double estimate(double timestep = 0.0);


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

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

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

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


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

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


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

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

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

119
    /// recovery method
120
121
    int method;

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

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

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

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

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

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

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

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

}

#endif