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>
241 template<
typename GV>
242 inline IteratorRange<...> elements(
const GV& gv);
276 template<
typename GV>
277 inline IteratorRange<...> facets(
const GV& gv);
311 template<
typename GV>
312 inline IteratorRange<...> edges(
const GV& gv);
346 template<
typename GV>
347 inline IteratorRange<...> vertices(
const GV& gv);
383 template<
typename GV,
typename Entity>
384 inline IteratorRange<...> intersections(
const GV& gv,
const Entity& e);
424 template<
typename Entity>
425 inline IteratorRange<...> descendantElements(
const Entity& e,
int maxLevel);
477 template<
typename GV,
int codim>
478 inline IteratorRange<...> entities(
const GV& gv, Codim<codim> cd);
523 template<
typename GV,
int dim>
524 inline IteratorRange<...> entities(
const GV& gv, Dim<dim> d);
563 template<
typename GV,
unsigned int partitions>
564 inline IteratorRange<...> elements(
const GV& gv, PartitionSet<partitions> ps);
598 template<
typename GV,
unsigned int partitions>
599 inline IteratorRange<...> facets(
const GV& gv, PartitionSet<partitions> ps);
630 template<
typename GV,
unsigned int partitions>
631 inline IteratorRange<...> edges(
const GV& gv, PartitionSet<partitions> ps);
662 template<
typename GV,
unsigned int partitions>
663 inline IteratorRange<...> vertices(
const GV& gv, PartitionSet<partitions> ps);
712 template<
typename GV,
int codim,
unsigned int partitions>
713 inline IteratorRange<...> entities(
const GV& gv gv, Codim<codim> cd, PartitionSet<partitions> ps);
754 template<
typename GV,
int dim,
unsigned int partitions>
755 inline IteratorRange<...> entities(
const GV& gv, Dim<dim> d, PartitionSet<partitions> ps);
764 #if HAVE_RANGE_BASED_FOR
780 template<
typename GV,
int codim,
unsigned int partitions>
781 inline IteratorRange<
782 typename GV::template Codim<codim>::template Partition<
783 derive_partition_iterator_type<partitions>::value
786 entities(
const GV& gv, Codim<codim>, PartitionSet<partitions>)
788 static_assert(0 <= codim && codim <= GV::dimension,
"invalid codimension for given GridView");
790 typedef IteratorRange<
791 typename GV::template Codim<codim>::template Partition<pit>::Iterator
793 return return_type(gv.template begin<codim,pit>(),gv.template end<codim,pit>());
803 template<
typename GV,
int codim>
804 inline IteratorRange<
805 typename GV::template Codim<codim>::Iterator
807 entities(
const GV& gv, Codim<codim>)
809 static_assert(0 <= codim && codim <= GV::dimension,
"invalid codimension for given GridView");
810 typedef IteratorRange<
811 typename GV::template Codim<codim>::Iterator
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>());
913 #endif // HAVE_RANGE_BASED_FOR
923 #endif // DUNE_GRID_COMMON_RANGEGENERATORS_HH
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:134
Include standard header files.
Definition: agrid.hh:59