All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
iterator.hh
1 // -*- mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=2 sw=2 sts=2:
3 #ifndef DUNE_POLYHEDRALGRID_ITERATOR_HH
4 #define DUNE_POLYHEDRALGRID_ITERATOR_HH
5 
6 #include <dune/geometry/referenceelements.hh>
7 
8 #include <dune/grid/common/entityiterator.hh>
9 
10 #include <dune/grid/polyhedralgrid/entitypointer.hh>
11 
12 namespace Dune
13 {
14 
15  // PolyhedralGridIterator
16  // --------------
17 
18  template< int codim, class Grid, PartitionIteratorType pitype >
20  : public PolyhedralGridEntityPointer< codim, Grid >
21  {
24 
25  protected:
26  typedef typename Base::ExtraData ExtraData;
27  using Base :: entityImpl;
28 
29  public:
30  typedef typename Grid::Traits::template Codim<codim>::EntitySeed EntitySeed;
31  typedef typename Grid::Traits::template Codim<codim>::EntityImpl EntityImpl;
32 
33  PolyhedralGridIterator ( ExtraData data, const bool beginIterator )
34  : Base( data )
35  {
36  if( beginIterator )
37  entityImpl() = EntityImpl( data, EntitySeed( 0 ) );
38  }
39 
40  PolyhedralGridIterator ( const This& other )
41  : Base( other )
42  {}
43 
45  void increment ()
46  {
47  int index = entityImpl().seed().index();
48  ++index;
49 
50  if( index >= entityImpl().data()->size( codim ) )
51  entityImpl() = EntityImpl( entityImpl().data() );
52  else
53  entityImpl() = EntityImpl( entityImpl().data(), EntitySeed( index ) );
54  }
55  };
56 
57 } // namespace Dune
58 
59 #endif // #ifndef DUNE_POLYHEDRALGRID_ITERATOR_HH
Definition: entitypointer.hh:18
Definition: iterator.hh:19
void increment()
increment
Definition: iterator.hh:45