Go to the documentation of this file. 1 #ifndef DUNE_PDELAB_GRIDOPERATOR_DEFAULT_RESIDUALENGINE_HH
2 #define DUNE_PDELAB_GRIDOPERATOR_DEFAULT_RESIDUALENGINE_HH
26 template<
typename TrialConstra
intsContainer,
typename TestConstra
intsContainer>
36 typedef typename LA::LocalOperator
LOP;
39 typedef typename LA::Traits::Residual
Residual;
43 typedef typename LA::Traits::Solution
Solution;
47 typedef typename LA::LFSU
LFSU;
49 typedef typename LFSU::Traits::GridFunctionSpace
GFSU;
50 typedef typename LA::LFSV
LFSV;
52 typedef typename LFSV::Traits::GridFunctionSpace
GFSV;
54 typedef typename Solution::template ConstLocalView<LFSUCache>
SolutionView;
55 typedef typename Residual::template LocalView<LFSVCache>
ResidualView;
64 : local_assembler(local_assembler_),
65 lop(local_assembler_.localOperator()),
73 {
return ( local_assembler.doAlphaSkeleton() || local_assembler.doLambdaSkeleton() ); }
75 {
return local_assembler.doSkeletonTwoSided(); }
77 {
return local_assembler.doAlphaVolume(); }
79 {
return local_assembler.doLambdaVolume(); }
81 {
return local_assembler.doAlphaSkeleton(); }
83 {
return local_assembler.doLambdaSkeleton(); }
85 {
return local_assembler.doAlphaBoundary(); }
87 {
return local_assembler.doLambdaBoundary(); }
89 {
return local_assembler.doAlphaVolumePostSkeleton(); }
91 {
return local_assembler.doLambdaVolumePostSkeleton(); }
97 return local_assembler;
101 const typename LocalAssembler::Traits::TrialGridFunctionSpaceConstraints&
trialConstraints()
const
107 const typename LocalAssembler::Traits::TestGridFunctionSpaceConstraints&
testConstraints()
const
116 global_rl_view.attach(residual_);
117 global_rn_view.attach(residual_);
124 global_sl_view.attach(solution_);
125 global_sn_view.attach(solution_);
131 template<
typename EG,
typename LFSUC,
typename LFSVC>
132 void onBindLFSUV(
const EG & eg,
const LFSUC & lfsu_cache,
const LFSVC & lfsv_cache)
134 global_sl_view.bind(lfsu_cache);
135 xl.
resize(lfsu_cache.size());
138 template<
typename EG,
typename LFSVC>
141 global_rl_view.bind(lfsv_cache);
142 rl.
assign(lfsv_cache.size(),0.0);
145 template<
typename IG,
typename LFSUC,
typename LFSVC>
148 global_sl_view.bind(lfsu_cache);
149 xl.
resize(lfsu_cache.size());
152 template<
typename IG,
typename LFSUC,
typename LFSVC>
154 const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
155 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache)
157 global_sn_view.bind(lfsu_n_cache);
158 xn.
resize(lfsu_n_cache.size());
161 template<
typename IG,
typename LFSVC>
164 global_rl_view.bind(lfsv_cache);
165 rl.
assign(lfsv_cache.size(),0.0);
168 template<
typename IG,
typename LFSVC>
170 const LFSVC & lfsv_s_cache,
171 const LFSVC & lfsv_n_cache)
173 global_rn_view.bind(lfsv_n_cache);
174 rn.
assign(lfsv_n_cache.size(),0.0);
182 template<
typename EG,
typename LFSVC>
185 global_rl_view.add(rl);
186 global_rl_view.commit();
189 template<
typename IG,
typename LFSVC>
192 global_rl_view.add(rl);
193 global_rl_view.commit();
196 template<
typename IG,
typename LFSVC>
198 const LFSVC & lfsv_s_cache,
199 const LFSVC & lfsv_n_cache)
201 global_rn_view.add(rn);
202 global_rn_view.commit();
208 template<
typename LFSUC>
211 global_sl_view.read(xl);
213 template<
typename LFSUC>
216 global_sn_view.read(xn);
218 template<
typename LFSUC>
221 DUNE_THROW(Dune::NotImplemented,
"No coupling lfsu available for ");
230 if(local_assembler.doPostProcessing())
246 template<
typename EG>
249 return LocalAssembler::isNonOverlapping && eg.entity().partitionType() != Dune::InteriorEntity;
252 template<
typename EG,
typename LFSUC,
typename LFSVC>
255 rl_view.
setWeight(local_assembler.weight());
257 alpha_volume(lop,eg,lfsu_cache.localFunctionSpace(),xl,lfsv_cache.localFunctionSpace(),rl_view);
260 template<
typename EG,
typename LFSVC>
263 rl_view.
setWeight(local_assembler.weight());
265 lambda_volume(lop,eg,lfsv_cache.localFunctionSpace(),rl_view);
268 template<
typename IG,
typename LFSUC,
typename LFSVC>
270 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache)
272 rl_view.
setWeight(local_assembler.weight());
273 rn_view.
setWeight(local_assembler.weight());
276 lfsu_s_cache.localFunctionSpace(),xl,lfsv_s_cache.localFunctionSpace(),
277 lfsu_n_cache.localFunctionSpace(),xn,lfsv_n_cache.localFunctionSpace(),
281 template<
typename IG,
typename LFSVC>
284 rl_view.
setWeight(local_assembler.weight());
285 rn_view.
setWeight(local_assembler.weight());
287 lambda_skeleton(lop,
ig, lfsv_s_cache.localFunctionSpace(), lfsv_n_cache.localFunctionSpace(), rl_view, rn_view);
290 template<
typename IG,
typename LFSUC,
typename LFSVC>
293 rl_view.
setWeight(local_assembler.weight());
295 alpha_boundary(lop,
ig,lfsu_s_cache.localFunctionSpace(),xl,lfsv_s_cache.localFunctionSpace(),rl_view);
298 template<
typename IG,
typename LFSVC>
301 rl_view.
setWeight(local_assembler.weight());
306 template<
typename IG,
typename LFSUC,
typename LFSVC>
308 const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
309 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache,
310 const LFSUC & lfsu_coupling_cache,
const LFSVC & lfsv_coupling_cache)
312 DUNE_THROW(Dune::NotImplemented,
"Assembling of coupling spaces is not implemented for ");
315 template<
typename IG,
typename LFSVC>
317 const LFSVC & lfsv_s_cache,
318 const LFSVC & lfsv_n_cache,
319 const LFSVC & lfsv_coupling_cache)
321 DUNE_THROW(Dune::NotImplemented,
"Assembling of coupling spaces is not implemented for ");
324 template<
typename EG,
typename LFSUC,
typename LFSVC>
327 rl_view.
setWeight(local_assembler.weight());
332 template<
typename EG,
typename LFSVC>
335 rl_view.
setWeight(local_assembler.weight());
384 #endif // DUNE_PDELAB_GRIDOPERATOR_DEFAULT_RESIDUALENGINE_HH
void assembleVBoundary(const IG &ig, const LFSVC &lfsv_s_cache)
Definition: default/residualengine.hh:299
bool requireVVolumePostSkeleton() const
Definition: default/residualengine.hh:90
void loadCoefficientsLFSUInside(const LFSUC &lfsu_s_cache)
Definition: default/residualengine.hh:209
Definition: localfunctionspacetags.hh:54
void assembleUVVolume(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: default/residualengine.hh:253
void assembleUVSkeleton(const IG &ig, const LFSUC &lfsu_s_cache, const LFSVC &lfsv_s_cache, const LFSUC &lfsu_n_cache, const LFSVC &lfsv_n_cache)
Definition: default/residualengine.hh:269
void assembleUVBoundary(const IG &ig, const LFSUC &lfsu_s_cache, const LFSVC &lfsv_s_cache)
Definition: default/residualengine.hh:291
bool requireVVolume() const
Definition: default/residualengine.hh:78
void assembleVVolume(const EG &eg, const LFSVC &lfsv_cache)
Definition: default/residualengine.hh:261
void loadCoefficientsLFSUCoupling(const LFSUC &lfsu_c_cache)
Definition: default/residualengine.hh:219
void loadCoefficientsLFSUOutside(const LFSUC &lfsu_n_cache)
Definition: default/residualengine.hh:214
void onUnbindLFSVInside(const IG &ig, const LFSVC &lfsv_cache)
Definition: default/residualengine.hh:190
void setWeight(weight_type weight)
Resets the weighting coefficient of the view.
Definition: localvector.hh:72
void onBindLFSUV(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: default/residualengine.hh:132
LA::Traits::Solution Solution
The type of the solution vector.
Definition: default/residualengine.hh:43
void setSolution(const Solution &solution_)
Definition: default/residualengine.hh:122
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
LA LocalAssembler
The type of the wrapping local assembler.
Definition: default/residualengine.hh:33
LA::LocalOperator LOP
The type of the local operator.
Definition: default/residualengine.hh:36
bool needsConstraintsCaching(const TrialConstraintsContainer &cu, const TestConstraintsContainer &cv) const
Definition: default/residualengine.hh:27
void onBindLFSVInside(const IG &ig, const LFSVC &lfsv_cache)
Definition: default/residualengine.hh:162
static void alpha_volume(const LA &la, const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, R &r)
Definition: callswitch.hh:91
static void assembleVEnrichedCoupling(const IG &ig, const LFSVC &lfsv_s_cache, const LFSVC &lfsv_n_cache, const LFSVC &lfsv_coupling_cache)
Definition: default/residualengine.hh:316
bool requireSkeletonTwoSided() const
Definition: default/residualengine.hh:74
bool requireUVSkeleton() const
Definition: default/residualengine.hh:80
bool requireSkeleton() const
Definition: default/residualengine.hh:72
void assembleVSkeleton(const IG &ig, const LFSVC &lfsv_s_cache, const LFSVC &lfsv_n_cache)
Definition: default/residualengine.hh:282
LA::LFSUCache LFSUCache
Definition: default/residualengine.hh:48
static void assembleUVEnrichedCoupling(const IG &ig, const LFSUC &lfsu_s_cache, const LFSVC &lfsv_s_cache, const LFSUC &lfsu_n_cache, const LFSVC &lfsv_n_cache, const LFSUC &lfsu_coupling_cache, const LFSVC &lfsv_coupling_cache)
Definition: default/residualengine.hh:307
LFSV::Traits::GridFunctionSpace GFSV
Definition: default/residualengine.hh:52
bool requireUVVolume() const
Definition: default/residualengine.hh:76
static void alpha_skeleton(const LA &la, 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)
Definition: callswitch.hh:99
LFSU::Traits::GridFunctionSpace GFSU
Definition: default/residualengine.hh:49
void resize(size_type size)
Resize the container.
Definition: localvector.hh:257
const LocalAssembler::Traits::TestGridFunctionSpaceConstraints & testConstraints() const
Test space constraints.
Definition: default/residualengine.hh:107
bool requireUVVolumePostSkeleton() const
Definition: default/residualengine.hh:88
LA::Traits::Residual Residual
The type of the residual vector.
Definition: default/residualengine.hh:39
const IG & ig
Definition: constraints.hh:148
Residual::template LocalView< LFSVCache > ResidualView
Definition: default/residualengine.hh:55
Solution::ElementType SolutionElement
Definition: default/residualengine.hh:44
void constrain_residual(const CG &cg, XG &xg)
transform residual into transformed basis: r -> r~
Definition: constraints.hh:906
bool requireVBoundary() const
Definition: default/residualengine.hh:86
DefaultLocalResidualAssemblerEngine(const LocalAssembler &local_assembler_)
Constructor.
Definition: default/residualengine.hh:63
void assembleVVolumePostSkeleton(const EG &eg, const LFSVC &lfsv_cache)
Definition: default/residualengine.hh:333
LA::LFSVCache LFSVCache
Definition: default/residualengine.hh:51
static void lambda_volume_post_skeleton(const LA &la, const EG &eg, const LFSV &lfsv, R &r)
Definition: callswitch.hh:117
void onUnbindLFSV(const EG &eg, const LFSVC &lfsv_cache)
Definition: default/residualengine.hh:183
Definition: localfunctionspacetags.hh:48
const LocalAssembler::Traits::TrialGridFunctionSpaceConstraints & trialConstraints() const
Trial space constraints.
Definition: default/residualengine.hh:101
LA::LFSU LFSU
The local function spaces.
Definition: default/residualengine.hh:47
bool requireVSkeleton() const
Definition: default/residualengine.hh:82
static void alpha_volume_post_skeleton(const LA &la, const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, R &r)
Definition: callswitch.hh:95
const LocalAssembler & localAssembler() const
Public access to the wrapping local assembler.
Definition: default/residualengine.hh:95
void assembleUVVolumePostSkeleton(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: default/residualengine.hh:325
static void lambda_volume(const LA &la, const EG &eg, const LFSV &lfsv, R &r)
Definition: callswitch.hh:113
Base class for LocalAssemblerEngine implementations to avoid boilerplate code.
Definition: localassemblerenginebase.hh:21
void onUnbindLFSVOutside(const IG &ig, const LFSVC &lfsv_s_cache, const LFSVC &lfsv_n_cache)
Definition: default/residualengine.hh:197
void setResidual(Residual &residual_)
Definition: default/residualengine.hh:114
void onBindLFSUVInside(const IG &ig, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: default/residualengine.hh:146
bool requireUVBoundary() const
Definition: default/residualengine.hh:84
void onBindLFSVOutside(const IG &ig, const LFSVC &lfsv_s_cache, const LFSVC &lfsv_n_cache)
Definition: default/residualengine.hh:169
Residual::ElementType ResidualElement
Definition: default/residualengine.hh:40
void assign(size_type size, const T &value)
Resize the container to size and assign the passed value to all entries.
Definition: localvector.hh:263
void postAssembly(const GFSU &gfsu, const GFSV &gfsv)
Definition: default/residualengine.hh:228
void onBindLFSV(const EG &eg, const LFSVC &lfsv_cache)
Definition: default/residualengine.hh:139
WeightedVectorAccumulationView< LocalVector > WeightedAccumulationView
An accumulate-only view of this container that automatically applies a weight to all contributions.
Definition: localvector.hh:198
Solution::template ConstLocalView< LFSUCache > SolutionView
Definition: default/residualengine.hh:54
bool assembleCell(const EG &eg)
Definition: default/residualengine.hh:247
void onBindLFSUVOutside(const IG &ig, const LFSUC &lfsu_s_cache, const LFSVC &lfsv_s_cache, const LFSUC &lfsu_n_cache, const LFSVC &lfsv_n_cache)
Definition: default/residualengine.hh:153
static void alpha_boundary(const LA &la, const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, R &r_s)
Definition: callswitch.hh:106
The local assembler engine for DUNE grids which assembles the residual vector.
Definition: default/residualengine.hh:21
LA::LFSV LFSV
Definition: default/residualengine.hh:50
static void lambda_boundary(const LA &la, const IG &ig, const LFSV &lfsv, R &r)
Definition: callswitch.hh:127
static void lambda_skeleton(const LA &la, const IG &ig, const LFSV &lfsv_s, const LFSV &lfsv_n, R &r_s, R &r_n)
Definition: callswitch.hh:121