DUNE-ACFEM (2.5.1)

emptyblockconstraints.hh
Go to the documentation of this file.
1
5#ifndef _DUNE_ACFEM_EMPTY_BLOCKCONSTRAINTS_HH_
6#define _DUNE_ACFEM_EMPTY_BLOCKCONSTRAINTS_HH_
7
8#include "blockconstraintsoperator.hh"
9
10namespace Dune {
11
12 namespace ACFem {
13
22 template<class DiscreteFunction>
23 class EmptyBlockConstraints;
24
25 template<class DiscreteFunction>
26 class LocalEmptyBlockConstraints;
27
28 template<class DiscreteFunction>
29 struct EmptyBlockConstraintsTraits
30 : BlockConstraintsDefaultTraits<EmptyBlockConstraints<DiscreteFunction>,
31 LocalEmptyBlockConstraints<DiscreteFunction> >
32 {};
33
36 template<class DiscreteFunction>
38 : public BlockConstraintsOperatorInterface<DiscreteFunction,
39 EmptyBlockConstraintsTraits<DiscreteFunction> >
40 {
42 public:
43 typedef EmptyBlockConstraintsTraits<DiscreteFunction> TraitsType;
44 typedef DiscreteFunction DiscreteFunctionType;
45 typedef typename TraitsType::LocalOperatorType LocalOperatorType;
46 typedef typename DiscreteFunctionType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
47 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
48 typedef typename DiscreteFunctionSpaceType::EntityType EntityType;
49
50 void rebuild() const {}
51 void operator()(const DiscreteFunctionType& arg, DiscreteFunctionType& result) const {}
52 void constrain(DiscreteFunctionType& w) const {}
53 void zeroConstrain(DiscreteFunctionType& w) const {}
54 size_t size() const { return 0; }
55
56 LocalOperatorType localOperator(const EntityType& entity) const
57 {
58 return LocalOperatorType();
59 }
60
61 LocalOperatorType localOperator() const
62 {
63 return LocalOperatorType();
64 }
65
66 };
67
68 template<class DiscreteFunction>
69 class LocalEmptyBlockConstraints
70 {
71 protected:
72 typedef EmptyBlockConstraints<DiscreteFunction> OperatorType;
73 typedef typename OperatorType::EntityType EntityType;
74 friend OperatorType;
75
76 LocalEmptyBlockConstraints() {}
77 public:
78 typedef typename OperatorType::DiscreteFunctionType::LocalFunctionType LocalFunctionType;
79
80 void init(const EntityType& entity) {}
81 void operator()(const LocalFunctionType& u, LocalFunctionType& w) const {}
82 void constrain(LocalFunctionType& u) const {}
83 void zeroConstrain(LocalFunctionType& u) const {}
84 size_t numConstrained() { return 0; }
85 bool unconstrained() { return true; }
86 bool totallyConstrained() { return false; }
87 };
88
89
90 template<class JacobianOperator>
91 class DifferentiableEmptyBlockConstraints;
92
93 template<class JacobianOperator>
94 class LocalDifferentiableEmptyBlockConstraints;
95
96 template<class JacobianOperator>
97 struct DifferentiableEmptyBlockConstraintsTraits
98 : public BlockConstraintsDefaultTraits<DifferentiableEmptyBlockConstraints<JacobianOperator>,
99 LocalDifferentiableEmptyBlockConstraints<JacobianOperator> >
100 {};
101
104 template<class JacobianOperator>
106 : public DifferentiableBlockConstraintsOperatorInterface<JacobianOperator,
107 DifferentiableEmptyBlockConstraintsTraits<JacobianOperator> >,
108 public EmptyBlockConstraints<typename JacobianOperator::RangeFunctionType>
109 {
112 public:
113 typedef DifferentiableEmptyBlockConstraintsTraits<JacobianOperator> TraitsType;
114 typedef typename BaseType::DiscreteFunctionType DiscreteFunctionType;
115 typedef typename TraitsType::LocalOperatorType LocalOperatorType;
116 typedef JacobianOperator JacobianOperatorType;
117 typedef typename DiscreteFunctionType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType;
118 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
119 typedef typename DiscreteFunctionSpaceType::EntityType EntityType;
120
121 // using BaseType::operator(); does not work here
122
123 //an accept-all constructor that is the default constructor
124 template <typename ...Args>
125 DifferentiableEmptyBlockConstraints(const Args & ...){}
126
127 void operator()(const DiscreteFunctionType& arg, DiscreteFunctionType& result) const {}
128 void jacobian(const DiscreteFunctionType& u, JacobianOperatorType& jOp) const {}
129
130 LocalOperatorType localOperator(const EntityType& entity) const
131 {
132 return LocalOperatorType();
133 }
134
135 LocalOperatorType localOperator() const
136 {
137 return LocalOperatorType();
138 }
139
140 using BaseType::size;
141 using BaseType::rebuild;
142 using BaseType::constrain;
143 using BaseType::zeroConstrain;
144 };
145
146 template<class JacobianOperator>
147 class LocalDifferentiableEmptyBlockConstraints
148 : public LocalEmptyBlockConstraints<typename JacobianOperator::DomainFunctionType>
149 {
150 typedef JacobianOperator JacobianOperatorType;
151 typedef LocalEmptyBlockConstraints<typename JacobianOperator::DomainFunctionType> BaseType;
152 protected:
154 typedef typename OperatorType::EntityType EntityType;
155 friend OperatorType;
156
157 LocalDifferentiableEmptyBlockConstraints()
158 : BaseType() {}
159 public:
160 typedef typename OperatorType::DiscreteFunctionType::LocalFunctionType LocalFunctionType;
161
162 using BaseType::init;
163 using BaseType::operator();
164 using BaseType::constrain;
165 using BaseType::zeroConstrain;
166
167 template<class LocalMatrix>
168 void jacobian(const LocalFunctionType& u /* unused */, LocalMatrix& jOpLocal) const {}
169 };
170
172
174
175 } // ACFem::
176
177} // Dune::
178
179
180#endif // _DUNE_ACFEM_EMPTY_BLOCKCONSTRAINTS_HH_
Interface class for a block-constraints-operator.
Definition: blockconstraintsoperator.hh:75
Interface class for a differentiable block-constraints-operator.
Definition: blockconstraintsoperator.hh:182
A class modelling differentiable do-nothing constraints.
Definition: emptyblockconstraints.hh:109
A class modelling do-nothing constraints.
Definition: emptyblockconstraints.hh:40
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Aug 13, 22:30, 2024)