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
22
23namespace Dumux {
24
30template<class GridView>
32{
33 using Scalar = typename GridView::ctype;
34 using LocalIndexType = typename IndexTraits<GridView>::LocalIndex;
35 using GridIndexType = typename IndexTraits<GridView>::GridIndex;
36
37 static constexpr auto dim = GridView::dimension;
38public:
40 static auto numLocalDofsIntersection(Dune::GeometryType type, unsigned int iIdx)
41 {
42 return Dune::referenceElement<Scalar, dim>(type).size(iIdx, 1, dim);
43 }
44
46 static auto localDofIndexIntersection(Dune::GeometryType type, unsigned int iIdx, unsigned int localDofIdx)
47 {
48 return Dune::referenceElement<Scalar, dim>(type).subEntity(iIdx, 1, localDofIdx, dim);
49 }
50
55 template<class ElemDisc, class BoundaryFace>
56 static auto localDofsOnBoundaryFace(const ElemDisc& elemDisc, const BoundaryFace& boundaryFace)
57 {
58 return Dune::transformedRangeView(
59 Dune::range(numLocalDofsIntersection(elemDisc.element().type(), boundaryFace.intersectionIndex())),
60 [&](const auto i) {
61 auto localDofIdx = localDofIndexIntersection(elemDisc.element().type(), boundaryFace.intersectionIndex(), i);
62 return CVFE::LocalDof(
63 static_cast<LocalIndexType>(localDofIdx),
64 static_cast<GridIndexType>(Dumux::Experimental::FEDofHelper<GridView>::dofIndex(
65 elemDisc.gridGeometry().dofMapper(),
66 elemDisc.element(),
67 elemDisc.feLocalCoefficients().localKey(localDofIdx))),
68 static_cast<GridIndexType>(elemDisc.elementIndex())
69 );
70 }
71 );
72 }
73};
74
75} // namespace Dumux
76
77#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:32
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:46
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:56
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:40
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