DUNE PDELab (2.7)

numericalresidual.hh
1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=8 sw=2 sts=2:
3#ifndef DUNE_PDELAB_LOCALOPERATOR_NUMERICALRESIDUAL_HH
4#define DUNE_PDELAB_LOCALOPERATOR_NUMERICALRESIDUAL_HH
5
6#include <cmath>
7
9#include <dune/pdelab/gridoperator/common/localmatrix.hh>
10
11namespace Dune {
12 namespace PDELab {
13
17
19 //
20 // Implementation of alpha_*() in terms of jacobian_*()
21 //
22
24
34 template<typename Imp>
36 {
37 public:
38
40 template<typename EG, typename LFSU, typename X, typename LFSV,
41 typename R>
43 ( const EG& eg,
44 const LFSU& lfsu, const X& x, const LFSV& lfsv,
45 R& r) const
46 {
48 typedef typename Jacobian::WeightedAccumulationView JacobianView;
49
50 Jacobian mat(r.size(),x.size(), 0);
51 JacobianView matview = mat.weightedAccumulationView(1.0);
52 asImp().jacobian_volume(eg, lfsu, x, lfsv, matview);
53 // we need to include the weight here, as umv() and usmv() operate on the bare container for effiency
54 mat.usmv(r.weight(),x,r);
55 }
56
57 private:
58 Imp& asImp () { return static_cast<Imp &> (*this); }
59 const Imp& asImp () const { return static_cast<const Imp &>(*this); }
60 };
61
63
73 template<typename Imp>
75 {
76 public:
77
79 template<typename IG, typename LFSU, typename X, typename LFSV,
80 typename R>
82 ( const IG& ig,
83 const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
84 const LFSU& lfsu_n, const X& x_n, const LFSV& lfsv_n,
85 R& r_s, R& r_n) const
86 {
88 typedef typename Jacobian::WeightedAccumulationView JacobianView;
89
90 Jacobian mat_ss(r_s.size(),x_s.size(),0);
91 Jacobian mat_sn(r_s.size(),x_n.size(),0);
92 Jacobian mat_ns(r_n.size(),x_s.size(),0);
93 Jacobian mat_nn(r_n.size(),x_n.size(),0);
94
95 JacobianView view_ss = mat_ss.weightedAccumulationView(1.0);
96 JacobianView view_sn = mat_sn.weightedAccumulationView(1.0);
97 JacobianView view_ns = mat_ns.weightedAccumulationView(1.0);
98 JacobianView view_nn = mat_nn.weightedAccumulationView(1.0);
99
100 asImp().jacobian_skeleton(ig,
101 lfsu_s, x_s, lfsv_s,
102 lfsu_n, x_n, lfsv_n,
103 view_ss, view_sn, view_ns, view_nn);
104 // TODO: Reihenfolge der Multiplikationen!
105 mat_ss.usmv(r_s.weight(),x_s,r_s);
106 mat_ns.usmv(r_n.weight(),x_s,r_n);
107 mat_sn.usmv(r_s.weight(),x_n,r_s);
108 mat_nn.usmv(r_n.weight(),x_n,r_n);
109 }
110
111 private:
112 Imp& asImp () { return static_cast<Imp &> (*this); }
113 const Imp& asImp () const { return static_cast<const Imp &>(*this); }
114 };
115
117
127 template<typename Imp>
129 {
130 public:
131
133 template<typename IG, typename LFSU, typename X, typename LFSV,
134 typename R>
136 ( const IG& ig,
137 const LFSU& lfsu, const X& x, const LFSV& lfsv,
138 R& r) const
139 {
141 typedef typename Jacobian::WeightedAccumulationView JacobianView;
142
143 Jacobian mat(x.size(),r.size(), 0);
144 JacobianView view = mat.weightedAccumulationView(1.0);
145 asImp().jacobian_boundary(ig, lfsu, x, lfsv, view);
146 // we need to include the weight here, as umv() and usmv() operate on the bare container for effiency
147 mat.usmv(r.weight(),x,r);
148 }
149
150 private:
151 Imp& asImp () { return static_cast<Imp &> (*this); }
152 const Imp& asImp () const { return static_cast<const Imp &>(*this); }
153 };
154
156 }
157}
158
159#endif // DUNE_PDELAB_LOCALOPERATOR_NUMERICALRESIDUAL_HH
Implement alpha_boundary() based on jacobian_boundary()
Definition: numericalresidual.hh:129
void alpha_boundary(const IG &ig, const LFSU &lfsu, const X &x, const LFSV &lfsv, R &r) const
compute
Definition: numericalresidual.hh:136
Implement alpha_skeleton() based on jacobian_skeleton()
Definition: numericalresidual.hh:75
void alpha_skeleton(const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, const LFSU &lfsu_n, const X &x_n, const LFSV &lfsv_n, R &r_s, R &r_n) const
compute
Definition: numericalresidual.hh:82
Implement alpha_volume() based on jacobian_volume()
Definition: numericalresidual.hh:36
void alpha_volume(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, R &r) const
compute
Definition: numericalresidual.hh:43
A dense matrix for storing data associated with the degrees of freedom of a pair of LocalFunctionSpac...
Definition: localmatrix.hh:184
Dune namespace.
Definition: alignedallocator.hh:14
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)