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>
235 template<
typename GV>
236 inline IteratorRange<...> elements(
const GV& gv);
270 template<
typename GV>
271 inline IteratorRange<...> facets(
const GV& gv);
305 template<
typename GV>
306 inline IteratorRange<...> edges(
const GV& gv);
340 template<
typename GV>
341 inline IteratorRange<...> vertices(
const GV& gv);
377 template<
typename GV,
typename Entity>
378 inline IteratorRange<...> intersections(
const GV& gv,
const Entity& e);
418 template<
typename Entity>
419 inline IteratorRange<...> descendantElements(
const Entity& e,
int maxLevel);
471 template<
typename GV,
int codim>
472 inline IteratorRange<...> entities(
const GV& gv, Codim<codim> cd);
517 template<
typename GV,
int dim>
518 inline IteratorRange<...> entities(
const GV& gv, Dim<dim> d);
557 template<
typename GV,
unsigned int partitions>
558 inline IteratorRange<...> elements(
const GV& gv, PartitionSet<partitions> ps);
592 template<
typename GV,
unsigned int partitions>
593 inline IteratorRange<...> facets(
const GV& gv, PartitionSet<partitions> ps);
624 template<
typename GV,
unsigned int partitions>
625 inline IteratorRange<...> edges(
const GV& gv, PartitionSet<partitions> ps);
656 template<
typename GV,
unsigned int partitions>
657 inline IteratorRange<...> vertices(
const GV& gv, PartitionSet<partitions> ps);
706 template<
typename GV,
int codim,
unsigned int partitions>
707 inline IteratorRange<...> entities(
const GV& gv gv, Codim<codim> cd, PartitionSet<partitions> ps);
748 template<
typename GV,
int dim,
unsigned int partitions>
749 inline IteratorRange<...> entities(
const GV& gv, Dim<dim> d, PartitionSet<partitions> ps);
758 #if HAVE_RANGE_BASED_FOR
774 template<
typename GV,
int codim,
unsigned int partitions>
775 inline IteratorRange<
776 typename GV::template Codim<codim>::template Partition<
777 derive_partition_iterator_type<partitions>::value
780 entities(
const GV& gv, Codim<codim>, PartitionSet<partitions>)
782 static_assert(0 <= codim && codim <= GV::dimension,
"invalid codimension for given GridView");
784 typedef IteratorRange<
785 typename GV::template Codim<codim>::template Partition<pit>::Iterator
787 return return_type(gv.template begin<codim,pit>(),gv.template end<codim,pit>());
797 template<
typename GV,
int codim>
798 inline IteratorRange<
799 typename GV::template Codim<codim>::Iterator
801 entities(
const GV& gv, Codim<codim>)
803 static_assert(0 <= codim && codim <= GV::dimension,
"invalid codimension for given GridView");
804 typedef IteratorRange<
805 typename GV::template Codim<codim>::Iterator
807 return return_type(gv.template begin<codim>(),gv.template end<codim>());
813 template<
typename Entity>
814 inline IteratorRange<typename Entity::HierarchicIterator> descendantElements(
const Entity& e,
int maxLevel)
816 typedef IteratorRange<typename Entity::HierarchicIterator> return_type;
817 return return_type(e.hbegin(maxLevel),e.hend(maxLevel));
823 template<
typename GV,
typename Entity>
824 inline IteratorRange<typename GV::IntersectionIterator> intersections(
const GV& gv,
const Entity& e)
826 return IteratorRange<typename GV::IntersectionIterator>(gv.ibegin(e),gv.iend(e));
835 template<
typename GV,
int dim,
unsigned int partitions>
836 inline auto entities(
const GV& gv, Dim<dim>, PartitionSet<partitions>)
837 -> decltype(entities(gv,Codim<GV::dimension - dim>(),PartitionSet<partitions>()))
839 static_assert(0 <= dim && dim <= GV::dimension,
"invalid dimension for given GridView");
840 return entities(gv,Codim<GV::dimension - dim>(),PartitionSet<partitions>());
843 template<
typename GV,
int dim>
844 inline auto entities(
const GV& gv, Dim<dim>)
845 -> decltype(entities(gv,Codim<GV::dimension - dim>()))
847 static_assert(0 <= dim && dim <= GV::dimension,
"invalid dimension for given GridView");
848 return entities(gv,Codim<GV::dimension - dim>());
851 template<
typename GV,
unsigned int partitions>
852 inline auto elements(
const GV& gv, PartitionSet<partitions>)
853 -> decltype(entities(gv,Codim<0>(),PartitionSet<partitions>()))
855 return entities(gv,Codim<0>(),PartitionSet<partitions>());
858 template<
typename GV>
859 inline auto elements(
const GV& gv)
860 -> decltype(entities(gv,Codim<0>()))
862 return entities(gv,Codim<0>());
865 template<
typename GV,
unsigned int partitions>
866 inline auto facets(
const GV& gv, PartitionSet<partitions>)
867 -> decltype(entities(gv,Codim<1>(),PartitionSet<partitions>()))
869 return entities(gv,Codim<1>(),PartitionSet<partitions>());
872 template<
typename GV>
873 inline auto facets(
const GV& gv)
874 -> decltype(entities(gv,Codim<1>()))
876 return entities(gv,Codim<1>());
879 template<
typename GV,
unsigned int partitions>
880 inline auto edges(
const GV& gv, PartitionSet<partitions>)
881 -> decltype(entities(gv,Dim<1>(),PartitionSet<partitions>()))
883 return entities(gv,Dim<1>(),PartitionSet<partitions>());
886 template<
typename GV>
887 inline auto edges(
const GV& gv)
888 -> decltype(entities(gv,Dim<1>()))
890 return entities(gv,Dim<1>());
893 template<
typename GV,
unsigned int partitions>
894 inline auto vertices(
const GV& gv, PartitionSet<partitions>)
895 -> decltype(entities(gv,Dim<0>(),PartitionSet<partitions>()))
897 return entities(gv,Dim<0>(),PartitionSet<partitions>());
900 template<
typename GV>
901 inline auto vertices(
const GV& gv)
902 -> decltype(entities(gv,Dim<0>()))
904 return entities(gv,Dim<0>());
907 #endif // HAVE_RANGE_BASED_FOR
917 #endif // DUNE_GRID_COMMON_RANGEGENERATORS_HH
Include standard header files.
Definition: agrid.hh:59
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:134