3#ifndef DUNE_PDELAB_LOCALOPERATOR_CALLSWITCH_HH
4#define DUNE_PDELAB_LOCALOPERATOR_CALLSWITCH_HH
23 template<
typename... Args>
27 auto require(LO&& lo) ->
decltype(
28 Concept::requireConvertible<bool>(lo.skip_entity(std::declval<Args>()...))
32 template<
typename... Args>
33 struct HasSkipIntersection
36 auto require(LO&& lo) ->
decltype(
37 Concept::requireConvertible<bool>(lo.skip_intersection(std::declval<Args>()...))
47 template<
typename LOP,
bool doIt,
bool isLinear = LOP::isLinear>
48 struct LocalAssemblerCallSwitchHelper
54 static bool skip_entity (
const LOP& lop,
const EG& eg)
60 static bool skip_intersection (
const LOP& lop,
const IG& ig)
68 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
69 static void pattern_volume (
const LOP& lop,
const LFSU& lfsu,
const LFSV& lfsv, LocalPattern& pattern)
72 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
73 static void pattern_volume_post_skeleton
75 const LFSU& lfsu,
const LFSV& lfsv,
76 LocalPattern& pattern)
79 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
80 static void pattern_skeleton (
const LOP& lop,
const LFSU& lfsu_s,
const LFSV& lfsv_s,
81 const LFSU& lfsu_n,
const LFSV& lfsv_n,
82 LocalPattern& pattern_sn,
83 LocalPattern& pattern_ns)
86 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
87 static void pattern_boundary(
const LOP& lop,
88 const LFSU& lfsu_s,
const LFSV& lfsv_s,
89 LocalPattern& pattern_ss)
96 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
typename R>
97 static void alpha_volume (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const LFSV& lfsv, R& r)
100 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
typename R>
101 static void alpha_volume_post_skeleton (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const LFSV& lfsv, R& r)
104 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
typename R>
105 static void alpha_skeleton (
const LOP& lop,
const IG& ig,
106 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
107 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
111 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
typename R>
112 static void alpha_boundary (
const LOP& lop,
const IG& ig,
113 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
121 template<
typename EG,
typename LFSV,
typename R>
122 static void lambda_volume (
const LOP& lop,
const EG& eg,
const LFSV& lfsv, R& r)
125 template<
typename EG,
typename LFSV,
typename R>
126 static void lambda_volume_post_skeleton (
const LOP& lop,
const EG& eg,
const LFSV& lfsv, R& r)
129 template<
typename IG,
typename LFSV,
typename R>
130 static void lambda_skeleton(
const LOP& lop,
const IG& ig,
131 const LFSV& lfsv_s,
const LFSV& lfsv_n,
135 template<
typename IG,
typename LFSV,
typename R>
136 static void lambda_boundary (
const LOP& lop,
const IG& ig,
const LFSV& lfsv, R& r)
143 template<
typename EG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
144 static void jacobian_apply_volume (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const Z& z,
const LFSV& lfsv, Y& y)
147 template<
typename EG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
148 static void jacobian_apply_volume_post_skeleton (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const Z& z,
const LFSV& lfsv, Y& y)
151 template<
typename IG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
152 static void jacobian_apply_skeleton (
const LOP& lop,
const IG& ig,
153 const LFSU& lfsu_s,
const X& x_s,
const Z& z_s,
const LFSV& lfsv_s,
154 const LFSU& lfsu_n,
const X& x_n,
const Z& z_n,
const LFSV& lfsv_n,
158 template<
typename IG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
159 static void jacobian_apply_boundary (
const LOP& lop,
const IG& ig,
160 const LFSU& lfsu_s,
const X& x_s,
const Z& z_s,
const LFSV& lfsv_s,
168 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
typename M>
169 static void jacobian_volume (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const LFSV& lfsv, M & mat)
172 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
typename M>
173 static void jacobian_volume_post_skeleton (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const LFSV& lfsv, M& mat)
176 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
typename M>
177 static void jacobian_skeleton (
const LOP& lop,
const IG& ig,
178 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
179 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
180 M & mat_ss, M & mat_sn,
181 M & mat_ns, M & mat_nn)
184 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
typename M>
185 static void jacobian_boundary (
const LOP& lop,
const IG& ig,
186 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
193 template<
typename LOP>
194 struct LocalAssemblerCallSwitchHelper<LOP,true,true>
200 template<
typename EG>
201 static bool skip_entity (
const LOP& lop,
const EG& eg)
203 static_assert(models<Impl::HasSkipEntity<EG>,LOP>());
204 return lop.skip_entity(eg);
207 template<
typename IG>
208 static bool skip_intersection (
const LOP& lop,
const IG& ig)
210 static_assert(models<Impl::HasSkipIntersection<IG>,LOP>());
211 return lop.skip_intersection(ig);
217 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
218 static void pattern_volume (
const LOP& lop,
const LFSU& lfsu,
const LFSV& lfsv, LocalPattern& pattern)
220 lop.pattern_volume(lfsu,lfsv,pattern);
222 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
223 static void pattern_volume_post_skeleton
225 const LFSU& lfsu,
const LFSV& lfsv,
226 LocalPattern& pattern)
228 lop.pattern_volume_post_skeleton(lfsu,lfsv,pattern);
230 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
231 static void pattern_skeleton (
const LOP& lop,
const LFSU& lfsu_s,
const LFSV& lfsv_s,
232 const LFSU& lfsu_n,
const LFSV& lfsv_n,
233 LocalPattern& pattern_sn,
234 LocalPattern& pattern_ns)
236 lop.pattern_skeleton(lfsu_s,lfsv_s,lfsu_n,lfsv_n,
237 pattern_sn, pattern_ns);
239 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
240 static void pattern_boundary(
const LOP& lop,
241 const LFSU& lfsu_s,
const LFSV& lfsv_s,
242 LocalPattern& pattern_ss)
244 lop.pattern_boundary(lfsu_s,lfsv_s,pattern_ss);
250 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
typename R>
251 static void alpha_volume (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const LFSV& lfsv, R& r)
253 lop.alpha_volume(eg,lfsu,x,lfsv,r);
255 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
typename R>
256 static void alpha_volume_post_skeleton (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const LFSV& lfsv, R& r)
258 lop.alpha_volume_post_skeleton(eg,lfsu,x,lfsv,r);
260 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
typename R>
261 static void alpha_skeleton (
const LOP& lop,
const IG& ig,
262 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
263 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
266 lop.alpha_skeleton(ig,lfsu_s,x_s,lfsv_s,lfsu_n,x_n,lfsv_n,r_s,r_n);
268 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
typename R>
269 static void alpha_boundary (
const LOP& lop,
const IG& ig,
270 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
273 lop.alpha_boundary(ig,lfsu_s,x_s,lfsv_s,r_s);
279 template<
typename EG,
typename LFSV,
typename R>
280 static void lambda_volume (
const LOP& lop,
const EG& eg,
const LFSV& lfsv, R& r)
282 lop.lambda_volume(eg,lfsv,r);
284 template<
typename EG,
typename LFSV,
typename R>
285 static void lambda_volume_post_skeleton (
const LOP& lop,
const EG& eg,
const LFSV& lfsv, R& r)
287 lop.lambda_volume_post_skeleton(eg,lfsv,r);
289 template<
typename IG,
typename LFSV,
typename R>
290 static void lambda_skeleton(
const LOP& lop,
const IG& ig,
291 const LFSV& lfsv_s,
const LFSV& lfsv_n,
294 lop.lambda_skeleton(ig, lfsv_s, lfsv_n, r_s, r_n);
296 template<
typename IG,
typename LFSV,
typename R>
297 static void lambda_boundary (
const LOP& lop,
const IG& ig,
const LFSV& lfsv, R& r)
299 lop.lambda_boundary(ig,lfsv,r);
305 template<
typename EG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
306 static auto jacobian_apply_volume (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const Z& z,
const LFSV& lfsv, Y& y)
308 lop.jacobian_apply_volume(eg,lfsu,z,lfsv,y);
310 template<
typename EG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
311 static void jacobian_apply_volume_post_skeleton (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const Z& z,
const LFSV& lfsv, Y& y)
313 lop.jacobian_apply_volume_post_skeleton(eg,lfsu,z,lfsv,y);
315 template<
typename IG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
316 static void jacobian_apply_skeleton (
const LOP& lop,
const IG& ig,
317 const LFSU& lfsu_s,
const X& x_s,
const Z& z_s,
const LFSV& lfsv_s,
318 const LFSU& lfsu_n,
const X& x_n,
const Z& z_n,
const LFSV& lfsv_n,
321 lop.jacobian_apply_skeleton(ig,lfsu_s,z_s,lfsv_s,lfsu_n,z_n,lfsv_n,y_s,y_n);
323 template<
typename IG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
324 static void jacobian_apply_boundary (
const LOP& lop,
const IG& ig,
325 const LFSU& lfsu_s,
const X& x_s,
const Z& z_s,
const LFSV& lfsv_s,
328 lop.jacobian_apply_boundary(ig,lfsu_s,z_s,lfsv_s,y_s);
334 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
typename M>
335 static void jacobian_volume (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const LFSV& lfsv, M & mat)
337 lop.jacobian_volume(eg,lfsu,x,lfsv,mat);
339 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
typename M>
340 static void jacobian_volume_post_skeleton (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const LFSV& lfsv, M & mat)
342 lop.jacobian_volume_post_skeleton(eg,lfsu,x,lfsv,mat);
344 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
typename M>
345 static void jacobian_skeleton (
const LOP& lop,
const IG& ig,
346 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
347 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
348 M & mat_ss, M & mat_sn,
349 M & mat_ns, M & mat_nn)
351 lop.jacobian_skeleton(ig,lfsu_s,x_s,lfsv_s,lfsu_n,x_n,lfsv_n,
352 mat_ss, mat_sn, mat_ns, mat_nn);
354 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
typename M>
355 static void jacobian_boundary (
const LOP& lop,
const IG& ig,
356 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
359 lop.jacobian_boundary(ig,lfsu_s,x_s,lfsv_s,mat_ss);
368 template<
typename LOP>
369 struct LocalAssemblerCallSwitchHelper<LOP,true,false> :
370 public LocalAssemblerCallSwitchHelper<LOP,true,true>
375 template<
typename EG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
376 static auto jacobian_apply_volume (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const Z& z,
const LFSV& lfsv, Y& y)
378 lop.jacobian_apply_volume(eg,lfsu,x,z,lfsv,y);
380 template<
typename EG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
381 static void jacobian_apply_volume_post_skeleton (
const LOP& lop,
const EG& eg,
const LFSU& lfsu,
const X& x,
const Z& z,
const LFSV& lfsv, Y& y)
383 lop.jacobian_apply_volume_post_skeleton(eg,lfsu,x,z,lfsv,y);
385 template<
typename IG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
386 static void jacobian_apply_skeleton (
const LOP& lop,
const IG& ig,
387 const LFSU& lfsu_s,
const X& x_s,
const Z& z_s,
const LFSV& lfsv_s,
388 const LFSU& lfsu_n,
const X& x_n,
const Z& z_n,
const LFSV& lfsv_n,
391 lop.jacobian_apply_skeleton(ig,lfsu_s,x_s,z_s,lfsv_s,lfsu_n,x_n,z_n,lfsv_n,y_s,y_n);
393 template<
typename IG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
394 static void jacobian_apply_boundary (
const LOP& lop,
const IG& ig,
395 const LFSU& lfsu_s,
const X& x_s,
const Z& z_s,
const LFSV& lfsv_s,
398 lop.jacobian_apply_boundary(ig,lfsu_s,x_s,z_s,lfsv_s,y_s);
405 template<
typename LOP,
bool doIt>
406 using LocalAssemblerCallSwitch =
407 Impl::LocalAssemblerCallSwitchHelper<LOP,doIt>;
410 namespace LocalOperatorApply {
namespace {
412 auto skipEntity = [](
const auto& lop,
auto&... args)
414 using LOP = std::decay_t<
decltype(lop)>;
415 return Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doSkipEntity>::
416 skip_entity(lop, args...);
419 auto skipIntersection = [](
const auto& lop,
auto&... args)
421 using LOP = std::decay_t<
decltype(lop)>;
422 return Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doSkipIntersection>::
423 skip_intersection(lop, args...);
426 auto patternVolume = [](
const auto& lop,
auto&... args)
428 using LOP = std::decay_t<
decltype(lop)>;
429 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doPatternVolume>::
430 pattern_volume(lop, args...);
433 auto patternVolumePostSkeleton = [](
const auto& lop,
auto&... args)
435 using LOP = std::decay_t<
decltype(lop)>;
436 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doPatternVolumePostSkeleton>::
437 pattern_volume_post_skeleton(lop, args...);
440 auto patternSkeleton = [](
const auto& lop,
auto&... args)
442 using LOP = std::decay_t<
decltype(lop)>;
443 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doPatternSkeleton>::
444 pattern_skeleton(lop, args...);
447 auto patternBoundary = [](
const auto& lop,
auto&... args)
449 using LOP = std::decay_t<
decltype(lop)>;
450 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doPatternBoundary>::
451 pattern_boundary(lop, args...);
455 auto alphaVolume = [](
const auto& lop,
auto&... args)
457 using LOP = std::decay_t<
decltype(lop)>;
458 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doAlphaVolume>::
459 alpha_volume(lop, args...);
462 auto alphaVolumePostSkeleton = [](
const auto& lop,
auto&... args)
464 using LOP = std::decay_t<
decltype(lop)>;
465 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doAlphaVolumePostSkeleton>::
466 alpha_volume_post_skeleton(lop, args...);
469 auto alphaSkeleton = [](
const auto& lop,
auto&... args)
471 using LOP = std::decay_t<
decltype(lop)>;
472 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doAlphaSkeleton>::
473 alpha_skeleton(lop, args...);
476 auto alphaBoundary = [](
const auto& lop,
auto&... args)
478 using LOP = std::decay_t<
decltype(lop)>;
479 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doAlphaBoundary>::
480 alpha_boundary(lop, args...);
485 auto lambdaVolume = [](
const auto& lop,
auto&... args)
487 using LOP = std::decay_t<
decltype(lop)>;
488 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doLambdaVolume>::
489 lambda_volume(lop, args...);
492 auto lambdaVolumePostSkeleton = [](
const auto& lop,
auto&... args)
494 using LOP = std::decay_t<
decltype(lop)>;
495 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doLambdaVolumePostSkeleton>::
496 lambda_volume_post_skeleton(lop, args...);
499 auto lambdaSkeleton = [](
const auto& lop,
auto&... args)
501 using LOP = std::decay_t<
decltype(lop)>;
502 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doLambdaSkeleton>::
503 lambda_skeleton(lop, args...);
506 auto lambdaBoundary = [](
const auto& lop,
auto&... args)
508 using LOP = std::decay_t<
decltype(lop)>;
509 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doLambdaBoundary>::
510 lambda_boundary(lop, args...);
515 auto jacobianVolume = [](
const auto& lop,
auto&... args)
517 using LOP = std::decay_t<
decltype(lop)>;
518 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doAlphaVolume>::
519 jacobian_volume(lop, args...);
522 auto jacobianVolumePostSkeleton = [](
const auto& lop,
auto&... args)
524 using LOP = std::decay_t<
decltype(lop)>;
525 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doAlphaVolumePostSkeleton>::
526 jacobian_volume_post_skeleton(lop, args...);
529 auto jacobianSkeleton = [](
const auto& lop,
auto&... args)
531 using LOP = std::decay_t<
decltype(lop)>;
532 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doAlphaSkeleton>::
533 jacobian_skeleton(lop, args...);
536 auto jacobianBoundary = [](
const auto& lop,
auto&... args)
538 using LOP = std::decay_t<
decltype(lop)>;
539 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doAlphaBoundary>::
540 jacobian_boundary(lop, args...);
545 auto jacobianApplyVolume = [](
const auto& lop,
auto&... args)
547 using LOP = std::decay_t<
decltype(lop)>;
548 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doAlphaVolume>::
549 jacobian_apply_volume(lop, args...);
552 auto jacobianApplyVolumePostSkeleton = [](
const auto& lop,
auto&... args)
554 using LOP = std::decay_t<
decltype(lop)>;
555 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doAlphaVolumePostSkeleton>::
556 jacobian_apply_volume_post_skeleton(lop, args...);
559 auto jacobianApplySkeleton = [](
const auto& lop,
auto&... args)
561 using LOP = std::decay_t<
decltype(lop)>;
562 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doAlphaSkeleton>::
563 jacobian_apply_skeleton(lop, args...);
566 auto jacobianApplyBoundary = [](
const auto& lop,
auto&... args)
568 using LOP = std::decay_t<
decltype(lop)>;
569 Impl::LocalAssemblerCallSwitchHelper<LOP,LOP::doAlphaBoundary>::
570 jacobian_apply_boundary(lop, args...);
Infrastructure for concepts.
Traits for type conversions and type information.
Dune namespace.
Definition: alignedallocator.hh:11