DUNE PDELab (git)

functionaldescriptor.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
5// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
6#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_FUNCTIONALDESCRIPTOR_HH
7#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_FUNCTIONALDESCRIPTOR_HH
8
9#include <array>
10
11
12namespace Dune::Functions::Impl
13{
14
15
16
33template<std::size_t dim>
34class FunctionalDescriptor
35{
36public:
37
38 using Order = std::array<unsigned int, dim>;
39
40 FunctionalDescriptor()
41 : partialDerivativeOrder_{}
42 , normalDerivativeOrder_(0)
43 {}
44
45 explicit FunctionalDescriptor(const Order& partialDerivativeOrder)
46 : partialDerivativeOrder_{partialDerivativeOrder}
47 , normalDerivativeOrder_(0)
48 {}
49
50 explicit FunctionalDescriptor(unsigned int normalDerivativeOrder)
51 : partialDerivativeOrder_{}
52 , normalDerivativeOrder_(normalDerivativeOrder)
53 {}
54
55 bool isNormalDerivative() const
56 {
57 return normalDerivativeOrder_>0;
58 }
59
60 bool isPartialDerivative() const
61 {
62 for(auto i: Dune::range(dim))
63 {
64 if (partialDerivativeOrder(i)>0)
65 return true;
66 }
67 return false;
68 }
69
70 unsigned int normalDerivativeOrder() const
71 {
72 return normalDerivativeOrder_;
73 }
74
75 const Order& partialDerivativeOrder() const
76 {
77 return partialDerivativeOrder_;
78 }
79
80private:
81 Order partialDerivativeOrder_;
82 unsigned int normalDerivativeOrder_;
83};
84
85
86
87} // namespace Dune::Functions::Impl
88
89#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_FUNCTIONALDESCRIPTOR_HH
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)