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> 234 template<
typename GV>
235 inline IteratorRange<...> elements(
const GV& gv);
268 template<
typename GV>
269 inline IteratorRange<...> facets(
const GV& gv);
302 template<
typename GV>
303 inline IteratorRange<...> edges(
const GV& gv);
336 template<
typename GV>
337 inline IteratorRange<...> vertices(
const GV& gv);
372 template<
typename GV,
typename Entity>
373 inline IteratorRange<...> intersections(
const GV& gv,
const Entity& e);
412 template<
typename Entity>
413 inline IteratorRange<...> descendantElements(
const Entity& e,
int maxLevel);
464 template<
typename GV,
int codim>
465 inline IteratorRange<...> entities(
const GV& gv, Codim<codim> cd);
509 template<
typename GV,
int dim>
510 inline IteratorRange<...> entities(
const GV& gv, Dim<dim> d);
548 template<
typename GV,
unsigned int partitions>
549 inline IteratorRange<...> elements(
const GV& gv, PartitionSet<partitions> ps);
582 template<
typename GV,
unsigned int partitions>
583 inline IteratorRange<...> facets(
const GV& gv, PartitionSet<partitions> ps);
613 template<
typename GV,
unsigned int partitions>
614 inline IteratorRange<...> edges(
const GV& gv, PartitionSet<partitions> ps);
644 template<
typename GV,
unsigned int partitions>
645 inline IteratorRange<...> vertices(
const GV& gv, PartitionSet<partitions> ps);
693 template<
typename GV,
int codim,
unsigned int partitions>
694 inline IteratorRange<...> entities(
const GV& gv gv, Codim<codim> cd, PartitionSet<partitions> ps);
734 template<
typename GV,
int dim,
unsigned int partitions>
735 inline IteratorRange<...> entities(
const GV& gv, Dim<dim> d, PartitionSet<partitions> ps);
757 template<
typename GV,
int codim,
unsigned int partitions>
758 inline auto entities(
const GV& gv, Codim<codim>, PartitionSet<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>
775 inline auto entities(
const GV& gv, Codim<codim>)
776 -> IteratorRange<decltype(gv.template begin<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>());
889 #endif // DUNE_GRID_COMMON_RANGEGENERATORS_HH Include standard header files.
Definition: agrid.hh:58
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:134