1#ifndef DUNE_PDELAB_GRIDOPERATOR_ONESTEP_JACOBIANRESIDUALENGINE_HH
2#define DUNE_PDELAB_GRIDOPERATOR_ONESTEP_JACOBIANRESIDUALENGINE_HH
6#include <dune/pdelab/gridoperator/common/localassemblerenginebase.hh>
18 template<
typename OSLA>
26 template<
typename TrialConstra
intsContainer,
typename TestConstra
intsContainer>
27 bool needsConstraintsCaching(
const TrialConstraintsContainer& cu,
const TestConstraintsContainer& cv)
const
29 return cu.containsNonDirichletConstraints() or cv.containsNonDirichletConstraints();
33 typedef typename OSLA::Real
Real;
35 typedef OSLA LocalAssembler;
36 typedef typename LocalAssembler::LocalPreStageAssemblerEngine PreStageEngine;
37 typedef typename LocalAssembler::LocalResidualAssemblerEngine ResidualEngine;
38 typedef typename LocalAssembler::LocalAssemblerDT1::LocalJacobianAssemblerEngine JacobianEngine;
47 (LocalAssembler & local_assembler_)
48 : la(local_assembler_),
49 prestage_engine(nullptr),
50 jacobian_engine(nullptr)
53 void setLocalPreStageEngine(PreStageEngine & prestage_engine_)
55 prestage_engine = & prestage_engine_;
58 void setLocalJacobianEngine(JacobianEngine & jacobian_engine_)
60 jacobian_engine = & jacobian_engine_;
67 return prestage_engine->requireSkeleton() or jacobian_engine->requireSkeleton();
69 bool requireSkeletonTwoSided()
const
71 return prestage_engine->requireSkeletonTwoSided() or jacobian_engine->requireSkeletonTwoSided();
73 bool requireUVVolume()
const
75 return prestage_engine->requireUVVolume() or jacobian_engine->requireUVVolume();
77 bool requireVVolume()
const
79 return prestage_engine->requireVVolume() or jacobian_engine->requireVVolume();
81 bool requireUVSkeleton()
const
83 return prestage_engine->requireUVSkeleton() or jacobian_engine->requireUVSkeleton();
85 bool requireVSkeleton()
const
87 return prestage_engine->requireVSkeleton() or jacobian_engine->requireVSkeleton();
89 bool requireUVBoundary()
const
91 return prestage_engine->requireUVBoundary() or jacobian_engine->requireUVBoundary();
93 bool requireVBoundary()
const
95 return prestage_engine->requireVBoundary() or jacobian_engine->requireVBoundary();
97 bool requireUVVolumePostSkeleton()
const
99 return prestage_engine->requireUVVolumePostSkeleton() or jacobian_engine->requireUVVolumePostSkeleton();
101 bool requireVVolumePostSkeleton()
const
103 return prestage_engine->requireVVolumePostSkeleton() or jacobian_engine->requireVVolumePostSkeleton();
117 template<
typename EG,
typename LFSU,
typename LFSV>
118 void onBindLFSUV(
const EG & eg,
const LFSU & lfsu,
const LFSV & lfsv)
120 if (prestage_engine->requireUVVolume() or prestage_engine->requireVVolume())
121 prestage_engine->onBindLFSUV(eg,lfsu,lfsv);
122 if (jacobian_engine->requireUVVolume() or jacobian_engine->requireVVolume())
123 jacobian_engine->onBindLFSUV(eg,lfsu,lfsv);
126 template<
typename EG,
typename LFSV>
127 void onBindLFSV(
const EG & eg,
const LFSV & lfsv)
129 if (prestage_engine->requireUVVolume() or prestage_engine->requireVVolume())
130 prestage_engine->onBindLFSV(eg,lfsv);
131 if (jacobian_engine->requireUVVolume() or jacobian_engine->requireVVolume())
132 jacobian_engine->onBindLFSV(eg,lfsv);
135 template<
typename IG,
typename LFSU,
typename LFSV>
136 void onBindLFSUVInside(
const IG & ig,
const LFSU & lfsu,
const LFSV & lfsv)
138 if (prestage_engine->requireUVVolume() or prestage_engine->requireVVolume())
139 prestage_engine->onBindLFSUVInside(ig,lfsu,lfsv);
140 if (jacobian_engine->requireUVVolume() or jacobian_engine->requireVVolume())
141 jacobian_engine->onBindLFSUVInside(ig,lfsu,lfsv);
144 template<
typename IG,
typename LFSU_S,
typename LFSV_S,
typename LFSU_N,
typename LFSV_N>
145 void onBindLFSUVOutside(
const IG & ig,
146 const LFSU_S & lfsus,
const LFSV_S & lfsvs,
147 const LFSU_N & lfsun,
const LFSV_N & lfsvn)
149 if (prestage_engine->requireSkeleton())
150 prestage_engine->onBindLFSUVOutside(ig,lfsus,lfsvs,lfsun,lfsvn);
151 if (jacobian_engine->requireSkeleton())
152 jacobian_engine->onBindLFSUVOutside(ig,lfsus,lfsvs,lfsun,lfsvn);
155 template<
typename IG,
typename LFSV>
156 void onBindLFSVInside(
const IG & ig,
const LFSV & lfsv)
158 if (prestage_engine->requireUVVolume() or prestage_engine->requireVVolume())
159 prestage_engine->onBindLFSVInside(ig,lfsv);
160 if (jacobian_engine->requireUVVolume() or jacobian_engine->requireVVolume())
161 jacobian_engine->onBindLFSVInside(ig,lfsv);
164 template<
typename IG,
typename LFSV_S,
typename LFSV_N>
165 void onBindLFSVOutside(
const IG & ig,
166 const LFSV_S & lfsvs,
167 const LFSV_N & lfsvn)
169 if (prestage_engine->requireSkeleton())
170 prestage_engine->onBindLFSVOutside(ig,lfsvs,lfsvn);
171 if (jacobian_engine->requireSkeleton())
172 jacobian_engine->onBindLFSVOutside(ig,lfsvs,lfsvn);
180 template<
typename EG,
typename LFSV>
183 if (prestage_engine->requireUVVolume() or prestage_engine->requireVVolume())
184 prestage_engine->onUnbindLFSV(eg,lfsv);
185 if (jacobian_engine->requireUVVolume() or jacobian_engine->requireVVolume())
186 jacobian_engine->onUnbindLFSV(eg,lfsv);
189 template<
typename IG,
typename LFSV>
190 void onUnbindLFSVInside(
const IG & ig,
const LFSV & lfsv)
192 if (prestage_engine->requireUVVolume() or prestage_engine->requireVVolume())
193 prestage_engine->onUnbindLFSVInside(ig,lfsv);
194 if (jacobian_engine->requireUVVolume() or jacobian_engine->requireVVolume())
195 jacobian_engine->onUnbindLFSVInside(ig,lfsv);
198 template<
typename IG,
typename LFSV_S,
typename LFSV_N>
199 void onUnbindLFSVOutside(
const IG & ig,
200 const LFSV_S & lfsvs,
201 const LFSV_N & lfsvn)
203 if (prestage_engine->requireSkeleton())
204 prestage_engine->onUnbindLFSVOutside(ig,lfsvs,lfsvn);
205 if (jacobian_engine->requireSkeleton())
206 jacobian_engine->onUnbindLFSVOutside(ig,lfsvs,lfsvn);
209 template<
typename EG,
typename LFSU,
typename LFSV>
210 void onUnbindLFSUV(
const EG& eg,
const LFSU& lfsu,
const LFSV& lfsv)
212 if (prestage_engine->requireUVVolume() or prestage_engine->requireVVolume())
213 prestage_engine->onUnbindLFSUV(eg,lfsu,lfsv);
214 if (jacobian_engine->requireUVVolume() or jacobian_engine->requireVVolume())
215 jacobian_engine->onUnbindLFSUV(eg,lfsu,lfsv);
218 template<
typename IG,
typename LFSU,
typename LFSV>
219 void onUnbindLFSUVInside(
const IG& ig,
const LFSU& lfsu,
const LFSV& lfsv)
221 if (prestage_engine->requireUVVolume() or prestage_engine->requireVVolume())
222 prestage_engine->onUnbindLFSUVInside(ig,lfsu,lfsv);
223 if (jacobian_engine->requireUVVolume() or jacobian_engine->requireVVolume())
224 jacobian_engine->onUnbindLFSUVInside(ig,lfsu,lfsv);
227 template<
typename IG,
typename LFSU_S,
typename LFSV_S,
typename LFSU_N,
typename LFSV_N>
228 void onUnbindLFSUVOutside(
const IG& ig,
229 const LFSU_S& lfsu_s,
const LFSV_S& lfsv_s,
230 const LFSU_N& lfsu_n,
const LFSV_N& lfsv_n)
232 if (prestage_engine->requireSkeleton())
233 prestage_engine->onUnbindLFSUVOutside(ig,lfsu_s,lfsv_s,lfsu_n,lfsv_n);
234 if (jacobian_engine->requireSkeleton())
235 jacobian_engine->onUnbindLFSUVOutside(ig,lfsu_s,lfsv_s,lfsu_n,lfsv_n);
243 template<
typename LFSU>
246 if (prestage_engine->requireUVVolume())
247 prestage_engine->loadCoefficientsLFSUInside(lfsu_s);
248 if (jacobian_engine->requireUVVolume())
249 jacobian_engine->loadCoefficientsLFSUInside(lfsu_s);
252 template<
typename LFSU>
253 void loadCoefficientsLFSUOutside(
const LFSU & lfsu_n)
255 if (prestage_engine->requireUVSkeleton())
256 prestage_engine->loadCoefficientsLFSUOutside(lfsu_n);
257 if (jacobian_engine->requireUVSkeleton())
258 jacobian_engine->loadCoefficientsLFSUOutside(lfsu_n);
261 template<
typename LFSU>
262 void loadCoefficientsLFSUCoupling(
const LFSU & lfsu_c)
264 prestage_engine->loadCoefficientsLFSUCoupling(lfsu_c);
265 jacobian_engine->loadCoefficientsLFSUCoupling(lfsu_c);
274 prestage_engine->preAssembly();
275 jacobian_engine->preAssembly();
278 template<
typename GFSU,
typename GFSV>
279 void postAssembly(
const GFSU& gfsu,
const GFSV& gfsv)
281 prestage_engine->postAssembly(gfsu,gfsv);
282 jacobian_engine->postAssembly(gfsu,gfsv);
290 template<
typename EG>
293 const bool abort_a = prestage_engine->assembleCell(eg);
294 const bool abort_c = jacobian_engine->assembleCell(eg);
295 return abort_a and abort_c;
298 template<
typename EG,
typename LFSU,
typename LFSV>
299 void assembleUVVolume(
const EG & eg,
const LFSU & lfsu,
const LFSV & lfsv)
301 if (prestage_engine->requireUVVolume())
302 prestage_engine->assembleUVVolume(eg,lfsu,lfsv);
304 prestage_engine->setTimeInLastStage();
305 if (jacobian_engine->requireUVVolume())
306 jacobian_engine->assembleUVVolume(eg,lfsu,lfsv);
309 template<
typename EG,
typename LFSV>
310 void assembleVVolume(
const EG & eg,
const LFSV & lfsv)
312 if (prestage_engine->requireVVolume())
313 prestage_engine->assembleVVolume(eg,lfsv);
315 prestage_engine->setTimeInLastStage();
316 if (jacobian_engine->requireVVolume())
317 jacobian_engine->assembleVVolume(eg,lfsv);
320 template<
typename IG,
typename LFSU_S,
typename LFSV_S,
typename LFSU_N,
typename LFSV_N>
321 void assembleUVSkeleton(
const IG & ig,
const LFSU_S & lfsu_s,
const LFSV_S & lfsv_s,
322 const LFSU_N & lfsu_n,
const LFSV_N & lfsv_n)
324 if (prestage_engine->requireUVSkeleton())
325 prestage_engine->assembleUVSkeleton(ig,lfsu_s,lfsv_s,lfsu_n,lfsv_n);
327 if (jacobian_engine->requireUVSkeleton())
328 jacobian_engine->assembleUVSkeleton(ig,lfsu_s,lfsv_s,lfsu_n,lfsv_n);
331 template<
typename IG,
typename LFSV_S,
typename LFSV_N>
332 void assembleVSkeleton(
const IG & ig,
const LFSV_S & lfsv_s,
const LFSV_N & lfsv_n)
334 if (prestage_engine->requireVSkeleton())
335 prestage_engine->assembleVSkeleton(ig,lfsv_s,lfsv_n);
337 if (jacobian_engine->requireVSkeleton())
338 jacobian_engine->assembleVSkeleton(ig,lfsv_s,lfsv_n);
341 template<
typename IG,
typename LFSU,
typename LFSV>
342 void assembleUVBoundary(
const IG & ig,
const LFSU & lfsu_s,
const LFSV & lfsv_s)
344 if (prestage_engine->requireUVBoundary())
345 prestage_engine->assembleUVBoundary(ig,lfsu_s,lfsv_s);
347 if (jacobian_engine->requireUVBoundary())
348 jacobian_engine->assembleUVBoundary(ig,lfsu_s,lfsv_s);
351 template<
typename IG,
typename LFSV>
352 void assembleVBoundary(
const IG & ig,
const LFSV & lfsv_s)
354 if (prestage_engine->requireVBoundary())
355 prestage_engine->assembleVBoundary(ig,lfsv_s);
357 if (jacobian_engine->requireVBoundary())
358 jacobian_engine->assembleVBoundary(ig,lfsv_s);
361 template<
typename IG,
typename LFSU_S,
typename LFSV_S,
typename LFSU_N,
typename LFSV_N,
362 typename LFSU_C,
typename LFSV_C>
363 void assembleUVEnrichedCoupling(
const IG & ig,
364 const LFSU_S & lfsu_s,
const LFSV_S & lfsv_s,
365 const LFSU_N & lfsu_n,
const LFSV_N & lfsv_n,
366 const LFSU_C & lfsu_coupling,
const LFSV_C & lfsv_coupling)
368 prestage_engine->assembleUVEnrichedCoupling(ig,lfsu_s,lfsv_s,lfsu_n,lfsv_n,lfsu_coupling,lfsv_coupling);
370 jacobian_engine->assembleUVEnrichedCoupling(ig,lfsu_s,lfsv_s,lfsu_n,lfsv_n,lfsu_coupling,lfsv_coupling);
373 template<
typename IG,
typename LFSV_S,
typename LFSV_N,
typename LFSV_C>
374 void assembleVEnrichedCoupling(
const IG & ig,
375 const LFSV_S & lfsv_s,
376 const LFSV_N & lfsv_n,
377 const LFSV_C & lfsv_coupling)
379 prestage_engine->assembleVEnrichedCoupling(ig,lfsv_s,lfsv_n,lfsv_coupling);
381 jacobian_engine->assembleVEnrichedCoupling(ig,lfsv_s,lfsv_n,lfsv_coupling);
384 template<
typename EG,
typename LFSU,
typename LFSV>
385 void assembleUVVolumePostSkeleton(
const EG & eg,
const LFSU & lfsu,
const LFSV & lfsv)
387 if (prestage_engine->requireUVVolumePostSkeleton())
388 prestage_engine->assembleUVVolumePostSkeleton(eg,lfsu,lfsv);
390 if (jacobian_engine->requireUVVolumePostSkeleton())
391 jacobian_engine->assembleUVVolumePostSkeleton(eg,lfsu,lfsv);
394 template<
typename EG,
typename LFSV>
395 void assembleVVolumePostSkeleton(
const EG & eg,
const LFSV & lfsv)
397 if (prestage_engine->requireVVolumePostSkeleton())
398 prestage_engine->assembleVVolumePostSkeleton(eg,lfsv);
400 if (jacobian_engine->requireVVolumePostSkeleton())
401 jacobian_engine->assembleVVolumePostSkeleton(eg,lfsv);
412 PreStageEngine * prestage_engine;
413 JacobianEngine * jacobian_engine;
Base class for LocalAssemblerEngine implementations to avoid boilerplate code.
Definition: localassemblerenginebase.hh:22
The local assembler engine for DUNE grids which assembles the residual vector.
Definition: jacobianresidualengine.hh:21
OneStepExplicitLocalJacobianResidualAssemblerEngine(LocalAssembler &local_assembler_)
Constructor.
Definition: jacobianresidualengine.hh:47
void loadCoefficientsLFSUInside(const LFSU &lfsu_s)
Definition: jacobianresidualengine.hh:244
bool assembleCell(const EG &eg)
Definition: jacobianresidualengine.hh:291
bool requireSkeleton() const
Definition: jacobianresidualengine.hh:65
void onBindLFSUV(const EG &eg, const LFSU &lfsu, const LFSV &lfsv)
Definition: jacobianresidualengine.hh:118
OSLA OneStepLocalAssembler
The type of the wrapping local assembler.
Definition: jacobianresidualengine.hh:24
void onUnbindLFSV(const EG &eg, const LFSV &lfsv)
Definition: jacobianresidualengine.hh:181
OSLA::Real Real
The type for real numbers.
Definition: jacobianresidualengine.hh:33
void preAssembly()
Definition: jacobianresidualengine.hh:272
const LocalAssembler & localAssembler() const
Public access to the wrapping local assembler.
Definition: jacobianresidualengine.hh:109
Dune namespace.
Definition: alignedallocator.hh:13