Dune Core Modules (2.9.0)

coefficients.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5
6#ifndef DUNE_LOCALFUNCTIONS_META_POWER_COEFFICIENTS_HH
7#define DUNE_LOCALFUNCTIONS_META_POWER_COEFFICIENTS_HH
8
9#include <cstddef>
10#include <vector>
11
12#include <dune/localfunctions/common/localkey.hh>
13
14namespace Dune {
15
18
23 std::vector<LocalKey> keys;
24
25 public:
27
35 template<class Backend>
36 PowerCoefficients(const Backend &backend, std::size_t power) :
37 keys(backend.size()*power)
38 {
39 for(std::size_t i = 0; i < backend.size(); ++i) {
40 const LocalKey &k = backend.localKey(i);
41 for(std::size_t d = 0; d < power; ++d)
42 keys[i+d*backend.size()] =
43 LocalKey(k.subEntity(), k.codim(), power*k.index() + d);
44 }
45 }
47 inline std::size_t size() const { return keys.size(); }
48
50 inline const LocalKey& localKey(std::size_t i) const { return keys[i]; }
51 };
52
53} // namespace Dune
54
55#endif // DUNE_LOCALFUNCTIONS_META_POWER_COEFFICIENTS_HH
Describe position of one degree of freedom.
Definition: localkey.hh:23
unsigned int index() const
Return offset within subentity.
Definition: localkey.hh:68
unsigned int codim() const
Return codim of associated entity.
Definition: localkey.hh:62
unsigned int subEntity() const
Return number of associated subentity.
Definition: localkey.hh:56
Meta-coefficients turning a scalar coefficients into vector-valued coefficients.
Definition: coefficients.hh:22
std::size_t size() const
number of coefficients
Definition: coefficients.hh:47
PowerCoefficients(const Backend &backend, std::size_t power)
Construct a PowerCoefficients object.
Definition: coefficients.hh:36
const LocalKey & localKey(std::size_t i) const
get i'th index
Definition: coefficients.hh:50
Dune namespace.
Definition: alignedallocator.hh:13
constexpr Base power(Base m, Exponent p)
Power method for integer exponents.
Definition: math.hh:75
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)