36#ifndef OPM_ITERATORS_HEADER
37#define OPM_ITERATORS_HEADER
39#include <dune/grid/common/gridenums.hh>
40#include "PartitionIteratorRule.hpp"
41#include <opm/common/ErrorMacros.hpp>
42#include "CpGridData.hpp"
58 template<
int cd, PartitionIteratorType pitype>
77 if(rule_.fullSet || rule_.emptySet)
79 while(this->
index()<noEntities_ && rule_.isInvalid(*
this))
121 : maxLevel_(maxLevel)
124 stackChildren_(target);
132 HierarchicIterator(
int maxLevel)
133 : maxLevel_(maxLevel)
155 if (elemStack_.empty()){
159 auto target = elemStack_.top();
163 stackChildren_(target);
184 void stackChildren_(
const Entity<0>& target);
195 std::stack<Entity<0>> elemStack_;
204 template<
int codim, Dune::PartitionIteratorType pitype >
205 struct iterator_traits<
Dune::cpgrid::Iterator< codim, pitype > >
208 typedef ptrdiff_t difference_type;
209 typedef typename Iterator::Entity value_type;
210 typedef value_type* pointer;
211 typedef value_type& reference;
212 typedef forward_iterator_tag iterator_category;
216 struct iterator_traits<
Dune::cpgrid::HierarchicIterator >
218 typedef ptrdiff_t difference_type;
220 typedef value_type* pointer;
221 typedef value_type& reference;
222 typedef forward_iterator_tag iterator_category;
228#include <opm/grid/cpgrid/CpGridData.hpp>
234template<
int cd, PartitionIteratorType pitype>
240 noEntities_(grid.size(cd))
242 if(rule_.fullSet || rule_.emptySet)
245 while(this->
index()<noEntities_ && rule_.isInvalid(*
this))
Struct that hods all the data needed to represent a Cpgrid.
Definition: CpGridData.hpp:122
Represents an entity of a given codim, with positive or negative orientation.
Definition: EntityRep.hpp:99
bool orientation() const
Returns true if the entity has positive orientation.
Definition: EntityRep.hpp:140
int index() const
The (positive) index of an entity.
Definition: EntityRep.hpp:126
void increment()
Increments the entityrep's index() by one.
Definition: EntityRep.hpp:153
Definition: Entity.hpp:64
Entity()
Constructor taking a grid and an integer entity representation.
Definition: Entity.hpp:110
Only needs to provide interface for doing nothing.
Definition: Iterators.hpp:108
const Entity< 0 > & operator*() const
Const dereferencing operator.
Definition: Iterators.hpp:177
HierarchicIterator(const CpGridData &grid)
Definition: Iterators.hpp:114
HierarchicIterator & operator++()
Equality.
Definition: Iterators.hpp:153
const Entity< 0 > * operator->() const
Const member by pointer operator.
Definition: Iterators.hpp:170
Iterator intended to be used as LeafIterator and LevelIterator (no difference due to no adaptivity) f...
Definition: Iterators.hpp:60
const Entity< cd > * operator->() const
Const member by pointer operator.
Definition: Iterators.hpp:84
Iterator & operator++()
Increment operator.
Definition: Iterators.hpp:74
Iterator(const CpGridData &grid, int index, bool orientation)
Definition: Iterators.hpp:235
const Entity< cd > & operator*() const
Const dereferencing operator.
Definition: Iterators.hpp:91
Copyright 2019 Equinor AS.
Definition: CartesianIndexMapper.hpp:10
A rule at what entities to stop.
Definition: PartitionIteratorRule.hpp:42