Debian Codegraph @

dune/localfunctions/refined/refinedp0.hh

raw
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 © DUNE Project contributors, see file LICENSE.md in module root
4 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5 #ifndef DUNE_REFINED_P0_LOCALFINITEELEMENT_HH
6 #define DUNE_REFINED_P0_LOCALFINITEELEMENT_HH
7
8 #include <dune/geometry/type.hh>
9
10 #include <dune/localfunctions/common/localfiniteelementtraits.hh>
11 #include <dune/localfunctions/lagrange/p0.hh>
12
13 #include "refinedp0/refinedp0localbasis.hh"
14 #include "refinedp0/refinedp0localcoefficients.hh"
15 #include "refinedp0/refinedp0localinterpolation.hh"
16
17 /** \file
18 \brief Piecewise P0 finite element
19 */
20 namespace Dune
21 {
22
23 /** \brief Local finite element that is piecewise P0 on a once uniformly refined reference geometry
24 *
25 * \ingroup LocalFunctions
26 */
27 template<class D, class R, int dim>
28 class RefinedP0LocalFiniteElement
29 {
30 RefinedP0LocalFiniteElement() {}
31
32 public:
33 // We steal the p0 traits since they exist for all dim.
34 // This allows to instantiate the type and access the Traits.
35 typedef typename P0LocalFiniteElement<D,R,dim>::Traits Traits;
36 };
37
38 /** \brief Local finite element that is piecewise P0 on a once uniformly refined reference geometry
39 *
40 * \ingroup LocalFunctions
41 */
42 template<class D, class R>
43 class RefinedP0LocalFiniteElement<D,R,1>
44 {
45 public:
46 /** \todo Please doc me !
47 */
48 typedef LocalFiniteElementTraits<
49 RefinedP0LocalBasis<D,R,1>,
50 RefinedP0LocalCoefficients<1>,
51 RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,1> > > Traits;
52
53 /** \todo Please doc me !
54 */
55 RefinedP0LocalFiniteElement ()
56 {}
57
58 /** \todo Please doc me !
59 */
60 const typename Traits::LocalBasisType& localBasis () const
61 {
62 return basis_;
63 }
64
65 /** \todo Please doc me !
66 */
67 const typename Traits::LocalCoefficientsType& localCoefficients () const
68 {
69 return coefficients_;
70 }
71
72 /** \todo Please doc me !
73 */
74 const typename Traits::LocalInterpolationType& localInterpolation () const
75 {
76 return interpolation_;
77 }
78
79 /** \brief Number of shape functions in this finite element */
80 unsigned int size () const
81 {
82 return basis_.size();
83 }
84
85 /** \todo Please doc me !
86 */
87 static constexpr GeometryType type ()
88 {
89 return GeometryTypes::line;
90 }
91
92 private:
93 RefinedP0LocalBasis<D,R,1> basis_;
94 RefinedP0LocalCoefficients<1> coefficients_;
95 RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,1> > interpolation_;
96 };
97
98 /** \brief Local finite element that is piecewise P0 on a once uniformly refined reference geometry
99 *
100 * \ingroup LocalFunctions
101 */
102 template<class D, class R>
103 class RefinedP0LocalFiniteElement<D,R,2>
104 {
105 public:
106 /** \todo Please doc me !
107 */
108 typedef LocalFiniteElementTraits<
109 RefinedP0LocalBasis<D,R,2>,
110 RefinedP0LocalCoefficients<2>,
111 RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,2> > > Traits;
112
113 /** \todo Please doc me !
114 */
115 RefinedP0LocalFiniteElement ()
116 {}
117
118 /** \todo Please doc me !
119 */
120 const typename Traits::LocalBasisType& localBasis () const
121 {
122 return basis_;
123 }
124
125 /** \todo Please doc me !
126 */
127 const typename Traits::LocalCoefficientsType& localCoefficients () const
128 {
129 return coefficients_;
130 }
131
132 /** \todo Please doc me !
133 */
134 const typename Traits::LocalInterpolationType& localInterpolation () const
135 {
136 return interpolation_;
137 }
138
139 /** \brief Number of shape functions in this finite element */
140 unsigned int size () const
141 {
142 return basis_.size();
143 }
144
145 /** \todo Please doc me !
146 */
147 static constexpr GeometryType type ()
148 {
149 return GeometryTypes::triangle;
150 }
151
152 private:
153 RefinedP0LocalBasis<D,R,2> basis_;
154 RefinedP0LocalCoefficients<2> coefficients_;
155 RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,2> > interpolation_;
156 };
157
158 /** \brief Local finite element that is piecewise P0 on a once uniformly refined reference geometry
159 *
160 * \ingroup LocalFunctions
161 */
162 template<class D, class R>
163 class RefinedP0LocalFiniteElement<D,R,3>
164 {
165 public:
166 /** \todo Please doc me !
167 */
168 typedef LocalFiniteElementTraits<
169 RefinedP0LocalBasis<D,R,3>,
170 RefinedP0LocalCoefficients<3>,
171 RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,3> > > Traits;
172
173 /** \todo Please doc me !
174 */
175 RefinedP0LocalFiniteElement ()
176 {}
177
178 /** \todo Please doc me !
179 */
180 const typename Traits::LocalBasisType& localBasis () const
181 {
182 return basis_;
183 }
184
185 /** \todo Please doc me !
186 */
187 const typename Traits::LocalCoefficientsType& localCoefficients () const
188 {
189 return coefficients_;
190 }
191
192 /** \todo Please doc me !
193 */
194 const typename Traits::LocalInterpolationType& localInterpolation () const
195 {
196 return interpolation_;
197 }
198
199 /** \brief Number of shape functions in this finite element */
200 unsigned int size () const
201 {
202 return basis_.size();
203 }
204
205 /** \todo Please doc me !
206 */
207 static constexpr GeometryType type ()
208 {
209 return GeometryTypes::tetrahedron;
210 }
211
212 private:
213 RefinedP0LocalBasis<D,R,3> basis_;
214 RefinedP0LocalCoefficients<3> coefficients_;
215 RefinedP0LocalInterpolation<RefinedP0LocalBasis<D,R,3> > interpolation_;
216 };
217
218
219 }
220
221 #endif