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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==
// ============================================================================
// == ==
// == crystal growth group ==
// == ==
// == Stiftung caesar ==
// == Ludwig-Erhard-Allee 2 ==
// == 53175 Bonn ==
// == germany ==
// == ==
// ============================================================================
// == ==
// == http://www.caesar.de/cg/AMDiS ==
// == ==
// ============================================================================
/** \file Error.h */
#ifndef AMDIS_ERROR_H
#define AMDIS_ERROR_H
#include "Global.h"
#include "Mesh.h"
#include "MemoryManager.h"
namespace AMDiS {
class FastQuadrature;
template<typename T> class DOFVector;
// ============================================================================
// ===== class Error ==========================================================
// ============================================================================
/** \ingroup Common
* \brief
* True error calculator
*/
template<typename T>
class Error
{
public:
MEMORY_MANAGED(Error<T>);
static void setWriteLeafData() {
writeInLeafData = true;
};
static void unsetWriteLeafData() {
writeInLeafData = false;
};
static bool writeLeafData() {
return writeInLeafData;
};
static double maxErrAtQp(const AbstractFunction<T, WorldVector<double> >& u,
const DOFVector<T>& uh,
const Quadrature* q);
static double H1Err(const AbstractFunction<WorldVector<T>, WorldVector<double> >& grdU,
const DOFVector<T>& uh,
int relErr,
double* max,
bool writeLeafData = false,
int comp = 0);
static double L2Err(const AbstractFunction<T, WorldVector<double> >& u,
const DOFVector<T>& uh,
int relErr,
double* max,
bool writeLeafData = false,
int comp = 0);
// methods for traversal
static int maxErrAtQpFct(ElInfo* elinfo);
static int H1ErrFct(ElInfo* elinfo);
static int L2ErrFct(ElInfo* elinfo);
static int relFct(ElInfo* elinfo);
public:
static T errUFct(const DimVec<double>& lambda);
static WorldVector<T> grdErrUFct(const DimVec<double>& lambda);
/** \brief
*
*/
class AbstrFctErrU : public AbstractFunction<T, DimVec<double> >
{
public:
AbstrFctErrU() : AbstractFunction<T, DimVec<double> >(0) {};
inline T operator()(const DimVec<double> & x) const {
return Error<T>::errUFct(x);
/** \brief
*
*/
class AbstrFctGrdErrU : public AbstractFunction<WorldVector<T>, DimVec<double> >
{
public:
AbstrFctGrdErrU() : AbstractFunction<WorldVector<T>, DimVec<double> >(0) {};
inline WorldVector<T> operator()(const DimVec<double> & x) const {
return Error<T>::grdErrUFct(x);
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
};
};
static AbstrFctGrdErrU grdErrU;
private:
static ElInfo* elinfo;
/* static const Parametric* el_parametric; */
static const FastQuadrature* quadFast;
static const AbstractFunction<T, WorldVector<double> >* pU;
static const AbstractFunction<WorldVector<T>, WorldVector<double> >* pGrdU;
static const BasisFunction* basFct;
static const DOFVector<T>* errUh;
static double maxErr;
static double l2Err2;
static double l2Norm2;
static int relative;
static double relNorm2;
static double h1Err2;
static double h1Norm2;
static bool writeInLeafData;
static int component;
};
template<typename T> ElInfo* Error<T>::elinfo = NULL;
template<typename T> const FastQuadrature* Error<T>::quadFast = NULL;
template<typename T> const AbstractFunction<T, WorldVector<double> >* Error<T>::pU = NULL;
template<typename T> const AbstractFunction<WorldVector<T>, WorldVector<double> >* Error<T>::pGrdU = NULL;
template<typename T> const BasisFunction* Error<T>::basFct = NULL;
template<typename T> const DOFVector<T>* Error<T>::errUh = NULL;
template<typename T> double Error<T>::maxErr = 0.0;
template<typename T> double Error<T>::l2Err2 = 0.0;
template<typename T> double Error<T>::l2Norm2 = 0.0;
template<typename T> int Error<T>::relative = 0;
template<typename T> double Error<T>::relNorm2 = 0.0;
template<typename T> double Error<T>::h1Err2 = 0.0;
template<typename T> double Error<T>::h1Norm2 = 0.0;
template<typename T> typename Error<T>::AbstrFctErrU Error<T>::errU;
template<typename T> typename Error<T>::AbstrFctGrdErrU Error<T>::grdErrU;
template<typename T> bool Error<T>::writeInLeafData = false;
template<typename T> int Error<T>::component = 0;
}
#include "Error.hh"
#endif // AMDIS_ERROR_H