4 #ifndef DUNE_GEOMETRY_GENERALVERTEXORDER_HH
5 #define DUNE_GEOMETRY_GENERALVERTEXORDER_HH
14 #include <dune/common/iteratorfacades.hh>
38 template<
class InIterator,
class OutIterator>
39 void reduceOrder(
const InIterator& inBegin,
const InIterator& inEnd,
43 typename std::iterator_traits<InIterator>::value_type
45 const less_t less = less_t();
47 for(InIterator inIt = inBegin; inIt != inEnd; ++inIt, ++outIt)
48 *outIt = std::count_if(inBegin, inEnd, std::bind2nd(less, *inIt));
67 template<std::
size_t dim,
class Index_ = std::
size_t>
74 std::vector<Index_> vertexOrder;
97 template<
class InIterator>
99 const InIterator &inEnd) :
100 refelem(
RefElems::general(gt_)), gt(gt_),
101 vertexOrder(refelem.
size(dim))
102 {
reduceOrder(inBegin, inEnd, vertexOrder.begin()); }
110 {
return iterator(*
this, codim, subEntity); }
117 return iterator(*
this, codim, subEntity,
118 refelem.
size(subEntity, codim, dim));
130 std::vector<Index>& order)
const
132 order.resize(refelem.
size(subEntity, codim, dim));
142 template<std::
size_t dim,
class Index_>
144 public Dune::RandomAccessIteratorFacade<iterator, const Index_>
148 std::size_t subEntity;
152 std::size_t subEntity_, std::size_t vertex_ = 0) :
153 order(&order_), codim(codim_), subEntity(subEntity_), vertex(vertex_)
158 return order->vertexOrder[order->refelem.subEntity(subEntity, codim,
162 return order->vertexOrder[order->refelem.subEntity(subEntity, codim,
166 return order == other.order && codim == other.codim &&
167 subEntity == other.subEntity && vertex == other.vertex;
171 void advance(std::ptrdiff_t n) { vertex += n; }
174 assert(order == other.order && codim == other.codim &&
175 subEntity == other.subEntity);
176 if(vertex < other.vertex)
return other.vertex - vertex;
177 else return -
static_cast<std::ptrdiff_t
>(vertex - other.vertex);
192 #endif // DUNE_GEOMETRY_GENERALVERTEXORDER_HH