5#ifndef DUNE_GRID_COMMON_RANGEGENERATORS_HH
6#define DUNE_GRID_COMMON_RANGEGENERATORS_HH
8#include <dune/common/iteratorrange.hh>
9#include <dune/common/rangeutilities.hh>
10#include <dune/geometry/dimension.hh>
256 template<
typename GV>
290 template<
typename GV>
291 inline IteratorRange<...>
facets(
const GV& gv);
324 template<
typename GV>
325 inline IteratorRange<...>
edges(
const GV& gv);
358 template<
typename GV>
394 template<
typename GV,
typename Entity>
434 template<
typename Entity>
486 template<
typename GV,
int codim>
531 template<
typename GV,
int dim>
532 inline IteratorRange<...>
entities(
const GV& gv, Dim<dim> d);
570 template<
typename GV,
unsigned int partitions>
604 template<
typename GV,
unsigned int partitions>
635 template<
typename GV,
unsigned int partitions>
666 template<
typename GV,
unsigned int partitions>
715 template<
typename GV,
int codim,
unsigned int partitions>
756 template<
typename GV,
int dim,
unsigned int partitions>
782 template<
typename E,
int codim>
783 inline IteratorRange<...>
subEntities(
const E& e, Codim<codim> c);
805 template<
typename GV,
int codim,
unsigned int partitions>
807 -> IteratorRange<
decltype(gv.template begin<codim,derive_partition_iterator_type<partitions>::value>())>
809 static_assert(0 <= codim && codim <= GV::dimension,
"invalid codimension for given GridView");
811 typedef IteratorRange<
decltype(gv.template begin<codim,pit>())> return_type;
812 return return_type(gv.template begin<codim,pit>(),gv.template end<codim,pit>());
822 template<
typename GV,
int codim>
823 inline auto entities(
const GV& gv, Codim<codim>)
824 -> IteratorRange<
decltype(gv.template begin<codim>())>
826 static_assert(0 <= codim && codim <= GV::dimension,
"invalid codimension for given GridView");
827 typedef IteratorRange<
decltype(gv.template begin<codim>())> return_type;
828 return return_type(gv.template begin<codim>(),gv.template end<codim>());
834 template<
typename Entity>
835 inline IteratorRange<typename Entity::HierarchicIterator> descendantElements(
const Entity& e,
int maxLevel)
837 typedef IteratorRange<typename Entity::HierarchicIterator> return_type;
838 return return_type(e.hbegin(maxLevel),e.hend(maxLevel));
844 template<
typename GV,
typename Entity>
845 inline auto intersections(
const GV& gv,
const Entity& e)
846 -> IteratorRange<
decltype(gv.ibegin(e))>
848 return IteratorRange<
decltype(gv.ibegin(e))>(gv.ibegin(e),gv.iend(e));
857 template<
typename GV,
int dim,
unsigned int partitions>
858 inline auto entities(
const GV& gv, Dim<dim>, PartitionSet<partitions>)
859 ->
decltype(entities(gv,Codim<GV::dimension - dim>(),PartitionSet<partitions>()))
861 static_assert(0 <= dim && dim <= GV::dimension,
"invalid dimension for given GridView");
862 return entities(gv,Codim<GV::dimension - dim>(),PartitionSet<partitions>());
865 template<
typename GV,
int dim>
866 inline auto entities(
const GV& gv, Dim<dim>)
867 ->
decltype(entities(gv,Codim<GV::dimension - dim>()))
869 static_assert(0 <= dim && dim <= GV::dimension,
"invalid dimension for given GridView");
870 return entities(gv,Codim<GV::dimension - dim>());
873 template<
typename GV,
unsigned int partitions>
874 inline auto elements(
const GV& gv, PartitionSet<partitions>)
875 ->
decltype(entities(gv,Codim<0>(),PartitionSet<partitions>()))
877 return entities(gv,Codim<0>(),PartitionSet<partitions>());
880 template<
typename GV>
881 inline auto elements(
const GV& gv)
882 ->
decltype(entities(gv,Codim<0>()))
884 return entities(gv,Codim<0>());
887 template<
typename GV,
unsigned int partitions>
888 inline auto facets(
const GV& gv, PartitionSet<partitions>)
889 ->
decltype(entities(gv,Codim<1>(),PartitionSet<partitions>()))
891 return entities(gv,Codim<1>(),PartitionSet<partitions>());
894 template<
typename GV>
895 inline auto facets(
const GV& gv)
896 ->
decltype(entities(gv,Codim<1>()))
898 return entities(gv,Codim<1>());
901 template<
typename GV,
unsigned int partitions>
902 inline auto edges(
const GV& gv, PartitionSet<partitions>)
903 ->
decltype(entities(gv,Dim<1>(),PartitionSet<partitions>()))
905 return entities(gv,Dim<1>(),PartitionSet<partitions>());
908 template<
typename GV>
909 inline auto edges(
const GV& gv)
910 ->
decltype(entities(gv,Dim<1>()))
912 return entities(gv,Dim<1>());
915 template<
typename GV,
unsigned int partitions>
916 inline auto vertices(
const GV& gv, PartitionSet<partitions>)
917 ->
decltype(entities(gv,Dim<0>(),PartitionSet<partitions>()))
919 return entities(gv,Dim<0>(),PartitionSet<partitions>());
922 template<
typename GV>
923 inline auto vertices(
const GV& gv)
924 ->
decltype(entities(gv,Dim<0>()))
926 return entities(gv,Dim<0>());
929 template<
typename E,
int codim>
930 inline auto subEntities(
const E& e, Codim<codim> c)
932 static_assert(E::codimension <= codim,
933 "Can only iterate over sub-entities with equal or larger codimension");
934 return transformedRangeView(
935 range(
static_cast<int>(e.subEntities(c))),
936 [&](
const int i){ return e.template subEntity<codim>(i); }
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:136
IteratorRange<... > intersections(const GV &gv, const Entity &e)
Iterates over all Intersections of an Entity with respect to the given GridView.
IteratorRange<... > vertices(const GV &gv)
Iterates over all vertices (entities with dimension 0) of a GridView.
IteratorRange<... > elements(const GV &gv, PartitionSet< partitions > ps)
Iterates over all elements / cells (entities with codimension 0) of a GridView that belong to the giv...
IteratorRange<... > entities(const GV &gv, Codim< codim > cd, PartitionSet< partitions > ps)
Iterates over all entities of a GridView with the given codimension that belong to the given Partitio...
IteratorRange<... > edges(const GV &gv, PartitionSet< partitions > ps)
Iterates over all edges (entities with dimension 1) of a GridView that belong to the given PartitionS...
IteratorRange<... > entities(const GV &gv, Dim< dim > d, PartitionSet< partitions > ps)
Iterates over all entities of a GridView with the given dimension that belong to the given PartitionS...
IteratorRange<... > entities(const GV &gv, Dim< dim > d)
Iterates over all entities of a GridView with the given dimension.
IteratorRange<... > subEntities(const E &e, Codim< codim > c)
Iterates over all sub-entities of an entity given the codimension of the sub-entities.
IteratorRange<... > vertices(const GV &gv, PartitionSet< partitions > ps)
Iterates over all vertices (entities with dimension 0) of a GridView that belong to the given Partiti...
IteratorRange<... > elements(const GV &gv)
Iterates over all elements / cells (entities with codimension 0) of a GridView.
IteratorRange<... > entities(const GV &gv, Codim< codim > cd)
Iterates over all entities of a GridView with the given codimension.
IteratorRange<... > facets(const GV &gv, PartitionSet< partitions > ps)
Iterates over all facets (entities with codimension 1) of a GridView that belong to the given Partiti...
IteratorRange<... > facets(const GV &gv)
Iterates over all facets (entities with codimension 1) of a GridView.
IteratorRange<... > edges(const GV &gv)
Iterates over all edges (entities with dimension 1) of a GridView.
IteratorRange<... > descendantElements(const Entity &e, int maxLevel)
Iterates over all descendant elements of the given element up to a maximum level.
Include standard header files.
Definition: agrid.hh:60
Wrapper class for entities.
Definition: common/entity.hh:66
A struct that collects all associated types of one implementation from the Traits class.
Definition: common/gridview.hh:118
A set of PartitionType values.
Definition: partitionset.hh:138