4#ifndef DUNE_FUFEM_FUNCTIONTOOLS_P0P1INTERPOLATION_HH
5#define DUNE_FUFEM_FUNCTIONTOOLS_P0P1INTERPOLATION_HH
14template <
class Gr
idView,
class Vector>
16 Vector
const &p0Data) {
17 auto const &gridView = patch.
gridView();
20 gridView.size(GridView::dimension));
23 Vector ret(surroundingArea.
size());
26 auto const &indexSet = gridView.indexSet();
27 for (
auto const &intersection : patch) {
28 auto const &inside = intersection.inside();
30 Dune::ReferenceElements<double, GridView::dimension>::general(
32 auto const globalElementIndex = indexSet.
index(inside);
34 auto const localFaceIndex = intersection.indexInInside();
35 auto const &face = inside.template subEntity<1>(localFaceIndex);
37 auto const area = face.geometry().volume();
39 int const numVertices =
40 refElement.size(localFaceIndex, 1, GridView::dimension);
41 for (
int i = 0; i < numVertices; i++) {
42 auto const localVertexIndex =
43 refElement.subEntity(localFaceIndex, 1, i, GridView::dimension);
44 auto const globalVertexIndex =
45 indexSet.
subIndex(inside, localVertexIndex, GridView::dimension);
47 surroundingArea[globalVertexIndex] += area;
48 ret[globalVertexIndex] += p0Data[globalElementIndex];
52 for (
size_t i = 0; i < ret.size(); ++i)
54 ret[i] /= surroundingArea[i];
60template <
class Gr
idView,
class Vector>
62 Vector
const &p0Data) {
64 unsigned int const dim = GridView::dimension;
69 Vector ret(surroundingArea.
size());
72 auto const &indexSet = gridView.indexSet();
73 for (
auto const &element : elements(gridView)) {
75 Dune::ReferenceElements<double, dim>::general(
77 auto const globalElementIndex = indexSet.
index(element);
78 auto const area = element.geometry().volume();
80 int const numVertices = refElement.size(
dim);
81 for (
int i = 0; i < numVertices; i++) {
82 auto const globalVertexIndex = indexSet.
subIndex(element, i,
dim);
84 surroundingArea[globalVertexIndex] += area;
85 ret[globalVertexIndex] += p0Data[globalElementIndex];
89 for (
size_t i = 0; i < ret.size(); ++i)
90 ret[i] /= surroundingArea[i];
IndexType subIndex(const typename Traits::template Codim< cc >::Entity &e, int i, unsigned int codim) const
IndexType index(const typename Traits::template Codim< cc >::Entity &e) const
Encapsulate a part of a grid boundary.
Definition boundarypatch.hh:218
bool containsVertex(size_t v) const
Definition boundarypatch.hh:366
const GridView & gridView() const
Return reference to the carrier grid view.
Definition domains/boundarypatch.hh:197
Vector interpolateP0ToP1(BoundaryPatch< GridView > const &patch, Vector const &p0Data)
Clement-type operator that interpolates P0-data of grid elements to P1-data of vertices that belong t...
Definition p0p1interpolation.hh:15