1 #ifndef DUNE_PDELAB_GRIDOPERATOR_DEFAULT_NONLINEARJACOBIANAPPLYENGINE_HH 2 #define DUNE_PDELAB_GRIDOPERATOR_DEFAULT_NONLINEARJACOBIANAPPLYENGINE_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_), lop(local_assembler_.lop),
72 {
return local_assembler.doAlphaSkeleton(); }
74 {
return local_assembler.doSkeletonTwoSided(); }
76 {
return local_assembler.doAlphaVolume(); }
78 {
return local_assembler.doAlphaSkeleton(); }
80 {
return local_assembler.doAlphaBoundary(); }
82 {
return local_assembler.doAlphaVolumePostSkeleton(); }
89 const typename LocalAssembler::Traits::TrialGridFunctionSpaceConstraints&
trialConstraints()
const 95 const typename LocalAssembler::Traits::TestGridFunctionSpaceConstraints&
testConstraints()
const 103 global_rl_view.attach(residual_);
104 global_rn_view.attach(residual_);
110 global_sl_view.attach(solution_);
111 global_sn_view.attach(solution_);
117 global_zl_view.attach(update_);
118 global_zn_view.attach(update_);
124 template<
typename EG,
typename LFSUC,
typename LFSVC>
125 void onBindLFSUV(
const EG & eg,
const LFSUC & lfsu_cache,
const LFSVC & lfsv_cache){
126 global_sl_view.bind(lfsu_cache);
127 xl.
resize(lfsu_cache.size());
128 global_zl_view.bind(lfsu_cache);
129 zl.
resize(lfsu_cache.size());
132 template<
typename EG,
typename LFSVC>
134 global_rl_view.bind(lfsv_cache);
135 rl.
assign(lfsv_cache.size(),0.0);
138 template<
typename IG,
typename LFSUC,
typename LFSVC>
140 global_sl_view.bind(lfsu_cache);
141 xl.
resize(lfsu_cache.size());
142 global_zl_view.bind(lfsu_cache);
143 zl.
resize(lfsu_cache.size());
146 template<
typename IG,
typename LFSUC,
typename LFSVC>
148 const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
149 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache)
151 global_sn_view.bind(lfsu_n_cache);
152 xn.
resize(lfsu_n_cache.size());
153 global_zn_view.bind(lfsu_n_cache);
154 zn.
resize(lfsu_n_cache.size());
157 template<
typename IG,
typename LFSVC>
159 global_rl_view.bind(lfsv_cache);
160 rl.
assign(lfsv_cache.size(),0.0);
163 template<
typename IG,
typename LFSVC>
165 const LFSVC & lfsv_s_cache,
166 const LFSVC & lfsv_n_cache)
168 global_rn_view.bind(lfsv_n_cache);
169 rn.
assign(lfsv_n_cache.size(),0.0);
177 template<
typename EG,
typename LFSVC>
179 global_rl_view.add(rl);
180 global_rl_view.commit();
183 template<
typename IG,
typename LFSVC>
185 global_rl_view.add(rl);
186 global_rl_view.commit();
189 template<
typename IG,
typename LFSVC>
191 const LFSVC & lfsv_s_cache,
192 const LFSVC & lfsv_n_cache)
194 global_rn_view.add(rn);
195 global_rn_view.commit();
201 template<
typename LFSUC>
203 global_sl_view.read(xl);
204 global_zl_view.read(xl);
206 template<
typename LFSUC>
208 global_sn_view.read(xn);
209 global_zn_view.read(xn);
211 template<
typename LFSUC>
213 {DUNE_THROW(Dune::NotImplemented,
"No coupling lfsu available for ");}
220 if(local_assembler.doPostProcessing){
236 template<
typename EG>
239 return LocalAssembler::isNonOverlapping && eg.entity().partitionType() != Dune::InteriorEntity;
242 template<
typename EG,
typename LFSUC,
typename LFSVC>
245 rl_view.
setWeight(local_assembler.weight);
250 template<
typename IG,
typename LFSUC,
typename LFSVC>
252 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache)
254 rl_view.
setWeight(local_assembler.weight);
255 rn_view.
setWeight(local_assembler.weight);
258 lfsu_s_cache.localFunctionSpace(),xl,zl,lfsv_s_cache.localFunctionSpace(),
259 lfsu_n_cache.localFunctionSpace(),xn,zl,lfsv_n_cache.localFunctionSpace(),
263 template<
typename IG,
typename LFSUC,
typename LFSVC>
266 rl_view.
setWeight(local_assembler.weight);
271 template<
typename IG,
typename LFSUC,
typename LFSVC>
273 const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
274 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache,
275 const LFSUC & lfsu_coupling_cache,
const LFSVC & lfsv_coupling_cache)
276 {DUNE_THROW(Dune::NotImplemented,
"Assembling of coupling spaces is not implemented for ");}
278 template<
typename EG,
typename LFSUC,
typename LFSVC>
281 rl_view.
setWeight(local_assembler.weight);
291 const LocalAssembler & local_assembler;
297 ResidualView global_rl_view;
298 ResidualView global_rn_view;
301 SolutionView global_sl_view;
302 SolutionView global_sn_view;
305 SolutionView global_zl_view;
306 SolutionView global_zn_view;
339 #endif // DUNE_PDELAB_GRIDOPERATOR_DEFAULT_NONLINEARJACOBIANAPPLYENGINE_HH Residual::ElementType ResidualElement
Definition: nonlinearjacobianapplyengine.hh:40
void resize(size_type size)
Resize the container.
Definition: localvector.hh:251
void loadCoefficientsLFSUCoupling(const LFSUC &lfsu_c_cache)
Definition: nonlinearjacobianapplyengine.hh:212
void assembleUVVolume(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: nonlinearjacobianapplyengine.hh:243
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: nonlinearjacobianapplyengine.hh:54
LA::Traits::Solution Solution
The type of the solution vector.
Definition: nonlinearjacobianapplyengine.hh:43
LA LocalAssembler
The type of the wrapping local assembler.
Definition: nonlinearjacobianapplyengine.hh:33
void assembleUVVolumePostSkeleton(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: nonlinearjacobianapplyengine.hh:279
LA::LFSUCache LFSUCache
Definition: nonlinearjacobianapplyengine.hh:48
const LocalAssembler::Traits::TestGridFunctionSpaceConstraints & testConstraints() const
Test space constraints.
Definition: nonlinearjacobianapplyengine.hh:95
static void nonlinear_jacobian_apply_volume(const LA &la, const EG &eg, const LFSU &lfsu, const X &x, const X &z, const LFSV &lfsv, Y &y)
Definition: callswitch.hh:154
static void nonlinear_jacobian_apply_volume_post_skeleton(const LA &la, const EG &eg, const LFSU &lfsu, const X &x, const X &z, const LFSV &lfsv, Y &y)
Definition: callswitch.hh:158
LA::LocalOperator LOP
The type of the local operator.
Definition: nonlinearjacobianapplyengine.hh:36
bool requireUVSkeleton() const
Definition: nonlinearjacobianapplyengine.hh:77
void setWeight(weight_type weight)
Resets the weighting coefficient of the view.
Definition: localvector.hh:72
Residual::template LocalView< LFSVCache > ResidualView
Definition: nonlinearjacobianapplyengine.hh:55
const IG & ig
Definition: constraints.hh:148
bool assembleCell(const EG &eg)
Definition: nonlinearjacobianapplyengine.hh:237
bool requireUVVolume() const
Definition: nonlinearjacobianapplyengine.hh:75
Definition: adaptivity.hh:27
bool requireSkeleton() const
Definition: nonlinearjacobianapplyengine.hh:71
void onBindLFSUVInside(const IG &ig, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: nonlinearjacobianapplyengine.hh:139
void onBindLFSVOutside(const IG &ig, const LFSVC &lfsv_s_cache, const LFSVC &lfsv_n_cache)
Definition: nonlinearjacobianapplyengine.hh:164
void postAssembly(const GFSU &gfsu, const GFSV &gfsv)
Definition: nonlinearjacobianapplyengine.hh:219
void assign(size_type size, const T &value)
Resize the container to size and assign the passed value to all entries.
Definition: localvector.hh:257
static void nonlinear_jacobian_apply_skeleton(const LA &la, const IG &ig, const LFSU &lfsu_s, const X &x_s, const X &z_s, const LFSV &lfsv_s, const LFSU &lfsu_n, const X &x_n, const X &z_n, const LFSV &lfsv_n, Y &y_s, Y &y_n)
Definition: callswitch.hh:162
Solution::ElementType SolutionElement
Definition: nonlinearjacobianapplyengine.hh:44
void assembleUVBoundary(const IG &ig, const LFSUC &lfsu_s_cache, const LFSVC &lfsv_s_cache)
Definition: nonlinearjacobianapplyengine.hh:264
bool requireUVVolumePostSkeleton() const
Definition: nonlinearjacobianapplyengine.hh:81
LA::LFSU LFSU
The local function spaces.
Definition: nonlinearjacobianapplyengine.hh:47
void onBindLFSUV(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: nonlinearjacobianapplyengine.hh:125
void setSolution(const Solution &solution_)
Definition: nonlinearjacobianapplyengine.hh:109
LA::LFSVCache LFSVCache
Definition: nonlinearjacobianapplyengine.hh:51
void onUnbindLFSVOutside(const IG &ig, const LFSVC &lfsv_s_cache, const LFSVC &lfsv_n_cache)
Definition: nonlinearjacobianapplyengine.hh:190
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: nonlinearjacobianapplyengine.hh:147
const LocalAssembler::Traits::TrialGridFunctionSpaceConstraints & trialConstraints() const
Trial space constraints.
Definition: nonlinearjacobianapplyengine.hh:89
LA::LFSV LFSV
Definition: nonlinearjacobianapplyengine.hh:50
void loadCoefficientsLFSUInside(const LFSUC &lfsu_s_cache)
Definition: nonlinearjacobianapplyengine.hh:202
bool requireUVBoundary() const
Definition: nonlinearjacobianapplyengine.hh:79
void constrain_residual(const CG &cg, XG &xg)
transform residual into transformed basis: r -> r~
Definition: constraints.hh:906
void setResidual(Residual &residual_)
Definition: nonlinearjacobianapplyengine.hh:102
const LocalAssembler & localAssembler() const
Public access to the wrapping local assembler.
Definition: nonlinearjacobianapplyengine.hh:86
Definition: localfunctionspacetags.hh:48
void onBindLFSVInside(const IG &ig, const LFSVC &lfsv_cache)
Definition: nonlinearjacobianapplyengine.hh:158
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: nonlinearjacobianapplyengine.hh:272
Definition: localfunctionspacetags.hh:54
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: nonlinearjacobianapplyengine.hh:251
void onBindLFSV(const EG &eg, const LFSVC &lfsv_cache)
Definition: nonlinearjacobianapplyengine.hh:133
static void nonlinear_jacobian_apply_boundary(const LA &la, const IG &ig, const LFSU &lfsu_s, const X &x_s, const X &z_s, const LFSV &lfsv_s, Y &y_s)
Definition: callswitch.hh:169
Base class for LocalAssemblerEngine implementations to avoid boilerplate code.
Definition: localassemblerenginebase.hh:21
LA::Traits::Residual Residual
The type of the residual vector.
Definition: nonlinearjacobianapplyengine.hh:39
void onUnbindLFSVInside(const IG &ig, const LFSVC &lfsv_cache)
Definition: nonlinearjacobianapplyengine.hh:184
void setUpdate(const Solution &update_)
Definition: nonlinearjacobianapplyengine.hh:116
void onUnbindLFSV(const EG &eg, const LFSVC &lfsv_cache)
Definition: nonlinearjacobianapplyengine.hh:178
void loadCoefficientsLFSUOutside(const LFSUC &lfsu_n_cache)
Definition: nonlinearjacobianapplyengine.hh:207
bool needsConstraintsCaching(const TrialConstraintsContainer &cu, const TestConstraintsContainer &cv) const
Definition: nonlinearjacobianapplyengine.hh:27
LFSV::Traits::GridFunctionSpace GFSV
Definition: nonlinearjacobianapplyengine.hh:52
DefaultLocalNonlinearJacobianApplyAssemblerEngine(const LocalAssembler &local_assembler_)
Constructor.
Definition: nonlinearjacobianapplyengine.hh:63
LFSU::Traits::GridFunctionSpace GFSU
Definition: nonlinearjacobianapplyengine.hh:49
bool requireSkeletonTwoSided() const
Definition: nonlinearjacobianapplyengine.hh:73
The local assembler engine for DUNE grids which assembles the local application of the Jacobian...
Definition: nonlinearjacobianapplyengine.hh:21