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>
234 template<
typename GV>
268 template<
typename GV>
302 template<
typename GV>
336 template<
typename GV>
372 template<
typename GV,
typename Entity>
412 template<
typename Entity>
464 template<
typename GV,
int codim>
509 template<
typename GV,
int dim>
548 template<
typename GV,
unsigned int partitions>
582 template<
typename GV,
unsigned int partitions>
613 template<
typename GV,
unsigned int partitions>
644 template<
typename GV,
unsigned int partitions>
693 template<
typename GV,
int codim,
unsigned int partitions>
734 template<
typename GV,
int dim,
unsigned int partitions>
757 template<
typename GV,
int codim,
unsigned int partitions>
759 ->
IteratorRange<
decltype(gv.template begin<codim,derive_partition_iterator_type<partitions>::value>())>
761 static_assert(0 <= codim && codim <= GV::dimension,
"invalid codimension for given GridView");
763 typedef IteratorRange<
decltype(gv.template begin<codim,pit>())> return_type;
764 return return_type(gv.template begin<codim,pit>(),gv.template end<codim,pit>());
774 template<
typename GV,
int codim>
778 static_assert(0 <= codim && codim <= GV::dimension,
"invalid codimension for given GridView");
779 typedef IteratorRange<
decltype(gv.template begin<codim>())> return_type;
780 return return_type(gv.template begin<codim>(),gv.template end<codim>());
786 template<
typename Entity>
787 inline IteratorRange<typename Entity::HierarchicIterator> descendantElements(
const Entity& e,
int maxLevel)
789 typedef IteratorRange<typename Entity::HierarchicIterator> return_type;
790 return return_type(e.hbegin(maxLevel),e.hend(maxLevel));
796 template<
typename GV,
typename Entity>
797 inline auto intersections(
const GV& gv,
const Entity& e)
798 -> IteratorRange<
decltype(gv.ibegin(e))>
800 return IteratorRange<
decltype(gv.ibegin(e))>(gv.ibegin(e),gv.iend(e));
809 template<
typename GV,
int dim,
unsigned int partitions>
810 inline auto entities(
const GV& gv, Dim<dim>, PartitionSet<partitions>)
811 ->
decltype(entities(gv,Codim<GV::dimension - dim>(),PartitionSet<partitions>()))
813 static_assert(0 <= dim && dim <= GV::dimension,
"invalid dimension for given GridView");
814 return entities(gv,Codim<GV::dimension - dim>(),PartitionSet<partitions>());
817 template<
typename GV,
int dim>
818 inline auto entities(
const GV& gv, Dim<dim>)
819 ->
decltype(entities(gv,Codim<GV::dimension - dim>()))
821 static_assert(0 <= dim && dim <= GV::dimension,
"invalid dimension for given GridView");
822 return entities(gv,Codim<GV::dimension - dim>());
825 template<
typename GV,
unsigned int partitions>
826 inline auto elements(
const GV& gv, PartitionSet<partitions>)
827 ->
decltype(entities(gv,Codim<0>(),PartitionSet<partitions>()))
829 return entities(gv,Codim<0>(),PartitionSet<partitions>());
832 template<
typename GV>
833 inline auto elements(
const GV& gv)
834 ->
decltype(entities(gv,Codim<0>()))
836 return entities(gv,Codim<0>());
839 template<
typename GV,
unsigned int partitions>
840 inline auto facets(
const GV& gv, PartitionSet<partitions>)
841 ->
decltype(entities(gv,Codim<1>(),PartitionSet<partitions>()))
843 return entities(gv,Codim<1>(),PartitionSet<partitions>());
846 template<
typename GV>
847 inline auto facets(
const GV& gv)
848 ->
decltype(entities(gv,Codim<1>()))
850 return entities(gv,Codim<1>());
853 template<
typename GV,
unsigned int partitions>
854 inline auto edges(
const GV& gv, PartitionSet<partitions>)
855 ->
decltype(entities(gv,Dim<1>(),PartitionSet<partitions>()))
857 return entities(gv,Dim<1>(),PartitionSet<partitions>());
860 template<
typename GV>
861 inline auto edges(
const GV& gv)
862 ->
decltype(entities(gv,Dim<1>()))
864 return entities(gv,Dim<1>());
867 template<
typename GV,
unsigned int partitions>
868 inline auto vertices(
const GV& gv, PartitionSet<partitions>)
869 ->
decltype(entities(gv,Dim<0>(),PartitionSet<partitions>()))
871 return entities(gv,Dim<0>(),PartitionSet<partitions>());
874 template<
typename GV>
875 inline auto vertices(
const GV& gv)
876 ->
decltype(entities(gv,Dim<0>()))
878 return entities(gv,Dim<0>());
Wrapper class for entities.
Definition: entity.hh:64
Simple range between a begin and an end iterator.
Definition: iteratorrange.hh:20
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: alignedallocator.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:136