5#ifndef DUNE_HIERARCHICAL_PRISM_P2_LOCALBASIS_HH
6#define DUNE_HIERARCHICAL_PRISM_P2_LOCALBASIS_HH
17#include <dune/localfunctions/common/localbasis.hh>
21 template<
class D,
class R>
22 class HierarchicalPrismP2LocalBasis
26 typedef LocalBasisTraits<D,3,Dune::FieldVector<D,3>,R,1,
Dune::FieldVector<R,1>,
Dune::FieldMatrix<R,1,3> > Traits;
29 unsigned int size ()
const
36 std::vector<typename Traits::RangeType> & out)
const
40 out[0]=(1.0-in[0]-in[1])*(1.0-in[2]);
41 out[1]= in[0]*(1-in[2]);
42 out[2]=in[1]*(1-in[2]);
43 out[3]=in[2]*(1.0-in[0]-in[1]);
48 out[6]=2*(1.0-in[0]-in[1])*(0.5-in[0]-in[1])*(4*in[2]-4*in[2]*in[2]);
49 out[7]=2*in[0]*(-0.5+in[0])*(4*in[2]-4*in[2]*in[2]);
50 out[8]=2*in[1]*(-0.5+in[1])*(4*in[2]-4*in[2]*in[2]);
51 out[9]=4*in[0]*(1-in[0]-in[1])*(1-3*in[2]+2*in[2]*in[2]);
52 out[10]=4*in[1]*(1-in[0]-in[1])*(1-3*in[2]+2*in[2]*in[2]);
53 out[11]=4*in[0]*in[1]*(1-3*in[2]+2*in[2]*in[2]);
54 out[12]=4*in[0]*(1-in[0]-in[1])*(-in[2]+2*in[2]*in[2]);
55 out[13]=4*in[1]*(1-in[0]-in[1])*(-in[2]+2*in[2]*in[2]);
56 out[14]=4*in[0]*in[1]*(-in[2]+2*in[2]*in[2]);
59 out[15]=4*in[0]*(1-in[0]-in[1])*(4*in[2]-4*in[2]*in[2]);
60 out[16]=4*in[1]*(1-in[0]-in[1])*(4*in[2]-4*in[2]*in[2]);
61 out[17]=4*in[0]*in[1]*(4*in[2]-4*in[2]*in[2]);
68 std::vector<typename Traits::JacobianType>& out)
const
73 out[0][0][0] = in[2]-1;
74 out[0][0][1] = in[2]-1;
75 out[0][0][2] = in[0]+in[1]-1;
77 out[1][0][0] = 1-in[2];
82 out[2][0][1] = 1-in[2];
83 out[2][0][2] = -in[1];
85 out[3][0][0] = -in[2];
86 out[3][0][1] = -in[2];
87 out[3][0][2] = 1-in[0]-in[1];
98 out[6][0][0] = (-3+4*in[0]+4*in[1])*(4*in[2]-4*in[2]*in[2]);
99 out[6][0][1] = (-3+4*in[0]+4*in[1])*(4*in[2]-4*in[2]*in[2]);
100 out[6][0][2] = 2*(1-in[0]-in[1])*(0.5-in[0]-in[1])*(4-8*in[2]);
102 out[7][0][0] = (-1+4*in[0])*(4*in[2]-4*in[2]*in[2]);
104 out[7][0][2] = 2*in[0]*(-0.5+in[0])*(4-8*in[2]);
107 out[8][0][1] = (-1+4*in[1])*(4*in[2]-4*in[2]*in[2]);
108 out[8][0][2] = 2*in[1]*(-0.5+in[1])*(4-8*in[2]);
110 out[9][0][0] = (4-8*in[0]-4*in[1])*(1-3*in[2]+2*in[2]*in[2]);
111 out[9][0][1] = -4*in[0]*(1-3*in[2]+2*in[2]*in[2]);
112 out[9][0][2] = 4*in[0]*(1-in[0]-in[1])*(-3+4*in[2]);
114 out[10][0][0] = (-4*in[1])*(1-3*in[2]+2*in[2]*in[2]);
115 out[10][0][1] = (4-4*in[0]-8*in[1])*(1-3*in[2]+2*in[2]*in[2]);
116 out[10][0][2] = 4*in[1]*(1-in[0]-in[1])*(-3+4*in[2]);
118 out[11][0][0] = 4*in[1]*(1-3*in[2]+2*in[2]*in[2]);
119 out[11][0][1] = 4*in[0]*(1-3*in[2]+2*in[2]*in[2]);
120 out[11][0][2] = 4*in[0]*in[1]*(-3+4*in[2]);
122 out[12][0][0] = (4-8*in[0]-4*in[1])*(-in[2]+2*in[2]*in[2]);
123 out[12][0][1] = (-4*in[0])*(-in[2]+2*in[2]*in[2]);
124 out[12][0][2] = 4*in[0]*(1-in[0]-in[1])*(-1+4*in[2]);
126 out[13][0][0] = -4*in[1]*(-in[2]+2*in[2]*in[2]);
127 out[13][0][1] = (4-4*in[0]-8*in[1])*(-in[2]+2*in[2]*in[2]);
128 out[13][0][2] = 4*in[1]*(1-in[0]-in[1])*(-1+4*in[2]);
130 out[14][0][0] = 4*in[1]*(-in[2]+2*in[2]*in[2]);
131 out[14][0][1] = 4*in[0]*(-in[2]+2*in[2]*in[2]);
132 out[14][0][2] = 4*in[0]*in[1]*(-1+4*in[2]);
135 out[15][0][0] = (4-8*in[0]-4*in[1])*(4*in[2]-4*in[2]*in[2]);
136 out[15][0][1] = -4*in[0]*(4*in[2]-4*in[2]*in[2]);
137 out[15][0][2] = 4*in[0]*(1-in[0]-in[1])*(4-8*in[2]);
139 out[16][0][0] = -4*in[1]*(4*in[2]-4*in[2]*in[2]);
140 out[16][0][1] = (4-4*in[0]-8*in[1])*(4*in[2]-4*in[2]*in[2]);
141 out[16][0][2] = 4*in[1]*(1-in[0]-in[1])*(4-8*in[2]);
143 out[17][0][0] = 4*in[1]*(4*in[2]-4*in[2]*in[2]);
144 out[17][0][1] = 4*in[0]*(4*in[2]-4*in[2]*in[2]);
145 out[17][0][2] = 4*in[0]*in[1]*(4-8*in[2]);
149 void partial (
const std::array<unsigned int, 3>& order,
151 std::vector<typename Traits::RangeType>& out)
const
154 if (totalOrder == 0) {
155 evaluateFunction(in, out);
156 }
else if (totalOrder == 1) {
158 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
168 out[6] = (-3+4*in[0]+4*in[1])*(4*in[2]-4*in[2]*in[2]);
169 out[7] = (-1+4*in[0])*(4*in[2]-4*in[2]*in[2]);
171 out[9] = (4-8*in[0]-4*in[1])*(1-3*in[2]+2*in[2]*in[2]);
172 out[10] = (-4*in[1])*(1-3*in[2]+2*in[2]*in[2]);
173 out[11] = 4*in[1]*(1-3*in[2]+2*in[2]*in[2]);
174 out[12] = (4-8*in[0]-4*in[1])*(-in[2]+2*in[2]*in[2]);
175 out[13] = -4*in[1]*(-in[2]+2*in[2]*in[2]);
176 out[14] = 4*in[1]*(-in[2]+2*in[2]*in[2]);
177 out[15] = (4-8*in[0]-4*in[1])*(4*in[2]-4*in[2]*in[2]);
178 out[16] = -4*in[1]*(4*in[2]-4*in[2]*in[2]);
179 out[17] = 4*in[1]*(4*in[2]-4*in[2]*in[2]);
188 out[6] = (-3+4*in[0]+4*in[1])*(4*in[2]-4*in[2]*in[2]);
190 out[8] = (-1+4*in[1])*(4*in[2]-4*in[2]*in[2]);
191 out[9] = -4*in[0]*(1-3*in[2]+2*in[2]*in[2]);
192 out[10] = (4-4*in[0]-8*in[1])*(1-3*in[2]+2*in[2]*in[2]);
193 out[11] = 4*in[0]*(1-3*in[2]+2*in[2]*in[2]);
194 out[12] = (-4*in[0])*(-in[2]+2*in[2]*in[2]);
195 out[13] = (4-4*in[0]-8*in[1])*(-in[2]+2*in[2]*in[2]);
196 out[14] = 4*in[0]*(-in[2]+2*in[2]*in[2]);
197 out[15] = -4*in[0]*(4*in[2]-4*in[2]*in[2]);
198 out[16] = (4-4*in[0]-8*in[1])*(4*in[2]-4*in[2]*in[2]);
199 out[17] = 4*in[0]*(4*in[2]-4*in[2]*in[2]);
202 out[0] = in[0]+in[1]-1;
205 out[3] = 1-in[0]-in[1];
208 out[6] = 2*(1-in[0]-in[1])*(0.5-in[0]-in[1])*(4-8*in[2]);
209 out[7] = 2*in[0]*(-0.5+in[0])*(4-8*in[2]);
210 out[8] = 2*in[1]*(-0.5+in[1])*(4-8*in[2]);
211 out[9] = 4*in[0]*(1-in[0]-in[1])*(-3+4*in[2]);
212 out[10] = 4*in[1]*(1-in[0]-in[1])*(-3+4*in[2]);
213 out[11] = 4*in[0]*in[1]*(-3+4*in[2]);
214 out[12] = 4*in[0]*(1-in[0]-in[1])*(-1+4*in[2]);
215 out[13] = 4*in[1]*(1-in[0]-in[1])*(-1+4*in[2]);
216 out[14] = 4*in[0]*in[1]*(-1+4*in[2]);
217 out[15] = 4*in[0]*(1-in[0]-in[1])*(4-8*in[2]);
218 out[16] = 4*in[1]*(1-in[0]-in[1])*(4-8*in[2]);
219 out[17] = 4*in[0]*in[1]*(4-8*in[2]);
222 DUNE_THROW(RangeError,
"Component out of range.");
225 DUNE_THROW(NotImplemented,
"Desired derivative order is not implemented");
231 unsigned int order()
const
A dense n x m matrix.
Definition: fmatrix.hh:117
vector space out of a tensor product of fields.
Definition: fvector.hh:95
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Implements a vector constructed from a given type representing a field and a compile-time given size.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
constexpr T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:291
Dune namespace.
Definition: alignedallocator.hh:13
D DomainType
domain type
Definition: localbasis.hh:42