Dune-Fufem 2.11-git
Loading...
Searching...
No Matches
coefficient.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-FUFEM 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
7#ifndef DUNE_FUFEM_FORMS_COEFFICIENT_HH
8#define DUNE_FUFEM_FORMS_COEFFICIENT_HH
9
10#include <type_traits>
11#include <utility>
12
14
15#include <dune/istl/matrix.hh>
17
21
22
23
24
25namespace Dune::Fufem::Forms {
26
27
28
40 template<class F>
41 class Coefficient : public F, public MultilinearOperator<0>
42 {
44 using LocalDomain = typename F::EntitySet::Element::Geometry::LocalCoordinate;
45
46 public:
47
48 using Element = typename F::EntitySet::Element;
50
51 Coefficient(const F& f) :
52 F(f),
53 order_(0)
54 {}
55
56 Coefficient(const F& f, std::size_t order) :
57 F(f),
58 order_(order)
59 {}
60
62 {
63 public:
64
65 using Element = typename Coefficient::Element;
66 using Intersection = typename F::EntitySet::GridView::Intersection;
69 using Range = typename Coefficient::Range;
70
72 LocalFunction(std::move(fLocal)),
73 order_(order)
74 {}
75
76 auto quadratureRuleKey() const
77 {
78 return QuadratureRuleKey(LocalFunction::localContext().type(), order_);
79 }
80
81 template<class... LV>
82 void registerLocalViews(const LV&... lvs)
83 {}
84
85 template<class... LV>
86 void registerOutsideLocalViews(const LV&... lvs)
87 {}
88
89 void registerCaches(CacheManager& cacheManager)
90 {}
91
93 {}
94
95 using LocalFunction::bind;
96
97 void bind(const Intersection& intersection, const Element& element, const Element& otherElement)
98 {
99 LocalFunction::bind(element);
100 }
101
102 template<class... OutsideCacheManager>
103 void bindToCaches(CacheManager& cacheManager, OutsideCacheManager&... outsideCacheManager)
104 {
105 rule_ = &cacheManager.rule();
106 }
107
109 {
110 return Impl::Tensor::RankZeroTensor(LocalFunction::operator()((*rule_)[index].position()));
111 }
112
113 private:
114 std::size_t order_;
115 const QuadratureRule* rule_ = nullptr;
116 };
117
118 friend LocalOperator localOperator(const Coefficient& coefficient)
119 {
120 return LocalOperator(localFunction(coefficient), coefficient.order_);
121 }
122
123 auto basis() const
124 {
125 return std::tuple<>();
126 }
127
128 auto treePath() const
129 {
130 return std::tuple<>();
131 }
132
133 private:
134 std::size_t order_;
135 };
136
137
138
139} // namespace Dune::Fufem::Forms
140
141
142
143#endif // DUNE_FUFEM_FORMS_COEFFICIENT_HH
std::ptrdiff_t index() const
STL namespace.
Definition baseclass.hh:22
Base class for multilinear operator implementations.
Definition baseclass.hh:73
Coefficient function.
Definition coefficient.hh:42
Coefficient(const F &f)
Definition coefficient.hh:51
Coefficient(const F &f, std::size_t order)
Definition coefficient.hh:56
auto treePath() const
Definition coefficient.hh:128
typename F::EntitySet::Element Element
Definition coefficient.hh:48
auto basis() const
Definition coefficient.hh:123
decltype(std::declval< LocalFunction >()(std::declval< LocalDomain >())) Range
Definition coefficient.hh:49
friend LocalOperator localOperator(const Coefficient &coefficient)
Definition coefficient.hh:118
typename Coefficient::Element Element
Definition coefficient.hh:65
void bind(const Intersection &intersection, const Element &element, const Element &otherElement)
Definition coefficient.hh:97
void registerOutsideLocalViews(const LV &... lvs)
Definition coefficient.hh:86
typename CacheManager::QuadratureRule QuadratureRule
Definition coefficient.hh:68
auto operator()(std::size_t index) const
Definition coefficient.hh:108
void registerLocalViews(const LV &... lvs)
Definition coefficient.hh:82
void registerCaches(CacheManager &cacheManager)
Definition coefficient.hh:89
void bindToCaches(CacheManager &cacheManager, OutsideCacheManager &... outsideCacheManager)
Definition coefficient.hh:103
void registerOutsideCaches(CacheManager &cacheManager)
Definition coefficient.hh:92
typename F::EntitySet::GridView::Intersection Intersection
Definition coefficient.hh:66
typename Coefficient::Range Range
Definition coefficient.hh:69
auto quadratureRuleKey() const
Definition coefficient.hh:76
LocalOperator(LocalFunction &&fLocal, std::size_t order)
Definition coefficient.hh:71
A class for managing caches of different types.
Definition shapefunctioncache.hh:615
Dune::QuadratureRule< CT, dimension > QuadratureRule
Definition shapefunctioncache.hh:617
const QuadratureRule & rule() const
Obtain the associated quadrature rule.
Definition shapefunctioncache.hh:709
A token that specifies a quadrature rule.
Definition quadraturerulecache.hh:39
T forward(T... args)