version 3.11-dev
Loading...
Searching...
No Matches
pq1/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_PQ1_LAGRANGE_DOF_HELPER_HH
13#define DUMUX_DISCRETIZATION_PQ1_LAGRANGE_DOF_HELPER_HH
14
15#include <dune/common/rangeutilities.hh>
16#include <dune/geometry/type.hh>
17#include <dune/geometry/referenceelements.hh>
18
23
24namespace Dumux {
25
31template<class GridView>
33{
34 using Scalar = typename GridView::ctype;
35 using LocalIndexType = typename IndexTraits<GridView>::LocalIndex;
36 using GridIndexType = typename IndexTraits<GridView>::GridIndex;
37
38 static constexpr auto dim = GridView::dimension;
39public:
41 static auto numLocalDofsIntersection(Dune::GeometryType type, unsigned int iIdx)
42 {
43 return Dune::referenceElement<Scalar, dim>(type).size(iIdx, 1, dim);
44 }
45
47 static auto localDofIndexIntersection(Dune::GeometryType type, unsigned int iIdx, unsigned int localDofIdx)
48 {
49 return Dune::referenceElement<Scalar, dim>(type).subEntity(iIdx, 1, localDofIdx, dim);
50 }
51
56 template<class ElemDisc, class BoundaryFace>
57 static auto localDofsOnBoundaryFace(const ElemDisc& elemDisc, const BoundaryFace& boundaryFace)
58 {
59 return Dune::transformedRangeView(
60 Dune::range(numLocalDofsIntersection(elemDisc.element().type(), boundaryFace.intersectionIndex())),
61 [&](const auto i) {
62 auto localDofIdx = localDofIndexIntersection(elemDisc.element().type(), boundaryFace.intersectionIndex(), i);
63 return CVFE::LocalDof(
64 static_cast<LocalIndexType>(localDofIdx),
65 static_cast<GridIndexType>(Dumux::Experimental::FEDofHelper<GridView>::dofIndex(
66 gridDiscretization(elemDisc).dofMapper(),
67 elemDisc.element(),
68 elemDisc.feLocalCoefficients().localKey(localDofIdx))),
69 static_cast<GridIndexType>(elemDisc.elementIndex())
70 );
71 }
72 );
73 }
74};
75
76} // namespace Dumux
77
78#endif // DUMUX_DISCRETIZATION_PQ1_LAGRANGE_DOF_HELPER_HH
Default Dof helper for finite-element discretizations providing dof-related utility functions....
Definition fedofhelper.hh:34
Helper class providing degree of freedom information for the PQ1 Lagrange basis. The pq1 basis uses v...
Definition pq1/dofhelper.hh:33
static auto localDofIndexIntersection(Dune::GeometryType type, unsigned int iIdx, unsigned int localDofIdx)
Local dof index of the localDofIdx-th dof on intersection with index iIdx.
Definition pq1/dofhelper.hh:47
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 pq1/dofhelper.hh:57
static auto numLocalDofsIntersection(Dune::GeometryType type, unsigned int iIdx)
Number of local dofs related to an intersection with index iIdx (vertex dofs only).
Definition pq1/dofhelper.hh:41
Default Dof helper for finite-element discretizations providing dof-related utility functions....
Type traits for classes providing a grid discretization.
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