6#ifndef DUNE_GRID_IO_FILE_VTK_BOUNDARYITERATORS_HH
7#define DUNE_GRID_IO_FILE_VTK_BOUNDARYITERATORS_HH
14#include <dune/grid/io/file/vtk/corner.hh>
15#include <dune/grid/io/file/vtk/corneriterator.hh>
16#include <dune/grid/io/file/vtk/functionwriter.hh>
38 < BoundaryIterator<GV>,
39 const typename GV::Intersection,
40 const typename GV::Intersection&,
41 typename std::iterator_traits<typename GV::template Codim<0>::
42 Iterator>::difference_type>
47 typedef const typename GV::Intersection Value;
48 typedef Value& Reference;
50 typedef typename GV::IntersectionIterator IntersectionIterator;
51 typedef typename std::iterator_traits<ElementIterator>::difference_type
60 std::shared_ptr<IntersectionIterator> iit;
64 if(eit == gv->template end<0>())
return true;
66 if((*iit)->boundary() && !(*iit)->neighbor())
return true;
71 void basic_increment() {
73 if(*iit == gv->iend(*eit)) {
76 if(eit != gv->template end<0>())
77 iit.reset(
new IntersectionIterator(gv->ibegin(*eit)));
82 Reference dereference()
const {
86 if(eit != other.eit)
return false;
90 bool mePassedTheEnd = eit == gv->template end<0>();
91 bool otherPassedTheEnd = other.eit == other.gv->template end<0>();
94 if(mePassedTheEnd && otherPassedTheEnd)
return true;
97 if(mePassedTheEnd || otherPassedTheEnd)
return false;
100 return *iit == *other.iit;
105 while(!valid()) basic_increment();
114 const IntersectionIterator& iit_)
115 : gv(&gv_), eit(eit_), iit(new IntersectionIterator(iit_))
117 while(!valid()) basic_increment();
126 : gv(&gv_), eit(eit_)
128 if(eit != gv->template end<0>())
129 iit.reset(
new IntersectionIterator(gv->ibegin(*eit)));
131 while(!valid()) basic_increment();
139 : gv(&gv_), eit(end ? gv->template end<0>() : gv->template begin<0>())
141 if(eit != gv->template end<0>())
142 iit.reset(
new IntersectionIterator(gv->ibegin(*eit)));
144 while(!valid()) basic_increment();
148 template<
typename ElementIndexSet>
149 class IntersectionIndexSet {
150 const ElementIndexSet& eis;
153 IntersectionIndexSet(
const ElementIndexSet& eis_)
158 template<
typename GV>
159 class NonConformingBoundaryIteratorFactory {
163 static const unsigned dimCell = GV::dimension-1;
165 typedef typename GV::Intersection Cell;
166 typedef BoundaryIterator<GV> CellIterator;
168 typedef VTK::Corner<Cell> Corner;
169 typedef VTK::CornerIterator<CellIterator> CornerIterator;
171 typedef Corner Point;
172 typedef CornerIterator PointIterator;
174 typedef NonConformingConnectivityWriter<Cell> ConnectivityWriter;
175 typedef typename GV::Communication Communication;
177 explicit NonConformingBoundaryIteratorFactory(
const GV& gv_)
181 CellIterator beginCells()
const {
182 return CellIterator(gv);
184 CellIterator endCells()
const {
185 return CellIterator(gv,
true);
188 CornerIterator beginCorners()
const {
189 return CornerIterator(beginCells(), endCells());
191 CornerIterator endCorners()
const {
192 return CornerIterator(endCells());
195 PointIterator beginPoints()
const {
return beginCorners(); }
196 PointIterator endPoints()
const {
return endCorners(); }
198 ConnectivityWriter makeConnectivity()
const {
199 return ConnectivityWriter();
201 const Communication& comm()
const {
Base class for stl conformant forward iterators.
Definition: iteratorfacades.hh:142
iterate over the GridViews boundary intersections
Definition: boundaryiterators.hh:43
BoundaryIterator(const GV &gv_, const ElementIterator &eit_)
construct a BoundaryIterator
Definition: boundaryiterators.hh:125
BoundaryIterator(const GV &gv_, bool end=false)
construct a BoundaryIterator
Definition: boundaryiterators.hh:138
BoundaryIterator(const GV &gv_, const ElementIterator &eit_, const IntersectionIterator &iit_)
construct a BoundaryIterator
Definition: boundaryiterators.hh:113
This file implements iterator facade classes for writing stl conformant iterators.
Dune namespace.
Definition: alignedallocator.hh:13
Static tag representing a codimension.
Definition: dimension.hh:24