1#ifndef DUNE_PDELAB_GRIDOPERATOR_DEFAULT_JACOBIANAPPLYENGINE_HH
2#define DUNE_PDELAB_GRIDOPERATOR_DEFAULT_JACOBIANAPPLYENGINE_HH
26 template<
typename TrialConstra
intsContainer,
typename TestConstra
intsContainer>
36 typedef typename LA::LocalOperator
LOP;
39 static constexpr bool isLinear = LOP::isLinear;
42 typedef typename LA::Traits::Range
Range;
46 typedef typename LA::Traits::Domain
Domain;
50 typedef typename LA::LFSU
LFSU;
52 typedef typename LFSU::Traits::GridFunctionSpace
GFSU;
53 typedef typename LA::LFSV
LFSV;
55 typedef typename LFSV::Traits::GridFunctionSpace
GFSV;
57 typedef typename Domain::template ConstLocalView<LFSUCache>
DomainView;
58 typedef typename Range::template LocalView<LFSVCache>
RangeView;
67 : local_assembler(local_assembler_),
68 lop(local_assembler_.localOperator()),
69 result_view_inside(local_result_inside,1.0),
70 result_view_outside(local_result_outside,1.0)
76 {
return local_assembler.doAlphaSkeleton(); }
78 {
return local_assembler.doSkeletonTwoSided(); }
80 {
return local_assembler.doAlphaVolume(); }
82 {
return local_assembler.doAlphaSkeleton(); }
84 {
return local_assembler.doAlphaBoundary(); }
86 {
return local_assembler.doAlphaVolumePostSkeleton(); }
92 return local_assembler;
96 const typename LocalAssembler::Traits::TrialGridFunctionSpaceConstraints&
trialConstraints()
const
102 const typename LocalAssembler::Traits::TestGridFunctionSpaceConstraints&
testConstraints()
const
111 global_solution_view_inside.attach(solution_);
112 global_solution_view_outside.attach(solution_);
119 global_update_view_inside.attach(update_);
120 global_update_view_outside.attach(update_);
127 global_result_view_inside.attach(result_);
128 global_result_view_outside.attach(result_);
134 template<
typename EG,
typename LFSUC,
typename LFSVC>
135 void onBindLFSUV(
const EG & eg,
const LFSUC & lfsu_cache,
const LFSVC & lfsv_cache)
137 global_solution_view_inside.bind(lfsu_cache);
140 local_solution_inside.
resize(lfsu_cache.size());
141 global_update_view_inside.bind(lfsu_cache);
142 local_update_inside.
resize(lfsu_cache.size());
145 template<
typename EG,
typename LFSVC>
148 global_result_view_inside.bind(lfsv_cache);
149 local_result_inside.
assign(lfsv_cache.size(),0.0);
152 template<
typename IG,
typename LFSUC,
typename LFSVC>
155 global_solution_view_inside.bind(lfsu_cache);
158 local_solution_inside.
resize(lfsu_cache.size());
159 global_update_view_inside.bind(lfsu_cache);
160 local_update_inside.
resize(lfsu_cache.size());
163 template<
typename IG,
typename LFSUC,
typename LFSVC>
165 const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
166 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache)
168 global_solution_view_outside.bind(lfsu_n_cache);
171 local_solution_outside.
resize(lfsu_n_cache.size());
172 global_update_view_outside.bind(lfsu_n_cache);
173 local_update_outside.
resize(lfsu_n_cache.size());
176 template<
typename IG,
typename LFSVC>
179 global_result_view_inside.bind(lfsv_cache);
180 local_result_inside.
assign(lfsv_cache.size(),0.0);
183 template<
typename IG,
typename LFSVC>
185 const LFSVC & lfsv_s_cache,
186 const LFSVC & lfsv_n_cache)
188 global_result_view_outside.bind(lfsv_n_cache);
189 local_result_outside.
assign(lfsv_n_cache.size(),0.0);
197 template<
typename EG,
typename LFSVC>
200 global_result_view_inside.add(local_result_inside);
201 global_result_view_inside.commit();
204 template<
typename IG,
typename LFSVC>
207 global_result_view_inside.add(local_result_inside);
208 global_result_view_inside.commit();
211 template<
typename IG,
typename LFSVC>
213 const LFSVC & lfsv_s_cache,
214 const LFSVC & lfsv_n_cache)
216 global_result_view_outside.add(local_result_outside);
217 global_result_view_outside.commit();
223 template<
typename LFSUC>
228 global_solution_view_inside.read(local_solution_inside);
229 global_update_view_inside.read(local_update_inside);
231 template<
typename LFSUC>
236 global_solution_view_outside.read(local_solution_outside);
237 global_update_view_outside.read(local_update_outside);
239 template<
typename LFSUC>
242 DUNE_THROW(Dune::NotImplemented,
"No coupling lfsu available for ");
251 if(local_assembler.doPostProcessing())
253 global_result_view_inside.container());
270 (LocalAssembler::isNonOverlapping &&
271 eg.entity().partitionType() != Dune::InteriorEntity);
280 template<
typename IG>
286 template<
typename EG,
typename LFSUC,
typename LFSVC>
289 result_view_inside.
setWeight(local_assembler.weight());
291 jacobian_apply_volume(lop,eg,lfsu_cache.localFunctionSpace(),local_solution_inside,local_update_inside,lfsv_cache.localFunctionSpace(),result_view_inside);
294 template<
typename IG,
typename LFSUC,
typename LFSVC>
296 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache)
298 result_view_inside.
setWeight(local_assembler.weight());
299 result_view_outside.
setWeight(local_assembler.weight());
302 lfsu_s_cache.localFunctionSpace(),local_solution_inside,local_update_inside,lfsv_s_cache.localFunctionSpace(),
303 lfsu_n_cache.localFunctionSpace(),local_solution_outside,local_update_outside,lfsv_n_cache.localFunctionSpace(),
304 result_view_inside,result_view_outside);
307 template<
typename IG,
typename LFSUC,
typename LFSVC>
310 result_view_inside.
setWeight(local_assembler.weight());
312 jacobian_apply_boundary(lop,
ig,lfsu_s_cache.localFunctionSpace(),local_solution_inside,local_update_inside,lfsv_s_cache.localFunctionSpace(),result_view_inside);
315 template<
typename IG,
typename LFSUC,
typename LFSVC>
317 const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
318 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache,
319 const LFSUC & lfsu_coupling_cache,
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 result_view_inside.
setWeight(local_assembler.weight());
363 DomainVector local_solution_inside;
365 DomainVector local_solution_outside;
367 DomainVector local_update_inside;
369 DomainVector local_update_outside;
371 RangeVector local_result_inside;
373 RangeVector local_result_outside;
const IG & ig
Definition: constraints.hh:149
void constrain_residual(const CG &cg, XG &xg)
transform residual into transformed basis: r -> r~
Definition: constraints.hh:904
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
Impl::LocalAssemblerCallSwitchHelper< LOP, doIt > LocalAssemblerCallSwitch
Definition: callswitch.hh:407
Definition: localfunctionspacetags.hh:48
Definition: localfunctionspacetags.hh:54
void setWeight(weight_type weight)
Resets the weighting coefficient of the view.
Definition: localvector.hh:72
A container for storing data associated with the degrees of freedom of a LocalFunctionSpace.
Definition: localvector.hh:184
void assign(size_type size, const T &value)
Resize the container to size and assign the passed value to all entries.
Definition: localvector.hh:329
WeightedVectorAccumulationView< LocalVector > WeightedAccumulationView
An accumulate-only view of this container that automatically applies a weight to all contributions.
Definition: localvector.hh:211
void resize(size_type size)
Resize the container.
Definition: localvector.hh:323
Base class for LocalAssemblerEngine implementations to avoid boilerplate code.
Definition: localassemblerenginebase.hh:22
The local assembler engine for DUNE grids which assembles the local application of the Jacobian.
Definition: default/jacobianapplyengine.hh:23
LFSU::Traits::GridFunctionSpace GFSU
Definition: default/jacobianapplyengine.hh:52
bool skipIntersection(const IG &ig)
Definition: default/jacobianapplyengine.hh:281
void onBindLFSUVInside(const IG &ig, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: default/jacobianapplyengine.hh:153
void onUnbindLFSVOutside(const IG &ig, const LFSVC &lfsv_s_cache, const LFSVC &lfsv_n_cache)
Definition: default/jacobianapplyengine.hh:212
void assembleUVBoundary(const IG &ig, const LFSUC &lfsu_s_cache, const LFSVC &lfsv_s_cache)
Definition: default/jacobianapplyengine.hh:308
void loadCoefficientsLFSUCoupling(const LFSUC &lfsu_c_cache)
Definition: default/jacobianapplyengine.hh:240
void onBindLFSV(const EG &eg, const LFSVC &lfsv_cache)
Definition: default/jacobianapplyengine.hh:146
bool requireSkeletonTwoSided() const
Definition: default/jacobianapplyengine.hh:77
void postAssembly(const GFSU &gfsu, const GFSV &gfsv)
Definition: default/jacobianapplyengine.hh:249
Range::ElementType RangeElement
Definition: default/jacobianapplyengine.hh:43
bool requireSkeleton() const
Definition: default/jacobianapplyengine.hh:75
const LocalAssembler::Traits::TrialGridFunctionSpaceConstraints & trialConstraints() const
Trial space constraints.
Definition: default/jacobianapplyengine.hh:96
DefaultLocalJacobianApplyAssemblerEngine(const LocalAssembler &local_assembler_)
Constructor.
Definition: default/jacobianapplyengine.hh:66
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/jacobianapplyengine.hh:295
Domain::ElementType DomainElement
Definition: default/jacobianapplyengine.hh:47
void setUpdate(const Domain &update_)
Definition: default/jacobianapplyengine.hh:117
bool requireUVBoundary() const
Definition: default/jacobianapplyengine.hh:83
void setResult(Range &result_)
Definition: default/jacobianapplyengine.hh:125
void loadCoefficientsLFSUInside(const LFSUC &lfsu_s_cache)
Definition: default/jacobianapplyengine.hh:224
void assembleUVVolume(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: default/jacobianapplyengine.hh:287
LA::LFSU LFSU
The local function spaces.
Definition: default/jacobianapplyengine.hh:50
LA::Traits::Range Range
The type of the result vector.
Definition: default/jacobianapplyengine.hh:42
LA::LFSUCache LFSUCache
Definition: default/jacobianapplyengine.hh:51
LFSV::Traits::GridFunctionSpace GFSV
Definition: default/jacobianapplyengine.hh:55
void onBindLFSUV(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: default/jacobianapplyengine.hh:135
void assembleUVVolumePostSkeleton(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: default/jacobianapplyengine.hh:325
void onUnbindLFSV(const EG &eg, const LFSVC &lfsv_cache)
Definition: default/jacobianapplyengine.hh:198
bool skipEntity(const EG &eg)
Definition: default/jacobianapplyengine.hh:267
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/jacobianapplyengine.hh:316
void onUnbindLFSVInside(const IG &ig, const LFSVC &lfsv_cache)
Definition: default/jacobianapplyengine.hh:205
const LocalAssembler::Traits::TestGridFunctionSpaceConstraints & testConstraints() const
Test space constraints.
Definition: default/jacobianapplyengine.hh:102
LA LocalAssembler
The type of the wrapping local assembler.
Definition: default/jacobianapplyengine.hh:33
bool needsConstraintsCaching(const TrialConstraintsContainer &cu, const TestConstraintsContainer &cv) const
Definition: default/jacobianapplyengine.hh:27
LA::LocalOperator LOP
The type of the local operator.
Definition: default/jacobianapplyengine.hh:36
static constexpr bool isLinear
Wheter the local operator is linear.
Definition: default/jacobianapplyengine.hh:39
void onBindLFSVOutside(const IG &ig, const LFSVC &lfsv_s_cache, const LFSVC &lfsv_n_cache)
Definition: default/jacobianapplyengine.hh:184
void loadCoefficientsLFSUOutside(const LFSUC &lfsu_n_cache)
Definition: default/jacobianapplyengine.hh:232
const LocalAssembler & localAssembler() const
Public access to the wrapping local assembler.
Definition: default/jacobianapplyengine.hh:90
bool requireUVSkeleton() const
Definition: default/jacobianapplyengine.hh:81
bool requireUVVolumePostSkeleton() const
Definition: default/jacobianapplyengine.hh:85
LA::LFSVCache LFSVCache
Definition: default/jacobianapplyengine.hh:54
Range::template LocalView< LFSVCache > RangeView
Definition: default/jacobianapplyengine.hh:58
Domain::template ConstLocalView< LFSUCache > DomainView
Definition: default/jacobianapplyengine.hh:57
bool requireUVVolume() const
Definition: default/jacobianapplyengine.hh:79
LA::LFSV LFSV
Definition: default/jacobianapplyengine.hh:53
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/jacobianapplyengine.hh:164
LA::Traits::Domain Domain
The type of the solution vector.
Definition: default/jacobianapplyengine.hh:46
void onBindLFSVInside(const IG &ig, const LFSVC &lfsv_cache)
Definition: default/jacobianapplyengine.hh:177
void setSolution(const Domain &solution_)
Definition: default/jacobianapplyengine.hh:109