24#ifndef DUMUX_DISCRETIZATION_LOCAL_INTERSECTION_INDEX_MAPPER_HH
25#define DUMUX_DISCRETIZATION_LOCAL_INTERSECTION_INDEX_MAPPER_HH
29#include <dune/common/float_cmp.hh>
40template<
class Gr
idView,
bool consistentlyOrientedGr
id>
49template<
class Gr
idView>
53 using Element =
typename GridView::template Codim<0>::Entity;
54 static constexpr auto numElementFaces = GridView::Grid::dimension * 2;
56 void update(
const GridView& gv,
const Element& element)
58 static const bool makeConsistentlyOriented = getParam<bool>(
"Grid.MakeConsistentlyOriented",
true);
59 if (!makeConsistentlyOriented)
61 std::iota(realToRefMap_.begin(), realToRefMap_.end(), 0);
62 refToRealMap_ = realToRefMap_;
66 for (
const auto& is : intersections(gv, element))
68 const auto& otherOuterNormal = is.centerUnitOuterNormal();
70 const int positveOrientation = !std::signbit(otherOuterNormal[idx]);
71 const auto refIdx = idx * 2 + positveOrientation;
72 const auto realIdx = is.indexInInside();
73 realToRefMap_[realIdx] = refIdx;
74 refToRealMap_[refIdx] = realIdx;
79 SmallLocalIndexType
realToRefIdx(
const SmallLocalIndexType localIsIdx)
const
80 {
return realToRefMap_[localIsIdx]; }
83 SmallLocalIndexType
refToRealIdx(
const SmallLocalIndexType localIsIdx)
const
84 {
return refToRealMap_[localIsIdx]; }
87 std::array<SmallLocalIndexType, numElementFaces> realToRefMap_ = {};
88 std::array<SmallLocalIndexType, numElementFaces> refToRealMap_ = {};
99template<
class Gr
idView>
103 using Element =
typename GridView::template Codim<0>::Entity;
107 void update(
const GridView&,
const Element&) {}
110 SmallLocalIndexType
realToRefIdx(
const SmallLocalIndexType localIsIdx)
const
111 {
return localIsIdx; }
114 SmallLocalIndexType
refToRealIdx(
const SmallLocalIndexType localIsIdx)
const
115 {
return localIsIdx; }
127template<
class Gr
idView>
Defines the index types used for grid and local indices.
Define some often used mathematical functions.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Returns the normal axis index of a unit vector (0 = x, 1 = y, 2 = z)
static std::size_t normalAxis(const Vector &v)
Definition: normalaxis.hh:39
std::uint_least8_t SmallLocalIndex
Definition: indextraits.hh:41
Definition: localintersectionindexmapper.hh:41
SmallLocalIndexType refToRealIdx(const SmallLocalIndexType localIsIdx) const
Return the intersection's local reference indexInElement given an actual local index.
Definition: localintersectionindexmapper.hh:83
void update(const GridView &gv, const Element &element)
Definition: localintersectionindexmapper.hh:56
SmallLocalIndexType realToRefIdx(const SmallLocalIndexType localIsIdx) const
Return the intersection's actual local indexInElement given a local reference index.
Definition: localintersectionindexmapper.hh:79
SmallLocalIndexType realToRefIdx(const SmallLocalIndexType localIsIdx) const
Return the intersection's actual local indexInElement given a local reference index.
Definition: localintersectionindexmapper.hh:110
SmallLocalIndexType refToRealIdx(const SmallLocalIndexType localIsIdx) const
Return the intersection's local reference indexInElement given an actual local index.
Definition: localintersectionindexmapper.hh:114
void update(const GridView &, const Element &)
Update the map for getting the corresponding local face indices in another element.
Definition: localintersectionindexmapper.hh:107