version 3.11-dev
Loading...
Searching...
No Matches
pq1bubble/dofhelper.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_DISCRETIZATION_PQ1BUBBLE_DOF_HELPER_HH
13#define DUMUX_DISCRETIZATION_PQ1BUBBLE_DOF_HELPER_HH
14
15#include <cstddef>
16
17#include <dune/common/rangeutilities.hh>
18#include <dune/geometry/type.hh>
19#include <dune/geometry/referenceelements.hh>
20
25
26namespace Dumux {
27
34template <class GridView, std::size_t numCubeBubbleDofs>
36{
37 using Scalar = typename GridView::ctype;
38 using LocalIndexType = typename IndexTraits<GridView>::LocalIndex;
39 using GridIndexType = typename IndexTraits<GridView>::GridIndex;
40
41 using Element = typename GridView::template Codim<0>::Entity;
42
43 static constexpr auto dim = GridView::dimension;
44
45public:
46
48 static std::size_t numElementDofs(Dune::GeometryType type)
49 {
50 const auto numVertexDofs = Dune::referenceElement<Scalar, dim>(type).size(dim);
51 return numVertexDofs + (type.isCube() ? numCubeBubbleDofs : 1);
52 }
53
55 static auto numLocalDofsIntersection(Dune::GeometryType type, unsigned int iIdx)
56 {
57 return Dune::referenceElement<Scalar, dim>(type).size(iIdx, 1, dim);
58 }
59
61 static auto localDofIndexIntersection(Dune::GeometryType type, unsigned int iIdx, unsigned int ilocalDofIdx)
62 {
63 return Dune::referenceElement<Scalar, dim>(type).subEntity(iIdx, 1, ilocalDofIdx, dim);
64 }
65
70 template<class ElemDisc, class BoundaryFace>
71 static auto localDofsOnBoundaryFace(const ElemDisc& elemDisc, const BoundaryFace& boundaryFace)
72 {
73 const auto& gridDiscretization = Deprecated::gridGeometry(elemDisc);
74 return Dune::transformedRangeView(
75 Dune::range(numLocalDofsIntersection(elemDisc.element().type(), boundaryFace.intersectionIndex())),
76 [&](const auto i) {
77 auto localDofIdx = localDofIndexIntersection(elemDisc.element().type(), boundaryFace.intersectionIndex(), i);
78 return CVFE::LocalDof(
79 static_cast<LocalIndexType>(localDofIdx),
80 static_cast<GridIndexType>(Dumux::Experimental::FEDofHelper<GridView>::dofIndex(
81 gridDiscretization.dofMapper(),
82 elemDisc.element(),
83 elemDisc.feLocalCoefficients().localKey(localDofIdx))),
84 static_cast<GridIndexType>(elemDisc.elementIndex())
85 );
86 }
87 );
88 }
89};
90
91} // namespace Dumux
92
93#endif // DUMUX_DISCRETIZATION_PQ1BUBBLE_DOF_HELPER_HH
Default Dof helper for finite-element discretizations providing dof-related utility functions....
Definition fedofhelper.hh:34
Dof helper for the PQ1Bubble method, providing the number of dofs and their positions.
Definition pq1bubble/dofhelper.hh:36
static auto numLocalDofsIntersection(Dune::GeometryType type, unsigned int iIdx)
Number of local dofs related to an intersection with index iIdx.
Definition pq1bubble/dofhelper.hh:55
static auto localDofsOnBoundaryFace(const ElemDisc &elemDisc, const BoundaryFace &boundaryFace)
Iterator range over all local dofs on a given boundary face. Overrides the less efficient default imp...
Definition pq1bubble/dofhelper.hh:71
static std::size_t numElementDofs(Dune::GeometryType type)
number of element dofs
Definition pq1bubble/dofhelper.hh:48
static auto localDofIndexIntersection(Dune::GeometryType type, unsigned int iIdx, unsigned int ilocalDofIdx)
Local dof index related to a localDof, with index ilocalDofIdx, on an intersection with index iIdx.
Definition pq1bubble/dofhelper.hh:61
Helpers for deprecation.
Default Dof helper for finite-element discretizations providing dof-related utility functions....
Defines the index types used for grid and local indices.
Class representing dofs on elements for control-volume finite element schemes.
Definition adapt.hh:17
typename GridView::IndexSet::IndexType GridIndex
Definition indextraits.hh:27
unsigned int LocalIndex
Definition indextraits.hh:28