DUNE-ACFEM (2.5.1)

bulkforcesmodel.hh
1#ifndef __DUNE_ACFEM_MODELS_MODULES_BULKFORCESMODEL_HH__
2#define __DUNE_ACFEM_MODELS_MODULES_BULKFORCESMODEL_HH__
3
4#include "../modelexpressionbase.hh"
5#include "../zeromodel.hh"
6
7namespace Dune {
8
9 namespace ACFem {
10
39 template<class GridFunction>
41 : public ModelExpression<BulkForcesFunctionModel<GridFunction> >
42 {
47 public:
48 typedef GridFunction BulkForcesFunctionImpType;
49 typedef typename TraitsType::BulkForcesFunctionType BulkForcesFunctionType;
50 typedef typename BulkForcesFunctionImpType::FunctionSpaceType FunctionSpaceType;
51 typedef typename BulkForcesFunctionImpType::GridPartType GridPartType;
52
53 BulkForcesFunctionModel(const Fem::Function<FunctionSpaceType, BulkForcesFunctionImpType>& function,
54 const std::string& name = "")
55 : function_(function),
56 name_(name == "" ? "- (" + function_().name() + ", . )" : name)
57 {}
58
59 std::string name() const
60 {
61 return name_;
62 }
63
64 BulkForcesFunctionType bulkForcesFunction(const GridPartType& gridPart) const
65 {
66 return *function_();
67 }
68
69 protected:
71 const std::string name_;
72 };
73
74 template<class GridFunction>
75 struct ModelTraits<BulkForcesFunctionModel<GridFunction> >
76 : public DefaultModelTraits<typename GridFunction::DiscreteFunctionSpaceType::FunctionSpaceType,
77 typename GridFunction::GridPartType>
78 {
79 protected:
80 typedef
81 DefaultModelTraits<typename GridFunction::DiscreteFunctionSpaceType::FunctionSpaceType,
82 typename GridFunction::GridPartType>
83 BaseType;
84 public:
86 isLinear = true,
87 isSymmetric = true,
88 isSemiDefinite = true
89 };
90
91 typedef decltype(*std::declval<GridFunction>()) BulkForcesFunctionType;
92 };
93
95 template<class FunctionSpace, class GridPart>
96 class BulkForcesFunctionModel<ZeroGridFunction<FunctionSpace, GridPart> >
97 : public ZeroModel<FunctionSpace, GridPart>
98 {
100 public:
101 typedef FunctionSpace FunctionSpaceType;
102 typedef GridPart GridPartType;
104
105 BulkForcesFunctionModel(const Fem::Function<FunctionSpaceType, BulkForcesFunctionImpType>& function,
106 const std::string& name = "")
107 : BaseType(name == "" ? "- (" + asImp(function).name() + ", . )" : name)
108 {}
109 };
110
112
124 template<class GridFunction>
126 bulkForcesModel(const Fem::Function<typename GridFunction::FunctionSpaceType, GridFunction>& f,
127 const std::string& name = "")
128 {
130 }
131
133
135
137
138 } // namespace ACFem
139
140} //Namespace Dune
141
142
143#endif // __DUNE_ACFEM_MODELS_MODULES_BULKFORCESMODEL_HH__
Default model implementation.
Definition: modelinterface.hh:330
Interface class for second order elliptic models.
Definition: modelinterface.hh:192
A grid-function always returning 0.
Definition: constantfunction.hh:352
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
BulkForcesFunctionModel< GridFunction > bulkForcesModel(const Fem::Function< typename GridFunction::FunctionSpaceType, GridFunction > &f, const std::string &name="")
Generate a BulkForcesFunctionModel for the "right hand side".
Definition: bulkforcesmodel.hh:126
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
Traits-template which has to be specialized for each individual model.
Definition: modelinterface.hh:48
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Aug 13, 22:30, 2024)