12#ifndef DUMUX_SCV_AND_SCVF_ITERATORS_HH 
   13#define DUMUX_SCV_AND_SCVF_ITERATORS_HH 
   15#include <dune/common/iteratorrange.hh> 
   16#include <dune/common/iteratorfacades.hh> 
   25template<
class SubControlVolume, 
class Vector, 
class FVElementGeometry>
 
   26class ScvIterator : 
public Dune::ForwardIteratorFacade<ScvIterator<SubControlVolume,
 
   29                                                       const SubControlVolume>
 
   32    using Iterator = 
typename Vector::const_iterator;
 
   34    ScvIterator(
const Iterator& it, 
const FVElementGeometry& fvGeometry)
 
   35    : it_(it), fvGeometryPtr_(&fvGeometry) {}
 
 
   42        return fvGeometryPtr_->scv(*it_);
 
 
   45    bool equals(
const ThisType& other)
 const 
   47        return it_ == other.it_;
 
 
   57    const FVElementGeometry* fvGeometryPtr_;
 
 
   65template<
class SubControlVolumeFace, 
class Vector, 
class FVElementGeometry>
 
   66class ScvfIterator : 
public Dune::ForwardIteratorFacade<ScvfIterator<SubControlVolumeFace,
 
   69                                                        const SubControlVolumeFace>
 
   72    using Iterator = 
typename Vector::const_iterator;
 
   74    ScvfIterator(
const Iterator& it, 
const FVElementGeometry& fvGeometry)
 
   75    : it_(it), fvGeometryPtr_(&fvGeometry) {}
 
 
   82        return fvGeometryPtr_->scvf(*it_);
 
 
   85    bool equals(
const ThisType& other)
 const 
   87        return it_ == other.it_;
 
 
   97    const FVElementGeometry* fvGeometryPtr_;
 
 
  105template<
class SubControlVolumeFace, 
class Vector, 
class FVElementGeometry>
 
  109                                                                 const SubControlVolumeFace>
 
  112    using Iterator = 
typename Vector::const_iterator;
 
  117    static ThisType 
makeBegin(
const Vector& vector, 
const FVElementGeometry& fvGeometry, 
const std::size_t scvIdx)
 
  119        auto begin = vector.begin();
 
  120        const auto end = vector.end();
 
  122        while (begin != end && fvGeometry.scvf(*begin).insideScvIdx() != scvIdx)
 
 
  128    static ThisType 
makeEnd(
const Vector& vector, 
const FVElementGeometry& fvGeometry, 
const std::size_t scvIdx)
 
 
  136        return fvGeometryPtr_->scvf(*it_);
 
 
  141        return it_ == other.it_;
 
 
  147        while (it_ != itEnd_ && 
dereference().insideScvIdx() != scvIdx_)
 
 
  153    SkippingScvfIterator(
const Iterator& itBegin, 
const Iterator& itEnd, 
const FVElementGeometry& fvGeometry, 
const std::size_t scvIdx)
 
  154    : it_(itBegin), fvGeometryPtr_(&fvGeometry), itEnd_(itEnd), scvIdx_(scvIdx) {}
 
  157    const FVElementGeometry* fvGeometryPtr_;
 
  158    const Iterator itEnd_;
 
 
bool equals(const ThisType &other) const
Definition scvandscvfiterators.hh:45
ScvIterator(const Iterator &it, const FVElementGeometry &fvGeometry)
Definition scvandscvfiterators.hh:34
const SubControlVolume & dereference() const
dereferencing yields a subcontrol volume
Definition scvandscvfiterators.hh:40
void increment()
Definition scvandscvfiterators.hh:50
ScvIterator()
Definition scvandscvfiterators.hh:37
ScvfIterator()
Definition scvandscvfiterators.hh:77
void increment()
Definition scvandscvfiterators.hh:90
ScvfIterator(const Iterator &it, const FVElementGeometry &fvGeometry)
Definition scvandscvfiterators.hh:74
const SubControlVolumeFace & dereference() const
dereferencing yields a subcontrol volume face
Definition scvandscvfiterators.hh:80
bool equals(const ThisType &other) const
Definition scvandscvfiterators.hh:85
bool equals(const ThisType &other) const
Definition scvandscvfiterators.hh:139
const SubControlVolumeFace & dereference() const
dereferencing yields a subcontrol volume face
Definition scvandscvfiterators.hh:134
SkippingScvfIterator()
Definition scvandscvfiterators.hh:115
void increment()
Definition scvandscvfiterators.hh:144
static ThisType makeEnd(const Vector &vector, const FVElementGeometry &fvGeometry, const std::size_t scvIdx)
Definition scvandscvfiterators.hh:128
static ThisType makeBegin(const Vector &vector, const FVElementGeometry &fvGeometry, const std::size_t scvIdx)
Definition scvandscvfiterators.hh:117