DUNE PDELab (2.8)

localfunctionspace.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_PDELAB_GRIDFUNCTIONSPACE_LOCALFUNCTIONSPACE_HH
4#define DUNE_PDELAB_GRIDFUNCTIONSPACE_LOCALFUNCTIONSPACE_HH
5
6#include <vector>
7#include <memory>
8
11
12#include <dune/geometry/referenceelements.hh>
13
14#include <dune/localfunctions/common/interfaceswitch.hh>
15#include <dune/localfunctions/common/localkey.hh>
16
17#include <dune/typetree/typetree.hh>
18
19#include <dune/pdelab/gridfunctionspace/tags.hh>
21
22namespace Dune {
23 namespace PDELab {
24
28
29 //=======================================
30 // local function space base: metaprograms
31 //=======================================
32
33 namespace {
34
35 // the bogus template parameter is necessary to make GCC honor the friend declaration
36 // in the LocalFunctionSpace (probably a GCC bug)
37 template<typename = int>
38 struct PropagateGlobalStorageVisitor
39 : public TypeTree::TreeVisitor
40 , public TypeTree::DynamicTraversal
41 {
42
43 template<typename LFS, typename Child, typename TreePath, typename ChildIndex>
44 void beforeChild(const LFS& lfs, Child& child, TreePath treePath, ChildIndex childIndex) const
45 {
46 child._dof_indices = lfs._dof_indices;
47 }
48 };
49
50 // This visitor is not used in standard PDELab code, but is necessary for MultiDomain
51 // It is defined here due to the necessary friend declarations in the local function spaces.
52 // for template parameter see above
53 template<typename = int>
54 struct ClearSizeVisitor
55 : public TypeTree::TreeVisitor
56 , public TypeTree::DynamicTraversal
57 {
58
59 template<typename Node, typename TreePath>
60 void pre(Node& node, TreePath treePath)
61 {
62 leaf(node,treePath);
63 }
64
65 template<typename Node, typename TreePath>
66 void leaf(Node& node, TreePath treePath)
67 {
68 node.offset = offset;
69 node.n = 0;
70 }
71
72 ClearSizeVisitor(std::size_t offset_)
73 : offset(offset_)
74 {}
75
76 const std::size_t offset;
77
78 };
79
80
81 template<typename Entity, bool fast>
82 struct ComputeSizeVisitor
83 : public TypeTree::TreeVisitor
84 , public TypeTree::DynamicTraversal
85 {
86
87 template<typename Node, typename TreePath>
88 void pre(Node& node, TreePath treePath)
89 {
90 node.offset = offset;
91 }
92
93 template<typename Node, typename TreePath>
94 void post(Node& node, TreePath treePath)
95 {
96 node.n = offset - node.offset;
97 }
98
99 template<typename Node, typename TreePath>
100 void leaf(Node& node, TreePath treePath)
101 {
102 node.offset = offset;
103 node.unbindFiniteElement();
104 node._in_entity_set = node.pgfs->entitySet().contains(e);
105 if (not node._in_entity_set) {
106 node.n = 0;
107 } else if (fast) {
108 node.n = node.pgfs->finiteElementMap().maxLocalSize();
109 node.bindFiniteElement(node.pgfs->finiteElementMap().find(e));
110 } else {
111 node.bindFiniteElement(node.pgfs->finiteElementMap().find(e));
112 node.n = Node::FESwitch::basis(node.finiteElement()).size();
113 }
114 offset += node.n;
115 }
116
117 ComputeSizeVisitor(const Entity& entity, std::size_t offset_ = 0)
118 : e(entity)
119 , offset(offset_)
120 {}
121
122 const Entity& e;
123 std::size_t offset;
124
125 };
126
127
128 template<typename Entity, bool fast>
129 struct FillIndicesVisitor
130 : public TypeTree::TreeVisitor
131 , public TypeTree::DynamicTraversal
132 {
133
134 template<typename Node, typename TreePath>
135 void leaf(Node& node, TreePath treePath)
136 {
137 // setup DOFIndices for this finite element
138 node.dofIndices(e,node._dof_indices->begin()+node.offset,node._dof_indices->begin()+node.offset+node.n,std::integral_constant<bool,fast>{});
139 }
140
141 template<typename Node, typename Child, typename TreePath, typename ChildIndex>
142 void afterChild(const Node& node, const Child& child, TreePath treePath, ChildIndex childIndex)
143 {
144 // Just skip the entire function space structure handling in fast mode
145 // This **really** breaks any attempt at using the DOFIndex for anything other
146 // than as input to the FastDGGridOperator machine.
147 // You have been warned!
148 if (not fast)
149 for (std::size_t i = 0; i<child.n; ++i)
150 {
151 // update tree path for the DOFIndices of the child
152 (*node._dof_indices)[child.offset+i].treeIndex().push_back(childIndex);
153 }
154 }
155
156 FillIndicesVisitor(const Entity& entity)
157 : e(entity)
158 {}
159
160 const Entity& e;
161 };
162
163 } // end empty namespace
164
165 //=======================================
166 // local function space base: base class
167 //=======================================
168
170 template<typename GFS, typename DI>
172 {
175
177 typedef GFS GridFunctionSpace;
178
180 typedef typename GFS::Traits::SizeType SizeType;
181
183 typedef typename std::vector<SizeType> IndexContainer;
184
186 typedef DI DOFIndex;
187
189 typedef typename std::vector<DI> DOFIndexContainer;
190
191 };
192
193 template <typename GFS, typename DOFIndex>
194 class LocalFunctionSpaceBaseNode
195 {
196 typedef typename GFS::Traits::Backend B;
197
198 template<typename>
199 friend struct PropagateGlobalStorageVisitor;
200
201 template<typename,bool>
202 friend struct ComputeSizeVisitor;
203
204 template<typename,bool>
205 friend struct FillIndicesVisitor;
206
207 template<typename LFS, typename C, typename Tag, bool>
208 friend class LFSIndexCacheBase;
209
210 public:
212
214 LocalFunctionSpaceBaseNode (std::shared_ptr<const GFS> gfs)
215 : pgfs(gfs)
216 , _dof_index_storage()
217 , _dof_indices(&_dof_index_storage)
218 , n(0)
219 {}
220
222 typename Traits::IndexContainer::size_type size () const
223 {
224 return n;
225 }
226
227 std::size_t subSpaceDepth() const
228 {
229 return 0;
230 }
231
233 typename Traits::IndexContainer::size_type maxSize () const
234 {
235 // _dof_indices is always as large as the max local size of the root GFS
236 return _dof_indices->size();
237 }
238
240
246 typename Traits::IndexContainer::size_type localVectorSize () const
247 {
248 return _dof_indices->size();
249 }
250
252 typename Traits::IndexContainer::size_type localIndex (typename Traits::IndexContainer::size_type index) const
253 {
254 return offset+index;
255 }
256
258
265 const typename Traits::DOFIndex& dofIndex(typename Traits::IndexContainer::size_type index) const
266 {
267 return (*_dof_indices)[offset + index];
268 }
269
271 void debug () const
272 {
273 std::cout << n << " indices = (";
274 for (typename Traits::IndexContainer::size_type k=0; k<n; k++)
275 std::cout << (*_dof_indices)[localIndex(k)] << " ";
276 std::cout << ")" << std::endl;
277 }
278
280 const GFS& gridFunctionSpace() const
281 {
282 return *pgfs;
283 }
284
285 public:
286 template<typename NodeType>
287 void setup(NodeType& node)
288 {
289 _dof_index_storage.resize(gridFunctionSpace().ordering().maxLocalSize());
290 TypeTree::applyToTree(node,PropagateGlobalStorageVisitor<>());
291 }
292
293 std::shared_ptr<GFS const> pgfs;
294 typename Traits::DOFIndexContainer _dof_index_storage;
295 typename Traits::DOFIndexContainer* _dof_indices;
296 typename Traits::IndexContainer::size_type n;
297 typename Traits::IndexContainer::size_type offset;
298 };
299
301 template<typename GFS, typename DOFIndex>
303 {
305 typedef typename GFS::Traits::GridViewType GridViewType;
306
308 typedef typename GFS::Traits::GridViewType GridView;
309
310 using EntitySet = typename GFS::Traits::EntitySet;
311
313 using Element = typename EntitySet::Element;
314 };
315
316 template <typename GFS, typename DOFIndex>
317 class GridViewLocalFunctionSpaceBaseNode :
318 public LocalFunctionSpaceBaseNode<GFS,DOFIndex>
319 {
320 typedef typename GFS::Traits::Backend B;
321 typedef LocalFunctionSpaceBaseNode<GFS,DOFIndex> BaseT;
322
323 public:
325
327 GridViewLocalFunctionSpaceBaseNode (std::shared_ptr<const GFS> gfs)
328 : BaseT(gfs)
329 {}
330
331 protected:
333
345 template<typename NodeType, bool fast = false>
346 void bind (NodeType& node, const typename Traits::Element& e, std::integral_constant<bool,fast> = std::integral_constant<bool,fast>{});
347 };
348
349 template <typename GFS, typename DOFIndex>
350 template <typename NodeType, bool fast>
351 void GridViewLocalFunctionSpaceBaseNode<GFS,DOFIndex>::bind (NodeType& node,
353 std::integral_constant<bool,fast>)
354 {
356 assert(&node == this);
357
358 // compute sizes
359 ComputeSizeVisitor<Element,fast> csv(e);
360 TypeTree::applyToTree(node,csv);
361
362
363 // initialize iterators and fill indices
364 FillIndicesVisitor<Element,fast> fiv(e);
365 TypeTree::applyToTree(node,fiv);
366 }
367
368 //=======================================
369 // local function space base: power implementation
370 //=======================================
371
373 template<typename GFS, typename DOFIndex, typename N>
375 {
377 typedef N NodeType;
378 };
379
380 // local function space for a power grid function space
381 template<typename GFS, typename DOFIndex, typename ChildLFS, std::size_t k>
382 class PowerLocalFunctionSpaceNode :
383 public GridViewLocalFunctionSpaceBaseNode<GFS,DOFIndex>,
384 public TypeTree::PowerNode<ChildLFS,k>
385 {
386 typedef GridViewLocalFunctionSpaceBaseNode<GFS,DOFIndex> BaseT;
387 typedef TypeTree::PowerNode<ChildLFS,k> TreeNode;
388
389 template<typename>
390 friend struct PropagateGlobalStorageVisitor;
391
392 template<typename>
393 friend struct ClearSizeVisitor;
394
395 template<typename,bool>
396 friend struct ComputeSizeVisitor;
397
398 template<typename,bool>
399 friend struct FillIndicesVisitor;
400
401 public:
403
405
407 template<typename Transformation>
408 PowerLocalFunctionSpaceNode (std::shared_ptr<const GFS> gfs,
409 const Transformation& t,
410 const std::array<std::shared_ptr<ChildLFS>,k>& children)
411 : BaseT(gfs)
412 , TreeNode(children)
413 {}
414
415 template<typename Transformation>
416 PowerLocalFunctionSpaceNode (const GFS& gfs,
417 const Transformation& t,
418 const std::array<std::shared_ptr<ChildLFS>,k>& children)
419 : BaseT(stackobject_to_shared_ptr(gfs))
420 , TreeNode(children)
421 {}
422
424 template<bool fast = false>
425 void bind (const typename Traits::Element& e, std::integral_constant<bool,fast> fast_ = std::integral_constant<bool,fast>{})
426 {
427 // call method on base class, this avoid the barton neckman trick
428 BaseT::bind(*this,e,fast_);
429 }
430
431 };
432
433
434 // transformation template, we need a custom template in order to inject the DOFIndex type into the LocalFunctionSpace
435 template<typename SourceNode, typename Transformation>
436 struct power_gfs_to_lfs_template
437 {
438 template<typename TC>
439 struct result
440 {
441 typedef PowerLocalFunctionSpaceNode<SourceNode,typename Transformation::DOFIndex,TC,TypeTree::StaticDegree<SourceNode>::value> type;
442 };
443 };
444
445 // register PowerGFS -> LocalFunctionSpace transformation
446 template<typename PowerGridFunctionSpace, typename Params>
447 TypeTree::TemplatizedGenericPowerNodeTransformation<
448 PowerGridFunctionSpace,
449 gfs_to_lfs<Params>,
450 power_gfs_to_lfs_template<PowerGridFunctionSpace,gfs_to_lfs<Params> >::template result
451 >
452 registerNodeTransformation(PowerGridFunctionSpace* pgfs, gfs_to_lfs<Params>* t, PowerGridFunctionSpaceTag* tag);
453
454
455 //=======================================
456 // local function space base: composite implementation
457 //=======================================
458
459 // local function space for a power grid function space
460 template<typename GFS, typename DOFIndex, typename... Children>
461 class CompositeLocalFunctionSpaceNode
462 : public GridViewLocalFunctionSpaceBaseNode<GFS,DOFIndex>
463 , public TypeTree::CompositeNode<Children...>
464 {
465 typedef GridViewLocalFunctionSpaceBaseNode<GFS,DOFIndex> BaseT;
466 typedef TypeTree::CompositeNode<Children...> NodeType;
467
468 template<typename>
469 friend struct PropagateGlobalStorageVisitor;
470
471 template<typename>
472 friend struct ClearSizeVisitor;
473
474 template<typename,bool>
475 friend struct ComputeSizeVisitor;
476
477 template<typename,bool>
478 friend struct FillIndicesVisitor;
479
480 public:
481 typedef PowerCompositeLocalFunctionSpaceTraits<GFS,DOFIndex,CompositeLocalFunctionSpaceNode> Traits;
482
483 typedef CompositeLocalFunctionSpaceTag ImplementationTag;
484
485 template<typename Transformation>
486 CompositeLocalFunctionSpaceNode (std::shared_ptr<const GFS> gfs,
487 const Transformation& t,
488 std::shared_ptr<Children>... children)
489 : BaseT(gfs)
490 , NodeType(children...)
491 {}
492
493 template<typename Transformation>
494 CompositeLocalFunctionSpaceNode (const GFS& gfs,
495 const Transformation& t,
496 std::shared_ptr<Children>... children)
497 : BaseT(stackobject_to_shared_ptr(gfs))
498 , NodeType(children...)
499 {}
500
502 template<bool fast = false>
503 void bind (const typename Traits::Element& e, std::integral_constant<bool,fast> fast_ = std::integral_constant<bool,fast>{})
504 {
505 // call method on base class, this avoid the barton neckman trick
506 BaseT::bind(*this,e,fast_);
507 }
508
509 };
510
511 // transformation template, we need a custom template in order to inject the MultiIndex type into the LocalFunctionSpace
512 template<typename SourceNode, typename Transformation>
513 struct composite_gfs_to_lfs_template
514 {
515 template<typename... TC>
516 struct result
517 {
518 typedef CompositeLocalFunctionSpaceNode<SourceNode,typename Transformation::DOFIndex,TC...> type;
519 };
520 };
521
522 // register CompositeGFS -> LocalFunctionSpace transformation (variadic version)
523 template<typename CompositeGridFunctionSpace, typename Params>
524 TypeTree::TemplatizedGenericCompositeNodeTransformation<
525 CompositeGridFunctionSpace,
526 gfs_to_lfs<Params>,
527 composite_gfs_to_lfs_template<CompositeGridFunctionSpace,gfs_to_lfs<Params> >::template result
528 >
529 registerNodeTransformation(CompositeGridFunctionSpace* cgfs, gfs_to_lfs<Params>* t, CompositeGridFunctionSpaceTag* tag);
530
531
532 //=======================================
533 // local function space base: single component implementation
534 //=======================================
535
537 template<typename GFS, typename DOFIndex, typename N>
539 {
541 typedef typename GFS::Traits::FiniteElementType FiniteElementType;
542
543 typedef typename GFS::Traits::FiniteElementType FiniteElement;
544
546 typedef typename GFS::Traits::ConstraintsType ConstraintsType;
547
548 typedef typename GFS::Traits::ConstraintsType Constraints;
549
550 };
551
553 template<typename GFS, typename DOFIndex>
555 : public GridViewLocalFunctionSpaceBaseNode<GFS,DOFIndex>
556 , public TypeTree::LeafNode
557 {
558 typedef GridViewLocalFunctionSpaceBaseNode<GFS,DOFIndex> BaseT;
559
560 template<typename>
561 friend struct PropagateGlobalStorageVisitor;
562
563 template<typename>
564 friend struct ClearSizeVisitor;
565
566 template<typename,bool>
567 friend struct ComputeSizeVisitor;
568
569 template<typename,bool>
570 friend struct FillIndicesVisitor;
571
572 public:
574
576
577 private:
580 > FESwitch;
581
582 public:
583
585 template<typename Transformation>
586 LeafLocalFunctionSpaceNode (std::shared_ptr<const GFS> gfs, const Transformation& t)
587 : BaseT(gfs)
588 {
589 }
590
591 template<typename Transformation>
592 LeafLocalFunctionSpaceNode (const GFS& gfs, const Transformation& t)
593 : BaseT(stackobject_to_shared_ptr(gfs))
594 {
595 }
596
599 {
600 assert((_in_entity_set && pfe) &&
601 "Local function spaces outside their entity set should not "
602 "request `finiteElement()`. To check if function has support "
603 "use: `size()!= 0`");
604 assert(pfe);
605 return *pfe;
606 }
607
609 const typename Traits::ConstraintsType& constraints () const
610 {
611 return this->pgfs->constraints();
612 }
613
615 template<typename Entity, typename DOFIndexIterator, bool fast>
616 void dofIndices(const Entity& e, DOFIndexIterator it, DOFIndexIterator endit, std::integral_constant<bool,fast>)
617 {
618 using EntitySet = typename GFS::Traits::EntitySet;
619 auto es = this->gridFunctionSpace().entitySet();
620
621 if (not es.contains(e))
622 return;
623 else if (fast) {
624 auto gt = e.type();
625 auto index = es.indexSet().index(e);
626 GFS::Ordering::Traits::DOFIndexAccessor::store(*it, gt, index, 0);
627 ++it;
628 } else {
629 // get layout of entity
630 const typename FESwitch::Coefficients &coeffs =
632
633 auto refEl =
635 this->pfe->type());
636
637 for (std::size_t i = 0; i < std::size_t(coeffs.size()); ++i, ++it) {
638 // get geometry type of subentity
639 auto gt = refEl.type(coeffs.localKey(i).subEntity(),
640 coeffs.localKey(i).codim());
641
642 // evaluate consecutive index of subentity
643 auto index = es.indexSet().subIndex(
644 e, coeffs.localKey(i).subEntity(), coeffs.localKey(i).codim());
645
646 // store data
647 GFS::Ordering::Traits::DOFIndexAccessor::store(
648 *it, gt, index, coeffs.localKey(i).index());
649
650 // make sure we don't write past the end of the iterator range
651 assert(it != endit);
652 }
653 }
654 }
655
656
657 template<typename GC, typename LC>
658 void insert_constraints (const LC& lc, GC& gc) const
659 {
660 // LC and GC are maps of maps
661 typedef typename LC::const_iterator local_col_iterator;
662 typedef typename LC::value_type::second_type::const_iterator local_row_iterator;
663 typedef typename GC::iterator global_col_iterator;
664 typedef typename GC::value_type::second_type global_row_type;
665
666 for (local_col_iterator cit=lc.begin(); cit!=lc.end(); ++cit)
667 {
668
669 // look up entry in global map, if not found, insert an empty one.
670 global_col_iterator gcit = gc.insert(std::make_pair(std::ref(this->dofIndex(cit->first)),global_row_type())).first;
671
672 // copy row to global container with transformed indices
673 for (local_row_iterator rit=(cit->second).begin(); rit!=(cit->second).end(); ++rit)
674 gcit->second[this->dofIndex(rit->first)] = rit->second;
675 }
676 }
677
679 template<bool fast = false>
680 void bind (const typename Traits::Element& e, std::integral_constant<bool,fast> fast_ = std::integral_constant<bool,fast>{})
681 {
682 // call method on base class, this avoid the barton neckman trick
683 BaseT::bind(*this,e,fast_);
684 }
685
695 template<class FE>
696 void bindFiniteElement(FE&& fe) {
697 static_assert(std::is_same_v<std::decay_t<FE>, typename Traits::FiniteElementType>);
698 if constexpr (std::is_rvalue_reference_v<FE&&>) {
699 static_assert(std::is_move_constructible_v<FE>);
700 static_assert(std::is_move_assignable_v<FE>);
701 if (spe)
702 (*spe) = std::move(fe);
703 else
704 spe = std::make_shared<typename Traits::FiniteElementType>(std::move(fe));
705 pfe = spe.get();
706 } else {
707 pfe = &fe;
708 }
709 }
710
712 void unbindFiniteElement() noexcept {
713 pfe = nullptr;
714 }
715
716 private:
717 const typename Traits::FiniteElementType * pfe;
718 std::shared_ptr<typename Traits::FiniteElementType> spe;
719 bool _in_entity_set;
720 };
721
722 // Register LeafGFS -> LocalFunctionSpace transformation
723 template<typename GridFunctionSpace, typename Params>
724 TypeTree::GenericLeafNodeTransformation<
725 GridFunctionSpace,
726 gfs_to_lfs<Params>,
727 LeafLocalFunctionSpaceNode<GridFunctionSpace,typename gfs_to_lfs<Params>::DOFIndex>
728 >
729 registerNodeTransformation(GridFunctionSpace* gfs, gfs_to_lfs<Params>* t, LeafGridFunctionSpaceTag* tag);
730
731 //=======================================
732 // local function facade
733 //=======================================
734
735 template <typename GFS, typename TAG=AnySpaceTag>
736 class LocalFunctionSpace;
737
751 template <typename GFS, typename TAG>
753 public TypeTree::TransformTree<GFS,gfs_to_lfs<GFS> >::Type
754 {
755 typedef typename TypeTree::TransformTree<GFS,gfs_to_lfs<GFS> >::Type BaseT;
756 typedef typename BaseT::Traits::IndexContainer::size_type I;
757 typedef typename BaseT::Traits::IndexContainer::size_type LocalIndex;
758
759 template<typename>
760 friend struct PropagateGlobalStorageVisitor;
761
762 template<typename>
763 friend struct ClearSizeVisitor;
764
765 template<typename>
766 friend struct ComputeSizeVisitor;
767
768 template<typename>
769 friend struct FillIndicesVisitor;
770
771 public:
772 typedef typename BaseT::Traits Traits;
773
774 LocalFunctionSpace(const GFS & gfs)
775 : BaseT(TypeTree::TransformTree<GFS,gfs_to_lfs<GFS> >::transform(gfs))
776 {
777 this->setup(*this);
778 }
779
781 : BaseT(lfs)
782 {
783 // We need to reset the DOFIndex storage pointers in the new LFS tree,
784 // as they are still pointing to the _dof_index_storage of the
785 // old tree.
786 this->_dof_indices = &(this->_dof_index_storage);
787 this->setup(*this);
788 }
789
790 LocalIndex localIndex (typename Traits::IndexContainer::size_type index) const
791 {
792 return LocalIndex(BaseT::localIndex(index));
793 }
794
795 private:
796 // we don't support getChild yet, so let's hide it!
797 template<int i>
798 void getChild () const;
799 template<int i>
800 void child () const;
801 };
802
803 // specialization for AnySpaceTag
804 // WARNING: If you modify this class, make sure to also fix the specialization in
805 // subspacelocalfunctionspace.hh!
806 template <typename GFS>
807 class LocalFunctionSpace<GFS, AnySpaceTag> :
808 public TypeTree::TransformTree<GFS,gfs_to_lfs<GFS> >::Type
809 {
810 typedef typename TypeTree::TransformTree<GFS,gfs_to_lfs<GFS> >::Type BaseT;
811
812 template<typename>
813 friend struct PropagateGlobalStorageVisitor;
814
815 template<typename>
816 friend struct ClearSizeVisitor;
817
818 template<typename,bool>
819 friend struct ComputeSizeVisitor;
820
821 template<typename,bool>
822 friend struct FillIndicesVisitor;
823
824 public:
825
826 LocalFunctionSpace(const GFS & gfs)
827 : BaseT(TypeTree::TransformTree<GFS,gfs_to_lfs<GFS> >::transform(gfs))
828 {
829 this->_dof_indices = &(this->_dof_index_storage);
830 this->setup(*this);
831 }
832
833 LocalFunctionSpace(std::shared_ptr<const GFS> pgfs)
834 : BaseT(*TypeTree::TransformTree<GFS,gfs_to_lfs<GFS> >::transform_storage(pgfs))
835 {
836 this->_dof_indices = &(this->_dof_index_storage);
837 this->setup(*this);
838 }
839
840 LocalFunctionSpace(const LocalFunctionSpace & lfs)
841 : BaseT(lfs)
842 {
843 // We need to reset the DOFIndex storage pointers in the new LFS tree,
844 // as they are still pointing to the _dof_index_storage of the
845 // old tree.
846 this->_dof_indices = &(this->_dof_index_storage);
847 this->setup(*this);
848 }
849
850 };
851
853 } // namespace PDELab
854} // namespace Dune
855
856#endif // DUNE_PDELAB_GRIDFUNCTIONSPACE_LOCALFUNCTIONSPACE_HH
Wrapper class for entities.
Definition: entity.hh:64
single component local function space
Definition: localfunctionspace.hh:557
const Traits::FiniteElementType & finiteElement() const
get finite element
Definition: localfunctionspace.hh:598
void unbindFiniteElement() noexcept
Release view of the bound finite element.
Definition: localfunctionspace.hh:712
void dofIndices(const Entity &e, DOFIndexIterator it, DOFIndexIterator endit, std::integral_constant< bool, fast >)
Calculates the multiindices associated with the given entity.
Definition: localfunctionspace.hh:616
const Traits::ConstraintsType & constraints() const
get constraints engine
Definition: localfunctionspace.hh:609
LeafLocalFunctionSpaceNode(std::shared_ptr< const GFS > gfs, const Transformation &t)
initialize with grid function space
Definition: localfunctionspace.hh:586
void bind(const typename Traits::Element &e, std::integral_constant< bool, fast > fast_=std::integral_constant< bool, fast >{})
bind local function space to entity
Definition: localfunctionspace.hh:680
void bindFiniteElement(FE &&fe)
Binds a finite element to the local space If the finite element is lvalue, the caller (i....
Definition: localfunctionspace.hh:696
Create a local function space from a global function space.
Definition: localfunctionspace.hh:754
Base class for leaf nodes in a dune-typetree.
Definition: leafnode.hh:26
Collect k instances of type T within a dune-typetree.
Definition: powernode.hh:50
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:156
typename std::decay_t< T >::ImplementationTag ImplementationTag
Returns the implementation tag of the given Node.
Definition: nodeinterface.hh:71
void registerNodeTransformation(SourceNode *, Transformation *, Tag *)
Register transformation descriptor to transform SourceNode with Transformation.
constexpr HybridTreePath< T... > treePath(const T &... t)
Constructs a new HybridTreePath from the given indices.
Definition: treepath.hh:188
void applyToTree(Tree &&tree, Visitor &&visitor)
Apply visitor to TypeTree.
Definition: traversal.hh:237
typename impl::_Child< Node, indices... >::type Child
Template alias for the type of a child node given by a list of child indices.
Definition: childextraction.hh:223
ImplementationDefined child(Node &&node, Indices... indices)
Extracts the child of a node given by a sequence of compile-time and run-time indices.
Definition: childextraction.hh:126
Dune namespace.
Definition: alignedallocator.hh:11
std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
Create a shared_ptr for a stack-allocated object.
Definition: shared_ptr.hh:70
This file implements several utilities related to std::shared_ptr.
Standard Dune debug streams.
Switch for uniform treatment of finite element with either the local or the global interface.
Definition: interfaceswitch.hh:28
static const Coefficients & coefficients(const FiniteElement &fe)
access coefficients
Definition: interfaceswitch.hh:43
FiniteElement::Traits::Coefficients Coefficients
export the type of the coefficients
Definition: interfaceswitch.hh:34
static const ReferenceElement & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:196
Definition: localfunctionspacetags.hh:40
traits for local function space on a gridview
Definition: localfunctionspace.hh:303
GFS::Traits::GridViewType GridViewType
Type of the grid view that the underlying grid function space is defined on.
Definition: localfunctionspace.hh:305
GFS::Traits::GridViewType GridView
Type of the grid view that the underlying grid function space is defined on.
Definition: localfunctionspace.hh:308
typename EntitySet::Element Element
Type of codim 0 entity in the grid.
Definition: localfunctionspace.hh:313
Tag denoting a LeafLocalFunctionSpace.
Definition: tags.hh:200
traits for single component local function space
Definition: localfunctionspace.hh:539
GFS::Traits::ConstraintsType ConstraintsType
Type of constraints engine.
Definition: localfunctionspace.hh:546
GFS::Traits::FiniteElementType FiniteElementType
Type of local finite element.
Definition: localfunctionspace.hh:541
traits mapping global function space information to local function space
Definition: localfunctionspace.hh:172
GFS GridFunctionSpace
Type of the underlying grid function space.
Definition: localfunctionspace.hh:177
std::vector< SizeType > IndexContainer
Type of container to store indices.
Definition: localfunctionspace.hh:183
GFS::Traits::SizeType SizeType
Type to store indices from Backend.
Definition: localfunctionspace.hh:180
GFS GridFunctionSpaceType
Type of the underlying grid function space.
Definition: localfunctionspace.hh:174
DI DOFIndex
Type of MultiIndex associated with this LocalFunctionSpace.
Definition: localfunctionspace.hh:186
std::vector< DI > DOFIndexContainer
Type of container to store multiindices.
Definition: localfunctionspace.hh:189
traits for multi component local function space
Definition: localfunctionspace.hh:375
N NodeType
type of local function space node
Definition: localfunctionspace.hh:377
Tag denoting a PowerLocalFunctionSpace.
Definition: tags.hh:194
Transform a TypeTree.
Definition: transformation.hh:94
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)