6#ifndef DUNE_GEOMETRY_GENERALVERTEXORDER_HH
7#define DUNE_GEOMETRY_GENERALVERTEXORDER_HH
15#include <dune/common/iteratorfacades.hh>
39 template<
class InIterator,
class OutIterator>
40 void reduceOrder(
const InIterator& inBegin,
const InIterator& inEnd,
43 for(InIterator inIt = inBegin; inIt != inEnd; ++inIt, ++outIt)
44 *outIt = std::count_if(inBegin, inEnd, [&](
const auto& v)
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);
A unique label for each type of element that can occur in a grid.
Definition affinegeometry.hh:21
void reduceOrder(const InIterator &inBegin, const InIterator &inEnd, OutIterator outIt)
Algorithm to reduce vertex order information.
Definition generalvertexorder.hh:40
Class providing access to the singletons of the reference elements.
Definition referenceelements.hh:170
typename Container::ReferenceElement ReferenceElement
The reference element type.
Definition referenceelements.hh:188
Class providing information on the ordering of vertices.
Definition generalvertexorder.hh:67
Index_ Index
Type of indices.
Definition generalvertexorder.hh:77
const GeometryType & type() const
get type of the entity's geometry
Definition generalvertexorder.hh:85
static const std::size_t dimension
export the dimension of the entity we provide information for
Definition generalvertexorder.hh:83
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:128
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:115
GeneralVertexOrder(const GeometryType >_, const InIterator &inBegin, const InIterator &inEnd)
construct a GeneralVertexOrder
Definition generalvertexorder.hh:97
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:108
Iterate over the vertex indices of some sub-entity.
Definition generalvertexorder.hh:144
iterator()
public default constructor
Definition generalvertexorder.hh:187
void decrement()
Definition generalvertexorder.hh:169
void advance(std::ptrdiff_t n)
Definition generalvertexorder.hh:170
const Index & dereference() const
Definition generalvertexorder.hh:156
void increment()
Definition generalvertexorder.hh:168
bool equals(const iterator &other) const
Definition generalvertexorder.hh:164
std::ptrdiff_t distanceTo(const iterator &other) const
Definition generalvertexorder.hh:171
const Index & elementAt(std::ptrdiff_t n) const
Definition generalvertexorder.hh:160
Unique label for each type of entities that can occur in DUNE grids.
Definition type.hh:126