Go to the documentation of this file.
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;
171 assert(order == other.order && codim == other.codim &&
172 subEntity == other.subEntity);
174 else return -
static_cast<std::ptrdiff_t
>(
vertex - other.vertex);
189 #endif // DUNE_GEOMETRY_GENERALVERTEXORDER_HH
A unique label for each type of element that can occur in a grid.
@ size
Definition: quadraturerules.hh:117
Class providing information on the ordering of vertices.
Definition: generalvertexorder.hh:65
bool equals(const iterator &other) const
Definition: generalvertexorder.hh:162
GeneralVertexOrder(const GeometryType >_, const InIterator &inBegin, const InIterator &inEnd)
construct a GeneralVertexOrder
Definition: generalvertexorder.hh:95
void reduceOrder(const InIterator &inBegin, const InIterator &inEnd, OutIterator outIt)
Algorithm to reduce vertex order information.
Definition: generalvertexorder.hh:38
constexpr GeometryType vertex
GeometryType representing a vertex.
Definition: type.hh:797
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
void increment()
Definition: generalvertexorder.hh:166
const Index & elementAt(std::ptrdiff_t n) const
Definition: generalvertexorder.hh:158
void decrement()
Definition: generalvertexorder.hh:167
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:278
const Index & dereference() const
Definition: generalvertexorder.hh:154
Class providing access to the singletons of the reference elements.
Definition: affinegeometry.hh:34
void advance(std::ptrdiff_t n)
Definition: generalvertexorder.hh:168
typename Container::ReferenceElement ReferenceElement
The reference element type.
Definition: referenceelements.hh:186
Index_ Index
Type of indices.
Definition: generalvertexorder.hh:75
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
static const std::size_t dimension
export the dimension of the entity we provide information for
Definition: generalvertexorder.hh:81
Definition: affinegeometry.hh:18
iterator()
public default constructor
Definition: generalvertexorder.hh:185
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
const GeometryType & type() const
get type of the entity's geometry
Definition: generalvertexorder.hh:83
std::ptrdiff_t distanceTo(const iterator &other) const
Definition: generalvertexorder.hh:169
Iterate over the vertex indices of some sub-entity.
Definition: generalvertexorder.hh:140