version 3.11-dev
Loading...
Searching...
No Matches
pq2/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//
17#ifndef DUMUX_DISCRETIZATION_PQ2_DOF_HELPER_HH
18#define DUMUX_DISCRETIZATION_PQ2_DOF_HELPER_HH
19
20#include <dune/common/fvector.hh>
21#include <dune/geometry/referenceelements.hh>
22
23namespace Dumux {
24
34template<class GridView>
36{
37 using Scalar = typename GridView::ctype;
38 static constexpr int dim = GridView::dimension;
39 using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimensionworld>;
40
43 template<class DofMapper, class Element, class LocalKey, class IdSet>
44 static std::size_t dofIndex(const DofMapper& m, const Element& e,
45 const LocalKey& lk, const IdSet& /*idSet*/)
46 { return m.subIndex(e, lk.subEntity(), lk.codim()); }
47
49 template<class DofMapper, class Element, class LocalKey>
50 static std::size_t dofIndex(const DofMapper& m, const Element& e, const LocalKey& lk)
51 { return m.subIndex(e, lk.subEntity(), lk.codim()); }
52
54 template<class Geometry, class LocalKey>
55 static GlobalPosition dofPosition(const Geometry& geo, const LocalKey& lk)
56 {
57 if (lk.codim() == dim) return geo.corner(lk.subEntity());
58 if (lk.codim() == 0) return geo.center();
59 const auto& ref = Dune::referenceElement<Scalar, dim>(geo.type());
60 return geo.global(ref.position(lk.subEntity(), lk.codim()));
61 }
62};
63
64} // namespace Dumux
65
66#endif // DUMUX_DISCRETIZATION_PQ2_DOF_HELPER_HH
Definition adapt.hh:17
DOF index and position helper for order-2 Lagrange discretizations.
Definition pq2/dofhelper.hh:36
Dune::FieldVector< Scalar, GridView::dimensionworld > GlobalPosition
Definition pq2/dofhelper.hh:39
typename GridView::ctype Scalar
Definition pq2/dofhelper.hh:37
static constexpr int dim
Definition pq2/dofhelper.hh:38
static std::size_t dofIndex(const DofMapper &m, const Element &e, const LocalKey &lk, const IdSet &)
Definition pq2/dofhelper.hh:44
static GlobalPosition dofPosition(const Geometry &geo, const LocalKey &lk)
Physical position of the DOF in global coordinates.
Definition pq2/dofhelper.hh:55
static std::size_t dofIndex(const DofMapper &m, const Element &e, const LocalKey &lk)
Global DOF index for the given local key (3-argument overload, no id-set).
Definition pq2/dofhelper.hh:50