/usr/include/dune/grid/io/file/vtk/corneriterator.hh is in libdune-grid-dev 2.4.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GRID_IO_FILE_VTK_CORNERITERATOR_HH
#define DUNE_GRID_IO_FILE_VTK_CORNERITERATOR_HH
#include <iterator>
#include <dune/common/iteratorfacades.hh>
#include <dune/common/typetraits.hh>
#include <dune/geometry/referenceelements.hh>
#include <dune/grid/io/file/vtk/corner.hh>
namespace Dune
{
//! \addtogroup VTK
//! \{
namespace VTK {
//! iterate over the corners of some cell range
/**
* This will visit all the corners of all elements visited by
* CellIterator.
*/
template<typename CellIterator>
class CornerIterator
: public ForwardIteratorFacade
< CornerIterator<CellIterator>,
const Corner<typename remove_const<typename std::iterator_traits<
CellIterator>::value_type>::type>,
const Corner<typename remove_const<typename std::iterator_traits<
CellIterator>::value_type>::type>&,
typename std::iterator_traits<CellIterator>::difference_type>
{
public:
// reiterate the facades typedefs here
typedef CornerIterator<CellIterator> DerivedType;
typedef VTK::Corner<typename remove_const<typename std::iterator_traits<
CellIterator>::value_type>::type> Corner;
typedef const Corner Value;
typedef Value& Reference;
typedef typename std::iterator_traits<CellIterator>::difference_type
DifferenceType;
typedef typename std::iterator_traits<CellIterator>::value_type::Geometry::ctype
ctype;
static const unsigned dim = std::iterator_traits<CellIterator>::
value_type::mydimension;
typedef ReferenceElements<ctype, dim> Refelems;
private:
typedef ForwardIteratorFacade<DerivedType, Value, Reference,
DifferenceType> Facade;
CellIterator cellit;
CellIterator cellend;
Corner corner;
public:
Reference dereference() const {
return corner;
}
bool isDereferencable() const {
return cellit != cellend;
}
bool equals(const DerivedType& other) const {
bool mePassedTheEnd = !isDereferencable();
bool otherPassedTheEnd = !other.isDereferencable();
// both are passed the end => return true
if(mePassedTheEnd && otherPassedTheEnd) return true;
// one is passed the end => return false
if(mePassedTheEnd || otherPassedTheEnd) return false;
// none is passed the end, do their iterators and indices match?
return cellit == other.cellit &&
corner.duneIndex() == other.corner.duneIndex();
}
void increment() {
int index = corner.vtkIndex();
++index;
if(index == Refelems::general(cellit->type()).size(dim)) {
++cellit;
if(cellit != cellend) {
corner.cell(*cellit);
corner.vtkIndex(0);
}
}
else
corner.vtkIndex(index);
}
//! construct a CornerIterator
/**
* \param cellit_ The begin iterator of the undelying range.
* \param cellend_ The end iterator of the underlying range.
* \param vtkIndex VTKIndex of the currently pointed to corner.
*/
CornerIterator(const CellIterator& cellit_, const CellIterator& cellend_,
unsigned vtkIndex = 0)
: cellit(cellit_), cellend(cellend_)
{
if(cellit != cellend) {
corner.cell(*cellit);
corner.vtkIndex(vtkIndex);
}
}
//! construct a CornerIterator
/**
* This constructs a passed-the-end iterator value.
*/
CornerIterator(const CellIterator& cellend_)
: cellit(cellend_), cellend(cellend_)
{ }
};
} // namespace VTK
//! \} group VTK
} // namespace Dune
#endif // DUNE_GRID_IO_FILE_VTK_CORNERITERATOR_HH
|