DUNE-ACFEM (2.5.1)

modelexpression.hh
1 #ifndef __MODELEXPRESSION_HH__
2 #define __MODELEXPRESSION_HH__
3 
4 #include "../models/modelinterface.hh"
5 #include "../models/modelexpressionbase.hh"
6 #include "../models/modeloperations.hh"
7 #include "../models/zeromodel.hh"
8 #include "operatorparts/operatorpartsexpression.hh"
9 #include "../functions/gridfunctionexpression.hh"
10 #include "../functions/gridfunctionwrapper.hh"
11 #include "../operators/functionals/l2innerproductfunctional.hh"
12 #include "../operators/functionals/functionalexpression.hh"
13 
14 namespace Dune
15 {
16 
17  namespace ACFem
18  {
19 
33  template<class BinOp, class LeftModelType, class RightModelType>
34  class BinaryModelExpression;
35 
37  template<class UnOp, class ModelType>
39 
41  template<class Model>
43  : public ModelExpression<UnaryModelExpression<IdentityOperation, Model> >
44  {
45  typedef Model ModelType;
46  typedef IdentityOperation OpType;
48  typedef ModelExpression<ThisType> BaseType;
51  public:
53  typedef ModelType ContainedExpressionType;
54 
56  typedef typename InterfaceType::FunctionSpaceType FunctionSpaceType;
57 
59  typedef typename InterfaceType::GridPartType GridPartType;
60 
62  typedef typename InterfaceType::EntityType EntityType;
63  typedef typename InterfaceType::IntersectionType IntersectionType;
64 
66  typedef typename InterfaceType::DomainFieldType DomainFieldType ;
68  typedef typename InterfaceType::RangeFieldType RangeFieldType ;
70  typedef typename InterfaceType::DomainType DomainType ;
72  typedef typename InterfaceType::RangeType RangeType ;
74  typedef typename InterfaceType::JacobianRangeType JacobianRangeType;
76  typedef typename InterfaceType::HessianRangeType HessianRangeType;
77 
78  enum { dimDomain = FunctionSpaceType::dimDomain, dimRange = FunctionSpaceType::dimRange };
79 
80  typedef typename InterfaceType::OperatorPartsType OperatorPartsType;
81 
82  typedef typename InterfaceType::BulkForcesFunctionType BulkForcesFunctionType;
83  typedef typename InterfaceType::DirichletBoundaryFunctionType DirichletBoundaryFunctionType;
84  typedef typename InterfaceType::NeumannBoundaryFunctionType NeumannBoundaryFunctionType;
85 
86  typedef typename InterfaceType::DirichletIndicatorType DirichletIndicatorType;
87  typedef typename InterfaceType::NeumannIndicatorType NeumannIndicatorType;
88 
89  public:
90 
91  // constructor
92  UnaryModelExpression(const ModelType& f)
93  : model_(f)
94  {}
95 
96  // copy constructor
97  UnaryModelExpression(const ThisType &other)
98  : model_( other.model_ )
99  {}
100 
102  std::string name() const
103  {
104  return OpType::name() + "(" + model_().name() + ")";
105  }
106 
108  OperatorPartsType operatorParts() const
109  {
110  return model_().operatorParts();
111  }
112 
114  BulkForcesFunctionType
115  bulkForcesFunction(const GridPartType& gridPart) const
116  {
117  return model_().bulkForcesFunction(gridPart);
118  }
119 
121  template<class DiscreteFunctionSpace>
122  typename TraitsType::template ForcesFunctionalTraits<DiscreteFunctionSpace>::FunctionalType
123  forcesFunctional(const DiscreteFunctionSpace& space) const
124  {
125  return model_().forcesFunctional(space);
126  }
127 
129  DirichletBoundaryFunctionType
131  {
132  return model_().dirichletBoundaryFunction(gridPart);
133  }
134 
136  NeumannBoundaryFunctionType neumannBoundaryFunction(const GridPartType& gridPart) const
137  {
138  return model_().neumannBoundaryFunction(gridPart);
139  }
140 
142  DirichletIndicatorType dirichletIndicator() const {
143  return model_().dirichletIndicator();
144  }
145 
147  NeumannIndicatorType neumannIndicator() const {
148  return model_().neumannIndicator();
149  }
150 
151  const ContainedExpressionType& containedExpression() const
152  {
153  return model_();
154  }
155 
156  protected:
157  ExpressionStorage<ModelType> model_;
158  };
159 
160  //traits
161  template<class Model>
162  struct ModelTraits<UnaryModelExpression<IdentityOperation, Model> >
163  : public DefaultModelTraits<typename Model::FunctionSpaceType, typename Model::GridPartType>
164  {
165  protected:
166  typedef Model ModelType;
167  public:
169  template<class DiscreteFunctionSpace>
170  struct ForcesFunctionalTraits
171  : public ModelType::template ForcesFunctionalTraits<DiscreteFunctionSpace>
172  {};
173 
174  typedef IdentityOperation OpType;
175  typedef typename ModelType::FunctionSpaceType FunctionSpaceType;
176  typedef typename ModelType::GridPartType GridPartType;
177 
178  typedef typename ModelType::OperatorPartsType OperatorPartsType;
179 
180  typedef typename ModelType::BulkForcesFunctionType BulkForcesFunctionType;
181  typedef typename ModelType::NeumannBoundaryFunctionType NeumannBoundaryFunctionType;
182  typedef typename ModelType::DirichletBoundaryFunctionType DirichletBoundaryFunctionType;
183  typedef typename ModelType::DirichletWeightFunctionType DirichletWeightFunctionType;
184 
185  typedef typename ModelType::DirichletIndicatorType DirichletIndicatorType;
186  typedef typename ModelType::NeumannIndicatorType NeumannIndicatorType;
187  };
188 
190  template<class Model>
192  : public ModelExpression<UnaryModelExpression<MinusOperation, Model> >
193  {
194  typedef Model ModelType;
195  typedef MinusOperation OpType;
197  typedef ModelExpression<ThisType> BaseType;
200  public:
202  typedef ModelType ContainedExpressionType;
203 
205  typedef typename InterfaceType::FunctionSpaceType FunctionSpaceType;
206 
208  typedef typename InterfaceType::GridPartType GridPartType;
209 
211  typedef typename InterfaceType::EntityType EntityType;
212  typedef typename InterfaceType::IntersectionType IntersectionType;
213 
215  typedef typename InterfaceType::DomainFieldType DomainFieldType ;
217  typedef typename InterfaceType::RangeFieldType RangeFieldType ;
219  typedef typename InterfaceType::DomainType DomainType ;
221  typedef typename InterfaceType::RangeType RangeType ;
223  typedef typename InterfaceType::JacobianRangeType JacobianRangeType;
225  typedef typename InterfaceType::HessianRangeType HessianRangeType;
226 
227  enum { dimDomain = FunctionSpaceType::dimDomain, dimRange = FunctionSpaceType::dimRange };
228 
229  typedef typename InterfaceType::OperatorPartsType OperatorPartsType;
230 
231  typedef typename InterfaceType::BulkForcesFunctionType BulkForcesFunctionType;
232  typedef typename InterfaceType::DirichletBoundaryFunctionType DirichletBoundaryFunctionType;
233  typedef typename InterfaceType::DirichletWeightFunctionType DirichletWeightFunctionType;
234  typedef typename InterfaceType::NeumannBoundaryFunctionType NeumannBoundaryFunctionType;
235 
236  typedef typename InterfaceType::DirichletIndicatorType DirichletIndicatorType;
237  typedef typename InterfaceType::NeumannIndicatorType NeumannIndicatorType;
238 
239  public:
240 
241  // constructor
242  UnaryModelExpression(const ModelType& f)
243  : model_(f)
244  {}
245 
246  // copy constructor
247  UnaryModelExpression(const ThisType &other)
248  : model_( other.model_ )
249  {}
250 
251 
253  std::string name() const
254  {
255  return OpType::name() + "(" + model_().name() + ")";
256  }
257 
259  OperatorPartsType operatorParts() const
260  {
261  return -model_().operatorParts();
262  }
263 
265  BulkForcesFunctionType
266  bulkForcesFunction(const GridPartType& gridPart) const
267  {
268  return -model_().bulkForcesFunction(gridPart);
269  }
270 
272  template<class DiscreteFunctionSpace>
273  typename TraitsType::template ForcesFunctionalTraits<DiscreteFunctionSpace>::FunctionalType
274  forcesFunctional(const DiscreteFunctionSpace& space) const
275  {
276  return -model_().forcesFunctional(space);
277  }
278 
280  DirichletBoundaryFunctionType
282  {
283  return -model_().dirichletBoundaryFunction(gridPart);
284  }
285 
287  DirichletWeightFunctionType
288  dirichletWeightFunction(const GridPartType& gridPart) const
289  {
290  return -model_().dirichletWeightFunction(gridPart);
291  }
292 
294  NeumannBoundaryFunctionType neumannBoundaryFunction(const GridPartType& gridPart) const
295  {
296  return -model_().neumannBoundaryFunction(gridPart);
297  }
298 
300  DirichletIndicatorType dirichletIndicator() const {
301  return model_().dirichletIndicator();
302  }
303 
305  NeumannIndicatorType neumannIndicator() const {
306  return model_().neumannIndicator();
307  }
308 
309  const ContainedExpressionType& containedExpression() const
310  {
311  return model_();
312  }
313 
314  protected:
315  ExpressionStorage<ModelType> model_;
316  };
317 
318  //traits
319  template<class Model>
320  struct ModelTraits<UnaryModelExpression<MinusOperation, Model> >
321  : public DefaultModelTraits<typename Model::FunctionSpaceType, typename Model::GridPartType>
322  {
323  protected:
324  typedef Model ModelType;
325  public:
327  template<class DiscreteFunctionSpace>
328  struct ForcesFunctionalTraits
329  : public ModelType::template ForcesFunctionalTraits<DiscreteFunctionSpace>
330  {
331  protected:
332  typedef typename ModelType::template ForcesFunctionalTraits<DiscreteFunctionSpace> BaseType;
333  public:
334  typedef
336  FunctionalType;
337  };
338 
339  typedef typename ModelType::FunctionSpaceType FunctionSpaceType;
340  typedef typename ModelType::GridPartType GridPartType;
341 
342  typedef
344  OperatorPartsType;
345 
346  typedef
348  BulkForcesFunctionType;
349  typedef
351  NeumannBoundaryFunctionType;
352  typedef
354  DirichletBoundaryFunctionType;
355  typedef
357  DirichletWeightFunctionType;
358 
359  typedef typename ModelType::DirichletIndicatorType DirichletIndicatorType;
360  typedef typename ModelType::NeumannIndicatorType NeumannIndicatorType;
361  };
362 
363  // BinaryModelExpression
364  // -------------------
365 
369  template<class BinOp, class LeftModelType, class RightModelType>
371  : public ModelExpression<BinaryModelExpression<BinOp, LeftModelType, RightModelType> >
372  {
373  typedef BinOp BinOpType;
375  typedef ModelExpression<ThisType> BaseType;
377  typedef BinaryModelExpressionOperation<BinOpType> OperationType;
379  public:
381  typedef typename InterfaceType::FunctionSpaceType FunctionSpaceType;
382 
384  typedef typename InterfaceType::GridPartType GridPartType;
385 
387  typedef typename InterfaceType::EntityType EntityType;
388  typedef typename InterfaceType::IntersectionType IntersectionType;
389 
391  typedef typename InterfaceType::DomainFieldType DomainFieldType ;
393  typedef typename InterfaceType::RangeFieldType RangeFieldType ;
395  typedef typename InterfaceType::DomainType DomainType ;
397  typedef typename InterfaceType::RangeType RangeType ;
399  typedef typename InterfaceType::JacobianRangeType JacobianRangeType;
401  typedef typename InterfaceType::HessianRangeType HessianRangeType;
402 
403  enum { dimDomain = FunctionSpaceType::dimDomain, dimRange = FunctionSpaceType::dimRange };
404 
405  typedef typename InterfaceType::OperatorPartsType OperatorPartsType;
406 
407  typedef typename InterfaceType::BulkForcesFunctionType BulkForcesFunctionType;
408  typedef typename InterfaceType::DirichletBoundaryFunctionType DirichletBoundaryFunctionType;
409  typedef typename InterfaceType::DirichletWeightFunctionType DirichletWeightFunctionType;
410  typedef typename InterfaceType::NeumannBoundaryFunctionType NeumannBoundaryFunctionType;
411 
412  typedef typename InterfaceType::DirichletIndicatorType DirichletIndicatorType;
413  typedef typename InterfaceType::NeumannIndicatorType NeumannIndicatorType;
414 
415  public:
416 
417  // constructor
418  BinaryModelExpression(const LeftModelType &f,
419  const RightModelType &g)
420  : leftModel_( f ), rightModel_( g )
421  {}
422 
423  // copy constructor
424  BinaryModelExpression(const ThisType &other )
425  : leftModel_( other.leftModel_ ),
426  rightModel_( other.rightModel_ )
427  {}
428 
430  std::string name() const
431  {
432  return "(" + leftModel_().name() + " " + BinOpType::name() + " " + rightModel_().name() + ")";
433  }
434 
436  OperatorPartsType operatorParts() const
437  {
438  return makeExpression(BinOpType(),
439  leftModel_().operatorParts(),
440  rightModel_().operatorParts());
441  }
442 
444  BulkForcesFunctionType
445  bulkForcesFunction(const GridPartType& gridPart) const
446  {
447  return makeExpression(BinOpType(),
448  leftModel_().bulkForcesFunction(gridPart),
449  rightModel_().bulkForcesFunction(gridPart));
450  }
451 
453  template<class DiscreteFunctionSpace>
454  typename TraitsType::template ForcesFunctionalTraits<DiscreteFunctionSpace>::FunctionalType
455  forcesFunctional(const DiscreteFunctionSpace& space) const
456  {
457  return makeExpression(BinOpType(),
458  leftModel_().forcesFunctional(space),
459  rightModel_().forcesFunctional(space));
460  }
461 
463  DirichletBoundaryFunctionType
465  {
466  return makeExpression(BinOpType(),
467  leftModel_().dirichletBoundaryFunction(gridPart),
468  rightModel_().dirichletBoundaryFunction(gridPart));
469  }
470 
472  DirichletWeightFunctionType
473  dirichletWeightFunction(const GridPartType& gridPart) const
474  {
475  return makeExpression(BinOpType(),
476  leftModel_().dirichletWeightFunction(gridPart),
477  rightModel_().dirichletWeightFunction(gridPart));
478  }
479 
481  NeumannBoundaryFunctionType
482  neumannBoundaryFunction(const GridPartType& gridPart) const
483  {
484  return makeExpression(BinOpType(),
485  leftModel_().neumannBoundaryFunction(gridPart),
486  rightModel_().neumannBoundaryFunction(gridPart));
487  }
488 
490  DirichletIndicatorType dirichletIndicator() const {
491  return *leftModel_().dirichletIndicator() || *rightModel_().dirichletIndicator();
492  }
493 
495  NeumannIndicatorType neumannIndicator() const {
496  return *leftModel_().neumannIndicator() || *rightModel_().neumannIndicator();
497  }
498 
499  protected:
502  };
503 
507  template<class BinOp, class LeftModel, class RightModel>
508  struct ModelTraits<BinaryModelExpression<BinOp, LeftModel, RightModel> >
509  : public DefaultModelTraits<typename LeftModel::FunctionSpaceType, typename LeftModel::GridPartType>
510  {
511  private:
512  typedef LeftModel LeftModelType;
513  typedef RightModel RightModelType;
514  typedef typename LeftModelType::FunctionSpaceType LeftFunctionSpaceType;
515  typedef typename RightModelType::FunctionSpaceType RightFunctionSpaceType;
516  typedef typename LeftModelType::GridPartType LeftGridPartType;
517  typedef typename RightModelType::GridPartType RightGridPartType;
518 
520 
521  static_assert((std::is_same<LeftFunctionSpaceType, RightFunctionSpaceType>::value),
522  "Function spaces must agree, cannot combine them");
523  static_assert((std::is_same<LeftGridPartType, RightGridPartType>::value),
524  "Grid-parts must agree, cannot combine them");
525  public:
527  template<class DiscreteFunctionSpace>
528  struct ForcesFunctionalTraits
529  {
530  protected:
531  typedef
532  typename LeftModelType::template ForcesFunctionalTraits<DiscreteFunctionSpace>::FunctionalType
533  LeftFunctionalType;
534  typedef
535  typename RightModelType::template ForcesFunctionalTraits<DiscreteFunctionSpace>::FunctionalType
536  RightFunctionalType;
537  public:
538  typedef DiscreteFunctionSpace DiscreteFunctionSpaceType;
539  typedef
541  FunctionalType;
542  };
543 
544  typedef LeftFunctionSpaceType FunctionSpaceType;
545  typedef LeftGridPartType GridPartType;
546 
547  typedef
548  typename ExpressionResult<BinOp,
549  typename LeftModelType::OperatorPartsType,
550  typename RightModelType::OperatorPartsType>::Type
551  OperatorPartsType;
552 
553  typedef
554  typename ExpressionResult<BinOp,
555  typename LeftModelType::BulkForcesFunctionType,
556  typename RightModelType::BulkForcesFunctionType>::Type
557  BulkForcesFunctionType;
558  typedef
559  typename ExpressionResult<BinOp,
560  typename LeftModelType::DirichletBoundaryFunctionType,
561  typename RightModelType::DirichletBoundaryFunctionType>::Type
562  DirichletBoundaryFunctionType;
563  typedef
564  typename ExpressionResult<BinOp,
565  typename LeftModelType::DirichletWeightFunctionType,
566  typename RightModelType::DirichletWeightFunctionType>::Type
567  DirichletWeightFunctionType;
568  typedef
569  typename ExpressionResult<BinOp,
570  typename LeftModelType::NeumannBoundaryFunctionType,
571  typename RightModelType::NeumannBoundaryFunctionType>::Type
572  NeumannBoundaryFunctionType;
573 
578  typedef
579  decltype(*std::declval<typename LeftModelType::DirichletIndicatorType>()
580  ||
581  *std::declval<typename RightModelType::DirichletIndicatorType>())
583 
588  typedef
589  decltype(*std::declval<typename LeftModelType::NeumannIndicatorType>()
590  ||
591  *std::declval<typename RightModelType::NeumannIndicatorType>())
593  };
594 
596  //
597  // Addition
598 
600  template<class LeftModelType, class RightModelType>
601  BinaryModelExpression<PlusOperation, LeftModelType, RightModelType>
602  operator+(const ModelInterface<LeftModelType>& f_,
603  const ModelInterface<RightModelType>& g_)
604  {
605  const LeftModelType& f(static_cast<const LeftModelType&>(f_));
606  const RightModelType& g(static_cast<const RightModelType&>(g_));
607 
609 
610  return ExpressionType(f, g);
611  }
612 
613 
615  //
616  // Subtraction
617 
619  template<class LeftModelType, class RightModelType>
620  BinaryModelExpression<MinusOperation, LeftModelType, RightModelType>
621  operator-(const ModelInterface<LeftModelType>& f_,
623  {
624  const LeftModelType& f(static_cast<const LeftModelType&>(f_));
625  const RightModelType& g(static_cast<const RightModelType&>(g_));
626 
628 
629  return ExpressionType(f, g);
630  }
631 
647  template<class Factor, class ModelType>
648  class BinaryModelExpression<SMultiplyOperation, Factor, ModelType>
649  : public ModelExpression<BinaryModelExpression<SMultiplyOperation, Factor, ModelType> >
650  {
653  typedef ModelExpression<ThisType> BaseType;
656  public:
657  typedef Factor FactorType;
658 
660  typedef typename InterfaceType::FunctionSpaceType FunctionSpaceType;
661 
663  typedef typename InterfaceType::GridPartType GridPartType;
664 
666  typedef typename InterfaceType::EntityType EntityType;
667  typedef typename InterfaceType::IntersectionType IntersectionType;
668 
670  typedef typename InterfaceType::DomainFieldType DomainFieldType ;
672  typedef typename InterfaceType::RangeFieldType RangeFieldType ;
674  typedef typename InterfaceType::DomainType DomainType ;
676  typedef typename InterfaceType::RangeType RangeType ;
678  typedef typename InterfaceType::JacobianRangeType JacobianRangeType;
680  typedef typename InterfaceType::HessianRangeType HessianRangeType;
681 
682  enum { dimDomain = FunctionSpaceType::dimDomain, dimRange = FunctionSpaceType::dimRange };
683 
684  typedef typename InterfaceType::OperatorPartsType OperatorPartsType;
685 
686  typedef typename InterfaceType::BulkForcesFunctionType BulkForcesFunctionType;
687  typedef typename InterfaceType::DirichletBoundaryFunctionType DirichletBoundaryFunctionType;
688  typedef typename InterfaceType::DirichletWeightFunctionType DirichletWeightFunctionType;
689  typedef typename InterfaceType::NeumannBoundaryFunctionType NeumannBoundaryFunctionType;
690 
691  typedef typename InterfaceType::DirichletIndicatorType DirichletIndicatorType;
692  typedef typename InterfaceType::NeumannIndicatorType NeumannIndicatorType;
693 
694  public:
695 
696  // constructor
697  BinaryModelExpression(const FactorType& s, const ModelType& f)
698  : scalar_(s), model_(f)
699  {}
700 
701  // copy constructor
702  BinaryModelExpression (const ThisType &other)
703  : scalar_( other.scalar_ ), model_( other.model_ )
704  {}
705 
707  std::string name() const
708  {
709  return "(" + std::to_string(parameterValue(scalar_())) + " " + BinOpType::name() + " " + model_().name() + ")";
710  }
711 
713  OperatorPartsType operatorParts() const
714  {
715  return makeExpression(BinOpType(), scalar_(), model_().operatorParts());
716  }
717 
719  BulkForcesFunctionType
720  bulkForcesFunction(const GridPartType& gridPart) const
721  {
722  typedef BulkForcesFunctionType FunctionType;
723 
724  return makeExpression(BinOpType(), scalar_(), model_().bulkForcesFunction(gridPart));
725  }
726 
728  template<class DiscreteFunctionSpace>
729  typename TraitsType::template ForcesFunctionalTraits<DiscreteFunctionSpace>::FunctionalType
730  forcesFunctional(const DiscreteFunctionSpace& space) const
731  {
732  return makeExpression(BinOpType(), scalar_(), model_().forcesFunctional(space));
733  }
734 
736  DirichletBoundaryFunctionType dirichletBoundaryFunction(const GridPartType& gridPart) const
737  {
738  // We treat even Dirichlet Boundary Values in a natural way,
739  // i.e. as one half of some functional having its origin in a
740  // bilinear form.
741  return makeExpression(BinOpType(), scalar_(), model_().dirichletBoundaryFunction(gridPart));
742  }
743 
745  DirichletWeightFunctionType dirichletWeightFunction(const GridPartType& gridPart) const
746  {
747  return makeExpression(BinOpType(), scalar_(), model_().dirichletWeightFunction(gridPart));
748  }
749 
751  NeumannBoundaryFunctionType neumannBoundaryFunction(const GridPartType& gridPart) const
752  {
753  return makeExpression(BinOpType(), scalar_(), model_().neumannBoundaryFunction(gridPart));
754  }
755 
757  DirichletIndicatorType dirichletIndicator() const {
758  return model_().dirichletIndicator();
759  }
760 
762  NeumannIndicatorType neumannIndicator() const {
763  return model_().neumannIndicator();
764  }
765 
766  public:
767  const FactorType& scalar() const { return scalar_(); }
768  const ModelType& model() const { return model_(); }
769  protected:
770  ExpressionStorage<FactorType> scalar_;
771  ExpressionStorage<ModelType> model_;
772  };
773 
774  //traits
775  template<class Factor, class Model>
776  struct ModelTraits<BinaryModelExpression<SMultiplyOperation, Factor, Model> >
777  : public DefaultModelTraits<typename Model::FunctionSpaceType, typename Model::GridPartType>
778  {
779  protected:
780  typedef Model ModelType;
781  typedef Factor FactorType;
782  typedef typename ModelType::FunctionSpaceType::ScalarFunctionSpaceType ScalarFunctionSpaceType;
783  public:
784  typedef SMultiplyOperation BinOpType;
785  typedef typename ModelType::FunctionSpaceType FunctionSpaceType;
786  typedef typename ModelType::GridPartType GridPartType;
787 
789  template<class DiscreteFunctionSpace>
790  struct ForcesFunctionalTraits
791  {
792  protected:
793  typedef
794  typename ModelType::template ForcesFunctionalTraits<DiscreteFunctionSpace>::FunctionalType
795  ModelFunctionalType;
796  public:
797  typedef DiscreteFunctionSpace DiscreteFunctionSpaceType;
798  typedef
800  FunctionalType;
801  };
802 
803  typedef
805  OperatorPartsType;
806 
807  typedef
809  BulkForcesFunctionType;
810  typedef
812  NeumannBoundaryFunctionType;
813  typedef
815  DirichletBoundaryFunctionType;
816  typedef
818  DirichletWeightFunctionType;
819 
820  typedef typename ModelType::DirichletIndicatorType DirichletIndicatorType;
821  typedef typename ModelType::NeumannIndicatorType NeumannIndicatorType;
822  };
823 
824 
826  template<class ModelType>
828  operator*(const typename ModelType::RangeFieldType& s_,
829  const ModelInterface<ModelType>& f_)
830  {
831  typedef typename ModelType::RangeFieldType RangeFieldType;
832  const ModelType& f(static_cast<const ModelType&>(f_));
833 
835 
836  return ExpressionType(s_, f);
837  }
838 
840  template<class ModelType>
842  const typename ModelType::RangeFieldType& s_)
843  -> decltype(s_ * asImp(m_))
844  {
845  return s_ * asImp(m_);
846  }
847 
849  template<class Parameter, class ModelType>
850  BinaryModelExpression<SMultiplyOperation, Parameter, ModelType>
852  const ModelInterface<ModelType>& f_)
853  {
854  typedef Parameter ParameterType;
855 
856  const ParameterType& s(static_cast<const ParameterType&>(s_));
857  const ModelType& f(static_cast<const ModelType&>(f_));
858 
860 
861  return ExpressionType(s, f);
862  }
863 
865  template<class Parameter, class ModelType>
868  -> decltype(asImp(s_) * asImp(m_))
869  {
870  return asImp(s_) * asImp(m_);
871  }
872 
873 #if 0
874  // We have real unary minus by now.
875  // unary minus operator
876  template<class ModelType>
877  BinaryModelExpression<SMultiplyOperation, typename ModelType::RangeFieldType, ModelType>
878  operator*(const ModelInterface<ModelType>& f_)
879  {
880  typedef typename ModelType::RangeFieldType RangeFieldType;
881  const ModelType& f(static_cast<const ModelType&>(f_));
882 
883  typedef BinaryModelExpression<SMultiplyOperation, RangeFieldType, ModelType> ExpressionType;
884 
885  return ExpressionType(-1.0, f);
886  }
887 #endif
888 
910  template<class FactorFunction, class ModelType>
911  class BinaryModelExpression<MultiplyOperation, FactorFunction, ModelType>
912  : public ModelExpression<BinaryModelExpression<MultiplyOperation, FactorFunction, ModelType> >
913  {
916  typedef ModelExpression<ThisType> BaseType;
919  typedef FactorFunction FactorFunctionType;
920  typedef typename FactorFunctionType::LocalFunctionType FactorLocalFunctionType;
921  typedef typename FactorFunctionType::RangeType FactorRangeType;
922  typedef typename FactorFunctionType::JacobianRangeType FactorJacobianRangeType;
923 
924  public:
926  typedef typename InterfaceType::FunctionSpaceType FunctionSpaceType;
927 
929  typedef typename InterfaceType::GridPartType GridPartType;
930 
932  typedef typename InterfaceType::EntityType EntityType;
933  typedef typename InterfaceType::IntersectionType IntersectionType;
934 
936  typedef typename InterfaceType::DomainFieldType DomainFieldType ;
938  typedef typename InterfaceType::RangeFieldType RangeFieldType ;
940  typedef typename InterfaceType::DomainType DomainType ;
942  typedef typename InterfaceType::RangeType RangeType ;
944  typedef typename InterfaceType::JacobianRangeType JacobianRangeType;
946  typedef typename InterfaceType::HessianRangeType HessianRangeType;
947 
948  enum { dimDomain = FunctionSpaceType::dimDomain, dimRange = FunctionSpaceType::dimRange };
949 
950  typedef typename InterfaceType::OperatorPartsType OperatorPartsType;
951 
952  typedef typename InterfaceType::BulkForcesFunctionType BulkForcesFunctionType;
953  typedef typename InterfaceType::DirichletBoundaryFunctionType DirichletBoundaryFunctionType;
954  typedef typename InterfaceType::DirichletWeightFunctionType DirichletWeightFunctionType;
955  typedef typename InterfaceType::NeumannBoundaryFunctionType NeumannBoundaryFunctionType;
956 
957  typedef typename InterfaceType::DirichletIndicatorType DirichletIndicatorType;
958  typedef typename InterfaceType::NeumannIndicatorType NeumannIndicatorType;
959 
960  public:
961 
962  // constructor
963  BinaryModelExpression(const FactorFunctionType& f, const ModelType& m)
964  : factor_(f), model_(m), localFactor_(factor_())
965  {}
966 
967  // copy constructor
968  BinaryModelExpression(const ThisType &other)
969  : factor_(other.factor_), model_(other.model_), localFactor_(factor_())
970  {}
971 
973  std::string name() const
974  {
975  return "(" + factor_().name() + " " + BinOpType::name() + " " + model_().name() + ")";
976  }
977 
979  OperatorPartsType operatorParts() const
980  {
981  return makeExpression(BinOpType(), factor_(), model_().operatorParts());
982  }
983 
985  BulkForcesFunctionType bulkForcesFunction(const GridPartType& gridPart) const
986  {
987  return makeExpression(BinOpType(), factor_(), model_().bulkForcesFunction(gridPart));
988  }
989 
991  DirichletBoundaryFunctionType dirichletBoundaryFunction(const GridPartType& gridPart) const
992  {
993  return makeExpression(BinOpType(), factor_(), model_().dirichletBoundaryFunction(gridPart));
994  }
995 
997  DirichletWeightFunctionType dirichletWeightFunction(const GridPartType& gridPart) const
998  {
999  return makeExpression(BinOpType(), factor_(), model_().dirichletWeightFunction(gridPart));
1000  }
1001 
1003  NeumannBoundaryFunctionType neumannBoundaryFunction(const GridPartType& gridPart) const
1004  {
1005  return makeExpression(BinOpType(), factor_(), model_().neumannBoundaryFunction(gridPart));
1006  }
1007 
1009  DirichletIndicatorType dirichletIndicator() const {
1010  return model_().dirichletIndicator();
1011  }
1012 
1014  NeumannIndicatorType neumannIndicator() const {
1015  return model_().neumannIndicator();
1016  }
1017 
1018  protected:
1021  mutable FactorLocalFunctionType localFactor_;
1022  };
1023 
1024  //traits
1025  template<class FactorFunction, class Model>
1026  struct ModelTraits<BinaryModelExpression<MultiplyOperation, FactorFunction, Model> >
1027  : public DefaultModelTraits<typename Model::FunctionSpaceType, typename Model::GridPartType>
1028  {
1029  protected:
1030  typedef MultiplyOperation BinOpType;
1031  typedef FactorFunction FactorFunctionType;
1032  typedef Model FactorModelType;
1033  enum {
1034  hasForcesFunctional = ModelConstituents<FactorModelType>::hasForcesFunctional
1035  };
1036 
1037  static_assert(!hasForcesFunctional,
1038  "Multiplication by functions is not allowed if the model carries a forces-functional.");
1039  public:
1040 
1041  typedef typename FactorModelType::FunctionSpaceType FunctionSpaceType;
1042  typedef typename FactorModelType::GridPartType GridPartType;
1043 
1044  typedef
1045  typename ExpressionResult<BinOpType,
1046  FactorFunctionType,
1047  typename FactorModelType::OperatorPartsType>::Type
1048  OperatorPartsType;
1049 
1050  typedef
1051  typename ExpressionResult<BinOpType,
1052  FactorFunctionType,
1053  typename FactorModelType::BulkForcesFunctionType>::Type
1054  BulkForcesFunctionType;
1055  typedef
1056  typename ExpressionResult<BinOpType,
1057  FactorFunctionType,
1058  typename FactorModelType::NeumannBoundaryFunctionType>::Type
1059  NeumannBoundaryFunctionType;
1060  typedef
1061  typename ExpressionResult<BinOpType,
1062  FactorFunctionType,
1063  typename FactorModelType::DirichletBoundaryFunctionType>::Type
1064  DirichletBoundaryFunctionType;
1065  typedef
1066  typename ExpressionResult<BinOpType,
1067  FactorFunctionType,
1068  typename FactorModelType::DirichletWeightFunctionType>::Type
1069  DirichletWeightFunctionType;
1070 
1071  typedef typename FactorModelType::DirichletIndicatorType DirichletIndicatorType;
1072  typedef typename FactorModelType::NeumannIndicatorType NeumannIndicatorType;
1073  };
1074 
1089  template<class FactorFunction, class ModelType>
1090  BinaryModelExpression<MultiplyOperation, FactorFunction, ModelType>
1091  operator*(const Fem::Function<typename FactorFunction::FunctionSpaceType::ScalarFunctionSpaceType, FactorFunction>& f_,
1092  const ModelInterface<ModelType>& m_)
1093  {
1094  const FactorFunction& f(static_cast<const FactorFunction&>(f_));
1095  const ModelType& m(static_cast<const ModelType&>(m_));
1096 
1098 
1099  return ExpressionType(f, m);
1100  }
1101 
1103  template<class FactorFunction, class ModelType>
1104  BinaryModelExpression<MultiplyOperation, FactorFunction, ModelType>
1106  const Fem::Function<typename FactorFunction::FunctionSpaceType::ScalarFunctionSpaceType, FactorFunction>& f_)
1107  {
1108  const FactorFunction& f(static_cast<const FactorFunction&>(f_));
1109  const ModelType& m(static_cast<const ModelType&>(m_));
1110 
1111  return f * m;
1112  }
1113 
1115  template<class Model>
1116  class UnaryModelExpression<MinusOperation, Model>
1117  operator-(const ModelInterface<Model>& m_)
1118  {
1119  const Model& m(static_cast<const Model&>(m_));
1120 
1121  typedef UnaryModelExpression<MinusOperation, Model> ExpressionType;
1122 
1123  return ExpressionType(m);
1124  }
1125 
1131  template<class Model>
1132  class UnaryModelExpression<IdentityOperation, Model>
1133  operator*(const ModelInterface<Model>& m_)
1134  {
1135  const Model& m(static_cast<const Model&>(m_));
1136 
1137  typedef UnaryModelExpression<IdentityOperation, Model> ExpressionType;
1138 
1139  return ExpressionType(m);
1140  }
1141 
1143  template<class Model>
1144  auto
1146  -> decltype(*m_)
1147  {
1148  return *m_;
1149  }
1150 
1161  template<class Model, class DiscreteFunctionSpace, class Traits>
1162  auto
1165  -> decltype(m_
1166  + // PLUS __IS__ CORRECT HERE (see above)
1168  {
1170 
1171  return m_ + FunctionalModelType(phi_);
1172  }
1173 
1187  template<class Model, class DiscreteFunctionSpace, class Traits>
1188  auto
1191  -> decltype(m_
1192  - // MINUS __IS__ CORRECT HERE (see above)
1194  {
1196 
1197  return m_ - FunctionalModelType(phi_);
1198  }
1199 
1211  template<class Model, class GridFunction>
1212  auto
1214  const Fem::Function<typename Model::FunctionSpaceType, GridFunction>& f)
1215  -> decltype(m
1216  + // PLUS __IS__ CORRECT HERE (see above)
1217  std::declval<BulkForcesFunctionModel<GridFunction> >())
1218  {
1219  typedef BulkForcesFunctionModel<GridFunction> BulkForcesModelType;
1220 
1221  return m + BulkForcesModelType(f);
1222  }
1223 
1239  template<class Model, class GridFunction>
1240  auto
1242  const Fem::Function<typename Model::FunctionSpaceType, GridFunction>& f)
1243  -> decltype(m_
1244  - // MINUS __IS__ CORRECT HERE (see above)
1245  std::declval<BulkForcesFunctionModel<GridFunction> >())
1246  {
1247  typedef BulkForcesFunctionModel<GridFunction> BulkForcesModelType;
1248 
1249  return m_ - BulkForcesModelType(f);
1250  }
1251 
1260  template<class Expression>
1261  Expression
1262  operator*(const ModelExpression<Expression>& m_)
1263  {
1264  return m_.expression();
1265  }
1266 
1268  template<class Model>
1269  static inline
1270  auto operator*(const typename Model::RangeFieldType& s_,
1272  -> decltype((s_ * m_.scalar()) * m_.model())
1273  {
1274  return (s_ * m_.scalar()) * m_.model();
1275  }
1276 
1277 #if 0
1279  template<class Parameter, class Field, class Model>
1280  static inline
1281  auto operator*(const ParameterInterface<Parameter>& p_,
1282  const BinaryModelExpression<SMultiplyOperation, Field, Model>& m_)
1283  -> decltype(m_.scalar() * (asImp(p_) * m_.model()))
1284  {
1285  return m_.scalar() * (asImp(p_) * m_.model());
1286  }
1287 #else
1289  template<class Parameter, class Model>
1290  static inline
1293  -> decltype(asImp(m_).scalar() * (asImp(p_) * asImp(m_).model()))
1294  {
1295  return asImp(m_).scalar() * (asImp(p_) * asImp(m_).model());
1296  }
1297 #endif
1298 
1300  template<class Field, class Parameter, class Model>
1301  static inline
1302  auto operator*(const BinaryParameterExpression<SMultiplyOperation, Field, Parameter>& p_,
1303  const ModelInterface<Model>& m_)
1304  -> decltype(p_.left() * (p_.right() * asImp(m_)))
1305  {
1306  return p_.left() * (p_.right() * asImp(m_));
1307  }
1308 
1310  template<class Function, class Field, class Model>
1311  static inline
1312  auto operator*(const Fem::Function<typename Function::FunctionSpaceType, Function>& f_,
1314  -> decltype(m_.scalar() * (asImp(f_) * m_.model()))
1315  {
1316  return m_.scalar() * (asImp(f_) * m_.model());
1317  }
1318 
1320  template<class Field, class Function, class Model>
1321  static inline
1323  const ModelInterface<Model>& m_)
1324  -> decltype(f_.scalar() * (f_.function() * asImp(m_)))
1325  {
1326  return f_.scalar() * (f_.function() * asImp(m_));
1327  }
1328 
1336  template<class Model>
1337  auto
1339  -> decltype(*m_.containedExpression())
1340  {
1341  return *m_.containedExpression();
1342  }
1343 
1345  template<class Model,
1346  class DiscreteFunctionSpace,
1347  class GridFunction, template<class> class QuadratureTraits>
1348  auto
1350  const L2InnerProductFunctional<DiscreteFunctionSpace, GridFunction, QuadratureTraits>& phi_)
1351  -> decltype(m_ - phi_.function())
1352  {
1353  return m_ - phi_.function();
1354  }
1355 
1357  template<class Model>
1358  auto
1361  -> decltype(*asImp(m))
1362  {
1363  return *asImp(m);
1364  }
1365 
1367  template<class Model>
1368  auto
1370  const ModelInterface<Model>& m)
1371  -> decltype(*asImp(m))
1372  {
1373  return *asImp(m);
1374  }
1375 
1377  template<class FunctionSpace, class GridPart>
1378  auto
1381  -> decltype(*z1)
1382  {
1383  return *z1;
1384  }
1385 
1387  template<class Model>
1388  auto
1391  -> decltype(*asImp(m))
1392  {
1393  return *asImp(m);
1394  }
1395 
1397  template<class Model>
1398  auto
1400  const ModelInterface<Model>& m)
1401  -> decltype(-m)
1402  {
1403  return -m;
1404  }
1405 
1407  template<class FunctionSpace, class GridPart>
1408  auto
1411  -> decltype(*z1)
1412  {
1413  return *z1;
1414  }
1415 
1417  template<class FunctionSpace, class GridPart>
1418  auto
1419  operator*(const typename FunctionSpace::RangeFieldType& s_,
1421  ->decltype(*z)
1422  {
1423  return *z;
1424  }
1425 
1427  template<class FunctionSpace, class GridPart>
1428  auto
1430  const typename FunctionSpace::RangeFieldType& s)
1431  ->decltype(*z)
1432  {
1433  return *z;
1434  }
1435 
1437  template<class Parameter, class FunctionSpace, class GridPart>
1438  auto
1441  ->decltype(*z)
1442  {
1443  return *z;
1444  }
1445 
1447  template<class Parameter, class FunctionSpace, class GridPart>
1448  auto
1451  ->decltype(*z)
1452  {
1453  return *z;
1454  }
1455 
1457  template<class Function, class ScalarSpace, class FunctionSpace, class GridPart>
1458  auto
1459  operator*(const Fem::Function<ScalarSpace, Function>& f,
1461  ->decltype(*z)
1462  {
1463  static_assert(std::is_same<ScalarSpace, typename FunctionSpace::ScalarFunctionSpaceType>::value,
1464  "Incompatible function spaces.");
1465  return *z;
1466  }
1467 
1469  template<class Function, class ScalarSpace, class FunctionSpace, class GridPart>
1470  auto
1472  const Fem::Function<ScalarSpace, Function>& f)
1473  ->decltype(*z)
1474  {
1475  static_assert(std::is_same<ScalarSpace, typename FunctionSpace::ScalarFunctionSpaceType>::value,
1476  "Incompatible function spaces.");
1477  return *z;
1478  }
1479 
1481 
1483 
1485 
1486  } // namespace ACFem
1487 
1488 } // namespace Dune
1489 
1490 #endif // __MODELEXPRESSION_HH__
BinaryGridFunctionExpression implements point-wise vector-space operations for GridFunction-types.
Definition: gridfunctionexpression.hh:423
Multiplication with grid-functions.
Definition: modelexpression.hh:913
DirichletWeightFunctionType dirichletWeightFunction(const GridPartType &gridPart) const
Generate an instance of a class defining Dirichlet boundary values as a Fem grid-function.
Definition: modelexpression.hh:997
InterfaceType::RangeType RangeType
range type (from function space)
Definition: modelexpression.hh:942
InterfaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: modelexpression.hh:944
std::string name() const
Print a descriptive name for debugging and output.
Definition: modelexpression.hh:973
InterfaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: modelexpression.hh:936
NeumannBoundaryFunctionType neumannBoundaryFunction(const GridPartType &gridPart) const
Generate an instance of a class defining Neumann boundary values as a Fem grid-function.
Definition: modelexpression.hh:1003
NeumannIndicatorType neumannIndicator() const
Generate an object to identify parts of the boundary subject to Neumann boundary conditions.
Definition: modelexpression.hh:1014
DirichletBoundaryFunctionType dirichletBoundaryFunction(const GridPartType &gridPart) const
Generate an instance of a class defining Dirichlet boundary values as a Fem grid-function.
Definition: modelexpression.hh:991
InterfaceType::DomainType DomainType
domain type (from function space)
Definition: modelexpression.hh:940
InterfaceType::GridPartType GridPartType
type of the grid-part we live on
Definition: modelexpression.hh:929
InterfaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: modelexpression.hh:946
BulkForcesFunctionType bulkForcesFunction(const GridPartType &gridPart) const
Generate an instance of a class defining the bulk-forces the model is subject to.
Definition: modelexpression.hh:985
DirichletIndicatorType dirichletIndicator() const
Generate an object to identify parts of the boundary subject to Dirichlet boundary conditions.
Definition: modelexpression.hh:1009
InterfaceType::RangeFieldType RangeFieldType
range type (from function space)
Definition: modelexpression.hh:938
OperatorPartsType operatorParts() const
Return the integral kernels for the bilinear form.
Definition: modelexpression.hh:979
InterfaceType::EntityType EntityType
type of the codim-0 Entity from the GridPartType
Definition: modelexpression.hh:932
InterfaceType::FunctionSpaceType FunctionSpaceType
type of discrete function space
Definition: modelexpression.hh:926
DirichletIndicatorType dirichletIndicator() const
Generate an object to identify parts of the boundary subject to Dirichlet boundary conditions.
Definition: modelexpression.hh:757
std::string name() const
Print a descriptive name for debugging and output.
Definition: modelexpression.hh:707
NeumannBoundaryFunctionType neumannBoundaryFunction(const GridPartType &gridPart) const
Generate an instance of a class defining Neumann boundary values as a Fem grid-function.
Definition: modelexpression.hh:751
TraitsType::template ForcesFunctionalTraits< DiscreteFunctionSpace >::FunctionalType forcesFunctional(const DiscreteFunctionSpace &space) const
Generate an instance of a class defining a functional which forms part of the force-terms for the mod...
Definition: modelexpression.hh:730
InterfaceType::GridPartType GridPartType
type of the grid-part we live on
Definition: modelexpression.hh:663
InterfaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: modelexpression.hh:678
InterfaceType::RangeType RangeType
range type (from function space)
Definition: modelexpression.hh:676
BulkForcesFunctionType bulkForcesFunction(const GridPartType &gridPart) const
Generate an instance of a class defining the bulk-forces the model is subject to.
Definition: modelexpression.hh:720
DirichletBoundaryFunctionType dirichletBoundaryFunction(const GridPartType &gridPart) const
Generate an instance of a class defining Dirichlet boundary values as a Fem grid-function.
Definition: modelexpression.hh:736
NeumannIndicatorType neumannIndicator() const
Generate an object to identify parts of the boundary subject to Neumann boundary conditions.
Definition: modelexpression.hh:762
InterfaceType::RangeFieldType RangeFieldType
range type (from function space)
Definition: modelexpression.hh:672
OperatorPartsType operatorParts() const
Return the integral kernels for the bilinear form.
Definition: modelexpression.hh:713
InterfaceType::FunctionSpaceType FunctionSpaceType
type of discrete function space
Definition: modelexpression.hh:660
InterfaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: modelexpression.hh:670
InterfaceType::DomainType DomainType
domain type (from function space)
Definition: modelexpression.hh:674
InterfaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: modelexpression.hh:680
DirichletWeightFunctionType dirichletWeightFunction(const GridPartType &gridPart) const
Generate an instance of a class defining a "left hand side" weight on the Dirichlet boundary conditio...
Definition: modelexpression.hh:745
InterfaceType::EntityType EntityType
type of the codim-0 Entity from the GridPartType
Definition: modelexpression.hh:666
Template for binary operations.
Definition: modelexpression.hh:372
InterfaceType::FunctionSpaceType FunctionSpaceType
type of discrete function space
Definition: modelexpression.hh:381
BulkForcesFunctionType bulkForcesFunction(const GridPartType &gridPart) const
Generate an instance of a class defining the bulk-forces the model is subject to.
Definition: modelexpression.hh:445
TraitsType::template ForcesFunctionalTraits< DiscreteFunctionSpace >::FunctionalType forcesFunctional(const DiscreteFunctionSpace &space) const
Generate an instance of a class defining a functional which forms part of the force-terms for the mod...
Definition: modelexpression.hh:455
InterfaceType::RangeFieldType RangeFieldType
range type (from function space)
Definition: modelexpression.hh:393
InterfaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: modelexpression.hh:391
DirichletIndicatorType dirichletIndicator() const
Generate an object to identify parts of the boundary subject to Dirichlet boundary conditions.
Definition: modelexpression.hh:490
OperatorPartsType operatorParts() const
Return the integral kernels for the bilinear form.
Definition: modelexpression.hh:436
NeumannBoundaryFunctionType neumannBoundaryFunction(const GridPartType &gridPart) const
Generate an instance of a class defining Neumann boundary values as a Fem grid-function.
Definition: modelexpression.hh:482
InterfaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: modelexpression.hh:399
InterfaceType::GridPartType GridPartType
type of the grid-part we live on
Definition: modelexpression.hh:384
InterfaceType::RangeType RangeType
range type (from function space)
Definition: modelexpression.hh:397
NeumannIndicatorType neumannIndicator() const
Generate an object to identify parts of the boundary subject to Neumann boundary conditions.
Definition: modelexpression.hh:495
DirichletWeightFunctionType dirichletWeightFunction(const GridPartType &gridPart) const
Definition: modelexpression.hh:473
InterfaceType::DomainType DomainType
domain type (from function space)
Definition: modelexpression.hh:395
InterfaceType::EntityType EntityType
type of the codim-0 Entity from the GridPartType
Definition: modelexpression.hh:387
std::string name() const
Print a descriptive name for debugging and output.
Definition: modelexpression.hh:430
InterfaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: modelexpression.hh:401
DirichletBoundaryFunctionType dirichletBoundaryFunction(const GridPartType &gridPart) const
Generate an instance of a class defining Dirichlet boundary values as a Fem grid-function.
Definition: modelexpression.hh:464
Interface class for a discrete linear functional.
Definition: linearfunctional.hh:52
Interface class for second order elliptic models.
Definition: modelinterface.hh:192
TraitsType::DirichletBoundaryFunctionType DirichletBoundaryFunctionType
A BoundarySupportedFunction which must be sub-ordinate to the DirichletIndicatorType.
Definition: modelinterface.hh:241
TraitsType::DirichletIndicatorType DirichletIndicatorType
A BoundarySupportedFunction which must be sub-ordinate to the DirichletIndicatorType.
Definition: modelinterface.hh:243
TraitsType::BulkForcesFunctionType BulkForcesFunctionType
A function modelling "force" terms in the bulk-phase.
Definition: modelinterface.hh:226
TraitsType::DirichletWeightFunctionType DirichletWeightFunctionType
A BoundarySupportedFunction which must be sub-ordinate to the DirichletIndicatorType.
Definition: modelinterface.hh:242
TraitsType::NeumannBoundaryFunctionType NeumannBoundaryFunctionType
A function modelling "force" terms in the bulk-phase.
Definition: modelinterface.hh:227
TraitsType::NeumannIndicatorType NeumannIndicatorType
A function modelling "force" terms in the bulk-phase.
Definition: modelinterface.hh:228
Parameters are quasi-constant quantities, like the time-step size in one time-step when solving trans...
Definition: parameterinterface.hh:80
OperatorPartsType operatorParts() const
Return the integral kernels for the bilinear form.
Definition: modelexpression.hh:108
std::string name() const
Print a descriptive name for debugging and output.
Definition: modelexpression.hh:102
BulkForcesFunctionType bulkForcesFunction(const GridPartType &gridPart) const
Generate an instance of a class defining the bulk-forces the model is subject to.
Definition: modelexpression.hh:115
InterfaceType::RangeFieldType RangeFieldType
range type (from function space)
Definition: modelexpression.hh:68
InterfaceType::EntityType EntityType
type of the codim-0 Entity from the GridPartType
Definition: modelexpression.hh:62
NeumannIndicatorType neumannIndicator() const
Generate an object to identify parts of the boundary subject to Neumann boundary conditions.
Definition: modelexpression.hh:147
InterfaceType::FunctionSpaceType FunctionSpaceType
type of discrete function space
Definition: modelexpression.hh:56
InterfaceType::RangeType RangeType
range type (from function space)
Definition: modelexpression.hh:72
InterfaceType::GridPartType GridPartType
type of the grid-part we live on
Definition: modelexpression.hh:59
TraitsType::template ForcesFunctionalTraits< DiscreteFunctionSpace >::FunctionalType forcesFunctional(const DiscreteFunctionSpace &space) const
Generate an instance of a class defining a functional which forms part of the force-terms for the mod...
Definition: modelexpression.hh:123
InterfaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: modelexpression.hh:76
InterfaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: modelexpression.hh:66
InterfaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: modelexpression.hh:74
DirichletIndicatorType dirichletIndicator() const
Generate an object to identify parts of the boundary subject to Dirichlet boundary conditions.
Definition: modelexpression.hh:142
NeumannBoundaryFunctionType neumannBoundaryFunction(const GridPartType &gridPart) const
Generate an instance of a class defining Neumann boundary values as a Fem grid-function.
Definition: modelexpression.hh:136
InterfaceType::DomainType DomainType
domain type (from function space)
Definition: modelexpression.hh:70
ModelType ContainedExpressionType
type of the contained expression
Definition: modelexpression.hh:53
DirichletBoundaryFunctionType dirichletBoundaryFunction(const GridPartType &gridPart) const
Generate an instance of a class defining Dirichlet boundary values as a Fem grid-function.
Definition: modelexpression.hh:130
Unary minus.
Definition: modelexpression.hh:193
DirichletWeightFunctionType dirichletWeightFunction(const GridPartType &gridPart) const
Generate an instance of a class defining Dirichlet boundary values as a Fem grid-function.
Definition: modelexpression.hh:288
DirichletBoundaryFunctionType dirichletBoundaryFunction(const GridPartType &gridPart) const
Generate an instance of a class defining Dirichlet boundary values as a Fem grid-function.
Definition: modelexpression.hh:281
InterfaceType::EntityType EntityType
type of the codim-0 Entity from the GridPartType
Definition: modelexpression.hh:211
InterfaceType::RangeType RangeType
range type (from function space)
Definition: modelexpression.hh:221
InterfaceType::DomainFieldType DomainFieldType
domain type (from function space)
Definition: modelexpression.hh:215
InterfaceType::FunctionSpaceType FunctionSpaceType
type of discrete function space
Definition: modelexpression.hh:205
NeumannIndicatorType neumannIndicator() const
Generate an object to identify parts of the boundary subject to Neumann boundary conditions.
Definition: modelexpression.hh:305
InterfaceType::HessianRangeType HessianRangeType
hessian type (from function space)
Definition: modelexpression.hh:225
ModelType ContainedExpressionType
type of the contained expression
Definition: modelexpression.hh:202
BulkForcesFunctionType bulkForcesFunction(const GridPartType &gridPart) const
Generate an instance of a class defining the bulk-forces the model is subject to.
Definition: modelexpression.hh:266
InterfaceType::DomainType DomainType
domain type (from function space)
Definition: modelexpression.hh:219
InterfaceType::RangeFieldType RangeFieldType
range type (from function space)
Definition: modelexpression.hh:217
DirichletIndicatorType dirichletIndicator() const
Generate an object to identify parts of the boundary subject to Dirichlet boundary conditions.
Definition: modelexpression.hh:300
std::string name() const
Print a descriptive name for debugging and output.
Definition: modelexpression.hh:253
TraitsType::template ForcesFunctionalTraits< DiscreteFunctionSpace >::FunctionalType forcesFunctional(const DiscreteFunctionSpace &space) const
Generate an instance of a class defining a functional which forms part of the force-terms for the mod...
Definition: modelexpression.hh:274
InterfaceType::GridPartType GridPartType
type of the grid-part we live on
Definition: modelexpression.hh:208
InterfaceType::JacobianRangeType JacobianRangeType
jacobian type (from function space)
Definition: modelexpression.hh:223
OperatorPartsType operatorParts() const
Return the integral kernels for the bilinear form.
Definition: modelexpression.hh:259
NeumannBoundaryFunctionType neumannBoundaryFunction(const GridPartType &gridPart) const
Generate an instance of a class defining Neumann boundary values as a Fem grid-function.
Definition: modelexpression.hh:294
Template for unary operations.
Definition: modelexpression.hh:38
Define a simple zero model to optimize expression templates.
Definition: zeromodel.hh:28
const Implementation & asImp(const Fem::BartonNackmanInterface< Interface, Implementation > &arg)
Up-cast to the implementation for any Fem::BartonNackmanInterface.
Definition: expressionoperations.hh:71
auto operator-(const ZeroModel< FunctionSpace, GridPart > &z1, const ZeroModel< FunctionSpace, GridPart > &z2) -> decltype(*z1)
Zero - Zero = Zero.
Definition: modelexpression.hh:1409
auto operator+(const ZeroModel< FunctionSpace, GridPart > &z1, const ZeroModel< FunctionSpace, GridPart > &z2) -> decltype(*z1)
Zero + Zero = Zero.
Definition: modelexpression.hh:1379
ParameterValue< Value >::ResultType parameterValue(const Value &value)
Return the unaltered argument for non-parameters and otherwise the parameter value.
Definition: parameterinterface.hh:263
BinaryParameterExpression< MultiplyOperation, Left, Right > operator*(const ParameterInterface< Left > &left, const ParameterInterface< Right > &right)
Scalar product between parameters.
Definition: parameterexpression.hh:321
Wrap an existing GridFunction into a model which only conatains this ModelConstituent.
Definition: bulkforcesmodel.hh:42
A structure defining some trivial default values for the template structure ModelTraits<ModelType>,...
Definition: modelinterface.hh:57
EmptyBoundaryIndicatorType NeumannIndicatorType
Something satisfying the BoundaryIndicatorInterface.
Definition: modelinterface.hh:138
EmptyBoundaryIndicatorType DirichletIndicatorType
Something satisfying the BoundaryIndicatorInterface.
Definition: modelinterface.hh:80
Automatically deduce the type by applying the respective operation.
Definition: expressionoperations.hh:476
Wrap an existing DiscreteLinearFunctional into a model which only conatains this ModelConstituent.
Definition: forcesfunctionalmodel.hh:42
Identity, i.e. just wrap the object.
Definition: expressionoperations.hh:284
Subtraction of two objects and unary minus.
Definition: expressionoperations.hh:239
Traits-template which has to be specialized for each individual model.
Definition: modelinterface.hh:48
Multiplication of two objects.
Definition: expressionoperations.hh:248
Addition of two objects.
Definition: expressionoperations.hh:230
Multiplication by scalars from the left.
Definition: expressionoperations.hh:257
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)