dune-grid 3.0-git
yaspgridentity.hh
Go to the documentation of this file.
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_GRID_YASPGRIDENTITY_HH
4#define DUNE_GRID_YASPGRIDENTITY_HH
5
19//========================================================================
20
21
22
23
24namespace Dune {
25
26 namespace Yasp {
27
28#ifndef DOXYGEN
29
30 // table for quick evaluation of binomial coefficients
31 template<int n>
32 struct BinomialTable
33 {
34 static void init()
35 {
36 if (_initialized)
37 return;
38 int offset = 0;
39 for (int d = 0; d <= n; ++d)
40 {
41 _offsets[d] = offset;
42 for (int c = 0; c <= d; ++c, ++offset)
43 _values[offset] = binomial(d,c);
44 }
45 _initialized = true;
46 }
47
48 // evaluation - note that in general d!=n, n is only the
49 // maximum value of d (in our case dimworld)
50 static int evaluate(int d, int c)
51 {
52 return _values[_offsets[d] + c];
53 }
54
55 private:
56 // prevent construction
57 BinomialTable();
58
59 static bool _initialized;
60 static std::array<int,(n+1)*(n+2)/2> _values;
61 static std::array<int,n+1> _offsets;
62
63 public:
64
65 // the actual implementation
66 static int binomial(int d, int c)
67 {
68 long binomial=1;
69 for (int i=d-c+1; i<=d; i++)
70 binomial *= i;
71 for (long i=2; i<=c; i++)
72 binomial /= i;
73 return binomial;
74 }
75 };
76
77 template<int n>
78 bool BinomialTable<n>::_initialized = false;
79 template<int n>
80 std::array<int,(n+1)*(n+2)/2> BinomialTable<n>::_values;
81 template<int n>
82 std::array<int,n+1> BinomialTable<n>::_offsets;
83
90 template<int dimworld>
91 int subEnt(int d, int c)
92 {
93 return (d < c ? 0 : BinomialTable<dimworld>::evaluate(d,c) << c);
94 }
95
96 // Make a table mapping all subentities of a codim 0 entity to a value.
97 // F is the functor to be evaluated.
98 template<typename F, int dim>
99 struct EntityShiftTable
100 {
101
102 typedef std::bitset<dim> value_type;
103
104 static void init()
105 {
106 if (_initialized)
107 return;
108 F f;
109 int offset = 0;
110 for (int codim = 0; codim <= dim; ++codim)
111 {
112 _offsets[codim] = offset;
113 for (int i = 0; i < subEnt<dim>(dim,codim); ++i, ++offset)
114 _values[offset] = static_cast<unsigned char>(f(i,codim).to_ulong());
115 }
116 _initialized = true;
117 }
118
119 static value_type evaluate(int i, int codim)
120 {
121 return {_values[_offsets[codim] + i]};
122 }
123
124 private:
125
126 // prevent construction
127 EntityShiftTable();
128
129 static bool _initialized;
130 static std::array<int,dim+1> _offsets;
131 static std::array<unsigned char,StaticPower<3,dim>::power> _values;
132
133 };
134
135 template<typename F, int dim>
136 bool EntityShiftTable<F,dim>::_initialized = false;
137 template<typename F, int dim>
138 std::array<int,dim+1> EntityShiftTable<F,dim>::_offsets;
139 template<typename F, int dim>
140 std::array<unsigned char,StaticPower<3,dim>::power> EntityShiftTable<F,dim>::_values;
141
142 // functor for doing the actual entity shift calculation
143 template<int dim>
144 struct calculate_entity_shift
145 {
146 calculate_entity_shift()
147 {
148 BinomialTable<dim>::init();
149 }
150
151 std::bitset<dim> operator()(int index, int cc) const
152 {
153 std::bitset<dim> result(0ull);
154 for (int d = dim; d>0; d--)
155 {
156 if (cc == d)
157 return result;
158 if (index < subEnt<dim>(d-1,cc))
159 result[d-1]=true;
160 else
161 {
162 index = (index - subEnt<dim>(d-1, cc)) % subEnt<dim>(d-1,cc-1);
163 cc--;
164 }
165 }
166 return result;
167 }
168 };
169
178 template<int dim>
179 std::bitset<dim> entityShift(int index, int cc)
180 {
181 return EntityShiftTable<calculate_entity_shift<dim>,dim>::evaluate(index,cc);
182 }
183
184 // functor for doing the actual entity move calculation
185 template<int dim>
186 struct calculate_entity_move
187 {
188
189 calculate_entity_move()
190 {
191 BinomialTable<dim>::init();
192 }
193
194 std::bitset<dim> operator()(int index, int cc) const
195 {
196 std::bitset<dim> result(0ull);
197 for (int d = dim; d>0; d--)
198 {
199 if (d == cc)
200 {
201 result[d-1] = index & (1<<(d-1));
202 index &= ~(1<<(d-1));
203 }
204 if (index >= subEnt<dim>(d-1,cc))
205 {
206 if ((index - subEnt<dim>(d-1,cc)) / subEnt<dim>(d-1,cc-1) == 1)
207 {
208 result[d-1] = true;
209 }
210 index = (index - subEnt<dim>(d-1, cc)) % subEnt<dim>(d-1,cc-1);
211 cc--;
212 }
213 }
214 return result;
215 }
216
217 };
218
226 template<int dim>
227 std::bitset<dim> entityMove(int index, int cc)
228 {
229 return EntityShiftTable<calculate_entity_move<dim>,dim>::evaluate(index,cc);
230 }
231
232#endif //DOXYGEN
233
234 } // namespace Yasp.
235
236 template<int codim, int dim, class GridImp>
238 : public EntityDefaultImplementation <codim,dim,GridImp,YaspEntity>
239 {
240
241 template<int, PartitionIteratorType, typename>
242 friend class YaspLevelIterator;
243
244 public:
245 typedef typename GridImp::ctype ctype;
246
247 typedef typename GridImp::template Codim<codim>::Geometry Geometry;
248 typedef typename GridImp::Traits::template Codim<codim>::GeometryImpl GeometryImpl;
249
250 typedef typename GridImp::template Codim<codim>::EntitySeed EntitySeed;
251
253 int level () const
254 {
255 return _g->level();
256 }
257
262 {
263 return EntitySeed(YaspEntitySeed<codim,GridImp>(_g->level(), _it.coord(), _it.which()));
264 }
265
268 {
269 GeometryImpl _geometry(_it.lowerleft(),_it.upperright(),_it.shift());
270 return Geometry(_geometry);
271 }
272
275 {
276 if (_g->interior[codim].inside(_it.coord(),_it.shift()))
277 return InteriorEntity;
278 if (_g->interiorborder[codim].inside(_it.coord(),_it.shift()))
279 return BorderEntity;
280 if (_g->overlap[codim].inside(_it.coord(),_it.shift()))
281 return OverlapEntity;
282 if (_g->overlapfront[codim].inside(_it.coord(),_it.shift()))
283 return FrontEntity;
284 return GhostEntity;
285 }
286
287 typedef typename GridImp::YGridLevelIterator YGLI;
288 typedef typename GridImp::YGrid::Iterator I;
290 {}
291
292 YaspEntity (const YGLI& g, const I& it)
293 : _it(it), _g(g)
294 {}
295
296// skip this constructor for GCC 4.4, which has a number of nasty bugs in its rvalue reference support
297// As this behavior is hard to trigger in small configuration tests and because we'll probably drop GCC 4.4
298// after the next release anyway, I hacked in this hardcoded check for the compiler version
299#if not (defined(__GNUC__) && (__GNUC__ < 5) && (__GNUC_MINOR__ < 5))
300
301 YaspEntity (YGLI&& g, const I&& it)
302 : _it(std::move(it)), _g(std::move(g))
303 {}
304
305#endif
306
308 bool equals (const YaspEntity& e) const
309 {
310 return _it == e._it && _g == e._g;
311 }
312
313 // IndexSets needs access to the private index methods
314 friend class Dune::YaspIndexSet<GridImp,true>;
315 friend class Dune::YaspIndexSet<GridImp,false>;
316 friend class Dune::YaspGlobalIdSet<GridImp>;
317 typedef typename GridImp::PersistentIndexType PersistentIndexType;
318
321 {
322 // get size of global grid (in elements)
323 std::array<int,dim> size;
324
325 for (int i=0; i<dim; i++)
326 {
327 // correct size according to shift
328 size[i] = _g->mg->levelSize(_g->level(), i);
329 if (!_it.shift(i))
330 size[i]++;
331 }
332
333 // encode codim
334 PersistentIndexType id(_it.shift().to_ulong());
335
336 // encode level
337 id = id << yaspgrid_level_bits;
338 id = id+PersistentIndexType(_g->level());
339
340 // encode coordinates
341 for (int i=dim-1; i>=0; i--)
342 {
343 id = id << yaspgrid_dim_bits;
344 id = id+PersistentIndexType(_it.coord(i));
345 }
346
347 return id;
348 }
349
351 int compressedIndex () const
352 {
353 return _it.superindex();
354 }
355
357 int subCompressedIndex (int i, unsigned int cc) const
358 {
359 // get the shift of the entity and the subentity
360 // the subentity shift is only available in the space spanned by the entity
361 std::bitset<dim> ent_shift = _it.shift();
362 std::bitset<dim-codim> subent_shift = Dune::Yasp::entityShift<dim-codim>(i,cc);
363 std::bitset<dim-codim> subent_move = Dune::Yasp::entityMove<dim-codim>(i,cc);
364 // combine the shifts to get the global shift of the subentity
365 std::bitset<dim> shift,move;
366 for (int curDim=0,j=0; curDim < dim; curDim++)
367 if (ent_shift[curDim])
368 {
369 shift[curDim] = subent_shift[j];
370 move[curDim] = subent_move[j];
371 j++;
372 }
373
374 std::array<int, dim> size = _g->mg->levelSize(_g->level());
375 std::array<int, dim> coord = _it.coord();
376 for (int j=0; j<dim; j++)
377 {
378 if (!shift[j])
379 size[j]++;
380 if (move[j])
381 coord[j]++;
382 }
383
384 int which = _g->overlapfront[cc].shiftmapping(shift);
385 return _g->overlapfront[cc].superindex(coord,which);
386 }
387 public:
388 const I& transformingsubiterator() const { return _it; }
389 const YGLI& gridlevel() const { return _g; }
391 YGLI& gridlevel() { return _g; }
392 const GridImp * yaspgrid() const { return _g->mg; }
393 protected:
394 I _it; // position in the grid level
395 YGLI _g; // access to grid level
396 };
397
398
399 // specialization for codim=0
400 template<int dim, class GridImp>
401 class YaspEntity<0,dim,GridImp>
402 : public EntityDefaultImplementation <0,dim,GridImp,YaspEntity>
403 {
404 enum { dimworld = GridImp::dimensionworld };
405
406 typedef typename GridImp::Traits::template Codim< 0 >::GeometryImpl GeometryImpl;
407
408 template<int, PartitionIteratorType, typename>
409 friend class YaspLevelIterator;
410
411 template<typename>
413
414 public:
415 typedef typename GridImp::ctype ctype;
416
417 typedef typename GridImp::YGridLevelIterator YGLI;
418 typedef typename GridImp::YGrid::Iterator I;
419
420 typedef typename GridImp::template Codim< 0 >::Geometry Geometry;
421 typedef typename GridImp::template Codim< 0 >::LocalGeometry LocalGeometry;
422
423 template <int cd>
424 struct Codim
425 {
426 typedef typename GridImp::template Codim<cd>::Entity Entity;
427 };
428
429 typedef typename GridImp::template Codim<0>::Entity Entity;
430 typedef typename GridImp::template Codim<0>::EntitySeed EntitySeed;
431 typedef typename GridImp::LevelIntersectionIterator IntersectionIterator;
432 typedef typename GridImp::LevelIntersectionIterator LevelIntersectionIterator;
433 typedef typename GridImp::LeafIntersectionIterator LeafIntersectionIterator;
434 typedef typename GridImp::HierarchicIterator HierarchicIterator;
435
437 typedef typename GridImp::PersistentIndexType PersistentIndexType;
438
440 typedef typename GridImp::YGrid::iTupel iTupel;
441
442 // constructor
444 {}
445
446 YaspEntity (const YGLI& g, const I& it)
447 : _it(it), _g(g)
448 {}
449
450 YaspEntity (const YGLI& g, I&& it)
451 : _it(std::move(it)), _g(g)
452 {}
453
454// skip this constructor for GCC 4.4, which has a number of nasty bugs in its rvalue reference support
455// As this behavior is hard to trigger in small configuration tests and because we'll probably drop GCC 4.4
456// after the next release anyway, I hacked in this hardcoded check for the compiler version
457#if not (defined(__GNUC__) && (__GNUC__ < 5) && (__GNUC_MINOR__ < 5))
458
459 YaspEntity (YGLI&& g, I&& it)
460 : _it(std::move(it)), _g(std::move(g))
461 {}
462
463#endif
464
466 bool equals (const YaspEntity& e) const
467 {
468 return _it == e._it && _g == e._g;
469 }
470
472 int level () const { return _g->level(); }
473
477 EntitySeed seed () const {
478 return EntitySeed(YaspEntitySeed<0,GridImp>(_g->level(), _it.coord()));
479 }
480
483 {
484 if (_g->interior[0].inside(_it.coord(),_it.shift()))
485 return InteriorEntity;
486 if (_g->overlap[0].inside(_it.coord(),_it.shift()))
487 return OverlapEntity;
488 DUNE_THROW(GridError, "Impossible GhostEntity");
489 return GhostEntity;
490 }
491
494 // the element geometry
495 auto ll = _it.lowerleft();
496 auto ur = _it.upperright();
497
498 // If on periodic overlap, transform coordinates by domain size
499 for (int i=0; i<dimworld; i++) {
500 if (gridlevel()->mg->isPeriodic(i)) {
501 int coord = transformingsubiterator().coord(i);
502 if (coord < 0) {
503 auto size = _g->mg->domainSize()[i];
504 ll[i] += size;
505 ur[i] += size;
506 } else if (coord + 1 > gridlevel()->mg->levelSize(gridlevel()->level(),i)) {
507 auto size = _g->mg->domainSize()[i];
508 ll[i] -= size;
509 ur[i] -= size;
510 }
511 }
512 }
513
514 GeometryImpl _geometry(ll,ur);
515 return Geometry( _geometry );
516 }
517
522 template<int cc> int count () const
523 {
524 return Dune::Yasp::subEnt<dim>(dim,cc);
525 }
526
531 unsigned int subEntities (unsigned int codim) const
532 {
533 return Dune::Yasp::subEnt<dim>(dim,codim);
534 }
535
538 template<int cc>
539 typename Codim<cc>::Entity subEntity (int i) const
540 {
541 // calculate move bitset
542 std::bitset<dim> move = Dune::Yasp::entityMove<dim>(i,cc);
543
544 // get the coordinate and modify it
545 iTupel coord = _it.coord();
546 for (int j=0; j<dim; j++)
547 if (move[j])
548 coord[j]++;
549
550 int which = _g->overlapfront[cc].shiftmapping(Dune::Yasp::entityShift<dim>(i,cc));
551 return typename Codim<cc>::Entity(YaspEntity<cc,GridImp::dimension,GridImp>(_g,_g->overlapfront[cc].begin(coord, which)));
552 }
553
555 Entity father () const
556 {
557 // check if coarse level exists
558 if (_g->level()<=0)
559 DUNE_THROW(GridError, "tried to call father on level 0");
560
561 // yes, get iterator to it
562 YGLI cg(_g);
563 --cg;
564
565 // coordinates of the cell
566 iTupel coord = _it.coord();
567
568 // get coordinates on next coarser level
569 for (int k=0; k<dim; k++) coord[k] = coord[k]/2;
570
571 return Entity(YaspEntity<0,GridImp::dimension,GridImp>(cg,cg->overlap[0].begin(coord)));
572 }
573
575 bool hasFather () const
576 {
577 return (_g->level()>0);
578 }
579
583 {
584 // configure one of the 2^dim transformations
585 FieldVector<ctype,dim> ll(0.0),ur(0.5);
586
587 for (int k=0; k<dim; k++)
588 {
589 if (_it.coord(k)%2)
590 {
591 ll[k] = 0.5;
592 ur[k] = 1.0;
593 }
594 }
595
597 }
598
599 const I& transformingsubiterator () const { return _it; }
600 const YGLI& gridlevel () const { return _g; }
602 YGLI& gridlevel() { return _g; }
603 const GridImp* yaspgrid () const { return _g->mg; }
604
605 bool isLeaf() const
606 {
607 return (_g->level() == yaspgrid()->maxLevel());
608 }
609
612 bool isNew () const { return yaspgrid()->adaptRefCount > 0 && yaspgrid()->maxLevel() < _g->level() + yaspgrid()->adaptRefCount; }
613
616 bool mightVanish () const { return false; }
617
620 {
621 return YaspIntersectionIterator<GridImp>(*this,false);
622 }
623
626 {
627 // only if entity is leaf this iterator delivers intersections
628 return YaspIntersectionIterator<GridImp>(*this, ! isLeaf() );
629 }
630
633 {
634 return ibegin();
635 }
636
639 {
640 return YaspIntersectionIterator<GridImp>(*this,true);
641 }
642
645 {
646 return iend();
647 }
648
651 {
652 return iend();
653 }
654
659 HierarchicIterator hbegin (int maxlevel) const
660 {
661 return YaspHierarchicIterator<GridImp>(_g,_it,maxlevel);
662 }
663
665 HierarchicIterator hend (int maxlevel) const
666 {
667 return YaspHierarchicIterator<GridImp>(_g,_it,_g->level());
668 }
669
670 private:
671 // IndexSets needs access to the private index methods
672 friend class Dune::YaspIndexSet<GridImp,true>;
673 friend class Dune::YaspIndexSet<GridImp,false>;
674 friend class Dune::YaspGlobalIdSet<GridImp>;
675
678 {
679 // encode codim
680 PersistentIndexType id(_it.shift().to_ulong());
681
682 // encode level
683 id = id << yaspgrid_level_bits;
684 id = id+PersistentIndexType(_g->level());
685
686
687 // encode coordinates
688 for (int i=dim-1; i>=0; i--)
689 {
690 id = id << yaspgrid_dim_bits;
691 id = id+PersistentIndexType(_it.coord(i));
692 }
693
694 return id;
695 }
696
698 int compressedIndex () const
699 {
700 return _it.superindex();
701 }
702
704 PersistentIndexType subPersistentIndex (int i, int cc) const
705 {
706 // calculate shift and move bitsets
707 std::bitset<dim> shift = Dune::Yasp::entityShift<dim>(i,cc);
708 std::bitset<dim> move = Dune::Yasp::entityMove<dim>(i,cc);
709
710 int trailing = (cc == dim) ? 1000 : 0;
711
712 std::array<int,dim> size = _g->mg->levelSize(_g->level());
713 std::array<int, dim> coord = _it.coord();
714 for (int j=0; j<dim; j++)
715 {
716 // correct size according to shift
717 if (!shift[j])
718 size[j]++;
719
720 // move the coordinates to the cell on which the entity lives
721 if (move[j])
722 coord[j]++;
723 }
724
725 for (int j=0; j<dim; j++)
726 {
727 // in the codim==dim case, count trailing zeroes.
728 if (cc == dim)
729 {
730 int zeroes = 0;
731 for (int k=0; k<_g->level(); k++)
732 if (coord[j] & (1<<k))
733 break;
734 else
735 zeroes++;
736 trailing = std::min(trailing,zeroes);
737 }
738 }
739
740 // encode codim
741 PersistentIndexType id(shift.to_ulong());
742
743 // encode level
744 id = id << yaspgrid_level_bits;
745 id = id+PersistentIndexType(_g->level()-trailing);
746
747 // encode coordinates
748 for (int j=dim-1; j>=0; j--)
749 {
750 id = id << yaspgrid_dim_bits;
751 id = id+PersistentIndexType(coord[j]>>trailing);
752 }
753
754 return id;
755 }
756
758 int subCompressedIndex (int i, int cc) const
759 {
760 // get shift and move of the subentity in question
761 std::bitset<dim> shift = Dune::Yasp::entityShift<dim>(i,cc);
762 std::bitset<dim> move = Dune::Yasp::entityMove<dim>(i,cc);
763
764 std::array<int,dim> size = _g->mg->levelSize(_g->level());
765 std::array<int, dim> coord = _it.coord();
766 for (int j=0; j<dim; j++)
767 {
768
769 size[j] += !shift[j];
770 coord[j] += move[j];
771 }
772
773 int which = _g->overlapfront[cc].shiftmapping(shift);
774 return _g->overlapfront[cc].superindex(coord,which);
775 }
776
777 I _it; // position in the grid level
778 YGLI _g; // access to grid level
779 };
780
781
782 // specialization for codim=dim (vertex)
783 template<int dim, class GridImp>
784 class YaspEntity<dim,dim,GridImp>
785 : public EntityDefaultImplementation <dim,dim,GridImp,YaspEntity>
786 {
787 enum { dimworld = GridImp::dimensionworld };
788
789 template<int, PartitionIteratorType, typename>
790 friend class YaspLevelIterator;
791
792 typedef typename GridImp::Traits::template Codim<dim>::GeometryImpl GeometryImpl;
793
794 public:
795 typedef typename GridImp::ctype ctype;
796
797 typedef typename GridImp::YGridLevelIterator YGLI;
798 typedef typename GridImp::YGrid::Iterator I;
799
800 typedef typename GridImp::template Codim<dim>::Geometry Geometry;
801
802 typedef typename GridImp::template Codim<dim>::EntitySeed EntitySeed;
803
805 typedef typename GridImp::PersistentIndexType PersistentIndexType;
806
808 typedef typename GridImp::YGrid::iTupel iTupel;
809
810 // constructor
812 {}
813
814 YaspEntity (const YGLI& g, const I& it)
815 : _it(it), _g(g)
816 {}
817
818// skip this constructor for GCC 4.4, which has a number of nasty bugs in its rvalue reference support
819// As this behavior is hard to trigger in small configuration tests and because we'll probably drop GCC 4.4
820// after the next release anyway, I hacked in this hardcoded check for the compiler version
821#if not (defined(__GNUC__) && (__GNUC__ < 5) && (__GNUC_MINOR__ < 5))
822
823 YaspEntity (YGLI&& g, I&& it)
824 : _it(std::move(it)), _g(std::move(g))
825 {}
826
827#endif
828
830 bool equals (const YaspEntity& e) const
831 {
832 return _it == e._it && _g == e._g;
833 }
834
836 int level () const {return _g->level();}
837
841 EntitySeed seed () const {
842 return EntitySeed(YaspEntitySeed<dim,GridImp>(_g->level(), _it.coord(), _it.which()));
843 }
844
847 GeometryImpl _geometry((_it).lowerleft());
848 return Geometry( _geometry );
849 }
850
853 {
854 if (_g->interior[dim].inside(_it.coord(),_it.shift()))
855 return InteriorEntity;
856 if (_g->interiorborder[dim].inside(_it.coord(),_it.shift()))
857 return BorderEntity;
858 if (_g->overlap[dim].inside(_it.coord(),_it.shift()))
859 return OverlapEntity;
860 if (_g->overlapfront[dim].inside(_it.coord(),_it.shift()))
861 return FrontEntity;
862 return GhostEntity;
863 }
864
866 int subCompressedIndex (int, unsigned int ) const
867 {
868 return compressedIndex();
869 }
870
871 private:
872 // IndexSets needs access to the private index methods
873 friend class Dune::YaspIndexSet<GridImp,true>;
874 friend class Dune::YaspIndexSet<GridImp,false>;
875 friend class Dune::YaspGlobalIdSet<GridImp>;
876
879 {
880 // get coordinate and size of global grid
881 iTupel size = _g->mg->levelSize(_g->level());
882
883 for (int i=0; i<dim; i++)
884 {
885 // we have vertices, add 1 size to all directions
886 size[i]++;
887 }
888
889 // determine min number of trailing zeroes
890 int trailing = 1000;
891 for (int i=0; i<dim; i++)
892 {
893 // count trailing zeros
894 int zeros = 0;
895 for (int j=0; j<_g->level(); j++)
896 if (_it.coord(i)&(1<<j))
897 break;
898 else
899 zeros++;
900 trailing = std::min(trailing,zeros);
901 }
902
903 // determine the level of this vertex
904 int level = _g->level()-trailing;
905
906 // encode codim: shift vector of vertices is 0.
908
909 // encode level
910 id = id << yaspgrid_level_bits;
911 id = id+PersistentIndexType(level);
912
913 // encode coordinates
914 for (int i=dim-1; i>=0; i--)
915 {
916 id = id << yaspgrid_dim_bits;
917 id = id+PersistentIndexType(_it.coord(i)>>trailing);
918 }
919
920 return id;
921 }
922
924 int compressedIndex () const { return _it.superindex();}
925
926 public:
927 const I& transformingsubiterator() const { return _it; }
928 const YGLI& gridlevel() const { return _g; }
930 YGLI& gridlevel() { return _g; }
931
932 const GridImp * yaspgrid() const { return _g->mg; }
933 protected:
934 I _it; // position in the grid level
935 YGLI _g; // access to grid level
936 };
937
938} // namespace Dune
939
940#endif // DUNE_GRID_YASPGRIDENTITY_HH
PartitionType
Attributes used in the generic overlap model.
Definition gridenums.hh:28
@ FrontEntity
on boundary between overlap and ghost
Definition gridenums.hh:32
@ InteriorEntity
all interior entities
Definition gridenums.hh:29
@ GhostEntity
ghost entities
Definition gridenums.hh:33
@ BorderEntity
on boundary between interior and overlap
Definition gridenums.hh:30
@ OverlapEntity
all entities lying in the overlap zone
Definition gridenums.hh:31
STL namespace.
Include standard header files.
Definition agrid.hh:60
const int yaspgrid_level_bits
Definition yaspgrid.hh:50
const int yaspgrid_dim_bits
Definition yaspgrid.hh:49
Default Implementations for EntityImp.
Definition common/entity.hh:544
Base class for exceptions in Dune grid modules.
Definition exceptions.hh:18
The general version that handles all codimensions but 0 and dim.
Definition yaspgridgeometry.hh:29
Definition yaspgridentity.hh:239
int level() const
level of this element
Definition yaspgridentity.hh:253
Geometry geometry() const
geometry of this entity
Definition yaspgridentity.hh:267
GridImp::ctype ctype
Definition yaspgridentity.hh:245
PersistentIndexType persistentIndex() const
globally unique, persistent index
Definition yaspgridentity.hh:320
const YGLI & gridlevel() const
Definition yaspgridentity.hh:389
const I & transformingsubiterator() const
Definition yaspgridentity.hh:388
YGLI _g
Definition yaspgridentity.hh:395
bool equals(const YaspEntity &e) const
Return true when two iterators over the same grid are equal (!).
Definition yaspgridentity.hh:308
PartitionType partitionType() const
return partition type attribute
Definition yaspgridentity.hh:274
GridImp::Traits::template Codim< codim >::GeometryImpl GeometryImpl
Definition yaspgridentity.hh:248
YGLI & gridlevel()
Definition yaspgridentity.hh:391
int subCompressedIndex(int i, unsigned int cc) const
subentity compressed index
Definition yaspgridentity.hh:357
GridImp::YGridLevelIterator YGLI
Definition yaspgridentity.hh:287
GridImp::YGrid::Iterator I
Definition yaspgridentity.hh:288
const GridImp * yaspgrid() const
Definition yaspgridentity.hh:392
GridImp::template Codim< codim >::EntitySeed EntitySeed
Definition yaspgridentity.hh:250
YaspEntity(YGLI &&g, const I &&it)
Definition yaspgridentity.hh:301
EntitySeed seed() const
Return the entity seed which contains sufficient information to generate the entity again and uses as...
Definition yaspgridentity.hh:261
int compressedIndex() const
consecutive, codim-wise, level-wise index
Definition yaspgridentity.hh:351
YaspEntity(const YGLI &g, const I &it)
Definition yaspgridentity.hh:292
I _it
Definition yaspgridentity.hh:394
YaspEntity()
Definition yaspgridentity.hh:289
GridImp::template Codim< codim >::Geometry Geometry
Definition yaspgridentity.hh:247
GridImp::PersistentIndexType PersistentIndexType
Definition yaspgridentity.hh:317
I & transformingsubiterator()
Definition yaspgridentity.hh:390
Describes the minimal information necessary to create a fully functional YaspEntity.
Definition yaspgridentityseed.hh:16
Iterates over entities of one grid level.
Definition yaspgridleveliterator.hh:18
YaspIntersectionIterator enables iteration over intersections with neighboring codim 0 entities.
Definition yaspgridintersectioniterator.hh:20
YaspHierarchicIterator enables iteration over son entities of codim 0.
Definition yaspgridhierarchiciterator.hh:19
Implementation of Level- and LeafIndexSets for YaspGrid.
Definition yaspgridindexsets.hh:23
persistent, globally unique Ids
Definition yaspgrididset.hh:23
LeafIntersectionIterator ileafbegin() const
returns intersection iterator for first intersection
Definition yaspgridentity.hh:625
GridImp::template Codim< 0 >::LocalGeometry LocalGeometry
Definition yaspgridentity.hh:421
Codim< cc >::Entity subEntity(int i) const
Definition yaspgridentity.hh:539
bool equals(const YaspEntity &e) const
Return true when two iterators over the same grid are equal (!).
Definition yaspgridentity.hh:466
YaspEntity(const YGLI &g, I &&it)
Definition yaspgridentity.hh:450
int count() const
Definition yaspgridentity.hh:522
GridImp::template Codim< 0 >::EntitySeed EntitySeed
Definition yaspgridentity.hh:430
GridImp::PersistentIndexType PersistentIndexType
define the type used for persistent indices
Definition yaspgridentity.hh:437
GridImp::YGrid::iTupel iTupel
define type used for coordinates in grid module
Definition yaspgridentity.hh:440
const YGLI & gridlevel() const
Definition yaspgridentity.hh:600
IntersectionIterator iend() const
Reference to one past the last neighbor.
Definition yaspgridentity.hh:638
const I & transformingsubiterator() const
Definition yaspgridentity.hh:599
GridImp::ctype ctype
Definition yaspgridentity.hh:415
YGLI & gridlevel()
Definition yaspgridentity.hh:602
YaspEntity(const YGLI &g, const I &it)
Definition yaspgridentity.hh:446
const GridImp * yaspgrid() const
Definition yaspgridentity.hh:603
int level() const
level of this element
Definition yaspgridentity.hh:472
GridImp::LeafIntersectionIterator LeafIntersectionIterator
Definition yaspgridentity.hh:433
YaspEntity(YGLI &&g, I &&it)
Definition yaspgridentity.hh:459
PartitionType partitionType() const
return partition type attribute
Definition yaspgridentity.hh:482
LevelIntersectionIterator ilevelend() const
Reference to one past the last neighbor.
Definition yaspgridentity.hh:650
bool mightVanish() const
Returns true, if entity might disappear during the next call to adapt()
Definition yaspgridentity.hh:616
GridImp::HierarchicIterator HierarchicIterator
Definition yaspgridentity.hh:434
GridImp::template Codim< 0 >::Entity Entity
Definition yaspgridentity.hh:429
LevelIntersectionIterator ilevelbegin() const
returns intersection iterator for first intersection
Definition yaspgridentity.hh:632
LeafIntersectionIterator ileafend() const
Reference to one past the last neighbor.
Definition yaspgridentity.hh:644
YaspEntity()
Definition yaspgridentity.hh:443
GridImp::YGrid::Iterator I
Definition yaspgridentity.hh:418
GridImp::template Codim< 0 >::Geometry Geometry
Definition yaspgridentity.hh:420
Geometry geometry() const
geometry of this entity
Definition yaspgridentity.hh:493
Entity father() const
Inter-level access to father element on coarser grid. Assumes that meshes are nested.
Definition yaspgridentity.hh:555
bool isNew() const
Returns true, if the entity has been created during the last call to adapt()
Definition yaspgridentity.hh:612
EntitySeed seed() const
Return the entity seed which contains sufficient information to generate the entity again and uses as...
Definition yaspgridentity.hh:477
HierarchicIterator hbegin(int maxlevel) const
Definition yaspgridentity.hh:659
IntersectionIterator ibegin() const
returns intersection iterator for first intersection
Definition yaspgridentity.hh:619
GridImp::YGridLevelIterator YGLI
Definition yaspgridentity.hh:417
unsigned int subEntities(unsigned int codim) const
Definition yaspgridentity.hh:531
LocalGeometry geometryInFather() const
Definition yaspgridentity.hh:582
GridImp::LevelIntersectionIterator IntersectionIterator
Definition yaspgridentity.hh:431
GridImp::LevelIntersectionIterator LevelIntersectionIterator
Definition yaspgridentity.hh:432
I & transformingsubiterator()
Definition yaspgridentity.hh:601
bool isLeaf() const
Definition yaspgridentity.hh:605
bool hasFather() const
returns true if father entity exists
Definition yaspgridentity.hh:575
GridImp::template Codim< cd >::Entity Entity
Definition yaspgridentity.hh:426
int level() const
level of this element
Definition yaspgridentity.hh:836
bool equals(const YaspEntity &e) const
Return true when two iterators over the same grid are equal (!).
Definition yaspgridentity.hh:830
YGLI & gridlevel()
Definition yaspgridentity.hh:930
Geometry geometry() const
geometry of this entity
Definition yaspgridentity.hh:846
YaspEntity(const YGLI &g, const I &it)
Definition yaspgridentity.hh:814
PartitionType partitionType() const
return partition type attribute
Definition yaspgridentity.hh:852
YGLI _g
Definition yaspgridentity.hh:935
GridImp::ctype ctype
Definition yaspgridentity.hh:795
GridImp::YGridLevelIterator YGLI
Definition yaspgridentity.hh:797
GridImp::PersistentIndexType PersistentIndexType
define the type used for persistent indices
Definition yaspgridentity.hh:805
EntitySeed seed() const
Return the entity seed which contains sufficient information to generate the entity again and uses as...
Definition yaspgridentity.hh:841
const GridImp * yaspgrid() const
Definition yaspgridentity.hh:932
GridImp::YGrid::Iterator I
Definition yaspgridentity.hh:798
I & transformingsubiterator()
Definition yaspgridentity.hh:929
const I & transformingsubiterator() const
Definition yaspgridentity.hh:927
I _it
Definition yaspgridentity.hh:934
GridImp::YGrid::iTupel iTupel
define type used for coordinates in grid module
Definition yaspgridentity.hh:808
GridImp::template Codim< dim >::Geometry Geometry
Definition yaspgridentity.hh:800
const YGLI & gridlevel() const
Definition yaspgridentity.hh:928
YaspEntity(YGLI &&g, I &&it)
Definition yaspgridentity.hh:823
YaspEntity()
Definition yaspgridentity.hh:811
GridImp::template Codim< dim >::EntitySeed EntitySeed
Definition yaspgridentity.hh:802