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>
72 const RefElem& refelem;
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
Definition: quadraturerules.hh:88
void advance(std::ptrdiff_t n)
Definition: generalvertexorder.hh:171
int size(int c) const
number of subentities of codimension c
Definition: referenceelements.hh:82
Class providing information on the ordering of vertices.
Definition: generalvertexorder.hh:68
Definition: affinegeometry.hh:18
Class providing access to the singletons of the reference elements.
Definition: affinegeometry.hh:28
Index_ Index
Type of indices.
Definition: generalvertexorder.hh:78
void reduceOrder(const InIterator &inBegin, const InIterator &inEnd, OutIterator outIt)
Algorithm to reduce vertex order information.
Definition: generalvertexorder.hh:39
const GeometryType & type() const
get type of the entity's geometry
Definition: generalvertexorder.hh:86
GeneralVertexOrder(const GeometryType >_, const InIterator &inBegin, const InIterator &inEnd)
construct a GeneralVertexOrder
Definition: generalvertexorder.hh:98
std::ptrdiff_t distanceTo(const iterator &other) const
Definition: generalvertexorder.hh:172
Iterate over the vertex indices of some sub-entity.
Definition: generalvertexorder.hh:143
const Index & elementAt(std::ptrdiff_t n) const
Definition: generalvertexorder.hh:161
iterator end(std::size_t codim, std::size_t subEntity) const
get end iterator for the vertex indices of some sub-entity
Definition: generalvertexorder.hh:116
This class provides access to geometric and topological properties of a reference element...
Definition: affinegeometry.hh:25
void decrement()
Definition: generalvertexorder.hh:170
iterator()
public default constructor
Definition: generalvertexorder.hh:188
A unique label for each type of element that can occur in a grid.
iterator begin(std::size_t codim, std::size_t subEntity) const
get begin iterator for the vertex indices of some sub-entity
Definition: generalvertexorder.hh:109
void increment()
Definition: generalvertexorder.hh:169
void getReduced(std::size_t codim, std::size_t subEntity, std::vector< Index > &order) const
get a vector of reduced indices for some sub-entity
Definition: generalvertexorder.hh:129
static const std::size_t dimension
export the dimension of the entity we provide information for
Definition: generalvertexorder.hh:84
const Index & dereference() const
Definition: generalvertexorder.hh:157
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:24
bool equals(const iterator &other) const
Definition: generalvertexorder.hh:165