/usr/include/dune/grid-glue/adapter/rangegenerators.hh is in libdune-grid-glue-dev 2.4.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | #ifndef DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH
#define DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH
#include <dune/common/version.hh>
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
# include <dune/common/iteratorrange.hh>
#endif
namespace Dune {
namespace GridGlue {
/**
* Static tag representing reversal of in- and outside of intersecions.
*/
template<bool reverse>
struct Reverse
: std::integral_constant<bool, reverse>
{
typedef Reverse type;
constexpr
Reverse<!reverse> operator!() const
{ return {}; }
};
#ifdef DOXYGEN
/**
* Static tag representing reversal of in- and outside of intersections.
* \relates Reverse
*/
const Reverse<true> reversed;
/**
* \brief Iterate over all intersections of a GridGlue.
*
* This function returns an object representing the range of intersections
* with respect to the GridGlue glue. Its main purpose is to enable iteration
* over these intersections by means of a range-based for loop:
*
* \code
* // Iterate over all intersections of a GridGlue in various ways
* using Dune::GridGlue::GridGlue;
* using Dune::GridGlue::Reverse;
* using Dune::GridGlue::reversed;
*
* GridGlue<...> glue;
* for (const auto& in : intersections(glue)) { ... }
* for (const auto& in : intersections(glue, reversed)) { ... }
* for (const auto& in : intersections(glue, !reversed)) { ... }
* for (const auto& in : intersections(glue, Reversed<true>())) { ... }
* \endcode
*
* The in- and outside of the intersection can be reversed by passing
* `reversed` as the second argument. The fourth form can be used in
* case a template parameter for reversal is required.
*
* \since dune-common 2.4
* \relatesalso Dune::GridGlue::GridGlue
* \param glue GridGlue to obtain the intersections from
* \param reverse Tag to indicate reversal of in- and outside of intersections
* \returns an unspecified object that is guaranteed to fulfill the interface
* of IteratorRange and that can be iterated over using a range-based
* for loop.
* \see Dune::GridGlue::Intersection
*/
template<...>
IteratorRange<...>
intersections(const GridGlue<...>& glue, const Reverse<...>& reverse = !reversed);
#else
namespace {
const Reverse<true> reversed = {};
} /* namespace */
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
template<typename P0, typename P1, bool reverse = false>
IteratorRange<typename GridGlueView<P0, P1, reverse ? 1 : 0>::IntersectionIterator>
intersections(const GridGlue<P0, P1>& glue, const Reverse<reverse>& = {})
{
const static int side = reverse ? 1 : 0;
return {glue.template ibegin<side>(), glue.template iend<side>()};
}
#endif
#endif // DOXYGEN
} /* namespace GridGlue */
} /* namespace Dune */
#endif
|