DUNE PDELab (2.7)

localassembler.hh
1#ifndef DUNE_PDELAB_GRIDOPERATOR_DEFAULT_LOCALASSEMBLER_HH
2#define DUNE_PDELAB_GRIDOPERATOR_DEFAULT_LOCALASSEMBLER_HH
3
4#include <dune/typetree/typetree.hh>
5
6#include <dune/pdelab/gridoperator/default/residualengine.hh>
7#include <dune/pdelab/gridoperator/default/patternengine.hh>
8#include <dune/pdelab/gridoperator/default/jacobianengine.hh>
9#include <dune/pdelab/gridoperator/default/jacobianapplyengine.hh>
10#include <dune/pdelab/gridoperator/common/assemblerutilities.hh>
11#include <dune/pdelab/gridfunctionspace/lfsindexcache.hh>
12
13namespace Dune{
14 namespace PDELab{
15
30 template<typename GO, typename LOP, bool nonoverlapping_mode = false>
32 public Dune::PDELab::LocalAssemblerBase<typename GO::Traits::MatrixBackend,
33 typename GO::Traits::TrialGridFunctionSpaceConstraints,
34 typename GO::Traits::TestGridFunctionSpaceConstraints>
35 {
36 public:
37
40
42 typedef typename Traits::Residual::ElementType RangeField;
43 typedef RangeField Real;
44
45 typedef typename Traits::TrialGridFunctionSpace GFSU;
46 typedef typename Traits::TestGridFunctionSpace GFSV;
47
50
53
55 typedef LOP LocalOperator;
56
57 static const bool isNonOverlapping = nonoverlapping_mode;
58
61 // Types of local function spaces
64 typedef LFSIndexCache<LFSU,CU> LFSUCache;
65 typedef LFSIndexCache<LFSV,CV> LFSVCache;
66
68
75
76 // friend declarations such that engines are able to call scatter_jacobian() and add_entry() from base class
80
82 DefaultLocalAssembler (LOP & lop, std::shared_ptr<typename GO::BorderDOFExchanger> border_dof_exchanger)
83 : lop_(lop), weight_(1.0), doPreProcessing_(true), doPostProcessing_(true),
84 pattern_engine(*this,border_dof_exchanger), residual_engine(*this), jacobian_engine(*this)
85 , jacobian_apply_engine(*this)
86 , _reconstruct_border_entries(isNonOverlapping)
87 {}
88
90 DefaultLocalAssembler (LOP & lop, const CU& cu, const CV& cv,
91 std::shared_ptr<typename GO::BorderDOFExchanger> border_dof_exchanger)
92 : Base(cu, cv),
93 lop_(lop), weight_(1.0), doPreProcessing_(true), doPostProcessing_(true),
94 pattern_engine(*this,border_dof_exchanger), residual_engine(*this), jacobian_engine(*this)
95 , jacobian_apply_engine(*this)
96 , _reconstruct_border_entries(isNonOverlapping)
97 {}
98
101 {
102 return lop_;
103 }
104
106 const LOP &localOperator() const
107 {
108 return lop_;
109 }
110
114 void setTime(Real time_)
115 {
116 lop_.setTime(time_);
117 }
118
121 {
122 return weight_;
123 }
124
127 weight_ = weight;
128 }
129
132 void preStage (Real time_, int r_) { lop_.preStage(time_,r_); }
133 void preStep (Real time_, Real dt_, std::size_t stages_){ lop_.preStep(time_,dt_,stages_); }
134 void postStep (){ lop_.postStep(); }
135 void postStage (){ lop_.postStage(); }
136 Real suggestTimestep (Real dt) const{return lop_.suggestTimestep(dt); }
138
139 bool reconstructBorderEntries() const
140 {
141 return _reconstruct_border_entries;
142 }
143
146
150 (typename Traits::MatrixPattern & p)
151 {
152 pattern_engine.setPattern(p);
153 return pattern_engine;
154 }
155
159 (typename Traits::Residual & r, const typename Traits::Solution & x)
160 {
161 residual_engine.setResidual(r);
162 residual_engine.setSolution(x);
163 return residual_engine;
164 }
165
169 (typename Traits::Jacobian & a, const typename Traits::Solution & x)
170 {
171 jacobian_engine.setJacobian(a);
172 jacobian_engine.setSolution(x);
173 return jacobian_engine;
174 }
175
179 (const typename Traits::Domain & update, typename Traits::Range & result)
180 {
181 jacobian_apply_engine.setUpdate(update);
182 jacobian_apply_engine.setResult(result);
183 return jacobian_apply_engine;
184 }
185
189 (const typename Traits::Domain & solution, const typename Traits::Domain & update, typename Traits::Range & result)
190 {
191 jacobian_apply_engine.setSolution(solution);
192 jacobian_apply_engine.setUpdate(update);
193 jacobian_apply_engine.setResult(result);
194 return jacobian_apply_engine;
195 }
196
198
203 static constexpr bool doAlphaVolume() { return LOP::doAlphaVolume; }
204 static constexpr bool doLambdaVolume() { return LOP::doLambdaVolume; }
205 static constexpr bool doAlphaSkeleton() { return LOP::doAlphaSkeleton; }
206 static constexpr bool doLambdaSkeleton() { return LOP::doLambdaSkeleton; }
207 static constexpr bool doAlphaBoundary() { return LOP::doAlphaBoundary; }
208 static constexpr bool doLambdaBoundary() { return LOP::doLambdaBoundary; }
209 static constexpr bool doAlphaVolumePostSkeleton() { return LOP::doAlphaVolumePostSkeleton; }
210 static constexpr bool doLambdaVolumePostSkeleton() { return LOP::doLambdaVolumePostSkeleton; }
211 static constexpr bool doSkeletonTwoSided() { return LOP::doSkeletonTwoSided; }
212 static constexpr bool doPatternVolume() { return LOP::doPatternVolume; }
213 static constexpr bool doPatternSkeleton() { return LOP::doPatternSkeleton; }
214 static constexpr bool doPatternBoundary() { return LOP::doPatternBoundary; }
215 static constexpr bool doPatternVolumePostSkeleton() { return LOP::doPatternVolumePostSkeleton; }
216 static constexpr bool isLinear() { return LOP::isLinear;}
218
220
223 bool doPreProcessing() const { return doPreProcessing_; }
224
229 void preProcessing(bool v)
230 {
231 doPreProcessing_ = v;
232 }
233
235
238 bool doPostProcessing() const { return doPostProcessing_; }
239
244 void postProcessing(bool v)
245 {
246 doPostProcessing_ = v;
247 }
248
249 private:
250
252 LOP & lop_;
253
255 RangeField weight_;
256
259 bool doPreProcessing_;
260
263 bool doPostProcessing_;
264
267 LocalPatternAssemblerEngine pattern_engine;
268 LocalResidualAssemblerEngine residual_engine;
269 LocalJacobianAssemblerEngine jacobian_engine;
270 LocalJacobianApplyAssemblerEngine jacobian_apply_engine;
272
273 bool _reconstruct_border_entries;
274 };
275
276 } // end namespace PDELab
277} // end namespace Dune
278#endif
The local assembler for DUNE grids.
Definition: localassembler.hh:35
Traits::Residual::ElementType RangeField
The local operators type for real numbers e.g. time.
Definition: localassembler.hh:42
RangeField weight() const
Obtain the weight that was set last.
Definition: localassembler.hh:120
DefaultLocalPatternAssemblerEngine< DefaultLocalAssembler > LocalPatternAssemblerEngine
Definition: localassembler.hh:71
Dune::PDELab::LocalFunctionSpace< GFSU, Dune::PDELab::TrialSpaceTag > LFSU
Definition: localassembler.hh:62
static constexpr bool doAlphaVolume()
Query methods for the assembler engines. Theses methods do not belong to the assembler interface,...
Definition: localassembler.hh:203
void setTime(Real time_)
Definition: localassembler.hh:114
LocalPatternAssemblerEngine & localPatternAssemblerEngine(typename Traits::MatrixPattern &p)
Definition: localassembler.hh:150
bool doPreProcessing() const
Query whether to do preprocessing in the engines.
Definition: localassembler.hh:223
Dune::PDELab::LocalAssemblerTraits< GO > Traits
The traits class.
Definition: localassembler.hh:39
void preStage(Real time_, int r_)
Definition: localassembler.hh:132
LocalJacobianApplyAssemblerEngine & localJacobianApplyAssemblerEngine(const typename Traits::Domain &update, typename Traits::Range &result)
Definition: localassembler.hh:179
const LOP & localOperator() const
get a reference to the local operator
Definition: localassembler.hh:106
LOP LocalOperator
The local operator.
Definition: localassembler.hh:55
LocalResidualAssemblerEngine & localResidualAssemblerEngine(typename Traits::Residual &r, const typename Traits::Solution &x)
Definition: localassembler.hh:159
void preProcessing(bool v)
Definition: localassembler.hh:229
LOP & localOperator()
get a reference to the local operator
Definition: localassembler.hh:100
void postProcessing(bool v)
Definition: localassembler.hh:244
void setWeight(RangeField weight)
Notifies the assembler about the current weight of assembling.
Definition: localassembler.hh:126
DefaultLocalAssembler(LOP &lop, std::shared_ptr< typename GO::BorderDOFExchanger > border_dof_exchanger)
Constructor with empty constraints.
Definition: localassembler.hh:82
LocalJacobianAssemblerEngine & localJacobianAssemblerEngine(typename Traits::Jacobian &a, const typename Traits::Solution &x)
Definition: localassembler.hh:169
Dune::PDELab::LocalAssemblerBase< typename Traits::MatrixBackend, CU, CV > Base
The base class of this local assembler.
Definition: localassembler.hh:52
DefaultLocalAssembler(LOP &lop, const CU &cu, const CV &cv, std::shared_ptr< typename GO::BorderDOFExchanger > border_dof_exchanger)
Constructor for non trivial constraints.
Definition: localassembler.hh:90
LocalJacobianApplyAssemblerEngine & localJacobianApplyAssemblerEngine(const typename Traits::Domain &solution, const typename Traits::Domain &update, typename Traits::Range &result)
Definition: localassembler.hh:189
bool doPostProcessing() const
Query whether to do postprocessing in the engines.
Definition: localassembler.hh:238
void setUpdate(const Domain &update_)
Definition: jacobianapplyengine.hh:117
void setResult(Range &result_)
Definition: jacobianapplyengine.hh:125
void setSolution(const Domain &solution_)
Definition: jacobianapplyengine.hh:109
void setSolution(const Solution &solution_)
Definition: jacobianengine.hh:120
void setJacobian(Jacobian &jacobian_)
Definition: jacobianengine.hh:110
void setPattern(Pattern &pattern_)
Definition: patternengine.hh:92
void setResidual(Residual &residual_)
Definition: residualengine.hh:114
void setSolution(const Solution &solution_)
Definition: residualengine.hh:122
Base class for local assembler.
Definition: assemblerutilities.hh:189
Create a local function space from a global function space.
Definition: localfunctionspace.hh:717
Dune namespace.
Definition: alignedallocator.hh:14
Definition: assemblerutilities.hh:23
GO::Traits::Range Residual
The type of the range (residual).
Definition: assemblerutilities.hh:60
MatrixBackend::template Pattern< Jacobian, TestGridFunctionSpace, TrialGridFunctionSpace > MatrixPattern
The matrix pattern.
Definition: assemblerutilities.hh:74
GO::Traits::TrialGridFunctionSpace TrialGridFunctionSpace
The trial grid function space.
Definition: assemblerutilities.hh:26
GO::Traits::Jacobian Jacobian
The type of the jacobian.
Definition: assemblerutilities.hh:67
GO::Traits::TestGridFunctionSpace TestGridFunctionSpace
The test grid function space.
Definition: assemblerutilities.hh:29
GO::Traits::Domain Solution
The type of the domain (solution).
Definition: assemblerutilities.hh:50
GO::Traits::Range Range
The type of the range (residual).
Definition: assemblerutilities.hh:57
GO::Traits::Domain Domain
The type of the domain (solution).
Definition: assemblerutilities.hh:47
GO::Traits::TrialGridFunctionSpaceConstraints TrialGridFunctionSpaceConstraints
The type of the trial grid function space constraints.
Definition: assemblerutilities.hh:33
GO::Traits::TestGridFunctionSpaceConstraints TestGridFunctionSpaceConstraints
The type of the test grid function space constraints.
Definition: assemblerutilities.hh:36
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)