DUNE-ACFEM (unstable)

modelbase.hh
1#ifndef __DUNE_ACFEM_MODELS_MODELBASE_HH__
2#define __DUNE_ACFEM_MODELS_MODELBASE_HH__
3
4#include <bitset>
5#include <dune/fem/space/common/functionspace.hh>
6#include <dune/fem/common/explicitfieldvector.hh>
7
8#include "../expressions/constantoperations.hh"
9#include "../expressions/expressionoperations.hh"
10#include "../common/quadraturepoint.hh"
11
12namespace Dune {
13
14 namespace ACFem {
15
39 template<class DomainFunctionSpace, class RangeFunctionSpace = DomainFunctionSpace>
40 struct ModelBase
41 {
51 template<class FunctionSpace>
52 using HessianRangeSelector = typename std::conditional<
53 std::is_convertible<typename FunctionSpace::RangeType, typename FunctionSpace::HessianRangeType>::value,
54 Fem::ExplicitFieldVector<typename FunctionSpace::HessianRangeType::value_type, FunctionSpace::dimRange>,
55 typename FunctionSpace::HessianRangeType>::type;
56
57 using RangeFunctionSpaceType = RangeFunctionSpace;
58 using DomainFunctionSpaceType = DomainFunctionSpace;
60
61 using DomainType = typename FunctionSpaceType::DomainType;
62 using RangeType = typename FunctionSpaceType::RangeType;
63 using JacobianRangeType = typename FunctionSpaceType::JacobianRangeType;
64 //using HessianRangeType = typename FunctionSpaceType::HessianRangeType; //!
66 using DomainFieldType = typename FunctionSpaceType::DomainFieldType;
67 using RangeFieldType = typename FunctionSpaceType::RangeFieldType;
68
69 using DomainRangeType = typename DomainFunctionSpaceType::RangeType;
70 using DomainDomainType = typename DomainFunctionSpaceType::DomainType;
71 using DomainJacobianRangeType = typename DomainFunctionSpaceType::JacobianRangeType;
72 //using DomainHessianRangeType = typename DomainFunctionSpaceType::HessianRangeType; //!
74 using DomainDomainFieldType = typename DomainFunctionSpaceType::DomainFieldType;
75 using DomainRangeFieldType = typename DomainFunctionSpaceType::RangeFieldType;
76
77 using RangeRangeType = typename RangeFunctionSpaceType::RangeType;
78 using RangeDomainType = typename RangeFunctionSpaceType::DomainType;
79 using RangeJacobianRangeType = typename RangeFunctionSpaceType::JacobianRangeType;
80 //using RangeHessianRangeType = typename RangeFunctionSpaceType::HessianRangeType; //!
82 using RangeDomainFieldType = typename RangeFunctionSpaceType::DomainFieldType;
83 using RangeRangeFieldType = typename RangeFunctionSpaceType::RangeFieldType;
84
85 static constexpr int dimDomain = FunctionSpaceType::dimDomain;
86 static constexpr int dimRange = FunctionSpaceType::dimRange;
87 static constexpr int domainDimDomain = DomainFunctionSpaceType::dimDomain;
88 static constexpr int domainDimRange = DomainFunctionSpaceType::dimRange;
89 static constexpr int rangeDimDomain = RangeFunctionSpaceType::dimDomain;
90 static constexpr int rangeDimRange = RangeFunctionSpaceType::dimRange;
91
92 static_assert(domainDimDomain == rangeDimDomain,
93 "Function-space need to live on the same domain");
94
98 using BoundaryConditionsType = std::pair<bool, std::bitset<dimRange> >;
99
101 std::string name() const
102 {
103 return "Hi! I am the base class of all models!";
104 }
105
117 template<class Entity>
118 void bind(const Entity& entity)
119 {}
120
130 void unbind()
131 {}
132
169 template<class Intersection>
170 auto classifyBoundary(const Intersection& intersection)
171 {
172 return BoundaryConditionsType();
173 }
174 };
175
177
179
180 } // namespace ACFem
181
182} //Namespace Dune
183
184#endif // __DUNE_ACFEM_MODELS_MODELBASE_HH__
A structure defining some basic default types and methods.
Definition: modelbase.hh:41
std::pair< bool, std::bitset< dimRange > > BoundaryConditionsType
The type returned by classifyBoundary().
Definition: modelbase.hh:98
static constexpr int rangeDimRange
Definition: modelbase.hh:90
typename FunctionSpaceType::DomainFieldType DomainFieldType
The type returned by classifyBoundary().
Definition: modelbase.hh:66
typename std::conditional< std::is_convertible< typename FunctionSpace::RangeType, typename FunctionSpace::HessianRangeType >::value, Fem::ExplicitFieldVector< typename FunctionSpace::HessianRangeType::value_type, FunctionSpace::dimRange >, typename FunctionSpace::HessianRangeType >::type HessianRangeSelector
The type returned by classifyBoundary().
Definition: modelbase.hh:55
typename FunctionSpaceType::JacobianRangeType JacobianRangeType
The type returned by classifyBoundary().
Definition: modelbase.hh:63
void unbind()
Unbind from the previously bound entity.
Definition: modelbase.hh:130
HessianRangeSelector< RangeFunctionSpaceType > RangeHessianRangeType
The type returned by classifyBoundary().
Definition: modelbase.hh:81
RangeFunctionSpace RangeFunctionSpaceType
The type returned by classifyBoundary().
Definition: modelbase.hh:57
typename DomainFunctionSpaceType::JacobianRangeType DomainJacobianRangeType
The type returned by classifyBoundary().
Definition: modelbase.hh:71
typename DomainFunctionSpaceType::RangeFieldType DomainRangeFieldType
The type returned by classifyBoundary().
Definition: modelbase.hh:75
typename DomainFunctionSpaceType::DomainFieldType DomainDomainFieldType
The type returned by classifyBoundary().
Definition: modelbase.hh:74
typename RangeFunctionSpaceType::RangeType RangeRangeType
The type returned by classifyBoundary().
Definition: modelbase.hh:77
static constexpr int domainDimRange
Definition: modelbase.hh:88
typename RangeFunctionSpaceType::DomainFieldType RangeDomainFieldType
The type returned by classifyBoundary().
Definition: modelbase.hh:82
typename FunctionSpaceType::DomainType DomainType
The type returned by classifyBoundary().
Definition: modelbase.hh:61
std::string name() const
Print a descriptive name for debugging and output.
Definition: modelbase.hh:101
typename FunctionSpaceType::RangeType RangeType
The type returned by classifyBoundary().
Definition: modelbase.hh:62
typename DomainFunctionSpaceType::DomainType DomainDomainType
The type returned by classifyBoundary().
Definition: modelbase.hh:70
HessianRangeSelector< FunctionSpaceType > HessianRangeType
The type returned by classifyBoundary().
Definition: modelbase.hh:65
static constexpr int domainDimDomain
The type returned by classifyBoundary().
Definition: modelbase.hh:87
HessianRangeSelector< DomainFunctionSpaceType > DomainHessianRangeType
The type returned by classifyBoundary().
Definition: modelbase.hh:73
typename RangeFunctionSpaceType::DomainType RangeDomainType
The type returned by classifyBoundary().
Definition: modelbase.hh:78
RangeFunctionSpaceType FunctionSpaceType
The type returned by classifyBoundary().
Definition: modelbase.hh:59
typename DomainFunctionSpaceType::RangeType DomainRangeType
The type returned by classifyBoundary().
Definition: modelbase.hh:69
static constexpr int dimRange
The type returned by classifyBoundary().
Definition: modelbase.hh:86
typename RangeFunctionSpaceType::RangeFieldType RangeRangeFieldType
The type returned by classifyBoundary().
Definition: modelbase.hh:83
typename FunctionSpaceType::RangeFieldType RangeFieldType
The type returned by classifyBoundary().
Definition: modelbase.hh:67
void bind(const Entity &entity)
Bind to the given entity.
Definition: modelbase.hh:118
auto classifyBoundary(const Intersection &intersection)
Bind to the given intersection and classify the components w.r.t.
Definition: modelbase.hh:170
static constexpr int rangeDimDomain
The type returned by classifyBoundary().
Definition: modelbase.hh:89
typename RangeFunctionSpaceType::JacobianRangeType RangeJacobianRangeType
The type returned by classifyBoundary().
Definition: modelbase.hh:79
DomainFunctionSpace DomainFunctionSpaceType
The type returned by classifyBoundary().
Definition: modelbase.hh:58
static constexpr int dimDomain
The type returned by classifyBoundary().
Definition: modelbase.hh:85
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 27, 23:30, 2024)