1#ifndef DUNE_PDELAB_GRIDOPERATOR_FASTDG_RESIDUALENGINE_HH
2#define DUNE_PDELAB_GRIDOPERATOR_FASTDG_RESIDUALENGINE_HH
5#include <dune/pdelab/gridoperator/common/gridoperatorutilities.hh>
6#include <dune/pdelab/gridoperator/common/assemblerutilities.hh>
7#include <dune/pdelab/gridoperator/common/localassemblerenginebase.hh>
8#include <dune/pdelab/constraints/common/constraints.hh>
9#include <dune/pdelab/localoperator/callswitch.hh>
27 template<
typename TrialConstra
intsContainer,
typename TestConstra
intsContainer>
28 bool needsConstraintsCaching(
const TrialConstraintsContainer& cu,
const TestConstraintsContainer& cv)
const
37 typedef typename LA::LocalOperator
LOP;
40 typedef typename LA::Traits::Residual
Residual;
41 typedef typename Residual::ElementType ResidualElement;
44 typedef typename LA::Traits::Solution
Solution;
45 typedef typename Solution::ElementType SolutionElement;
48 typedef typename LA::LFSU
LFSU;
49 typedef typename LA::LFSUCache LFSUCache;
50 typedef typename LFSU::Traits::GridFunctionSpace GFSU;
51 typedef typename LA::LFSV LFSV;
52 typedef typename LA::LFSVCache LFSVCache;
53 typedef typename LFSV::Traits::GridFunctionSpace GFSV;
55 typedef typename Solution::template ConstAliasedLocalView<LFSUCache> SolutionView;
56 typedef typename Residual::template AliasedLocalView<LFSVCache> ResidualView;
65 : local_assembler(local_assembler_),
66 lop(local_assembler_.localOperator())
87 local_assembler(other.local_assembler), lop(other.lop),
88 global_rl_view(other.global_rl_view),
89 global_rn_view(other.global_rn_view),
90 global_sl_view(other.global_sl_view),
91 global_sn_view(other.global_sn_view)
99 {
return ( local_assembler.doAlphaSkeleton() || local_assembler.doLambdaSkeleton() ); }
100 bool requireSkeletonTwoSided()
const
101 {
return local_assembler.doSkeletonTwoSided(); }
102 bool requireUVVolume()
const
103 {
return local_assembler.doAlphaVolume(); }
104 bool requireVVolume()
const
105 {
return local_assembler.doLambdaVolume(); }
106 bool requireUVSkeleton()
const
107 {
return local_assembler.doAlphaSkeleton(); }
108 bool requireVSkeleton()
const
109 {
return local_assembler.doLambdaSkeleton(); }
110 bool requireUVBoundary()
const
111 {
return local_assembler.doAlphaBoundary(); }
112 bool requireVBoundary()
const
113 {
return local_assembler.doLambdaBoundary(); }
114 bool requireUVVolumePostSkeleton()
const
115 {
return local_assembler.doAlphaVolumePostSkeleton(); }
116 bool requireVVolumePostSkeleton()
const
117 {
return local_assembler.doLambdaVolumePostSkeleton(); }
123 return local_assembler;
127 const typename LocalAssembler::Traits::TrialGridFunctionSpaceConstraints&
trialConstraints()
const
133 const typename LocalAssembler::Traits::TestGridFunctionSpaceConstraints&
testConstraints()
const
142 global_rl_view.attach(residual_);
143 global_rn_view.attach(residual_);
150 global_sl_view.attach(solution_);
151 global_sn_view.attach(solution_);
157 template<
typename EG,
typename LFSUC,
typename LFSVC>
158 void onBindLFSUV(
const EG & eg,
const LFSUC & lfsu_cache,
const LFSVC & lfsv_cache)
160 global_sl_view.bind(lfsu_cache);
164 template<
typename EG,
typename LFSVC>
165 void onBindLFSV(
const EG & eg,
const LFSVC & lfsv_cache)
167 global_rl_view.bind(lfsv_cache);
171 template<
typename IG,
typename LFSUC,
typename LFSVC>
172 void onBindLFSUVInside(
const IG & ig,
const LFSUC & lfsu_cache,
const LFSVC & lfsv_cache)
174 global_sl_view.bind(lfsu_cache);
178 template<
typename IG,
typename LFSUC,
typename LFSVC>
179 void onBindLFSUVOutside(
const IG & ig,
180 const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
181 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache)
183 global_sn_view.bind(lfsu_n_cache);
187 template<
typename IG,
typename LFSVC>
188 void onBindLFSVInside(
const IG & ig,
const LFSVC & lfsv_cache)
190 global_rl_view.bind(lfsv_cache);
194 template<
typename IG,
typename LFSVC>
195 void onBindLFSVOutside(
const IG & ig,
196 const LFSVC & lfsv_s_cache,
197 const LFSVC & lfsv_n_cache)
199 global_rn_view.bind(lfsv_n_cache);
208 template<
typename EG,
typename LFSVC>
212 global_rl_view.unbind();
213 global_rl_view.commit();
216 template<
typename IG,
typename LFSVC>
217 void onUnbindLFSVInside(
const IG & ig,
const LFSVC & lfsv_cache)
220 global_rl_view.commit();
221 global_rl_view.unnbind();
224 template<
typename IG,
typename LFSVC>
225 void onUnbindLFSVOutside(
const IG & ig,
226 const LFSVC & lfsv_s_cache,
227 const LFSVC & lfsv_n_cache)
230 global_rn_view.commit();
231 global_rn_view.unbind();
237 template<
typename LFSUC>
242 template<
typename LFSUC>
243 void loadCoefficientsLFSUOutside(
const LFSUC & lfsu_n_cache)
247 template<
typename LFSUC>
248 void loadCoefficientsLFSUCoupling(
const LFSUC & lfsu_c_cache)
259 if(local_assembler.doPostProcessing())
261 global_rl_view.container());
276 template<
typename EG>
282 template<
typename EG,
typename LFSUC,
typename LFSVC>
283 void assembleUVVolume(
const EG & eg,
const LFSUC & lfsu_cache,
const LFSVC & lfsv_cache)
286 global_rl_view.setWeight(local_assembler.weight());
287 Dune::PDELab::LocalAssemblerCallSwitch<LOP,LOP::doAlphaVolume>::
288 alpha_volume(lop,eg,lfsu_cache.localFunctionSpace(),global_sl_view,lfsv_cache.localFunctionSpace(),global_rl_view);
291 template<
typename EG,
typename LFSVC>
292 void assembleVVolume(
const EG & eg,
const LFSVC & lfsv_cache)
295 global_rl_view.setWeight(local_assembler.weight());
296 Dune::PDELab::LocalAssemblerCallSwitch<LOP,LOP::doLambdaVolume>::
297 lambda_volume(lop,eg,lfsv_cache.localFunctionSpace(),global_rl_view);
300 template<
typename IG,
typename LFSUC,
typename LFSVC>
301 void assembleUVSkeleton(
const IG & ig,
const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
302 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache)
306 global_rl_view.setWeight(local_assembler.weight());
307 global_rn_view.setWeight(local_assembler.weight());
308 Dune::PDELab::LocalAssemblerCallSwitch<LOP,LOP::doAlphaSkeleton>::
309 alpha_skeleton(lop,ig,
310 lfsu_s_cache.localFunctionSpace(),global_sl_view,lfsv_s_cache.localFunctionSpace(),
311 lfsu_n_cache.localFunctionSpace(),global_sn_view,lfsv_n_cache.localFunctionSpace(),
312 global_rl_view,global_rn_view);
315 template<
typename IG,
typename LFSVC>
316 void assembleVSkeleton(
const IG & ig,
const LFSVC & lfsv_s_cache,
const LFSVC & lfsv_n_cache)
320 global_rl_view.setWeight(local_assembler.weight());
321 global_rn_view.setWeight(local_assembler.weight());
322 Dune::PDELab::LocalAssemblerCallSwitch<LOP,LOP::doLambdaSkeleton>::
323 lambda_skeleton(lop, ig, lfsv_s_cache.localFunctionSpace(), lfsv_n_cache.localFunctionSpace(), global_rl_view, global_rn_view);
326 template<
typename IG,
typename LFSUC,
typename LFSVC>
327 void assembleUVBoundary(
const IG & ig,
const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache)
330 global_rl_view.setWeight(local_assembler.weight());
331 Dune::PDELab::LocalAssemblerCallSwitch<LOP,LOP::doAlphaBoundary>::
332 alpha_boundary(lop,ig,lfsu_s_cache.localFunctionSpace(),global_sl_view,lfsv_s_cache.localFunctionSpace(),global_rl_view);
335 template<
typename IG,
typename LFSVC>
336 void assembleVBoundary(
const IG & ig,
const LFSVC & lfsv_s_cache)
339 global_rl_view.setWeight(local_assembler.weight());
340 Dune::PDELab::LocalAssemblerCallSwitch<LOP,LOP::doLambdaBoundary>::
341 lambda_boundary(lop,ig,lfsv_s_cache.localFunctionSpace(),global_rl_view);
344 template<
typename IG,
typename LFSUC,
typename LFSVC>
345 static void assembleUVEnrichedCoupling(
const IG & ig,
346 const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
347 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache,
348 const LFSUC & lfsu_coupling_cache,
const LFSVC & lfsv_coupling_cache)
353 template<
typename IG,
typename LFSVC>
354 static void assembleVEnrichedCoupling(
const IG & ig,
355 const LFSVC & lfsv_s_cache,
356 const LFSVC & lfsv_n_cache,
357 const LFSVC & lfsv_coupling_cache)
362 template<
typename EG,
typename LFSUC,
typename LFSVC>
363 void assembleUVVolumePostSkeleton(
const EG & eg,
const LFSUC & lfsu_cache,
const LFSVC & lfsv_cache)
366 global_rl_view.setWeight(local_assembler.weight());
367 Dune::PDELab::LocalAssemblerCallSwitch<LOP,LOP::doAlphaVolumePostSkeleton>::
368 alpha_volume_post_skeleton(lop,eg,lfsu_cache.localFunctionSpace(),global_sl_view,lfsv_cache.localFunctionSpace(),global_rl_view);
371 template<
typename EG,
typename LFSVC>
372 void assembleVVolumePostSkeleton(
const EG & eg,
const LFSVC & lfsv_cache)
375 global_rl_view.setWeight(local_assembler.weight());
376 Dune::PDELab::LocalAssemblerCallSwitch<LOP,LOP::doLambdaVolumePostSkeleton>::
377 lambda_volume_post_skeleton(lop,eg,lfsv_cache.localFunctionSpace(),global_rl_view);
391 ResidualView global_rl_view;
392 ResidualView global_rn_view;
395 SolutionView global_sl_view;
396 SolutionView global_sn_view;
Default exception for dummy implementations.
Definition: exceptions.hh:261
The fast DG local assembler engine for DUNE grids which assembles the residual vector.
Definition: residualengine.hh:24
LA::Traits::Residual Residual
The type of the residual vector.
Definition: residualengine.hh:40
LA::Traits::Solution Solution
The type of the solution vector.
Definition: residualengine.hh:44
void setSolution(const Solution &solution_)
Definition: residualengine.hh:148
LA LocalAssembler
The type of the wrapping local assembler.
Definition: residualengine.hh:34
void onBindLFSUV(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: residualengine.hh:158
bool assembleCell(const EG &eg)
Definition: residualengine.hh:277
bool requireSkeleton() const
Definition: residualengine.hh:98
const LocalAssembler::Traits::TestGridFunctionSpaceConstraints & testConstraints() const
Test space constraints.
Definition: residualengine.hh:133
void setResidual(Residual &residual_)
Definition: residualengine.hh:140
void onUnbindLFSV(const EG &eg, const LFSVC &lfsv_cache)
Definition: residualengine.hh:209
FastDGLocalResidualAssemblerEngine(const LocalAssembler &local_assembler_)
Constructor.
Definition: residualengine.hh:64
LA::LFSU LFSU
The local function spaces.
Definition: residualengine.hh:48
void loadCoefficientsLFSUInside(const LFSUC &lfsu_s_cache)
Definition: residualengine.hh:238
void postAssembly(const GFSU &gfsu, const GFSV &gfsv)
Definition: residualengine.hh:257
FastDGLocalResidualAssemblerEngine(const FastDGLocalResidualAssemblerEngine &other)
copy contructor
Definition: residualengine.hh:86
LA::LocalOperator LOP
The type of the local operator.
Definition: residualengine.hh:37
const LocalAssembler::Traits::TrialGridFunctionSpaceConstraints & trialConstraints() const
Trial space constraints.
Definition: residualengine.hh:127
const LocalAssembler & localAssembler() const
Public access to the wrapping local assembler.
Definition: residualengine.hh:121
Base class for LocalAssemblerEngine implementations to avoid boilerplate code.
Definition: localassemblerenginebase.hh:22
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
void constrain_residual(const CG &cg, XG &xg)
transform residual into transformed basis: r -> r~
Definition: constraints.hh:904
Dune namespace.
Definition: alignedallocator.hh:14
Definition: localfunctionspacetags.hh:54
Definition: localfunctionspacetags.hh:48