DUNE-ACFEM (2.5.1)

operatorpartsexpression.hh
1#ifndef __OPERATORPARTSEXPRESSION_HH__
2#define __OPERATORPARTSEXPRESSION_HH__
3
4#include "operatorparts.hh"
5#include "operatorpartsexpressionbase.hh"
6#include "operatorpartsoperations.hh"
7#include "zerooperatorparts.hh"
8
9namespace Dune
10{
11
12 namespace ACFem
13 {
14
28 template<class BinOp, class LeftOperand, class RightOperand>
29 class BinaryOperatorPartsExpression;
30
32 template<class UnOp, class Operand>
34
36 template<class Operand>
38 : public OperatorPartsExpression<UnaryOperatorPartsExpression<IdentityOperation, Operand> >
39 {
40 typedef Operand OperandType;
43 typedef OperatorPartsExpression<ThisType> BaseType;
46 public:
48 typedef OperandType ContainedExpressionType;
49
51 typedef typename InterfaceType::FunctionSpaceType FunctionSpaceType;
52
54 typedef typename InterfaceType::DomainFieldType DomainFieldType ;
56 typedef typename InterfaceType::RangeFieldType RangeFieldType ;
58 typedef typename InterfaceType::DomainType DomainType ;
60 typedef typename InterfaceType::RangeType RangeType ;
62 typedef typename InterfaceType::JacobianRangeType JacobianRangeType;
64 typedef typename InterfaceType::HessianRangeType HessianRangeType;
65
66 enum { dimDomain = FunctionSpaceType::dimDomain, dimRange = FunctionSpaceType::dimRange };
67
68 public:
69
70 // constructor
71 UnaryOperatorPartsExpression(const OperandType& op)
72 : operand_(op)
73 {}
74
75 // copy constructor
76 UnaryOperatorPartsExpression(const ThisType &other)
77 : operand_( other.operand_ )
78 {}
79
81 template<class Entity>
82 void setEntity(const Entity& entity) const
83 {
84 operand_().setEntity(entity);
85 }
86
88 template<class Intersection>
89 bool setIntersection(const Intersection& intersection) const
90 {
91 return operand_().setIntersection(intersection); // recurse ...
92 }
93
95 std::string name() const
96 {
97 return OpType::name() + "(" + operand_().name() + ")";
98 }
99
101 template<class Entity, class Point>
102 void flux(const Entity& entity,
103 const Point &x,
104 const RangeType &value,
105 const JacobianRangeType &jacobian,
106 JacobianRangeType &flux ) const
107 {
108 if (!OperandType::hasFlux) {
109 flux = 0.;
110 return;
111 }
112 operand_().flux(entity, x, value, jacobian, flux);
113 }
114
116 template<class Entity, class Point>
117 void linearizedFlux(const RangeType& uBar,
118 const JacobianRangeType& DuBar,
119 const Entity& entity,
120 const Point &x,
121 const RangeType &value,
122 const JacobianRangeType &jacobian,
123 JacobianRangeType &flux) const
124 {
125 if (!OperandType::hasFlux) {
126 flux = 0.;
127 return;
128 }
129 operand_().linearizedFlux(uBar, DuBar, entity, x, value, jacobian, flux);
130 }
131
133 template<class Entity, class Point>
134 void source(const Entity& entity,
135 const Point &x,
136 const RangeType &value,
137 const JacobianRangeType &jacobian,
138 RangeType &result) const
139 {
140 if (!OperandType::hasSources) {
141 result = 0.;
142 return;
143 }
144 operand_().source(entity, x, value, jacobian, result);
145 }
146
148 template<class Entity, class Point>
149 void linearizedSource(const RangeType &uBar,
150 const JacobianRangeType& DuBar,
151 const Entity& entity,
152 const Point &x,
153 const RangeType &value,
154 const JacobianRangeType &jacobian,
155 RangeType &result) const
156 {
157 if (!OperandType::hasSources) {
158 result = 0.;
159 return;
160 }
161 operand_().linearizedSource(uBar, DuBar, entity, x, value, jacobian, result);
162 }
163
165 template<class Intersection, class Point>
166 void robinFlux(const Intersection& intersection,
167 const Point& x,
168 const DomainType& unitOuterNormal,
169 const RangeType& value,
170 RangeType& result) const
171 {
172 if (!OperandType::hasRobinFlux) {
173 result = 0.;
174 return;
175 }
176 operand_().robinFlux(intersection, x, unitOuterNormal, value, result);
177 }
178
180 template<class Intersection, class Point>
182 const Intersection& intersection,
183 const Point& x,
184 const DomainType& unitOuterNormal,
185 const RangeType& value,
186 RangeType& result) const
187 {
188 if (!OperandType::hasRobinFlux) {
189 result = 0.;
190 return;
191 }
192 operand_().linearizedRobinFlux(uBar, intersection, x, unitOuterNormal, value, result);
193 }
194
196 template<class Entity, class Point>
197 void fluxDivergence(const Entity& entity,
198 const Point &x,
199 const RangeType &value,
200 const JacobianRangeType &jacobian,
201 const HessianRangeType &hessian,
202 RangeType &result) const
203 {
204 if (!OperandType::hasFlux) {
205 result = 0.;
206 return;
207 }
208 operand_().fluxDivergence(entity, x, value, jacobian, hessian, result);
209 }
210
211 const ContainedExpressionType& containedExpression() const
212 {
213 return operand_();
214 }
215
216 protected:
217 ExpressionStorage<OperandType> operand_;
218 };
219
220 //traits
221 template<class Operand>
222 struct OperatorPartsTraits<UnaryOperatorPartsExpression<IdentityOperation, Operand> >
223 : public DefaultOperatorPartsTraits<typename Operand::FunctionSpaceType>
224 {
225 protected:
226 typedef Operand OperandType;
227 public:
228 enum StructureFlags {
229 isLinear = OperandType::isLinear,
230 isSymmetric = OperandType::isSymmetric,
231 isSemiDefinite = OperandType::isSemiDefinite
232 };
233
234 enum ConstituentFlags {
235 hasFlux = OperandType::hasFlux,
236 hasSources = OperandType::hasSources,
237 hasRobinFlux = OperandType::hasRobinFlux
238 };
239 };
240
242 template<class Operand>
244 : public OperatorPartsExpression<UnaryOperatorPartsExpression<MinusOperation, Operand> >
245 {
246 typedef Operand OperandType;
247 typedef MinusOperation OpType;
249 typedef OperatorPartsExpression<ThisType> BaseType;
252 public:
254 typedef OperandType ContainedExpressionType;
255
257 typedef typename InterfaceType::FunctionSpaceType FunctionSpaceType;
258
260 typedef typename InterfaceType::DomainFieldType DomainFieldType ;
262 typedef typename InterfaceType::RangeFieldType RangeFieldType ;
264 typedef typename InterfaceType::DomainType DomainType ;
266 typedef typename InterfaceType::RangeType RangeType ;
268 typedef typename InterfaceType::JacobianRangeType JacobianRangeType;
270 typedef typename InterfaceType::HessianRangeType HessianRangeType;
271
272 enum { dimDomain = FunctionSpaceType::dimDomain, dimRange = FunctionSpaceType::dimRange };
273
274 public:
275
276 // constructor
277 UnaryOperatorPartsExpression(const OperandType& f)
278 : operand_(f)
279 {}
280
281 // copy constructor
282 UnaryOperatorPartsExpression(const ThisType &other)
283 : operand_( other.operand_ )
284 {}
285
286
288 template<class Entity>
289 void setEntity(const Entity& entity) const
290 {
291 operand_().setEntity(entity);
292 }
293
295 template<class Intersection>
296 bool setIntersection(const Intersection& intersection) const
297 {
298 return operand_().setIntersection(intersection); // recurse ...
299 }
300
302 std::string name() const
303 {
304 return OpType::name() + "(" + operand_().name() + ")";
305 }
306
308 template<class Entity, class Point>
309 void flux(const Entity& entity,
310 const Point &x,
311 const RangeType &value,
312 const JacobianRangeType &jacobian,
313 JacobianRangeType &flux) const
314 {
315 if (!OperandType::hasFlux) {
316 flux = 0.;
317 return;
318 }
319 operand_().flux(entity, x, value, jacobian, flux);
320 flux *= -1.;
321 }
322
324 template<class Entity, class Point>
325 void linearizedFlux(const RangeType& uBar,
326 const JacobianRangeType& DuBar,
327 const Entity& entity,
328 const Point &x,
329 const RangeType &value,
330 const JacobianRangeType &jacobian,
331 JacobianRangeType &flux ) const
332 {
333 if (!OperandType::hasFlux) {
334 flux = 0.;
335 return;
336 }
337 operand_().linearizedFlux(uBar, DuBar, entity, x, value, jacobian, flux);
338 flux *= -1.;
339 }
340
342 template<class Entity, class Point>
343 void source(const Entity& entity,
344 const Point &x,
345 const RangeType &value,
346 const JacobianRangeType &jacobian,
347 RangeType &result) const
348 {
349 if (!OperandType::hasSources) {
350 result = 0.;
351 return;
352 }
353 operand_().source(entity, x, value, jacobian, result);
354 result *= -1.;
355 }
356
358 template<class Entity, class Point>
359 void linearizedSource(const RangeType &uBar,
360 const JacobianRangeType& DuBar,
361 const Entity& entity,
362 const Point &x,
363 const RangeType &value,
364 const JacobianRangeType &jacobian,
365 RangeType &result) const
366 {
367 if (!OperandType::hasSources) {
368 result = 0.;
369 return;
370 }
371 operand_().linearizedSource(uBar, DuBar, entity, x, value, jacobian, result);
372 result *= -1.;
373 }
374
376 template<class Intersection, class Point>
377 void robinFlux(const Intersection& intersection,
378 const Point& x,
379 const DomainType& unitOuterNormal,
380 const RangeType& value,
381 RangeType& result) const
382 {
383 if (!OperandType::hasRobinFlux) {
384 result = 0.;
385 return;
386 }
387 operand_().robinFlux(intersection, x, unitOuterNormal, value, result);
388 result *= -1.;
389 }
390
392 template<class Intersection, class Point>
394 const Intersection& intersection,
395 const Point& x,
396 const DomainType& unitOuterNormal,
397 const RangeType& value,
398 RangeType& result) const
399 {
400 if (!OperandType::hasRobinFlux) {
401 result = 0.;
402 return;
403 }
404 operand_().linearizedRobinFlux(uBar, intersection, x, unitOuterNormal, value, result);
405 result *= -1.0;
406 }
407
409 template<class Entity, class Point>
410 void fluxDivergence(const Entity& entity,
411 const Point &x,
412 const RangeType &value,
413 const JacobianRangeType &jacobian,
414 const HessianRangeType &hessian,
415 RangeType &result) const
416 {
417 if (!OperandType::hasFlux) {
418 result = 0.;
419 return;
420 }
421 operand_().fluxDivergence(entity, x, value, jacobian, hessian, result);
422 result *= -1.;
423 }
424
425 const ContainedExpressionType& containedExpression() const
426 {
427 return operand_();
428 }
429
430 protected:
431 ExpressionStorage<OperandType> operand_;
432 };
433
434 //traits
435 template<class Operand>
436 struct OperatorPartsTraits<UnaryOperatorPartsExpression<MinusOperation, Operand> >
437 : public DefaultOperatorPartsTraits<typename Operand::FunctionSpaceType>
438 {
439 protected:
440 typedef Operand OperandType;
441 public:
442 enum StructureFlags {
443 isLinear = OperandType::isLinear,
444 isSymmetric = OperandType::isSymmetric,
445 isSemiDefinite = OperandType::isSemiDefinite
446 };
447
448 enum ConstituentFlags {
449 hasFlux = OperandType::hasFlux,
450 hasSources = OperandType::hasSources,
451 hasRobinFlux = OperandType::hasRobinFlux
452 };
453
454 typedef typename OperandType::FunctionSpaceType FunctionSpaceType;
455 };
456
457 // BinaryOperatorPartsExpression
458 // -------------------
459
463 template<class BinOp, class LeftOperand, class RightOperand>
465 : public OperatorPartsExpression<BinaryOperatorPartsExpression<BinOp, LeftOperand, RightOperand> >
466 {
467 typedef BinOp BinOpType;
469 typedef OperatorPartsExpression<ThisType> BaseType;
471 typedef BinaryOperatorPartsExpressionOperation<BinOpType> OperationType;
473 public:
475 typedef typename InterfaceType::FunctionSpaceType FunctionSpaceType;
476
478 typedef typename InterfaceType::DomainFieldType DomainFieldType ;
480 typedef typename InterfaceType::RangeFieldType RangeFieldType ;
482 typedef typename InterfaceType::DomainType DomainType ;
484 typedef typename InterfaceType::RangeType RangeType ;
486 typedef typename InterfaceType::JacobianRangeType JacobianRangeType;
488 typedef typename InterfaceType::HessianRangeType HessianRangeType;
489
490 enum { dimDomain = FunctionSpaceType::dimDomain, dimRange = FunctionSpaceType::dimRange };
491
492 public:
493
494 // constructor
495 BinaryOperatorPartsExpression(const LeftOperand &f,
496 const RightOperand &g)
497 : leftOperand_( f ), rightOperand_( g )
498 {}
499
500 // copy constructor
501 BinaryOperatorPartsExpression(const ThisType &other )
502 : leftOperand_( other.leftOperand_ ),
503 rightOperand_( other.rightOperand_ )
504 {}
505
507 template<class Entity>
508 void setEntity(const Entity& entity) const
509 {
510 leftOperand_().setEntity(entity);
511 rightOperand_().setEntity(entity);
512 }
513
515 template<class Intersection>
516 bool setIntersection(const Intersection& intersection) const
517 {
518 // This corresponds to the combined Robin-indicator ... Do
519 // not wrap the calls to setIntersection() into the return
520 // value, as then the second one is not executed if the first
521 // one yields true.
522 bool leftRobin = leftOperand_().setIntersection(intersection);
523 bool rightRobin = rightOperand_().setIntersection(intersection);
524
525 return leftRobin || rightRobin;
526 }
527
529 std::string name() const
530 {
531 return "(" + leftOperand_().name() + " " + BinOpType::name() + " " + rightOperand_().name() + ")";
532 }
533
535 template<class Entity, class Point>
536 void flux(const Entity& entity,
537 const Point &x,
538 const RangeType &value,
539 const JacobianRangeType &jacobian,
540 JacobianRangeType &flux ) const
541 {
542 OperationType::flux(leftOperand_(), rightOperand_(), entity, x, value, jacobian, flux);
543 }
544
546 template<class Entity, class Point>
547 void linearizedFlux(const RangeType& uBar,
548 const JacobianRangeType& DuBar,
549 const Entity& entity,
550 const Point &x,
551 const RangeType &value,
552 const JacobianRangeType &jacobian,
553 JacobianRangeType &flux ) const
554 {
555 OperationType::linearizedFlux(leftOperand_(), rightOperand_(), uBar, DuBar, entity, x, value, jacobian, flux);
556 }
557
559 template<class Entity, class Point>
560 void source( const Entity& entity,
561 const Point &x,
562 const RangeType &value,
563 const JacobianRangeType &jacobian,
564 RangeType &result) const
565 {
566 OperationType::source(leftOperand_(), rightOperand_(), entity, x, value, jacobian, result);
567 }
568
570 template<class Entity, class Point>
571 void linearizedSource( const RangeType &uBar,
572 const JacobianRangeType& DuBar,
573 const Entity& entity,
574 const Point &x,
575 const RangeType &value,
576 const JacobianRangeType &jacobian,
577 RangeType &result) const
578 {
579 OperationType::linearizedSource(leftOperand_(), rightOperand_(), uBar, DuBar, entity, x, value, jacobian, result);
580 }
581
583 template<class Intersection, class Point>
584 void robinFlux(const Intersection& intersection,
585 const Point& x,
586 const DomainType& unitOuterNormal,
587 const RangeType& value,
588 RangeType& result) const
589 {
590 OperationType::robinFlux(leftOperand_(), rightOperand_(), intersection, x, unitOuterNormal, value, result);
591 }
592
594 template<class Intersection, class Point>
596 const Intersection& intersection,
597 const Point& x,
598 const DomainType& unitOuterNormal,
599 const RangeType& value,
600 RangeType& result) const
601 {
602 OperationType::linearizedRobinFlux(leftOperand_(), rightOperand_(), uBar, intersection, x, unitOuterNormal, value, result);
603 }
604
606 template<class Entity, class Point>
607 void fluxDivergence(const Entity& entity,
608 const Point &x,
609 const RangeType &value,
610 const JacobianRangeType &jacobian,
611 const HessianRangeType &hessian,
612 RangeType &result) const
613 {
614 OperationType::fluxDivergence(leftOperand_(), rightOperand_(), entity, x, value, jacobian, hessian, result);
615 }
616
617 protected:
620 };
621
625 template<class BinOp, class LeftOperand, class RightOperand>
626 struct OperatorPartsTraits<BinaryOperatorPartsExpression<BinOp, LeftOperand, RightOperand> >
627 : public DefaultOperatorPartsTraits<typename LeftOperand::FunctionSpaceType>
628 {
629 private:
630 typedef LeftOperand LeftOperandType;
631 typedef RightOperand RightOperandType;
632 typedef typename LeftOperand::FunctionSpaceType LeftFunctionSpaceType;
633 typedef typename RightOperandType::FunctionSpaceType RightFunctionSpaceType;
634
636
637 static_assert((std::is_same<LeftFunctionSpaceType, RightFunctionSpaceType>::value),
638 "Function spaces must agree, cannot combine them");
639 public:
640 enum StructureFlags {
641 isLinear = LeftOperandType::isLinear && RightOperandType::isLinear,
642 isSymmetric = LeftOperandType::isSymmetric && RightOperandType::isSymmetric,
643 isSemiDefinite = LeftOperandType::isSemiDefinite && RightOperandType::isSemiDefinite // this is not true
644 };
645
646 enum ConstituentFlags {
647 hasFlux = LeftOperandType::hasFlux || RightOperandType::hasFlux,
648 hasSources = LeftOperandType::hasSources || RightOperandType::hasSources,
649 hasRobinFlux = LeftOperandType::hasRobinFlux || RightOperandType::hasRobinFlux,
650 };
651
652 typedef LeftFunctionSpaceType FunctionSpaceType;
653 };
654
656 //
657 // Addition
658
660 template<class LeftOperand, class RightOperand>
664 {
665 const LeftOperand& f(static_cast<const LeftOperand&>(f_));
666 const RightOperand& g(static_cast<const RightOperand&>(g_));
667
669
670 return ExpressionType(f, g);
671 }
672
673
675 //
676 // Subtraction
677
679 template<class LeftOperand, class RightOperand>
680 BinaryOperatorPartsExpression<MinusOperation, LeftOperand, RightOperand>
683 {
684 const LeftOperand& f(static_cast<const LeftOperand&>(f_));
685 const RightOperand& g(static_cast<const RightOperand&>(g_));
686
688
689 return ExpressionType(f, g);
690 }
691
707 template<class Factor, class OperandType>
709 : public OperatorPartsExpression<BinaryOperatorPartsExpression<SMultiplyOperation, Factor, OperandType> >
710 {
713 typedef OperatorPartsExpression<ThisType> BaseType;
716 public:
717 typedef Factor FactorType;
718
720 typedef typename InterfaceType::FunctionSpaceType FunctionSpaceType;
721
723 typedef typename InterfaceType::DomainFieldType DomainFieldType ;
725 typedef typename InterfaceType::RangeFieldType RangeFieldType ;
727 typedef typename InterfaceType::DomainType DomainType ;
729 typedef typename InterfaceType::RangeType RangeType ;
731 typedef typename InterfaceType::JacobianRangeType JacobianRangeType;
733 typedef typename InterfaceType::HessianRangeType HessianRangeType;
734
735 enum { dimDomain = FunctionSpaceType::dimDomain, dimRange = FunctionSpaceType::dimRange };
736
737 public:
738
739 // constructor
740 BinaryOperatorPartsExpression(const FactorType& s, const OperandType& f)
741 : scalar_(s), operand_(f)
742 {}
743
744 // copy constructor
745 BinaryOperatorPartsExpression(const ThisType &other)
746 : scalar_( other.scalar_ ), operand_( other.operand_ )
747 {}
748
750 template<class Entity>
751 void setEntity(const Entity& entity) const
752 {
753 operand_().setEntity(entity);
754 }
755
757 template<class Intersection>
758 bool setIntersection(const Intersection& intersection) const
759 {
760 return operand_().setIntersection(intersection); // recurse ...
761 }
762
764 std::string name() const
765 {
766 return "(" + std::to_string(parameterValue(scalar_())) + " " + BinOpType::name() + " " + operand_().name() + ")";
767 }
768
770 template<class Entity, class Point>
771 void flux(const Entity& entity,
772 const Point &x,
773 const RangeType &value,
774 const JacobianRangeType &jacobian,
775 JacobianRangeType &flux) const
776 {
777 if (!OperandType::hasFlux) {
778 flux = 0.;
779 return;
780 }
781 operand_().flux(entity, x, value, jacobian, flux);
782 flux *= parameterValue(scalar_());
783 }
784
786 template<class Entity, class Point>
787 void linearizedFlux(const RangeType& uBar,
788 const JacobianRangeType& DuBar,
789 const Entity& entity,
790 const Point &x,
791 const RangeType &value,
792 const JacobianRangeType &jacobian,
793 JacobianRangeType &flux) const
794 {
795 if (!OperandType::hasFlux) {
796 flux = 0.;
797 return;
798 }
799 operand_().linearizedFlux(uBar, DuBar, entity, x, value, jacobian, flux);
800 flux *= parameterValue(scalar_());
801 }
802
804 template<class Entity, class Point>
805 void source(const Entity& entity,
806 const Point &x,
807 const RangeType &value,
808 const JacobianRangeType &jacobian,
809 RangeType &result) const
810 {
811 if (!OperandType::hasSources) {
812 result = 0.;
813 return;
814 }
815 operand_().source(entity, x, value, jacobian, result);
816 result *= parameterValue(scalar_());
817 }
818
820 template<class Entity, class Point>
821 void linearizedSource(const RangeType &uBar,
822 const JacobianRangeType& DuBar,
823 const Entity& entity,
824 const Point &x,
825 const RangeType &value,
826 const JacobianRangeType &jacobian,
827 RangeType &result) const
828 {
829 if (!OperandType::hasSources) {
830 result = 0.;
831 return;
832 }
833 operand_().linearizedSource(uBar, DuBar, entity, x, value, jacobian, result);
834 result *= parameterValue(scalar_());
835 }
836
838 template<class Intersection, class Point>
839 void robinFlux(const Intersection& intersection,
840 const Point& x,
841 const DomainType& unitOuterNormal,
842 const RangeType& value,
843 RangeType& result) const
844 {
845 if (!OperandType::hasRobinFlux) {
846 result = 0.;
847 return;
848 }
849 operand_().robinFlux(intersection, x, unitOuterNormal, value, result);
850 result *= parameterValue(scalar_());
851 }
852
854 template<class Intersection, class Point>
856 const Intersection& intersection,
857 const Point& x,
858 const DomainType& unitOuterNormal,
859 const RangeType& value,
860 RangeType& result) const
861 {
862 if (!OperandType::hasRobinFlux) {
863 result = 0.;
864 return;
865 }
866 operand_().linearizedRobinFlux(uBar, intersection, x, unitOuterNormal, value, result);
867 result *= parameterValue(scalar_());
868 }
869
871 template<class Entity, class Point>
872 void fluxDivergence(const Entity& entity,
873 const Point &x,
874 const RangeType &value,
875 const JacobianRangeType &jacobian,
876 const HessianRangeType &hessian,
877 RangeType &result) const
878 {
879 if (!OperandType::hasFlux) {
880 result = 0.;
881 return;
882 }
883 operand_().fluxDivergence(entity, x, value, jacobian, hessian, result);
884 result *= parameterValue(scalar_());
885 }
886
887 public:
888 const FactorType& scalar() const { return scalar_(); }
889 const OperandType& operand() const { return operand_(); }
890 protected:
891 ExpressionStorage<FactorType> scalar_;
892 ExpressionStorage<OperandType> operand_;
893 };
894
895 //traits
896 template<class Factor, class Operand>
897 struct OperatorPartsTraits<BinaryOperatorPartsExpression<SMultiplyOperation, Factor, Operand> >
898 : public DefaultOperatorPartsTraits<typename Operand::FunctionSpaceType>
899 {
900 protected:
901 typedef Operand OperandType;
902 typedef Factor FactorType;
903 typedef typename OperandType::FunctionSpaceType::ScalarFunctionSpaceType ScalarFunctionSpaceType;
904 public:
905 enum StructureFlags {
906 isLinear = OperandType::isLinear,
907 isSymmetric = OperandType::isSymmetric,
908 isSemiDefinite = OperandType::isSemiDefinite // this is not true when multiplying by negative factors ...
909 };
910
911 enum ConstituentFlags {
912 hasFlux = OperandType::hasFlux,
913 hasSources = OperandType::hasSources
914 };
915
916 typedef SMultiplyOperation BinOpType;
917 typedef typename OperandType::FunctionSpaceType FunctionSpaceType;
918 };
919
920
922 template<class OperandType>
923 BinaryOperatorPartsExpression<SMultiplyOperation, typename OperandType::RangeFieldType, OperandType>
924 operator*(const typename OperandType::RangeFieldType& s_,
926 {
927 typedef typename OperandType::RangeFieldType RangeFieldType;
928 const OperandType& f(static_cast<const OperandType&>(f_));
929
931
932 return ExpressionType(s_, f);
933 }
934
936 template<class OperandType>
938 const typename OperandType::RangeFieldType& s_)
939 -> decltype(s_ * asImp(op_))
940 {
941 return s_ * asImp(op_);
942 }
943
945 template<class Parameter, class OperandType>
946 BinaryOperatorPartsExpression<SMultiplyOperation, Parameter, OperandType>
949 {
950 typedef Parameter ParameterType;
951
952 const ParameterType& s(static_cast<const ParameterType&>(s_));
953 const OperandType& f(static_cast<const OperandType&>(f_));
954
956
957 return ExpressionType(s, f);
958 }
959
961 template<class Parameter, class OperandType>
964 -> decltype(asImp(s_) * asImp(op_))
965 {
966 return asImp(s_) * asImp(op_);
967 }
968
969#if 0
970 // We have real unary minus by now.
971 // unary minus operator
972 template<class OperandType>
973 BinaryOperatorPartsExpression<SMultiplyOperation, typename OperandType::RangeFieldType, OperandType>
974 operator*(const OperatorPartsInterface<OperandType>& f_)
975 {
976 typedef typename OperandType::RangeFieldType RangeFieldType;
977 const OperandType& f(static_cast<const OperandType&>(f_));
978
979 typedef BinaryOperatorPartsExpression<SMultiplyOperation, RangeFieldType, OperandType> ExpressionType;
980
981 return ExpressionType(-1.0, f);
982 }
983#endif
984
1003 template<class FactorFunction, class OperandType>
1004 class BinaryOperatorPartsExpression<MultiplyOperation, FactorFunction, OperandType>
1005 : public OperatorPartsExpression<BinaryOperatorPartsExpression<MultiplyOperation, FactorFunction, OperandType> >
1006 {
1009 typedef OperatorPartsExpression<ThisType> BaseType;
1012 typedef FactorFunction FactorFunctionType;
1013 typedef typename FactorFunctionType::LocalFunctionType FactorLocalFunctionType;
1014 typedef typename FactorFunctionType::RangeType FactorRangeType;
1015 typedef typename FactorFunctionType::JacobianRangeType FactorJacobianRangeType;
1016
1017 public:
1019 typedef typename InterfaceType::FunctionSpaceType FunctionSpaceType;
1020
1022 typedef typename InterfaceType::DomainFieldType DomainFieldType ;
1024 typedef typename InterfaceType::RangeFieldType RangeFieldType ;
1026 typedef typename InterfaceType::DomainType DomainType ;
1028 typedef typename InterfaceType::RangeType RangeType ;
1030 typedef typename InterfaceType::JacobianRangeType JacobianRangeType;
1032 typedef typename InterfaceType::HessianRangeType HessianRangeType;
1033
1034 enum { dimDomain = FunctionSpaceType::dimDomain, dimRange = FunctionSpaceType::dimRange };
1035 enum { isLinear = TraitsType::isLinear,
1036 isSymmetric = TraitsType::isSymmetric,
1037 isSemiDefinite = TraitsType::isSemiDefinite
1038 };
1039
1040 public:
1041
1042 // constructor
1043 BinaryOperatorPartsExpression(const FactorFunctionType& f, const OperandType& op)
1044 : factor_(f), operand_(op), localFactor_(factor_())
1045 {}
1046
1047 // copy constructor
1048 BinaryOperatorPartsExpression(const ThisType &other)
1049 : factor_(other.factor_), operand_(other.operand_), localFactor_(factor_())
1050 {}
1051
1053 template<class Entity>
1054 void setEntity(const Entity& entity) const
1055 {
1056 operand_().setEntity(entity);
1057 localFactor_.init(entity);
1058 }
1059
1061 template<class Intersection>
1062 bool setIntersection(const Intersection& intersection) const
1063 {
1064 // Should we also initialize localFactor_ here? For the moment
1065 // we assume that any high/level code first computes the
1066 // bulk-contributions, so localFactor_ should alreay be
1067 // initialized here
1068 //
1069 // Would the following work? Probably not
1070 // assert(&localFactor_.entity() == &*intersection.inside());
1071 return operand_().setIntersection(intersection); // recurse ...
1072 }
1073
1075 std::string name() const
1076 {
1077 return "(" + factor_().name() + " " + BinOpType::name() + " " + operand_().name() + ")";
1078 }
1079
1081 template<class Entity, class Point>
1082 void flux(const Entity& entity,
1083 const Point &x,
1084 const RangeType &value,
1085 const JacobianRangeType &jacobian,
1086 JacobianRangeType &result) const
1087 {
1088 assert(&entity == &localFactor_.entity());
1089
1090 if (!OperandType::hasFlux) {
1091 result = 0.;
1092 return;
1093 }
1094 operand_().flux(entity, x, value, jacobian, result);
1095
1096 FactorRangeType factorValue;
1097 localFactor_.evaluate(x, factorValue);
1098
1099 result *= factorValue;
1100 }
1101
1103 template<class Entity, class Point>
1104 void linearizedFlux(const RangeType& uBar,
1105 const JacobianRangeType& DuBar,
1106 const Entity& entity,
1107 const Point &x,
1108 const RangeType &value,
1109 const JacobianRangeType &jacobian,
1110 JacobianRangeType &result) const
1111 {
1112 assert(&entity == &localFactor_.entity());
1113
1114 if (!OperandType::hasFlux) {
1115 result = 0.;
1116 return;
1117 }
1118
1119 operand_().linearizedFlux(uBar, DuBar, entity, x, value, jacobian, result);
1120
1121 FactorRangeType factorValue;
1122 localFactor_.evaluate(x, factorValue);
1123
1124 result *= factorValue;
1125 }
1126
1128 template<class Entity, class Point>
1129 void source(const Entity& entity,
1130 const Point &x,
1131 const RangeType &value,
1132 const JacobianRangeType &jacobian,
1133 RangeType &result) const
1134 {
1135 assert(&entity == &localFactor_.entity());
1136
1137 if (!OperandType::hasSources) {
1138 result = 0.;
1139 return;
1140 }
1141
1142 operand_().source(entity, x, value, jacobian, result);
1143
1144 FactorRangeType factorValue;
1145 localFactor_.evaluate(x, factorValue);
1146
1147 result *= factorValue;
1148 }
1149
1151 template<class Entity, class Point>
1152 void linearizedSource(const RangeType &uBar,
1153 const JacobianRangeType& DuBar,
1154 const Entity& entity,
1155 const Point &x,
1156 const RangeType &value,
1157 const JacobianRangeType &jacobian,
1158 RangeType &result) const
1159 {
1160 assert(&entity == &localFactor_.entity());
1161
1162 if (!OperandType::hasSources) {
1163 result = 0.;
1164 return;
1165 }
1166
1167 operand_().linearizedSource(uBar, DuBar, entity, x, value, jacobian, result);
1168
1169 FactorRangeType factorValue;
1170 localFactor_.evaluate(x, factorValue);
1171
1172 result *= factorValue;
1173 }
1174
1176 template<class Intersection, class Point>
1177 void robinFlux(const Intersection& intersection,
1178 const Point& x,
1179 const DomainType& unitOuterNormal,
1180 const RangeType& value,
1181 RangeType& result) const
1182 {
1183 if (!OperandType::hasRobinFlux) {
1184 result = 0.;
1185 return;
1186 }
1187
1188 operand_().robinFlux(intersection, x, unitOuterNormal, value, result);
1189
1190 FactorRangeType factorValue;
1191 localFactor_.evaluate(x, factorValue);
1192
1193 result *= factorValue;
1194 }
1195
1197 template<class Intersection, class Point>
1199 const Intersection& intersection,
1200 const Point& x,
1201 const DomainType& unitOuterNormal,
1202 const RangeType& value,
1203 RangeType& result) const
1204 {
1205 if (!OperandType::hasRobinFlux) {
1206 result = 0.;
1207 return;
1208 }
1209
1210 operand_().linearizedRobinFlux(uBar, intersection, x, unitOuterNormal, value, result);
1211
1212 FactorRangeType factorValue;
1213 localFactor_.evaluate(x, factorValue);
1214
1215 result *= factorValue;
1216 }
1217
1219 template<class Entity, class Point>
1220 void fluxDivergence(const Entity& entity,
1221 const Point &x,
1222 const RangeType &value,
1223 const JacobianRangeType &jacobian,
1224 const HessianRangeType &hessian,
1225 RangeType &result) const
1226 {
1227 if (!OperandType::hasFlux) {
1228 result = 0.;
1229 return;
1230 }
1231
1232 // Product rule
1233
1234 operand_().fluxDivergence(entity, x, value, jacobian, hessian, result);
1235
1236 FactorRangeType factorValue;
1237 localFactor_.evaluate(x, factorValue);
1238
1239 JacobianRangeType fluxValue;
1240 FactorJacobianRangeType factorJacobian;
1241
1242 operand_().flux(entity, x, value, jacobian, fluxValue);
1243 localFactor_.jacobian(x, factorJacobian);
1244
1245 for (int i = 0; i < dimRange; ++i) {
1246 result += factorJacobian[i] * fluxValue[i];
1247 }
1248 }
1249
1250 protected:
1253 mutable FactorLocalFunctionType localFactor_;
1254 };
1255
1256 //traits
1257 template<class FactorFunction, class Operand>
1258 struct OperatorPartsTraits<BinaryOperatorPartsExpression<MultiplyOperation, FactorFunction, Operand> >
1259 : public DefaultOperatorPartsTraits<typename Operand::FunctionSpaceType>
1260 {
1261 protected:
1262 typedef MultiplyOperation BinOpType;
1263 typedef FactorFunction FactorFunctionType;
1264 typedef Operand FactorOperandType;
1265
1266 public:
1267
1268 enum StructureFlags
1269 {
1270 isLinear = FactorOperandType::isLinear,
1271 isSymmetric = FactorOperandType::isSymmetric,
1272 isSemiDefinite = FactorOperandType::isSemiDefinite // this is not necessarily true
1273 };
1274
1275 enum ConstituentFlags {
1276 hasFlux = FactorOperandType::hasFlux,
1277 hasSources = FactorOperandType::hasSources,
1278 hasRobinFlux = FactorOperandType::hasRobinFlux
1279 };
1280
1281 typedef typename FactorOperandType::FunctionSpaceType FunctionSpaceType;
1282
1283 };
1284
1286 template<class FactorFunction, class OperandType>
1287 BinaryOperatorPartsExpression<MultiplyOperation, FactorFunction, OperandType>
1288 operator*(const Fem::Function<typename FactorFunction::FunctionSpaceType::ScalarFunctionSpaceType, FactorFunction>& f_,
1290 {
1291 const FactorFunction& f(static_cast<const FactorFunction&>(f_));
1292 const OperandType& op(static_cast<const OperandType&>(op_));
1293
1295
1296 return ExpressionType(f, op);
1297 }
1298
1300 template<class FactorFunction, class OperandType>
1301 BinaryOperatorPartsExpression<MultiplyOperation, FactorFunction, OperandType>
1303 const Fem::Function<typename FactorFunction::FunctionSpaceType::ScalarFunctionSpaceType, FactorFunction>& f_)
1304 {
1305 const FactorFunction& f(static_cast<const FactorFunction&>(f_));
1306 const OperandType& op(static_cast<const OperandType&>(op_));
1307
1308 return f * op;
1309 }
1310
1312 template<class Operand>
1313 class UnaryOperatorPartsExpression<MinusOperation, Operand>
1314 operator-(const OperatorPartsInterface<Operand>& op_)
1315 {
1316 const Operand& op(static_cast<const Operand&>(op_));
1317
1319
1320 return ExpressionType(op);
1321 }
1322
1328 template<class Operand>
1329 class UnaryOperatorPartsExpression<IdentityOperation, Operand>
1331 {
1332 const Operand& op(static_cast<const Operand&>(op_));
1333
1335
1336 return ExpressionType(op);
1337 }
1338
1340 template<class Operand>
1341 auto
1343 -> decltype(*op_)
1344 {
1345 return *op_;
1346 }
1347
1356 template<class Expression>
1357 Expression
1358 operator*(const OperatorPartsExpression<Expression>& op_)
1359 {
1360 return op_.expression();
1361 }
1362
1364 template<class Operand>
1365 static inline
1366 auto operator*(const typename Operand::RangeFieldType& s_,
1368 -> decltype((s_ * op_.scalar()) * op_.operand())
1369 {
1370 return (s_ * op_.scalar()) * op_.operand();
1371 }
1372
1373#if 0
1375 template<class Parameter, class Field, class Operand>
1376 static inline
1377 auto operator*(const ParameterInterface<Parameter>& p_,
1378 const BinaryOperatorPartsExpression<SMultiplyOperation, Field, Operand>& op_)
1379 -> decltype(op_.scalar() * (asImp(p_) * op_.operand()))
1380 {
1381 return op_.scalar() * (asImp(p_) * op_.operand());
1382 }
1383#else
1385 template<class Parameter, class Operand>
1386 static inline
1389 -> decltype(asImp(op_).scalar() * (asImp(p_) * asImp(op_).operand()))
1390 {
1391 return asImp(op_).scalar() * (asImp(p_) * asImp(op_).operand());
1392 }
1393#endif
1394
1396 template<class Field, class Parameter, class Operand>
1397 static inline
1398 auto operator*(const BinaryParameterExpression<SMultiplyOperation, Field, Parameter>& p_,
1400 -> decltype(p_.left() * (p_.right() * asImp(op_)))
1401 {
1402 return p_.left() * (p_.right() * asImp(op_));
1403 }
1404
1406 template<class Function, class Field, class Operand>
1407 static inline
1408 auto operator*(const Fem::Function<typename Function::FunctionSpaceType, Function>& f_,
1410 -> decltype(op_.scalar() * (asImp(f_) * op_.operand()))
1411 {
1412 return op_.scalar() * (asImp(f_) * op_.operand());
1413 }
1414
1416 template<class Field, class Function, class Operand>
1417 static inline
1420 -> decltype(f_.scalar() * (f_.function() * asImp(op_)))
1421 {
1422 return f_.scalar() * (f_.function() * asImp(op_));
1423 }
1424
1432 template<class Operand>
1433 auto
1435 -> decltype(*op_.containedExpression())
1436 {
1437 return *op_.containedExpression();
1438 }
1439
1441 template<class Operand>
1442 auto
1445 -> decltype(*asImp(op))
1446 {
1447 return *asImp(op);
1448 }
1449
1451 template<class Operand>
1452 auto
1455 -> decltype(*asImp(op))
1456 {
1457 return *asImp(op);
1458 }
1459
1461 template<class FunctionSpace>
1462 auto
1465 -> decltype(*z1)
1466 {
1467 return *z1;
1468 }
1469
1471 template<class Operand>
1472 auto
1475 -> decltype(*asImp(op))
1476 {
1477 return *asImp(op);
1478 }
1479
1481 template<class Operand>
1482 auto
1485 -> decltype(-op)
1486 {
1487 return -op;
1488 }
1489
1491 template<class FunctionSpace>
1492 auto
1495 -> decltype(*z1)
1496 {
1497 return *z1;
1498 }
1499
1501 template<class FunctionSpace>
1502 auto
1503 operator*(const typename FunctionSpace::RangeFieldType& s_,
1505 ->decltype(*z)
1506 {
1507 return *z;
1508 }
1509
1511 template<class FunctionSpace>
1512 auto
1514 const typename FunctionSpace::RangeFieldType& s)
1515 ->decltype(*z)
1516 {
1517 return *z;
1518 }
1519
1521 template<class Parameter, class FunctionSpace>
1522 auto
1525 ->decltype(*z)
1526 {
1527 return *z;
1528 }
1529
1531 template<class Parameter, class FunctionSpace>
1532 auto
1535 ->decltype(*z)
1536 {
1537 return *z;
1538 }
1539
1541 template<class Function, class ScalarSpace, class FunctionSpace>
1542 auto
1543 operator*(const Fem::Function<ScalarSpace, Function>& f,
1545 ->decltype(*z)
1546 {
1547 static_assert(std::is_same<ScalarSpace, typename FunctionSpace::ScalarFunctionSpaceType>::value,
1548 "Incompatible function spaces.");
1549 return *z;
1550 }
1551
1553 template<class Function, class ScalarSpace, class FunctionSpace>
1554 auto
1556 const Fem::Function<ScalarSpace, Function>& f)
1557 ->decltype(*z)
1558 {
1559 static_assert(std::is_same<ScalarSpace, typename FunctionSpace::ScalarFunctionSpaceType>::value,
1560 "Incompatible function spaces.");
1561 return *z;
1562 }
1563
1565
1567
1569
1570 } // namespace ACFem
1571
1572} // namespace Dune
1573
1574#endif // __OPERATORPARTSEXPRESSION_HH__
BinaryGridFunctionExpression implements point-wise vector-space operations for GridFunction-types.
Definition: gridfunctionexpression.hh:423
Multiplication with grid-functions.
Definition: operatorpartsexpression.hh:1006
InterfaceType::DomainType DomainType
domain type (from function space)
Definition: operatorpartsexpression.hh:1026
void linearizedRobinFlux(const RangeType &uBar, const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
Definition: operatorpartsexpression.hh:1198
InterfaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: operatorpartsexpression.hh:1030
void fluxDivergence(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, const HessianRangeType &hessian, RangeType &result) const
fluxDivergence for estimator
Definition: operatorpartsexpression.hh:1220
void linearizedSource(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
linearized source term
Definition: operatorpartsexpression.hh:1152
InterfaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: operatorpartsexpression.hh:1022
void linearizedFlux(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &result) const
linearizedflux
Definition: operatorpartsexpression.hh:1104
void setEntity(const Entity &entity) const
Definition: operatorpartsexpression.hh:1054
bool setIntersection(const Intersection &intersection) const
Definition: operatorpartsexpression.hh:1062
void flux(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &result) const
flux on local coordinate local
Definition: operatorpartsexpression.hh:1082
InterfaceType::RangeFieldType RangeFieldType
range type (from function space)
Definition: operatorpartsexpression.hh:1024
InterfaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: operatorpartsexpression.hh:1032
std::string name() const
Definition: operatorpartsexpression.hh:1075
void source(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
source term
Definition: operatorpartsexpression.hh:1129
void robinFlux(const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
Definition: operatorpartsexpression.hh:1177
InterfaceType::RangeType RangeType
range type (from function space)
Definition: operatorpartsexpression.hh:1028
InterfaceType::FunctionSpaceType FunctionSpaceType
type of discrete function space
Definition: operatorpartsexpression.hh:1019
void fluxDivergence(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, const HessianRangeType &hessian, RangeType &result) const
fluxDivergence for estimator
Definition: operatorpartsexpression.hh:872
void source(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
source term
Definition: operatorpartsexpression.hh:805
InterfaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: operatorpartsexpression.hh:733
void linearizedFlux(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
linearizedflux
Definition: operatorpartsexpression.hh:787
void linearizedSource(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
linearized source term
Definition: operatorpartsexpression.hh:821
InterfaceType::DomainType DomainType
domain type (from function space)
Definition: operatorpartsexpression.hh:727
InterfaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: operatorpartsexpression.hh:723
void setEntity(const Entity &entity) const
Definition: operatorpartsexpression.hh:751
void linearizedRobinFlux(const RangeType &uBar, const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
Definition: operatorpartsexpression.hh:855
void robinFlux(const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
Definition: operatorpartsexpression.hh:839
void flux(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
flux on local coordinate local
Definition: operatorpartsexpression.hh:771
InterfaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: operatorpartsexpression.hh:731
bool setIntersection(const Intersection &intersection) const
Definition: operatorpartsexpression.hh:758
InterfaceType::RangeType RangeType
range type (from function space)
Definition: operatorpartsexpression.hh:729
InterfaceType::FunctionSpaceType FunctionSpaceType
type of discrete function space
Definition: operatorpartsexpression.hh:720
InterfaceType::RangeFieldType RangeFieldType
range type (from function space)
Definition: operatorpartsexpression.hh:725
std::string name() const
Definition: operatorpartsexpression.hh:764
Template for binary operations.
Definition: operatorpartsexpression.hh:466
void setEntity(const Entity &entity) const
Definition: operatorpartsexpression.hh:508
void linearizedSource(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
linearized source term
Definition: operatorpartsexpression.hh:571
void robinFlux(const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
Definition: operatorpartsexpression.hh:584
void flux(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
flux on local coordinate local
Definition: operatorpartsexpression.hh:536
InterfaceType::RangeFieldType RangeFieldType
range type (from function space)
Definition: operatorpartsexpression.hh:480
InterfaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: operatorpartsexpression.hh:486
void linearizedRobinFlux(const RangeType &uBar, const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
Definition: operatorpartsexpression.hh:595
InterfaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: operatorpartsexpression.hh:478
InterfaceType::DomainType DomainType
domain type (from function space)
Definition: operatorpartsexpression.hh:482
void source(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
source term
Definition: operatorpartsexpression.hh:560
void linearizedFlux(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
linearizedflux
Definition: operatorpartsexpression.hh:547
InterfaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: operatorpartsexpression.hh:488
bool setIntersection(const Intersection &intersection) const
Definition: operatorpartsexpression.hh:516
void fluxDivergence(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, const HessianRangeType &hessian, RangeType &result) const
fluxDivergence for estimator
Definition: operatorpartsexpression.hh:607
std::string name() const
Definition: operatorpartsexpression.hh:529
InterfaceType::FunctionSpaceType FunctionSpaceType
type of discrete function space
Definition: operatorpartsexpression.hh:475
InterfaceType::RangeType RangeType
range type (from function space)
Definition: operatorpartsexpression.hh:484
@ isSemiDefinite
Definition: operatorparts.hh:416
@ isLinear
Definition: operatorparts.hh:414
@ isSymmetric
Definition: operatorparts.hh:415
Interface class for second order elliptic models.
Definition: operatorparts.hh:92
Parameters are quasi-constant quantities, like the time-step size in one time-step when solving trans...
Definition: parameterinterface.hh:80
Unary identity operation which simply wraps the underlying stuff.
Definition: operatorpartsexpression.hh:39
OperandType ContainedExpressionType
type of the contained expression
Definition: operatorpartsexpression.hh:48
InterfaceType::RangeType RangeType
range type (from function space)
Definition: operatorpartsexpression.hh:60
InterfaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: operatorpartsexpression.hh:64
std::string name() const
Definition: operatorpartsexpression.hh:95
void setEntity(const Entity &entity) const
Definition: operatorpartsexpression.hh:82
InterfaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: operatorpartsexpression.hh:62
InterfaceType::FunctionSpaceType FunctionSpaceType
type of discrete function space
Definition: operatorpartsexpression.hh:51
void linearizedSource(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
linearized source term
Definition: operatorpartsexpression.hh:149
bool setIntersection(const Intersection &intersection) const
Definition: operatorpartsexpression.hh:89
void robinFlux(const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
Definition: operatorpartsexpression.hh:166
void flux(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
flux on local coordinate local
Definition: operatorpartsexpression.hh:102
void source(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
source term
Definition: operatorpartsexpression.hh:134
void fluxDivergence(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, const HessianRangeType &hessian, RangeType &result) const
fluxDivergence for estimator
Definition: operatorpartsexpression.hh:197
InterfaceType::RangeFieldType RangeFieldType
range type (from function space)
Definition: operatorpartsexpression.hh:56
void linearizedRobinFlux(const RangeType &uBar, const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
Definition: operatorpartsexpression.hh:181
InterfaceType::DomainType DomainType
domain type (from function space)
Definition: operatorpartsexpression.hh:58
void linearizedFlux(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
linearizedflux
Definition: operatorpartsexpression.hh:117
InterfaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: operatorpartsexpression.hh:54
Unary minus.
Definition: operatorpartsexpression.hh:245
void flux(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
flux on local coordinate local
Definition: operatorpartsexpression.hh:309
OperandType ContainedExpressionType
type of the contained expression
Definition: operatorpartsexpression.hh:254
bool setIntersection(const Intersection &intersection) const
Definition: operatorpartsexpression.hh:296
InterfaceType::FunctionSpaceType FunctionSpaceType
type of discrete function space
Definition: operatorpartsexpression.hh:257
void fluxDivergence(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, const HessianRangeType &hessian, RangeType &result) const
fluxDivergence for estimator
Definition: operatorpartsexpression.hh:410
InterfaceType::RangeFieldType RangeFieldType
range type (from function space)
Definition: operatorpartsexpression.hh:262
std::string name() const
Definition: operatorpartsexpression.hh:302
InterfaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: operatorpartsexpression.hh:260
void linearizedFlux(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, JacobianRangeType &flux) const
linearizedflux
Definition: operatorpartsexpression.hh:325
void linearizedRobinFlux(const RangeType &uBar, const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
Definition: operatorpartsexpression.hh:393
InterfaceType::RangeType RangeType
range type (from function space)
Definition: operatorpartsexpression.hh:266
InterfaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: operatorpartsexpression.hh:270
void source(const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
source term
Definition: operatorpartsexpression.hh:343
void linearizedSource(const RangeType &uBar, const JacobianRangeType &DuBar, const Entity &entity, const Point &x, const RangeType &value, const JacobianRangeType &jacobian, RangeType &result) const
linearized source term
Definition: operatorpartsexpression.hh:359
InterfaceType::DomainType DomainType
domain type (from function space)
Definition: operatorpartsexpression.hh:264
void setEntity(const Entity &entity) const
Definition: operatorpartsexpression.hh:289
void robinFlux(const Intersection &intersection, const Point &x, const DomainType &unitOuterNormal, const RangeType &value, RangeType &result) const
Definition: operatorpartsexpression.hh:377
InterfaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: operatorpartsexpression.hh:268
Template for unary operations.
Definition: operatorpartsexpression.hh:33
Define a simple zero model to optimize expression templates.
Definition: zerooperatorparts.hh:31
const Implementation & asImp(const Fem::BartonNackmanInterface< Interface, Implementation > &arg)
Up-cast to the implementation for any Fem::BartonNackmanInterface.
Definition: expressionoperations.hh:71
ParameterValue< Value >::ResultType parameterValue(const Value &value)
Return the unaltered argument for non-parameters and otherwise the parameter value.
Definition: parameterinterface.hh:263
auto operator+(const ZeroOperatorParts< FunctionSpace > &z1, const ZeroOperatorParts< FunctionSpace > &z2) -> decltype(*z1)
Zero + Zero = Zero.
Definition: operatorpartsexpression.hh:1463
auto operator-(const ZeroOperatorParts< FunctionSpace > &z1, const ZeroOperatorParts< FunctionSpace > &z2) -> decltype(*z1)
Zero - Zero = Zero.
Definition: operatorpartsexpression.hh:1493
BinaryParameterExpression< MultiplyOperation, Left, Right > operator*(const ParameterInterface< Left > &left, const ParameterInterface< Right > &right)
Scalar product between parameters.
Definition: parameterexpression.hh:321
A structure defining some trivial default values for the template structure OperatorPartsTraits<Parts...
Definition: operatorparts.hh:45
Identity, i.e. just wrap the object.
Definition: expressionoperations.hh:284
Subtraction of two objects and unary minus.
Definition: expressionoperations.hh:239
Multiplication of two objects.
Definition: expressionoperations.hh:248
Traits-template which has to be specialized for each individual model.
Definition: operatorparts.hh:36
Multiplication by scalars from the left.
Definition: expressionoperations.hh:257
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)