3#ifndef DUNE_PDELAB_GRIDOPERATOR_FASTDG_ASSEMBLER_HH
4#define DUNE_PDELAB_GRIDOPERATOR_FASTDG_ASSEMBLER_HH
7#include <dune/pdelab/gridoperator/common/assemblerutilities.hh>
8#include <dune/pdelab/gridfunctionspace/localfunctionspace.hh>
9#include <dune/pdelab/gridfunctionspace/lfsindexcache.hh>
10#include <dune/pdelab/common/geometrywrapper.hh>
11#include <dune/pdelab/common/intersectiontype.hh>
24 template<
typename GFSU,
typename GFSV,
typename CU,
typename CV,
bool nonoverlapping_mode=false>
31 using Element =
typename EntitySet::Element;
32 using Intersection =
typename EntitySet::Intersection;
38 typedef GFSV TestGridFunctionSpace;
42 typedef typename GFSU::Traits::SizeType
SizeType;
47 FastDGAssembler (
const GFSU& gfsu_,
const GFSV& gfsv_,
const CU& cu_,
const CV& cv_)
87 template<
class LocalAssemblerEngine>
90 const bool fast =
true;
91 typedef LFSIndexCache<LFSU,CU,fast> LFSUCache;
93 typedef LFSIndexCache<LFSV,CV,fast> LFSVCache;
95 const bool needs_constraints_caching = assembler_engine.needsConstraintsCaching(cu,cv);
97 LFSUCache lfsu_cache(lfsu,cu,needs_constraints_caching);
98 LFSVCache lfsv_cache(lfsv,cv,needs_constraints_caching);
99 LFSUCache lfsun_cache(lfsun,cu,needs_constraints_caching);
100 LFSVCache lfsvn_cache(lfsvn,cv,needs_constraints_caching);
106 const bool require_uv_skeleton = assembler_engine.requireUVSkeleton();
107 const bool require_v_skeleton = assembler_engine.requireVSkeleton();
108 const bool require_uv_boundary = assembler_engine.requireUVBoundary();
109 const bool require_v_boundary = assembler_engine.requireVBoundary();
110 const bool require_uv_processor = assembler_engine.requireUVBoundary();
111 const bool require_v_processor = assembler_engine.requireVBoundary();
112 const bool require_uv_post_skeleton = assembler_engine.requireUVVolumePostSkeleton();
113 const bool require_v_post_skeleton = assembler_engine.requireVVolumePostSkeleton();
114 const bool require_skeleton_two_sided = assembler_engine.requireSkeletonTwoSided();
116 auto entity_set = gfsu.entitySet();
117 auto& index_set = entity_set.indexSet();
120 for (
const auto& element : elements(entity_set,assembler_engine.partition()))
123 auto ids = index_set.uniqueIndex(element);
131 lfsv.bind(element,std::integral_constant<bool,fast>{});
135 assembler_engine.onBindLFSV(eg,lfsv_cache);
141 lfsu.bind(element,std::integral_constant<bool,fast>{});
145 assembler_engine.onBindLFSUV(eg,lfsu_cache,lfsv_cache);
148 assembler_engine.loadCoefficientsLFSUInside(lfsu_cache);
154 if (require_uv_skeleton || require_v_skeleton ||
155 require_uv_boundary || require_v_boundary ||
156 require_uv_processor || require_v_processor)
159 unsigned int intersection_index = 0;
160 for(
const auto& intersection : intersections(entity_set,element))
163 IntersectionGeometry<Intersection> ig(intersection,intersection_index);
168 auto intersection_data = classifyIntersection(entity_set,intersection);
169 auto intersection_type = std::get<0>(intersection_data);
170 auto& outside_element = std::get<1>(intersection_data);
172 switch (intersection_type)
174 case IntersectionType::skeleton:
177 case IntersectionType::periodic:
178 if (require_uv_skeleton || require_v_skeleton)
182 auto idn = index_set.uniqueIndex(outside_element);
185 bool visit_face = ids > idn
186 or require_skeleton_two_sided
194 lfsvn.bind(outside_element,std::integral_constant<bool,fast>{});
195 lfsvn_cache.update();
198 assembler_engine.onBindLFSVOutside(ig,lfsv_cache,lfsvn_cache);
203 if(require_uv_skeleton){
206 lfsun.bind(outside_element,std::integral_constant<bool,fast>{});
207 lfsun_cache.update();
210 assembler_engine.onBindLFSUVOutside(ig,
211 lfsu_cache,lfsv_cache,
212 lfsun_cache,lfsvn_cache);
215 assembler_engine.loadCoefficientsLFSUOutside(lfsun_cache);
218 assembler_engine.
assembleUVSkeleton(ig,lfsu_cache,lfsv_cache,lfsun_cache,lfsvn_cache);
221 assembler_engine.onUnbindLFSUVOutside(ig,
222 lfsu_cache,lfsv_cache,
223 lfsun_cache,lfsvn_cache);
227 assembler_engine.onUnbindLFSVOutside(ig,lfsv_cache,lfsvn_cache);
232 case IntersectionType::boundary:
233 if(require_uv_boundary || require_v_boundary )
239 if(require_uv_boundary){
246 case IntersectionType::processor:
247 if(require_uv_processor || require_v_processor )
253 if(require_uv_processor){
261 ++intersection_index;
265 if(require_uv_post_skeleton || require_v_post_skeleton){
269 if(require_uv_post_skeleton){
276 assembler_engine.onUnbindLFSUV(eg,lfsu_cache,lfsv_cache);
279 assembler_engine.onUnbindLFSV(eg,lfsv_cache);
294 typename std::conditional<
295 std::is_same<CU,EmptyTransformation>::value,
299 typename std::conditional<
300 std::is_same<CV,EmptyTransformation>::value,
306 typedef LocalFunctionSpace<GFSU, TrialSpaceTag> LFSU;
307 typedef LocalFunctionSpace<GFSV, TestSpaceTag> LFSV;
Wrap element.
Definition: geometrywrapper.hh:16
The fast DG assembler for standard DUNE grid.
Definition: assembler.hh:25
GFSU::Traits::SizeType SizeType
Size type as used in grid function space.
Definition: assembler.hh:42
typename GFSU::Traits::EntitySet EntitySet
Definition: assembler.hh:30
const GFSV & testGridFunctionSpace() const
Get the test grid function space.
Definition: assembler.hh:76
const GFSU & trialGridFunctionSpace() const
Get the trial grid function space.
Definition: assembler.hh:70
GFSU TrialGridFunctionSpace
Definition: assembler.hh:37
static const bool isGalerkinMethod
Static check on whether this is a Galerkin method.
Definition: assembler.hh:45
The local assembler engine which handles the integration parts as provided by the global assemblers.
Definition: assembler.hh:34
void assembleUVVolume(const EG &eg, const LFSU &lfsu, const LFSV &lfsv)
void assembleVSkeleton(const IG &ig, const LFSV_S &lfsv_s, const LFSV_N &lfsv_n)
void assembleUVProcessor(const IG &ig, const LFSU_S &lfsu_s, const LFSV_S &lfsv_s)
bool skipIntersection(const IG &ig)
void assembleUVSkeleton(const IG &ig, const LFSU_S &lfsu_s, const LFSV_S &lfsv_s, const LFSU_N &lfsu_n, const LFSV_N &lfsv_n)
void assembleVProcessor(const IG &ig, const LFSV_S &lfsv_s)
bool skipEntity(const EG &eg)
void preAssembly()
Called directly before assembling.
void assembleVVolumePostSkeleton(const EG &eg, const LFSV &lfsv)
void assembleUVVolumePostSkeleton(const EG &eg, const LFSU &lfsu, const LFSV &lfsv)
void assembleVBoundary(const IG &ig, const LFSV_S &lfsv_s)
void assembleVVolume(const EG &eg, const LFSV &lfsv)
void postAssembly()
Called last thing after assembling.
void assembleUVBoundary(const IG &ig, const LFSU_S &lfsu_s, const LFSV_S &lfsv_s)
Traits for type conversions and type information.
constexpr InteriorBorder interiorBorder
PartitionSet for the interior and border partitions.
Definition: partitionset.hh:286
Dune namespace.
Definition: alignedallocator.hh:13