3#ifndef DUNE_GRID_COMMON_RANGEGENERATORS_HH
4#define DUNE_GRID_COMMON_RANGEGENERATORS_HH
6#include <dune/common/iteratorrange.hh>
7#include <dune/geometry/dimension.hh>
8#include <dune/grid/common/gridenums.hh>
9#include <dune/grid/common/partitionset.hh>
241 template<
typename GV>
276 template<
typename GV>
311 template<
typename GV>
346 template<
typename GV>
383 template<
typename GV,
typename Entity>
424 template<
typename Entity>
477 template<
typename GV,
int codim>
523 template<
typename GV,
int dim>
563 template<
typename GV,
unsigned int partitions>
598 template<
typename GV,
unsigned int partitions>
630 template<
typename GV,
unsigned int partitions>
662 template<
typename GV,
unsigned int partitions>
712 template<
typename GV,
int codim,
unsigned int partitions>
754 template<
typename GV,
int dim,
unsigned int partitions>
764#if HAVE_RANGE_BASED_FOR
780 template<
typename GV,
int codim,
unsigned int partitions>
783 derive_partition_iterator_type<partitions>::value
788 static_assert(0 <= codim && codim <= GV::dimension,
"invalid codimension for given GridView");
793 return return_type(gv.template begin<codim,pit>(),gv.template end<codim,pit>());
803 template<
typename GV,
int codim>
809 static_assert(0 <= codim && codim <= GV::dimension,
"invalid codimension for given GridView");
813 return return_type(gv.template begin<codim>(),gv.template end<codim>());
819 template<
typename Entity>
820 inline IteratorRange<typename Entity::HierarchicIterator> descendantElements(
const Entity& e,
int maxLevel)
822 typedef IteratorRange<typename Entity::HierarchicIterator> return_type;
823 return return_type(e.hbegin(maxLevel),e.hend(maxLevel));
829 template<
typename GV,
typename Entity>
830 inline IteratorRange<typename GV::IntersectionIterator> intersections(
const GV& gv,
const Entity& e)
832 return IteratorRange<typename GV::IntersectionIterator>(gv.ibegin(e),gv.iend(e));
841 template<
typename GV,
int dim,
unsigned int partitions>
842 inline auto entities(
const GV& gv, Dim<dim>, PartitionSet<partitions>)
843 ->
decltype(entities(gv,Codim<GV::dimension - dim>(),PartitionSet<partitions>()))
845 static_assert(0 <= dim && dim <= GV::dimension,
"invalid dimension for given GridView");
846 return entities(gv,Codim<GV::dimension - dim>(),PartitionSet<partitions>());
849 template<
typename GV,
int dim>
850 inline auto entities(
const GV& gv, Dim<dim>)
851 ->
decltype(entities(gv,Codim<GV::dimension - dim>()))
853 static_assert(0 <= dim && dim <= GV::dimension,
"invalid dimension for given GridView");
854 return entities(gv,Codim<GV::dimension - dim>());
857 template<
typename GV,
unsigned int partitions>
858 inline auto elements(
const GV& gv, PartitionSet<partitions>)
859 ->
decltype(entities(gv,Codim<0>(),PartitionSet<partitions>()))
861 return entities(gv,Codim<0>(),PartitionSet<partitions>());
864 template<
typename GV>
865 inline auto elements(
const GV& gv)
866 ->
decltype(entities(gv,Codim<0>()))
868 return entities(gv,Codim<0>());
871 template<
typename GV,
unsigned int partitions>
872 inline auto facets(
const GV& gv, PartitionSet<partitions>)
873 ->
decltype(entities(gv,Codim<1>(),PartitionSet<partitions>()))
875 return entities(gv,Codim<1>(),PartitionSet<partitions>());
878 template<
typename GV>
879 inline auto facets(
const GV& gv)
880 ->
decltype(entities(gv,Codim<1>()))
882 return entities(gv,Codim<1>());
885 template<
typename GV,
unsigned int partitions>
886 inline auto edges(
const GV& gv, PartitionSet<partitions>)
887 ->
decltype(entities(gv,Dim<1>(),PartitionSet<partitions>()))
889 return entities(gv,Dim<1>(),PartitionSet<partitions>());
892 template<
typename GV>
893 inline auto edges(
const GV& gv)
894 ->
decltype(entities(gv,Dim<1>()))
896 return entities(gv,Dim<1>());
899 template<
typename GV,
unsigned int partitions>
900 inline auto vertices(
const GV& gv, PartitionSet<partitions>)
901 ->
decltype(entities(gv,Dim<0>(),PartitionSet<partitions>()))
903 return entities(gv,Dim<0>(),PartitionSet<partitions>());
906 template<
typename GV>
907 inline auto vertices(
const GV& gv)
908 ->
decltype(entities(gv,Dim<0>()))
910 return entities(gv,Dim<0>());
Wrapper class for entities.
Definition: entity.hh:62
Simple range between a begin and an end iterator.
Definition: iteratorrange.hh:19
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<... > 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<... > 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 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<... > 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.
Dune namespace.
Definition: alignment.hh:10
Static tag representing a codimension.
Definition: dimension.hh:22
Static tag representing a dimension.
Definition: dimension.hh:14
A struct that collects all associated types of one implementation from the Traits class.
Definition: gridview.hh:95
A set of PartitionType values.
Definition: partitionset.hh:97