Dune Core Modules (2.7.0)

rangegenerators.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_GRID_COMMON_RANGEGENERATORS_HH
4#define DUNE_GRID_COMMON_RANGEGENERATORS_HH
5
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>
10
11namespace Dune
12{
13
14#ifdef DOXYGEN
15
184 // *****************************************************************************************
185 // Doxygen documentation
186 // *****************************************************************************************
187 //
188 // In the following, the range generating functions are documented for Doxygen; the actual
189 // implementations are further down in this file and hidden from Doxygen.
190 // The main reason for this split are the return types of those functions, which either contain
191 // long type listings to obtain the iterator type or (in the case of the forwarded functions
192 // use the new-style function syntax and calculate the return type using decltype. In both cases,
193 // Doxygen generates function signatures that are very confusing to the average user.
194 //
195 // *****************************************************************************************
196
197
198
202
203
205
234 template<typename GV>
235 inline IteratorRange<...> elements(const GV& gv);
236
237
239
268 template<typename GV>
269 inline IteratorRange<...> facets(const GV& gv);
270
271
273
302 template<typename GV>
303 inline IteratorRange<...> edges(const GV& gv);
304
305
307
336 template<typename GV>
337 inline IteratorRange<...> vertices(const GV& gv);
338
339
341
342
343
347
349
372 template<typename GV, typename Entity>
373 inline IteratorRange<...> intersections(const GV& gv, const Entity& e);
374
375
377
378
379
383
384
386
412 template<typename Entity>
413 inline IteratorRange<...> descendantElements(const Entity& e, int maxLevel);
414 // Entity<int dim, class GridImp, template<int,int,class> class EntityImp>
415
417
418
419
423
424
426
464 template<typename GV, int codim>
465 inline IteratorRange<...> entities(const GV& gv, Codim<codim> cd);
466
467
469
509 template<typename GV, int dim>
510 inline IteratorRange<...> entities(const GV& gv, Dim<dim> d);
511
513
514
515
519
520
522
548 template<typename GV, unsigned int partitions>
549 inline IteratorRange<...> elements(const GV& gv, PartitionSet<partitions> ps);
550
551
553
582 template<typename GV, unsigned int partitions>
583 inline IteratorRange<...> facets(const GV& gv, PartitionSet<partitions> ps);
584
585
587
613 template<typename GV, unsigned int partitions>
614 inline IteratorRange<...> edges(const GV& gv, PartitionSet<partitions> ps);
615
616
618
644 template<typename GV, unsigned int partitions>
645 inline IteratorRange<...> vertices(const GV& gv, PartitionSet<partitions> ps);
646
648
649
650
654
655
657
693 template<typename GV, int codim, unsigned int partitions>
694 inline IteratorRange<...> entities(const GV& gv gv, Codim<codim> cd, PartitionSet<partitions> ps);
695
696
698
734 template<typename GV, int dim, unsigned int partitions>
735 inline IteratorRange<...> entities(const GV& gv, Dim<dim> d, PartitionSet<partitions> ps);
736
737
739
740
741#else // DOXYGEN
742
743 // ******************************************************************************************
744 // Implementations
745 // ******************************************************************************************
746
747
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>())>
760 {
761 static_assert(0 <= codim && codim <= GV::dimension, "invalid codimension for given GridView");
762 const PartitionIteratorType pit = derive_partition_iterator_type<partitions>::value;
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>());
765 }
766
774 template<typename GV, int codim>
775 inline auto entities(const GV& gv, Codim<codim>)
776 -> IteratorRange<decltype(gv.template begin<codim>())>
777 {
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>());
781 }
782
786 template<typename Entity>
787 inline IteratorRange<typename Entity::HierarchicIterator> descendantElements(const Entity& e, int maxLevel)
788 {
789 typedef IteratorRange<typename Entity::HierarchicIterator> return_type;
790 return return_type(e.hbegin(maxLevel),e.hend(maxLevel));
791 }
792
796 template<typename GV, typename Entity>
797 inline auto intersections(const GV& gv, const Entity& e)
798 -> IteratorRange<decltype(gv.ibegin(e))>
799 {
800 return IteratorRange<decltype(gv.ibegin(e))>(gv.ibegin(e),gv.iend(e));
801 }
802
803
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>()))
812 {
813 static_assert(0 <= dim && dim <= GV::dimension, "invalid dimension for given GridView");
814 return entities(gv,Codim<GV::dimension - dim>(),PartitionSet<partitions>());
815 }
816
817 template<typename GV, int dim>
818 inline auto entities(const GV& gv, Dim<dim>)
819 -> decltype(entities(gv,Codim<GV::dimension - dim>()))
820 {
821 static_assert(0 <= dim && dim <= GV::dimension, "invalid dimension for given GridView");
822 return entities(gv,Codim<GV::dimension - dim>());
823 }
824
825 template<typename GV, unsigned int partitions>
826 inline auto elements(const GV& gv, PartitionSet<partitions>)
827 -> decltype(entities(gv,Codim<0>(),PartitionSet<partitions>()))
828 {
829 return entities(gv,Codim<0>(),PartitionSet<partitions>());
830 }
831
832 template<typename GV>
833 inline auto elements(const GV& gv)
834 -> decltype(entities(gv,Codim<0>()))
835 {
836 return entities(gv,Codim<0>());
837 }
838
839 template<typename GV, unsigned int partitions>
840 inline auto facets(const GV& gv, PartitionSet<partitions>)
841 -> decltype(entities(gv,Codim<1>(),PartitionSet<partitions>()))
842 {
843 return entities(gv,Codim<1>(),PartitionSet<partitions>());
844 }
845
846 template<typename GV>
847 inline auto facets(const GV& gv)
848 -> decltype(entities(gv,Codim<1>()))
849 {
850 return entities(gv,Codim<1>());
851 }
852
853 template<typename GV, unsigned int partitions>
854 inline auto edges(const GV& gv, PartitionSet<partitions>)
855 -> decltype(entities(gv,Dim<1>(),PartitionSet<partitions>()))
856 {
857 return entities(gv,Dim<1>(),PartitionSet<partitions>());
858 }
859
860 template<typename GV>
861 inline auto edges(const GV& gv)
862 -> decltype(entities(gv,Dim<1>()))
863 {
864 return entities(gv,Dim<1>());
865 }
866
867 template<typename GV, unsigned int partitions>
868 inline auto vertices(const GV& gv, PartitionSet<partitions>)
869 -> decltype(entities(gv,Dim<0>(),PartitionSet<partitions>()))
870 {
871 return entities(gv,Dim<0>(),PartitionSet<partitions>());
872 }
873
874 template<typename GV>
875 inline auto vertices(const GV& gv)
876 -> decltype(entities(gv,Dim<0>()))
877 {
878 return entities(gv,Dim<0>());
879 }
880
881#endif // DOXYGEN
882
887} // namespace Dune
888
889#endif // DUNE_GRID_COMMON_RANGEGENERATORS_HH
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.
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:134
Dune namespace.
Definition: alignedallocator.hh:14
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
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)