4 #ifndef DUNE_GEOMETRY_GENERALVERTEXORDER_HH
5 #define DUNE_GEOMETRY_GENERALVERTEXORDER_HH
14 #include <dune/common/iteratorfacades.hh>
17 #include "referenceelements.hh"
37 template<
class InIterator,
class OutIterator>
38 void reduceOrder(
const InIterator& inBegin,
const InIterator& inEnd,
42 typename std::iterator_traits<InIterator>::value_type
44 static const less_t less = less_t();
46 for(InIterator inIt = inBegin; inIt != inEnd; ++inIt, ++outIt)
47 *outIt = std::count_if(inBegin, inEnd, std::bind2nd(less, *inIt));
66 template<std::
size_t dim,
class Index_ = std::
size_t>
73 std::vector<Index_> vertexOrder;
96 template<
class InIterator>
98 const InIterator &inEnd) :
99 refelem(
RefElems::general(gt_)), gt(gt_),
100 vertexOrder(refelem.size(dim))
101 {
reduceOrder(inBegin, inEnd, vertexOrder.begin()); }
109 {
return iterator(*
this, codim, subEntity); }
116 return iterator(*
this, codim, subEntity,
117 refelem.
size(subEntity, codim, dim));
129 std::vector<Index>& order)
const
131 order.resize(refelem.
size(subEntity, codim, dim));
141 template<std::
size_t dim,
class Index_>
143 public Dune::RandomAccessIteratorFacade<iterator, const Index_>
147 std::size_t subEntity;
151 std::size_t subEntity_, std::size_t vertex_ = 0) :
152 order(&order_), codim(codim_), subEntity(subEntity_), vertex(vertex_)
157 return order->vertexOrder[order->refelem.subEntity(subEntity, codim,
161 return order->vertexOrder[order->refelem.subEntity(subEntity, codim,
165 return order == other.order && codim == other.codim &&
166 subEntity == other.subEntity && vertex == other.vertex;
170 void advance(std::ptrdiff_t n) { vertex += n; }
173 assert(order == other.order && codim == other.codim &&
174 subEntity == other.subEntity);
175 if(vertex < other.vertex)
return other.vertex - vertex;
176 else return -
static_cast<std::ptrdiff_t
>(vertex - other.vertex);
191 #endif // DUNE_GEOMETRY_GENERALVERTEXORDER_HH