My Project
Loading...
Searching...
No Matches
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 <opm/grid/polyhedralgrid/entitypointer.hh>
11
12namespace 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
41 void increment ()
42 {
43 int index = entityImpl().seed().index();
44 ++index;
45
46 if( index >= entityImpl().data()->size( codim ) )
47 entityImpl() = EntityImpl( entityImpl().data() );
48 else
49 entityImpl() = EntityImpl( entityImpl().data(), EntitySeed( index ) );
50 }
51 };
52
53} // namespace Dune
54
55#endif // #ifndef DUNE_POLYHEDRALGRID_ITERATOR_HH
Definition entitypointer.hh:19
Definition iterator.hh:21
void increment()
increment
Definition iterator.hh:41
The namespace Dune is the main namespace for all Dune code.
Definition CartesianIndexMapper.hpp:10