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
24
25namespace Dumux {
26
33template <class GridView, std::size_t numCubeBubbleDofs>
35{
36 using Scalar = typename GridView::ctype;
37 using LocalIndexType = typename IndexTraits<GridView>::LocalIndex;
38 using GridIndexType = typename IndexTraits<GridView>::GridIndex;
39
40 using Element = typename GridView::template Codim<0>::Entity;
41
42 static constexpr auto dim = GridView::dimension;
43
44public:
45
47 static std::size_t numElementDofs(Dune::GeometryType type)
48 {
49 const auto numVertexDofs = Dune::referenceElement<Scalar, dim>(type).size(dim);
50 return numVertexDofs + (type.isCube() ? numCubeBubbleDofs : 1);
51 }
52
54 static auto numLocalDofsIntersection(Dune::GeometryType type, unsigned int iIdx)
55 {
56 return Dune::referenceElement<Scalar, dim>(type).size(iIdx, 1, dim);
57 }
58
60 static auto localDofIndexIntersection(Dune::GeometryType type, unsigned int iIdx, unsigned int ilocalDofIdx)
61 {
62 return Dune::referenceElement<Scalar, dim>(type).subEntity(iIdx, 1, ilocalDofIdx, dim);
63 }
64
69 template<class ElemDisc, class BoundaryFace>
70 static auto localDofsOnBoundaryFace(const ElemDisc& elemDisc, const BoundaryFace& boundaryFace)
71 {
72 return Dune::transformedRangeView(
73 Dune::range(numLocalDofsIntersection(elemDisc.element().type(), boundaryFace.intersectionIndex())),
74 [&](const auto i) {
75 auto localDofIdx = localDofIndexIntersection(elemDisc.element().type(), boundaryFace.intersectionIndex(), i);
76 return CVFE::LocalDof(
77 static_cast<LocalIndexType>(localDofIdx),
78 static_cast<GridIndexType>(Dumux::Experimental::FEDofHelper<GridView>::dofIndex(
79 elemDisc.gridGeometry().dofMapper(),
80 elemDisc.element(),
81 elemDisc.feLocalCoefficients().localKey(localDofIdx))),
82 static_cast<GridIndexType>(elemDisc.elementIndex())
83 );
84 }
85 );
86 }
87};
88
89} // namespace Dumux
90
91#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:35
static auto numLocalDofsIntersection(Dune::GeometryType type, unsigned int iIdx)
Number of local dofs related to an intersection with index iIdx.
Definition pq1bubble/dofhelper.hh:54
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:70
static std::size_t numElementDofs(Dune::GeometryType type)
number of element dofs
Definition pq1bubble/dofhelper.hh:47
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:60
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