1#ifndef DUNE_PDELAB_GRIDOPERATOR_FASTDG_PATTERNENGINE_HH
2#define DUNE_PDELAB_GRIDOPERATOR_FASTDG_PATTERNENGINE_HH
5#include <dune/pdelab/gridoperator/common/localmatrix.hh>
6#include <dune/pdelab/gridoperator/common/assemblerutilities.hh>
7#include <dune/pdelab/gridoperator/common/localassemblerenginebase.hh>
8#include <dune/pdelab/constraints/common/constraints.hh>
9#include <dune/pdelab/localoperator/callswitch.hh>
27 template<
typename TrialConstra
intsContainer,
typename TestConstra
intsContainer>
28 bool needsConstraintsCaching(
const TrialConstraintsContainer& cu,
const TestConstraintsContainer& cv)
const
30 return cu.containsNonDirichletConstraints() || cv.containsNonDirichletConstraints();
37 typedef typename LA::LocalOperator
LOP;
40 typedef typename LA::LFSU
LFSU;
41 typedef typename LA::LFSUCache LFSUCache;
42 typedef typename LFSU::Traits::GridFunctionSpace GFSU;
43 typedef typename LA::LFSV LFSV;
44 typedef typename LA::LFSVCache LFSVCache;
45 typedef typename LFSV::Traits::GridFunctionSpace GFSV;
49 typedef typename BorderDOFExchanger::BorderPattern BorderPattern;
52 typedef typename LA::Traits::MatrixPattern
Pattern;
56 typedef std::size_t size_type;
65 std::shared_ptr<typename LA::Traits::BorderDOFExchanger> border_dof_exchanger)
66 : local_assembler(local_assembler_)
67 , lop(local_assembler.localOperator())
69 , _border_dof_exchanger(border_dof_exchanger)
75 return local_assembler;
79 const typename LocalAssembler::Traits::TrialGridFunctionSpaceConstraints&
trialConstraints()
const
85 const typename LocalAssembler::Traits::TestGridFunctionSpaceConstraints&
testConstraints()
const
102 return local_assembler.doPatternSkeleton();
105 bool requireUVVolume()
const
107 return local_assembler.doPatternVolume();
110 bool requireUVSkeleton()
const
112 return local_assembler.doPatternSkeleton();
115 bool requireUVBoundary()
const
117 return local_assembler.doPatternBoundary();
120 bool requireUVVolumePostSkeleton()
const
122 return local_assembler.doPatternVolumePostSkeleton();
125 auto partition()
const
134 template<
typename LFSVC,
typename LFSUC>
135 void add_border_pattern(std::true_type,
const LFSVC& lfsv_cache,
const LFSUC& lfsu_cache,
136 const LocalPattern& p)
138 if (local_assembler.reconstructBorderEntries() &&
139 !communicationCache().initialized())
141 communicationCache().addEntries(lfsv_cache,lfsu_cache,p);
145 template<
typename LFSVC,
typename LFSUC>
146 void add_border_pattern(std::false_type,
const LFSVC& lfsv_cache,
const LFSUC& lfsu_cache,
147 const LocalPattern& p)
150 template<
typename LFSVC,
typename LFSUC>
151 void add_pattern(
const LFSVC& lfsv_cache,
const LFSUC& lfsu_cache,
const LocalPattern& p)
155 local_assembler.add_entry(*pattern,
162 add_border_pattern(std::integral_constant<bool,LocalAssembler::isNonOverlapping>(),
174 template<
typename EG>
186 template<
typename IG>
195 template<
typename EG,
typename LFSUC,
typename LFSVC>
196 void onUnbindLFSUV(
const EG & eg,
const LFSUC & lfsu_cache,
const LFSVC & lfsv_cache)
198 add_pattern(lfsv_cache,lfsu_cache,localpattern);
199 localpattern.clear();
202 template<
typename IG,
typename LFSUC,
typename LFSVC>
203 void onUnbindLFSUVOutside(
const IG& ig,
204 const LFSUC& lfsu_s_cache,
const LFSVC& lfsv_s_cache,
205 const LFSUC& lfsu_n_cache,
const LFSVC& lfsv_n_cache)
207 add_pattern(lfsv_s_cache,lfsu_n_cache,localpattern_sn);
208 localpattern_sn.clear();
209 add_pattern(lfsv_n_cache,lfsu_s_cache,localpattern_ns);
210 localpattern_ns.clear();
218 template<
typename EG,
typename LFSUC,
typename LFSVC>
221 Dune::PDELab::LocalAssemblerCallSwitch<LOP,LOP::doPatternVolume>::
222 pattern_volume(lop,lfsu_cache.localFunctionSpace(),lfsv_cache.localFunctionSpace(),localpattern);
225 template<
typename IG,
typename LFSUC,
typename LFSVC>
226 void assembleUVSkeleton(
const IG & ig,
const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
227 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache)
229 Dune::PDELab::LocalAssemblerCallSwitch<LOP,LOP::doPatternSkeleton>::
230 pattern_skeleton(lop,
231 lfsu_s_cache.localFunctionSpace(),lfsv_s_cache.localFunctionSpace(),
232 lfsu_n_cache.localFunctionSpace(),lfsv_n_cache.localFunctionSpace(),
233 localpattern_sn, localpattern_ns);
236 template<
typename IG,
typename LFSUC,
typename LFSVC>
237 void assembleUVBoundary(
const IG & ig,
const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache)
239 Dune::PDELab::LocalAssemblerCallSwitch<LOP,LOP::doPatternBoundary>::
240 pattern_boundary(lop,lfsu_s_cache.localFunctionSpace(),lfsv_s_cache.localFunctionSpace(),localpattern);
243 template<
typename IG,
typename LFSUC,
typename LFSVC>
244 static void assembleUVEnrichedCoupling(
const IG & ig,
245 const LFSUC & lfsu_s_cache,
const LFSVC & lfsv_s_cache,
246 const LFSUC & lfsu_n_cache,
const LFSVC & lfsv_n_cache,
247 const LFSUC & lfsu_coupling_cache,
const LFSVC & lfsv_coupling_cache)
252 template<
typename IG,
typename LFSVC>
253 static void assembleVEnrichedCoupling(
const IG & ig,
254 const LFSVC & lfsv_s_cache,
255 const LFSVC & lfsv_n_cache,
256 const LFSVC & lfsv_coupling_cache)
261 template<
typename EG,
typename LFSUC,
typename LFSVC>
262 void assembleUVVolumePostSkeleton(
const EG & eg,
const LFSUC & lfsu_cache,
const LFSVC & lfsv_cache)
264 Dune::PDELab::LocalAssemblerCallSwitch<LOP,LOP::doPatternVolumePostSkeleton>::
265 pattern_volume_post_skeleton(lop,lfsu_cache.localFunctionSpace(),lfsv_cache.localFunctionSpace(),localpattern);
269 void postAssembly(
const GFSU& gfsu,
const GFSV& gfsv){
270 post_border_pattern_assembly(std::integral_constant<bool,LocalAssembler::isNonOverlapping>(),
275 void post_border_pattern_assembly(std::true_type,
const GFSU& gfsu,
const GFSV& gfsv)
277 if(local_assembler.doPostProcessing() &&
278 local_assembler.reconstructBorderEntries())
280 communicationCache().finishInitialization();
282 typename LA::Traits::BorderDOFExchanger::template PatternExtender<Pattern>
283 data_handle(*_border_dof_exchanger,gfsu,gfsv,*pattern);
284 gfsv.gridView().communicate(data_handle,
290 void post_border_pattern_assembly(std::false_type,
const GFSU& gfsu,
const GFSV& gfsv)
298 typename LA::Traits::BorderDOFExchanger::CommunicationCache&
301 return _border_dof_exchanger->communicationCache();
304 const typename LA::Traits::BorderDOFExchanger::CommunicationCache&
305 communicationCache()
const
307 return _border_dof_exchanger->communicationCache();
320 LocalPattern localpattern;
321 LocalPattern localpattern_sn, localpattern_ns;
323 BorderPattern _border_pattern;
325 std::shared_ptr<BorderDOFExchanger> _border_dof_exchanger;
Default exception for dummy implementations.
Definition: exceptions.hh:263
The fast DG local assembler engine for DUNE grids which creates the matrix pattern.
Definition: patternengine.hh:24
void setPattern(Pattern &pattern_)
Definition: patternengine.hh:92
void assembleUVVolume(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: patternengine.hh:219
LA::LFSU LFSU
The local function spaces.
Definition: patternengine.hh:40
LA::Traits::MatrixPattern Pattern
The type of the solution vector.
Definition: patternengine.hh:52
LA::Traits::BorderDOFExchanger BorderDOFExchanger
helper classes
Definition: patternengine.hh:48
LA::LocalOperator LOP
The type of the local operator.
Definition: patternengine.hh:37
void onUnbindLFSUV(const EG &eg, const LFSUC &lfsu_cache, const LFSVC &lfsv_cache)
Definition: patternengine.hh:196
bool skipIntersection(const IG &ig)
Definition: patternengine.hh:187
FastDGLocalPatternAssemblerEngine(const LocalAssembler &local_assembler_, std::shared_ptr< typename LA::Traits::BorderDOFExchanger > border_dof_exchanger)
Constructor.
Definition: patternengine.hh:64
bool requireSkeleton() const
Definition: patternengine.hh:100
const LocalAssembler::Traits::TrialGridFunctionSpaceConstraints & trialConstraints() const
Trial space constraints.
Definition: patternengine.hh:79
LA LocalAssembler
The type of the wrapping local assembler.
Definition: patternengine.hh:34
const LocalAssembler & localAssembler() const
Public access to the wrapping local assembler.
Definition: patternengine.hh:73
bool skipEntity(const EG &eg)
Definition: patternengine.hh:175
const LocalAssembler::Traits::TestGridFunctionSpaceConstraints & testConstraints() const
Test space constraints.
Definition: patternengine.hh:85
Base class for LocalAssemblerEngine implementations to avoid boilerplate code.
Definition: localassemblerenginebase.hh:22
Layout description for a sparse linear operator.
Definition: assemblerutilities.hh:165
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
constexpr All all
PartitionSet for all partitions.
Definition: partitionset.hh:295
Dune namespace.
Definition: alignedallocator.hh:13