Loading [MathJax]/extensions/tex2jax.js

DUNE MultiDomainGrid (2.9)

subdomaingrid.hh
1#ifndef DUNE_MULTIDOMAINGRID_SUBDOMAINGRID_HH
2#define DUNE_MULTIDOMAINGRID_SUBDOMAINGRID_HH
3
4#include <memory>
5#include <string>
6
7#include <dune/common/exceptions.hh>
8
9#include <dune/grid/multidomaingrid/hostgridaccessor.hh>
10#include <dune/grid/multidomaingrid/subdomainset.hh>
11
12#include <dune/grid/multidomaingrid/subdomaingrid/geometry.hh>
13#include <dune/grid/multidomaingrid/subdomaingrid/localgeometry.hh>
14#include <dune/grid/multidomaingrid/subdomaingrid/entity.hh>
15#include <dune/grid/multidomaingrid/subdomaingrid/iterator.hh>
16#include <dune/grid/multidomaingrid/subdomaingrid/hierarchiciterator.hh>
17#include <dune/grid/multidomaingrid/subdomaingrid/intersection.hh>
18#include <dune/grid/multidomaingrid/subdomaingrid/intersectioniterator.hh>
19#include <dune/grid/multidomaingrid/subdomaingrid/idsets.hh>
20#include <dune/grid/multidomaingrid/subdomaingrid/indexsets.hh>
21#include <dune/grid/multidomaingrid/subdomaingrid/gridview.hh>
22
23
24namespace Dune {
25
26namespace mdgrid {
27
28
29// forward declaration in correct namespace
30template<typename,typename>
31class MultiDomainGrid;
32
33namespace subdomain {
34
35template<typename MDGrid>
36class SubDomainGrid;
37
38template<typename MDGrid>
39struct SubDomainGridFamily {
40
41private:
42
43 static const int dim = MDGrid::dimension;
44 static const int dimw = MDGrid::dimensionworld;
45
46public:
47
48 struct Traits
49 {
51 using Grid = SubDomainGrid<MDGrid>;
52
53
54 using LeafIntersection = Dune::Intersection<
55 const Grid,
56 IntersectionWrapper<
57 const Grid,
58 IndexSetWrapper<
59 const Grid,
60 typename MDGrid::LeafIndexSetImp
61 >,
62 typename MDGrid::LeafGridView::Intersection
63 >
64 >;
65
66 using LevelIntersection = Dune::Intersection<
67 const Grid,
68 IntersectionWrapper<
69 const Grid,
70 IndexSetWrapper<
71 const Grid,
72 typename MDGrid::LevelIndexSetImp
73 >,
74 typename MDGrid::LevelGridView::Intersection
75 >
76 >;
77
78 using LeafIntersectionIterator = Dune::IntersectionIterator<
79 const Grid,
80 IntersectionIteratorWrapper<
81 const Grid,
82 IndexSetWrapper<
83 const Grid,
84 typename MDGrid::LeafIndexSetImp
85 >,
86 typename MDGrid::LeafGridView::IntersectionIterator
87 >,
88 IntersectionWrapper<
89 const Grid,
90 IndexSetWrapper<
91 const Grid,
92 typename MDGrid::LeafIndexSetImp
93 >,
94 typename MDGrid::LeafGridView::Intersection
95 >
96 >;
97
98 using LevelIntersectionIterator = Dune::IntersectionIterator<
99 const Grid,
100 IntersectionIteratorWrapper<
101 const Grid,
102 IndexSetWrapper<
103 const Grid,
104 typename MDGrid::LevelIndexSetImp
105 >,
106 typename MDGrid::LevelGridView::IntersectionIterator
107 >,
108 IntersectionWrapper<
109 const Grid,
110 IndexSetWrapper<
111 const Grid,
112 typename MDGrid::LevelIndexSetImp
113 >,
114 typename MDGrid::LevelGridView::Intersection
115 >
116 >;
117
118 using HierarchicIterator = Dune::EntityIterator< 0, const Grid, HierarchicIteratorWrapper< const Grid > >;
119
120 using LevelGridView = Dune::GridView<LevelGridViewTraits<const Grid>>;
121 using LeafGridView = Dune::GridView<LeafGridViewTraits<const Grid>>;
122
123 template <int cd>
124 struct Codim
125 {
126
127 using Geometry = Dune::Geometry<dim-cd, dimw, const Grid, GeometryWrapper>;
128 using LocalGeometry = Dune::Geometry<dim-cd, dim, const Grid, LocalGeometryWrapper>;
129
130 using Entity = Dune::Entity<cd, dim, const Grid, EntityWrapper>;
131
132 using EntitySeed = EntitySeedWrapper<typename MDGrid::HostGrid::template Codim<cd>::EntitySeed>;
133
134 template <PartitionIteratorType pitype>
135 struct Partition
136 {
137
138 using LevelIterator = Dune::EntityIterator<
139 cd,
140 const Grid,
141 IteratorWrapper<
142 typename Traits::LevelGridView,
143 typename MDGrid::LevelGridView::template Codim<cd>::template Partition<pitype>::Iterator,
144 cd,
145 pitype,
146 const Grid
147 >
148 >;
149
150 using LeafIterator = Dune::EntityIterator<
151 cd,
152 const Grid,
153 IteratorWrapper<
154 typename Traits::LeafGridView,
155 typename MDGrid::LeafGridView::template Codim<cd>::template Partition<pitype>::Iterator,
156 cd,
157 pitype,
158 const Grid
159 >
160 >;
161 };
162
163 using LeafIterator = typename Partition< All_Partition >::LeafIterator;
164 using LevelIterator = typename Partition< All_Partition >::LevelIterator;
165
166 private:
167 friend class Dune::Entity<cd, dim, const Grid, EntityWrapper>;
168
169 };
170
171 using LevelIndexSet = IndexSetWrapper<const Grid, typename MDGrid::LevelIndexSetImp>;
172 using LeafIndexSet = IndexSetWrapper<const Grid, typename MDGrid::LeafIndexSetImp>;
173
174 using GlobalIdSet = IdSet<
175 const Grid,
176 IdSetWrapper<
177 const Grid,
178 typename MDGrid::HostGrid::Traits::GlobalIdSet
179 >,
180 typename MDGrid::HostGrid::Traits::GlobalIdSet::IdType
181 >;
182
183 using LocalIdSet = IdSet<
184 const Grid,
185 IdSetWrapper<
186 const Grid,
187 typename MDGrid::HostGrid::Traits::LocalIdSet
188 >,
189 typename MDGrid::HostGrid::Traits::LocalIdSet::IdType
190 >;
191
192 using CollectiveCommunication
193 [[deprecated("Use Communication. Will be removed after release 2.9")]]
194 = typename MDGrid::CollectiveCommunication;
195
196 using Communication = typename MDGrid::Communication;
197 };
198
199};
200
201
202template<typename MDGrid>
203class SubDomainGrid :
204 public GridDefaultImplementation<MDGrid::dimension,
205 MDGrid::dimensionworld,
206 typename MDGrid::ctype,
207 SubDomainGridFamily<MDGrid> > {
208
209 template<typename,typename>
210 friend class ::Dune::mdgrid::MultiDomainGrid;
211
212 template<int codim, int dim, typename GridImp>
213 friend class EntityWrapperBase;
214
215 template<int codim, int dim, typename GridImp>
216 friend class EntityWrapper;
217
218 template<typename, typename, int codim, PartitionIteratorType pitype, typename GridImp>
219 friend class IteratorWrapper;
220
221 template<typename GridImp>
222 friend class HierarchicIteratorWrapper;
223
224 template<int mydim, int coorddim, typename GridImp>
225 friend class GeometryWrapper;
226
227 template<int mydim, int coorddim, typename GridImp>
228 friend class LocalGeometryWrapper;
229
230 template<typename GridImp, typename WrappedIndexSet>
231 friend class IndexSetWrapper;
232
233 template<typename GridImp, typename WrappedIdSet>
234 friend class IdSetWrapper;
235
236 template<typename GridImp>
237 friend struct ::Dune::mdgrid::detail::HostGridAccessor;
238
239 template<typename,typename,typename>
240 friend class IntersectionIteratorWrapper;
241
242 template<typename,typename,typename>
243 friend class IntersectionWrapper;
244
245 template<typename>
246 friend class LevelGridView;
247
248 template<typename>
249 friend class LeafGridView;
250
251 typedef GridDefaultImplementation<MDGrid::dimension,
252 MDGrid::dimensionworld,
253 typename MDGrid::ctype,
254 SubDomainGridFamily<MDGrid>
255 > BaseT;
256
257 using GridImp = SubDomainGrid<MDGrid>;
258
259public:
260
261 using MultiDomainGrid = MDGrid;
262
263 using HostGrid = typename MDGrid::HostGrid;
264
265private:
266
267 typedef IndexSetWrapper<const SubDomainGrid<MDGrid>, typename MDGrid::LevelIndexSetImp> LevelIndexSetImp;
268
269 typedef IndexSetWrapper<const SubDomainGrid<MDGrid>, typename MDGrid::LeafIndexSetImp> LeafIndexSetImp;
270
271 typedef IdSetWrapper<const SubDomainGrid<MDGrid>, typename HostGrid::Traits::GlobalIdSet> GlobalIdSetImp;
272
273 typedef IdSetWrapper<const SubDomainGrid<MDGrid>, typename HostGrid::Traits::LocalIdSet> LocalIdSetImp;
274
275public:
276
277 typedef SubDomainGridFamily<MDGrid> GridFamily;
278 typedef typename GridFamily::Traits Traits;
279
281 typedef typename MDGrid::ctype ctype;
282
284 typedef typename MDGrid::SubDomainIndex SubDomainIndex;
285
286 enum IntersectionType { neighbor, foreign, boundary, processor };
287
288 using BaseT::dimension;
289 using BaseT::dimensionworld;
290
293
294 template<typename EntitySeed>
295 typename Traits::template Codim<EntitySeed::codimension>::Entity
296 entity(const EntitySeed& entitySeed) const
297 {
298 return
299 EntityWrapper<EntitySeed::codimension,dimension,const GridImp>(
300 this,
301 typename MDGrid::template Codim<EntitySeed::codimension>::Entity(
302 _grid.entity(entitySeed)
303 )
304 );
305 }
306
307 int maxLevel() const {
308 return _grid.maxLevel();
309 }
310
311 template<int codim>
312 typename Traits::template Codim<codim>::LevelIterator lbegin(int level) const {
313 return IteratorWrapper<
314 typename Traits::LevelGridView,
315 typename MultiDomainGrid::LevelGridView::template Codim<codim>::template Partition<All_Partition>::Iterator,
316 codim,
317 All_Partition,
318 const GridImp>(
319 this,
320 &this->levelGridView(level).indexSet(),
321 _grid.levelGridView(level).template begin<codim>(),
322 _grid.levelGridView(level).template end<codim>()
323 );
324 }
325
326 template<int codim>
327 typename Traits::template Codim<codim>::LevelIterator lend(int level) const {
328 return IteratorWrapper<
329 typename Traits::LevelGridView,
330 typename MultiDomainGrid::LevelGridView::template Codim<codim>::template Partition<All_Partition>::Iterator,
331 codim,
332 All_Partition,
333 const GridImp>(
334 this,
335 &this->levelGridView(level).indexSet(),
336 _grid.levelGridView(level).template end<codim>(),
337 _grid.levelGridView(level).template end<codim>()
338 );
339 }
340
341 template<int codim, PartitionIteratorType pitype>
342 typename Traits::template Codim<codim>::template Partition<pitype>::LevelIterator lbegin(int level) const {
343 return IteratorWrapper<
344 typename Traits::LevelGridView,
345 typename MultiDomainGrid::LevelGridView::template Codim<codim>::template Partition<pitype>::Iterator,
346 codim,
347 pitype,
348 const GridImp>(
349 this,
350 &this->levelGridView(level).indexSet(),
351 _grid.levelGridView(level).template begin<codim,pitype>(),
352 _grid.levelGridView(level).template end<codim,pitype>()
353 );
354 }
355
356 template<int codim, PartitionIteratorType pitype>
357 typename Traits::template Codim<codim>::template Partition<pitype>::LevelIterator lend(int level) const {
358 return IteratorWrapper<
359 typename Traits::LevelGridView,
360 typename MultiDomainGrid::LevelGridView::template Codim<codim>::template Partition<pitype>::Iterator,
361 codim,
362 pitype,
363 const GridImp>(
364 this,
365 &this->levelGridView(level).indexSet(),
366 _grid.levelGridView(level).template end<codim,pitype>(),
367 _grid.levelGridView(level).template end<codim,pitype>()
368 );
369 }
370
371 template<int codim>
372 typename Traits::template Codim<codim>::LeafIterator leafbegin() const {
373 return IteratorWrapper<
374 typename Traits::LeafGridView,
375 typename MultiDomainGrid::LeafGridView::template Codim<codim>::template Partition<All_Partition>::Iterator,
376 codim,
377 All_Partition,
378 const GridImp>(
379 this,
380 &this->leafGridView().indexSet(),
381 _grid.leafGridView().template begin<codim>(),
382 _grid.leafGridView().template end<codim>()
383 );
384 }
385
386 template<int codim>
387 typename Traits::template Codim<codim>::LeafIterator leafend() const {
388 return IteratorWrapper<
389 typename Traits::LeafGridView,
390 typename MultiDomainGrid::LeafGridView::template Codim<codim>::template Partition<All_Partition>::Iterator,
391 codim,
392 All_Partition,
393 const GridImp>(
394 this,
395 &this->leafGridView().indexSet(),
396 _grid.leafGridView().template end<codim>(),
397 _grid.leafGridView().template end<codim>()
398 );
399 }
400
401 template<int codim, PartitionIteratorType pitype>
402 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator leafbegin() const {
403 return IteratorWrapper<
404 typename Traits::LeafGridView,
405 typename MultiDomainGrid::LeafGridView::template Codim<codim>::template Partition<pitype>::Iterator,
406 codim,
407 pitype,
408 const GridImp>(
409 this,
410 &this->leafGridView().indexSet(),
411 _grid.leafGridView().template begin<codim,pitype>(),
412 _grid.leafGridView().template end<codim,pitype>()
413 );
414 }
415
416 template<int codim, PartitionIteratorType pitype>
417 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator leafend() const {
418 return IteratorWrapper<
419 typename Traits::LeafGridView,
420 typename MultiDomainGrid::LeafGridView::template Codim<codim>::template Partition<pitype>::Iterator,
421 codim,
422 pitype,
423 const GridImp>(
424 this,
425 &this->leafGridView().indexSet(),
426 _grid.leafGridView().template end<codim,pitype>(),
427 _grid.leafGridView().template end<codim,pitype>()
428 );
429 }
430
431 int size(int level, int codim) const {
432 assert(level <= maxLevel());
433 return _levelIndexSets[level]->size(codim);
434 }
435
436 int size(int codim) const {
437 return _leafIndexSet.size(codim);
438 }
439
440 int size(int level, GeometryType type) const {
441 assert(level <= maxLevel());
442 return _levelIndexSets[level]->size(type);
443 }
444
445 int size(GeometryType type) const {
446 // TODO: check this (perhaps return sum over levelindexsets?)
447 return _leafIndexSet.size(type);
448 }
449
450 const typename Traits::GlobalIdSet& globalIdSet() const {
451 return _globalIdSet;
452 }
453
454 const typename Traits::LocalIdSet& localIdSet() const {
455 return _localIdSet;
456 }
457
458 const typename Traits::LevelIndexSet& levelIndexSet(int level) const {
459 if (!_grid.supportLevelIndexSets()) {
460 DUNE_THROW(GridError,"level index set support not enabled for this grid");
461 }
462 assert(level <= maxLevel());
463 assert(_levelIndexSets[level]);
464 return *_levelIndexSets[level];
465 }
466
467 const typename Traits::LeafIndexSet& leafIndexSet() const {
468 return _leafIndexSet;
469 }
470
472
478 void globalRefine(int refCount) {
479 DUNE_THROW(NotImplemented,"grid modification only allowed on the MultiDomainGrid");
480 }
481
483
493 bool mark(int refCount, const typename Traits::template Codim<0>::Entity& e) {
494 return _grid.mark(refCount,multiDomainEntity(e));
495 }
496
498
505 int getMark(const typename Traits::template Codim<0>::Entity& e) {
506 return _grid.getMark(multiDomainEntity(e));
507 }
508
510
516 bool preAdapt() {
517 DUNE_THROW(NotImplemented,"grid modification only allowed on the MultiDomainGrid");
518 }
519
521
527 bool adapt() {
528 DUNE_THROW(NotImplemented,"grid modification only allowed on the MultiDomainGrid");
529 }
530
532
538 void postAdapt() {
539 DUNE_THROW(NotImplemented,"grid modification only allowed on the MultiDomainGrid");
540 }
541
542 int overlapSize(int level, int codim) const {
543 return _grid.overlapSize(level,codim);
544 }
545
546 int overlapSize(int codim) const {
547 return _grid.overlapSize(codim);
548 }
549
550 int ghostSize(int level, int codim) const {
551 return _grid.ghostSize(level,codim);
552 }
553
554 int ghostSize(int codim) const {
555 return _grid.ghostSize(codim);
556 }
557
558 const typename Traits::Communication& comm() const {
559 return _grid.comm();
560 }
561
562 template<typename DataHandleImp, typename DataTypeImp>
563 void communicate (CommDataHandleIF<DataHandleImp,DataTypeImp> &data,
564 InterfaceType iftype,
565 CommunicationDirection dir,
566 int level) const
567 {
568 DataHandleWrapper<CommDataHandleIF<DataHandleImp,DataTypeImp> > datahandle(data,*this);
569 _grid._hostGrid.levelGridView(level).communicate(datahandle,iftype,dir);
570 }
571
572 template<typename DataHandleImp, typename DataTypeImp>
573 void communicate (CommDataHandleIF<DataHandleImp,DataTypeImp> &data,
574 InterfaceType iftype,
575 CommunicationDirection dir) const
576 {
577 DataHandleWrapper<CommDataHandleIF<DataHandleImp,DataTypeImp> > datahandle(data,*this);
578 _grid._hostGrid.leafGridView().communicate(datahandle,iftype,dir);
579 }
580
581 size_t numBoundarySegments() const
582 {
583 return _grid.numBoundarySegments();
584 }
585
589 const MDGrid& multiDomainGrid() const {
590 return _grid;
591 }
592
594 SubDomainIndex domain() const {
595 return _subDomain;
596 }
597
598 void update() {
599 if (_grid.supportLevelIndexSets()) {
600 while (_levelIndexSets.size() <= static_cast<std::size_t>(maxLevel())) {
601 _levelIndexSets.push_back(std::make_shared<LevelIndexSetImp>(*this,_grid.levelIndexSet(_levelIndexSets.size())));
602 }
603 }
604 }
605
606 bool operator==(const SubDomainGrid& rhs) const {
607 return (&_grid == &rhs._grid && _subDomain == rhs._subDomain);
608 }
609
612
613 template <
614 class EntityType,
615 std::enable_if_t<std::is_same_v<typename MDGrid::Traits::template Codim<EntityType::codimension>::Entity,EntityType>, int> = 0>
616 typename Traits::template Codim<EntityType::codimension>::Entity subDomainEntity(const EntityType& mdEntity) const {
617 return EntityWrapper<EntityType::codimension,dimension,const GridImp>(this,mdEntity);
618 }
619
621 template <
622 class EntityType,
623 std::enable_if_t<std::is_same_v<typename MDGrid::Traits::template Codim<EntityType::codimension>::Entity,EntityType>, int> = 0>
624 static const EntityType&
625 multiDomainEntity(const EntityType &e) {
626 return e;
627 }
628
629 template <
630 class EntityType,
631 std::enable_if_t<!std::is_same_v<typename MDGrid::Traits::template Codim<EntityType::codimension>::Entity,EntityType>,int> = 0>
632 static const typename MDGrid::Traits::template Codim<EntityType::codimension>::Entity &
633 multiDomainEntity(const EntityType &e) {
634 return e.impl().multiDomainEntity();
635 }
636
637 template<typename EntityType>
638 static const typename MDGrid::template HostEntity<EntityType>::type& hostEntity(const EntityType& e) {
639 return e.impl().hostEntity();
640 }
641
642 static const auto& multiDomainIntersection(const typename Traits::LeafIntersection& is) {
643 return is.impl().multiDomainIntersection();
644 }
645
646 static const auto& multiDomainIntersection(const typename Traits::LevelIntersection& is) {
647 return is.impl().multiDomainIntersection();
648 }
649
652 typename Traits::LeafIntersectionIterator subDomainIntersectionIterator(const typename MDGrid::LeafSubDomainInterfaceIterator it) const {
653 assert(_subDomain == it->subDomain1() || _subDomain == it->subDomain2());
654 if (_subDomain == it->subDomain1())
655 return IntersectionIteratorWrapper<
656 const GridImp,
657 typename GridImp::LeafGridView::IndexSet,
658 typename MDGrid::LeafGridView::IntersectionIterator
659 >(
660 &this->leafGridView().indexSet(),
661 it->firstMultiDomainIntersectionIterator()
662 );
663 else
664 return IntersectionIteratorWrapper<
665 const GridImp,
666 typename GridImp::LeafGridView::IndexSet,
667 typename MDGrid::LeafGridView::IntersectionIterator
668 >(
669 &this->leafGridView().indexSet(),
670 it->secondMultiDomainIntersectionIterator()
671 );
672 }
673
674 typename Traits::LevelIntersectionIterator subDomainIntersectionIterator(const typename MDGrid::LevelSubDomainInterfaceIterator it) const {
675 assert(_subDomain == it->subDomain1() || _subDomain == it->subDomain2());
676 if (_subDomain == it->subDomain1())
677 return IntersectionIteratorWrapper<
678 const GridImp,
679 typename GridImp::LevelGridView::IndexSet,
680 typename MDGrid::LevelGridView::IntersectionIterator
681 >(
682 &this->levelGridView(it->firstMultiDomainIntersectionIterator()->inside().level()).indexSet(),
683 it->firstMultiDomainIntersectionIterator()
684 );
685 else
686 return IntersectionIteratorWrapper<
687 const GridImp,
688 typename GridImp::LevelGridView::IndexSet,
689 typename MDGrid::LevelGridView::IntersectionIterator
690 >(
691 &this->levelGridView(it->secondMultiDomainIntersectionIterator()->inside().level()).indexSet(),
692 it->secondMultiDomainIntersectionIterator()
693 );
694 }
695
696 template<typename Intersection>
697 IntersectionType intersectionType(const Intersection& intersection) const {
698 return intersection.impl().intersectionType();
699 }
700
701private:
702
703 MDGrid& _grid;
704 SubDomainIndex _subDomain;
705 GlobalIdSetImp _globalIdSet;
706 LocalIdSetImp _localIdSet;
707 LeafIndexSetImp _leafIndexSet;
708 std::vector<std::shared_ptr<LevelIndexSetImp> > _levelIndexSets;
709
710 SubDomainGrid(MDGrid& grid, SubDomainIndex subDomain) :
711 _grid(grid),
712 _subDomain(subDomain),
713 _globalIdSet(*this,grid._hostGrid.globalIdSet()),
714 _localIdSet(*this,grid._hostGrid.localIdSet()),
715 _leafIndexSet(*this,grid.leafIndexSet())
716 {
717 update();
718 }
719
720 template<typename EntityType>
721 bool containsMultiDomainEntity(const EntityType& e) const {
722 if (_grid.supportLevelIndexSets())
723 return levelIndexSet(e.level()).containsMultiDomainEntity(e);
724 else
725 return leafIndexSet().containsMultiDomainEntity(e);
726 }
727
728 template<typename EntityType>
729 bool containsHostEntity(const EntityType& e) const {
730 if (_grid.supportLevelIndexSets())
731 return levelIndexSet(e.level()).containsHostEntity(e);
732 else
733 return leafIndexSet().containsHostEntity(e);
734 }
735
736 SubDomainGrid(const SubDomainGrid& rv);
737 SubDomainGrid& operator=(const SubDomainGrid& rv);
738
739
740 template<typename Impl>
741 struct DataHandleWrapper
742 : public Dune::CommDataHandleIF<DataHandleWrapper<Impl>,
743 typename Impl::DataType
744 >
745 {
746
747 bool contains(int dim, int codim) const
748 {
749 return _impl.contains(dim,codim); // TODO: check if codim supported
750 }
751
752 bool fixedSize(int dim, int codim) const
753 {
754 //_impl.fixedSize(dim,codim); // TODO: warning if true?
755 return false;
756 }
757
758 template<typename Entity>
759 std::size_t size(const Entity& e) const
760 {
761 if (_grid.containsHostEntity(e))
762 return _impl.size(_grid.subDomainEntity(_grid._grid.wrapHostEntity(e)));
763 else
764 return 0;
765 }
766
767 template<typename MessageBufferImp, typename Entity>
768 void gather(MessageBufferImp& buf, const Entity& e) const
769 {
770 if (_grid.containsHostEntity(e))
771 _impl.gather(buf,_grid.subDomainEntity(_grid._grid.wrapHostEntity(e)));
772 }
773
774 template<typename MessageBufferImp, typename Entity>
775 void scatter(MessageBufferImp& buf, const Entity& e, std::size_t n)
776 {
777 if (_grid.containsHostEntity(e))
778 _impl.scatter(buf,_grid.subDomainEntity(_grid._grid.wrapHostEntity(e)),n);
779 }
780
781 DataHandleWrapper(Impl& impl, const SubDomainGrid<MDGrid>& grid)
782 : _impl(impl)
783 , _grid(grid)
784 {}
785
786 Impl& _impl;
787 const SubDomainGrid<MDGrid>& _grid;
788
789 };
790
791};
792
793} // namespace subdomain
794
795} // namespace mdgrid
796
797} // namespace Dune
798
799#endif // DUNE_MULTIDOMAINGRID_MULTIDOMAINGRID_HH
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Apr 13, 22:42, 2025)