Go to the documentation of this file. 1 #ifndef DUNE_PDELAB_GRIDOPERATOR_DEFAULT_JACOBIANENGINE_HH
2 #define DUNE_PDELAB_GRIDOPERATOR_DEFAULT_JACOBIANENGINE_HH
29 template<
typename TrialConstra
intsContainer,
typename TestConstra
intsContainer>
32 return cu.containsNonDirichletConstraints() || cv.containsNonDirichletConstraints();
39 typedef typename LA::LocalOperator
LOP;
42 typedef typename LA::LFSU
LFSU;
44 typedef typename LFSU::Traits::GridFunctionSpace
GFSU;
45 typedef typename LA::LFSV
LFSV;
47 typedef typename LFSV::Traits::GridFunctionSpace
GFSV;
50 typedef typename LA::Traits::Jacobian
Jacobian;
52 typedef typename Jacobian::template LocalView<LFSVCache,LFSUCache>
JacobianView;
55 typedef typename LA::Traits::Solution
Solution;
57 typedef typename Solution::template ConstLocalView<LFSUCache>
SolutionView;
66 : local_assembler(local_assembler_),
67 lop(local_assembler_.localOperator()),
69 al_sn_view(al_sn,1.0),
70 al_ns_view(al_ns,1.0),
77 {
return local_assembler.doAlphaSkeleton(); }
79 {
return local_assembler.doSkeletonTwoSided(); }
81 {
return local_assembler.doAlphaVolume(); }
83 {
return local_assembler.doAlphaSkeleton(); }
85 {
return local_assembler.doAlphaBoundary(); }
87 {
return local_assembler.doAlphaVolumePostSkeleton(); }
93 return local_assembler;
97 const typename LocalAssembler::Traits::TrialGridFunctionSpaceConstraints&
trialConstraints()
const
103 const typename LocalAssembler::Traits::TestGridFunctionSpaceConstraints&
testConstraints()
const
112 global_a_ss_view.attach(jacobian_);
113 global_a_sn_view.attach(jacobian_);
114 global_a_ns_view.attach(jacobian_);
115 global_a_nn_view.attach(jacobian_);
122 global_s_s_view.attach(solution_);
123 global_s_n_view.attach(solution_);
129 template<
typename EG,
typename LFSUC,
typename LFSVC>
130 void onBindLFSUV(
const EG & eg,
const LFSUC & lfsu_cache,
const LFSVC & lfsv_cache)
132 global_s_s_view.bind(lfsu_cache);
133 xl.
resize(lfsu_cache.size());
134 global_a_ss_view.bind(lfsv_cache,lfsu_cache);
135 al.assign(lfsv_cache.size(),lfsu_cache.size(),0.0);
138 template<
typename IG,
typename LFSUC,
typename LFSVC>
140 const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
141 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache)
143 global_s_n_view.bind(lfsu_n_cache);
144 xn.
resize(lfsu_n_cache.size());
145 global_a_sn_view.bind(lfsv_s_cache,lfsu_n_cache);
146 al_sn.assign(lfsv_s_cache.size(),lfsu_n_cache.size(),0.0);
147 global_a_ns_view.bind(lfsv_n_cache,lfsu_s_cache);
148 al_ns.assign(lfsv_n_cache.size(),lfsu_s_cache.size(),0.0);
149 global_a_nn_view.bind(lfsv_n_cache,lfsu_n_cache);
150 al_nn.assign(lfsv_n_cache.size(),lfsu_n_cache.size(),0.0);
158 template<
typename EG,
typename LFSUC,
typename LFSVC>
159 void onUnbindLFSUV(
const EG & eg,
const LFSUC & lfsu_cache,
const LFSVC & lfsv_cache)
161 local_assembler.scatter_jacobian(al,global_a_ss_view,
false);
164 template<
typename IG,
typename LFSUC,
typename LFSVC>
166 const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
167 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache)
169 local_assembler.scatter_jacobian(al_sn,global_a_sn_view,
false);
170 local_assembler.scatter_jacobian(al_ns,global_a_ns_view,
false);
171 local_assembler.scatter_jacobian(al_nn,global_a_nn_view,
false);
178 template<
typename LFSUC>
181 global_s_s_view.read(xl);
183 template<
typename LFSUC>
186 global_s_n_view.read(xn);
188 template<
typename LFSUC>
191 DUNE_THROW(Dune::NotImplemented,
"No coupling lfsu_cache available for ");
199 Jacobian& jacobian = global_a_ss_view.container();
200 global_s_s_view.detach();
201 global_s_n_view.detach();
202 global_a_ss_view.detach();
203 global_a_sn_view.detach();
204 global_a_ns_view.detach();
205 global_a_nn_view.detach();
207 if(local_assembler.doPostProcessing())
208 local_assembler.handle_dirichlet_constraints(gfsv,jacobian);
222 template<
typename EG>
225 return LocalAssembler::isNonOverlapping && eg.entity().partitionType() != Dune::InteriorEntity;
228 template<
typename EG,
typename LFSUC,
typename LFSVC>
231 al_view.setWeight(local_assembler.weight());
233 jacobian_volume(lop,eg,lfsu_cache.localFunctionSpace(),xl,lfsv_cache.localFunctionSpace(),al_view);
236 template<
typename IG,
typename LFSUC,
typename LFSVC>
238 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache)
240 al_view.setWeight(local_assembler.weight());
241 al_sn_view.setWeight(local_assembler.weight());
242 al_ns_view.setWeight(local_assembler.weight());
243 al_nn_view.setWeight(local_assembler.weight());
246 jacobian_skeleton(lop,
ig,lfsu_s_cache.localFunctionSpace(),xl,lfsv_s_cache.localFunctionSpace(),lfsu_n_cache.localFunctionSpace(),xn,lfsv_n_cache.localFunctionSpace(),al_view,al_sn_view,al_ns_view,al_nn_view);
249 template<
typename IG,
typename LFSUC,
typename LFSVC>
252 al_view.setWeight(local_assembler.weight());
254 jacobian_boundary(lop,
ig,lfsu_s_cache.localFunctionSpace(),xl,lfsv_s_cache.localFunctionSpace(),al_view);
257 template<
typename IG,
typename LFSUC,
typename LFSVC>
259 const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
260 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache,
261 const LFSUC & lfsu_coupling_cache,
const LFSVC & lfsv_coupling_cache)
263 DUNE_THROW(Dune::NotImplemented,
"Assembling of coupling spaces is not implemented for ");
266 template<
typename IG,
typename LFSVC>
268 const LFSVC & lfsv_s_cache,
269 const LFSVC & lfsv_n_cache,
270 const LFSVC & lfsv_coupling_cache)
272 DUNE_THROW(Dune::NotImplemented,
"Assembling of coupling spaces is not implemented for ");
275 template<
typename EG,
typename LFSUC,
typename LFSVC>
278 al_view.setWeight(local_assembler.weight());
309 typedef typename std::conditional<
316 >::type JacobianMatrix;
322 JacobianMatrix al_sn;
323 JacobianMatrix al_ns;
324 JacobianMatrix al_nn;
326 typename JacobianMatrix::WeightedAccumulationView al_view;
327 typename JacobianMatrix::WeightedAccumulationView al_sn_view;
328 typename JacobianMatrix::WeightedAccumulationView al_ns_view;
329 typename JacobianMatrix::WeightedAccumulationView al_nn_view;
337 #endif // DUNE_PDELAB_GRIDOPERATOR_DEFAULT_JACOBIANENGINE_HH
bool requireSkeleton() const
Definition: default/jacobianengine.hh:76
LFSV::Traits::GridFunctionSpace GFSV
Definition: default/jacobianengine.hh:47
void onBindLFSUV(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: default/jacobianengine.hh:130
const LocalAssembler::Traits::TestGridFunctionSpaceConstraints & testConstraints() const
Test space constraints.
Definition: default/jacobianengine.hh:103
Solution::ElementType SolutionElement
Definition: default/jacobianengine.hh:56
Definition: localfunctionspacetags.hh:48
bool requireUVBoundary() const
Definition: default/jacobianengine.hh:84
void loadCoefficientsLFSUOutside(const LFSUC &lfsu_n_cache)
Definition: default/jacobianengine.hh:184
A dense matrix for storing data associated with the degrees of freedom of a pair of LocalFunctionSpac...
Definition: diagonallocalmatrix.hh:28
bool requireUVVolume() const
Definition: default/jacobianengine.hh:80
bool requireUVSkeleton() const
Definition: default/jacobianengine.hh:82
LA::LFSV LFSV
Definition: default/jacobianengine.hh:45
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
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/jacobianengine.hh:237
void assembleUVBoundary(const IG &ig, const LFSUC &lfsu_s_cache, const LFSVC &lfsv_s_cache)
Definition: default/jacobianengine.hh:250
const LocalAssembler & localAssembler() const
Public access to the wrapping local assembler.
Definition: default/jacobianengine.hh:91
void assembleUVVolume(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: default/jacobianengine.hh:229
static const unsigned int value
Definition: gridfunctionspace/tags.hh:139
Jacobian::ElementType JacobianElement
Definition: default/jacobianengine.hh:51
static void assembleVEnrichedCoupling(const IG &ig, const LFSVC &lfsv_s_cache, const LFSVC &lfsv_n_cache, const LFSVC &lfsv_coupling_cache)
Definition: default/jacobianengine.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/jacobianengine.hh:258
DefaultLocalJacobianAssemblerEngine(const LocalAssembler &local_assembler_)
Constructor.
Definition: default/jacobianengine.hh:65
LA::LocalOperator LOP
The type of the local operator.
Definition: default/jacobianengine.hh:39
void loadCoefficientsLFSUCoupling(const LFSUC &lfsu_c_cache)
Definition: default/jacobianengine.hh:189
The local assembler for DUNE grids.
Definition: default/localassembler.hh:31
void setSolution(const Solution &solution_)
Definition: default/jacobianengine.hh:120
Definition: localfunctionspacetags.hh:54
LA::LFSUCache LFSUCache
Definition: default/jacobianengine.hh:43
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/jacobianengine.hh:139
void setJacobian(Jacobian &jacobian_)
Definition: default/jacobianengine.hh:110
A dense matrix for storing data associated with the degrees of freedom of a pair of LocalFunctionSpac...
Definition: localmatrix.hh:183
Impl::LocalAssemblerCallSwitchHelper< LOP, doIt > LocalAssemblerCallSwitch
Definition: callswitch.hh:344
LA LocalAssembler
The type of the wrapping local assembler.
Definition: default/jacobianengine.hh:36
Base class for LocalAssemblerEngine implementations to avoid boilerplate code.
Definition: localassemblerenginebase.hh:21
LA::Traits::Jacobian Jacobian
The type of the jacobian matrix.
Definition: default/jacobianengine.hh:50
The local assembler engine for DUNE grids which assembles the jacobian matrix.
Definition: default/jacobianengine.hh:24
LA::LFSVCache LFSVCache
Definition: default/jacobianengine.hh:46
Jacobian::template LocalView< LFSVCache, LFSUCache > JacobianView
Definition: default/jacobianengine.hh:52
LA::Traits::Solution Solution
The type of the solution vector.
Definition: default/jacobianengine.hh:55
void loadCoefficientsLFSUInside(const LFSUC &lfsu_cache)
Definition: default/jacobianengine.hh:179
Decorator base class for local operators that have a diagonal jacobian matrix.
Definition: flags.hh:101
void resize(size_type size)
Resize the container.
Definition: localvector.hh:323
const IG & ig
Definition: constraints.hh:149
void assembleUVVolumePostSkeleton(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: default/jacobianengine.hh:276
bool needsConstraintsCaching(const TrialConstraintsContainer &cu, const TestConstraintsContainer &cv)
Definition: default/jacobianengine.hh:30
void onUnbindLFSUV(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: default/jacobianengine.hh:159
bool assembleCell(const EG &eg)
Definition: default/jacobianengine.hh:223
const LocalAssembler::Traits::TrialGridFunctionSpaceConstraints & trialConstraints() const
Trial space constraints.
Definition: default/jacobianengine.hh:97
void postAssembly(const GFSU &gfsu, const GFSV &gfsv)
Definition: default/jacobianengine.hh:197
LFSU::Traits::GridFunctionSpace GFSU
Definition: default/jacobianengine.hh:44
void onUnbindLFSUVOutside(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/jacobianengine.hh:165
bool requireUVVolumePostSkeleton() const
Definition: default/jacobianengine.hh:86
bool requireSkeletonTwoSided() const
Definition: default/jacobianengine.hh:78
Solution::template ConstLocalView< LFSUCache > SolutionView
Definition: default/jacobianengine.hh:57
LA::LFSU LFSU
The local function spaces.
Definition: default/jacobianengine.hh:42