KASKADE 7 development version
norms.hh
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the library KASKADE 7 */
4/* https://www.zib.de/research/projects/kaskade7-finite-element-toolbox */
5/* */
6/* Copyright (C) 2002-2019 Zuse Institute Berlin */
7/* */
8/* KASKADE 7 is distributed under the terms of the ZIB Academic License. */
9/* see $KASKADE/academic.txt */
10/* */
11/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12
13#ifndef NORMS_HH
14#define NORMS_HH
15
22#include <boost/fusion/include/at_c.hpp>
23#include <fem/integration.hh>
24#include <fem/functionviews.hh>
25
26namespace Kaskade
27{
29 struct L2Norm
30 {
32 template<typename Function>
33 typename Function::Scalar square(Function const& f) const
34 {
37 return integral(asf);
38 }
39
41 template<typename Function>
42 typename Function::Scalar operator()(Function const& f) const
43 {
44 return std::sqrt(square(f));
45 }
46 };
47
48
51 {
53 template<typename Function>
54 typename Function::Scalar square(Function const& f) const
55 {
58 return integral(asf);
59 // FunctionViews::Gradient<Function> gf(f);
60 // L2Norm l2Norm;
61 // return l2Norm.square(gf);
62 }
63
65 template<typename Function>
66 typename Function::Scalar operator()(Function const& f) const
67 {
68 return std::sqrt(square(f));
69 }
70 };
71
72
73
75 struct H1Norm
76 {
78 template<typename Function>
80 {
81 H1SemiNorm h1Norm;
82 L2Norm l2Norm;
83 return h1Norm.square(f)+l2Norm.square(f);
84 }
85
87 template<typename Function>
89 {
90 return std::sqrt(square(f));
91 }
92 };
93
94 template<class Space> class LocalIntegral;
95 template<class Grid, class T> class CellData;
96
98 template<class Function>
99 [[deprecated("appears to be outdated and unused - candidate for removal")]]
101 {
102 typedef typename Function::Space Space;
103 typedef typename Space::Grid Grid;
104 LocalIntegral<Space> localIntegral;
106 errorIndicator(localIntegral(
107 makeView<FunctionViews::AbsSquare>(makeView<FunctionViews::Gradient>(f))));
108 return errorIndicator;
109 }
110
112 template<class Function>
113 [[deprecated("appears to be outdated and unused - candidate for removal")]]
115 {
116 typedef typename Function::Space Space;
117 typedef typename Space::Grid Grid;
118 LocalIntegral<Space> localIntegral;
120 errorIndicator(localIntegral(
121 makeView<FunctionViews::AbsSquare>(f)));
122 return errorIndicator;
123 }
124
125
134 template <class FEFunction>
135 auto boundaryL2Norm(FEFunction const& function)
136 {
137 FunctionViews::AbsSquare<FEFunction> functionSquared(function);
138 return std::sqrt(integrateOverBoundary(functionSquared));
139 }
140} // end of namespace Kaskade
141#endif
Function is the interface for evaluatable functions .
Definition: concepts.hh:324
unspecified Scalar
Definition: concepts.hh:330
std::vector< CellDataPair > CellDataVector
Definition: celldata.hh:44
A function view returning the square of the Frobenius norm of a function's derivative.
Evaluation class for integrals.
Definition: integration.hh:312
Create a CellData by computing local integrals over each Cell.
Some useful views on FunctionSpaceElement s.
Function::ValueType integral(Function const &f)
Evaluate integrals of finite element functions.
Definition: integration.hh:289
FEFunction::ValueType integrateOverBoundary(FEFunction const &function)
integrateOverBoundary computes the integral of an FE function over the whole boundary of the underlyi...
Definition: integration.hh:211
Functionalities for integration of FunctionSpaceElement s or FunctionViews.
auto boundaryL2Norm(FEFunction const &function)
boundaryL2Norm computes the L2-norm of an FE function on the whole boundary of the underlying grid.
Definition: norms.hh:135
CellData< typenameFunction::Space::Grid, typenameFunction::ValueType >::CellDataVector localL2Norm(Function const &f)
local (cellwise) L2-norms
Definition: norms.hh:114
CellData< typenameFunction::Space::Grid, typenameFunction::ValueType >::CellDataVector localH1SemiNorm(Function const &f)
local (cellwise) H1-semi-norms
Definition: norms.hh:100
H1-norms.
Definition: norms.hh:76
Function::Scalar square(Function f)
Evaluation of square norm.
Definition: norms.hh:79
Function::Scalar operator()(Function f)
Evaluation of norm.
Definition: norms.hh:88
H1-semi-norms.
Definition: norms.hh:51
Function::Scalar operator()(Function const &f) const
Evaluation of norm.
Definition: norms.hh:66
Function::Scalar square(Function const &f) const
Evaluation of square norm.
Definition: norms.hh:54
L_2-norms.
Definition: norms.hh:30
Function::Scalar operator()(Function const &f) const
Evaluation of norm.
Definition: norms.hh:42
Function::Scalar square(Function const &f) const
Evaluation of square norm.
Definition: norms.hh:33