Dune-Functions 2.11
Loading...
Searching...
No Matches
functionaldescriptor.hh
Go to the documentation of this file.
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#include <dune/common/rangeutilities.hh>
12
13
14namespace Dune::Functions::Impl
15{
16
17
18
35template<std::size_t dim>
36class FunctionalDescriptor
37{
38public:
39
40 using Order = std::array<unsigned int, dim>;
41
42 FunctionalDescriptor()
43 : partialDerivativeOrder_{}
44 , normalDerivativeOrder_(0)
45 {}
46
47 explicit FunctionalDescriptor(const Order& partialDerivativeOrder)
48 : partialDerivativeOrder_{partialDerivativeOrder}
49 , normalDerivativeOrder_(0)
50 {}
51
52 explicit FunctionalDescriptor(unsigned int normalDerivativeOrder)
53 : partialDerivativeOrder_{}
54 , normalDerivativeOrder_(normalDerivativeOrder)
55 {}
56
57 bool isNormalDerivative() const
58 {
59 return normalDerivativeOrder_>0;
60 }
61
62 bool isPartialDerivative() const
63 {
64 for(auto i: Dune::range(dim))
65 {
66 if (partialDerivativeOrder(i)>0)
67 return true;
68 }
69 return false;
70 }
71
72 unsigned int normalDerivativeOrder() const
73 {
74 return normalDerivativeOrder_;
75 }
76
77 const Order& partialDerivativeOrder() const
78 {
79 return partialDerivativeOrder_;
80 }
81
82private:
83 Order partialDerivativeOrder_;
84 unsigned int normalDerivativeOrder_;
85};
86
87
88
89} // namespace Dune::Functions::Impl
90
91#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_FUNCTIONALDESCRIPTOR_HH