4#ifndef DUNE_GEOMETRY_GENERALVERTEXORDER_HH
5#define DUNE_GEOMETRY_GENERALVERTEXORDER_HH
13#include <dune/common/iteratorfacades.hh>
37 template<
class InIterator,
class OutIterator>
38 void reduceOrder(
const InIterator& inBegin,
const InIterator& inEnd,
41 for(InIterator inIt = inBegin; inIt != inEnd; ++inIt, ++outIt)
42 *outIt = std::count_if(inBegin, inEnd, [&](
const auto& v)
64 template<std::
size_t dim,
class Index_ = std::
size_t>
71 std::vector<Index_> vertexOrder;
94 template<
class InIterator>
96 const InIterator &inEnd) :
97 refelem(
RefElems::general(gt_)), gt(gt_),
98 vertexOrder(refelem.size(dim))
99 {
reduceOrder(inBegin, inEnd, vertexOrder.begin()); }
107 {
return iterator(*
this, codim, subEntity); }
114 return iterator(*
this, codim, subEntity,
115 refelem.size(subEntity, codim, dim));
127 std::vector<Index>& order)
const
129 order.resize(refelem.size(subEntity, codim, dim));
139 template<std::
size_t dim,
class Index_>
141 public Dune::RandomAccessIteratorFacade<iterator, const Index_>
145 std::size_t subEntity;
149 std::size_t subEntity_, std::size_t vertex_ = 0) :
150 order(&order_), codim(codim_), subEntity(subEntity_), vertex(vertex_)
155 return order->vertexOrder[order->refelem.subEntity(subEntity, codim,
159 return order->vertexOrder[order->refelem.subEntity(subEntity, codim,
163 return order == other.order && codim == other.codim &&
164 subEntity == other.subEntity && vertex == other.vertex;
168 void advance(std::ptrdiff_t n) { vertex += n; }
171 assert(order == other.order && codim == other.codim &&
172 subEntity == other.subEntity);
173 if(vertex < other.vertex)
return other.vertex - vertex;
174 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:19
void reduceOrder(const InIterator &inBegin, const InIterator &inEnd, OutIterator outIt)
Algorithm to reduce vertex order information.
Definition: generalvertexorder.hh:38
Class providing access to the singletons of the reference elements.
Definition: referenceelements.hh:168
typename Container::ReferenceElement ReferenceElement
The reference element type.
Definition: referenceelements.hh:186
Class providing information on the ordering of vertices.
Definition: generalvertexorder.hh:65
Index_ Index
Type of indices.
Definition: generalvertexorder.hh:75
const GeometryType & type() const
get type of the entity's geometry
Definition: generalvertexorder.hh:83
static const std::size_t dimension
export the dimension of the entity we provide information for
Definition: generalvertexorder.hh:81
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:126
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:113
GeneralVertexOrder(const GeometryType >_, const InIterator &inBegin, const InIterator &inEnd)
construct a GeneralVertexOrder
Definition: generalvertexorder.hh:95
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:106
Iterate over the vertex indices of some sub-entity.
Definition: generalvertexorder.hh:142
iterator()
public default constructor
Definition: generalvertexorder.hh:185
void decrement()
Definition: generalvertexorder.hh:167
void advance(std::ptrdiff_t n)
Definition: generalvertexorder.hh:168
const Index & dereference() const
Definition: generalvertexorder.hh:154
void increment()
Definition: generalvertexorder.hh:166
bool equals(const iterator &other) const
Definition: generalvertexorder.hh:162
std::ptrdiff_t distanceTo(const iterator &other) const
Definition: generalvertexorder.hh:169
const Index & elementAt(std::ptrdiff_t n) const
Definition: generalvertexorder.hh:158
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:123