3#ifndef DUNE_HIERARCHICAL_PRISM_P2_LOCALBASIS_HH
4#define DUNE_HIERARCHICAL_PRISM_P2_LOCALBASIS_HH
15#include <dune/localfunctions/common/localbasis.hh>
19 template<
class D,
class R>
20 class HierarchicalPrismP2LocalBasis
24 typedef LocalBasisTraits<D,3,Dune::FieldVector<D,3>,R,1,
Dune::FieldVector<R,1>,
Dune::FieldMatrix<R,1,3> > Traits;
27 unsigned int size ()
const
34 std::vector<typename Traits::RangeType> & out)
const
38 out[0]=(1.0-in[0]-in[1])*(1.0-in[2]);
39 out[1]= in[0]*(1-in[2]);
40 out[2]=in[1]*(1-in[2]);
41 out[3]=in[2]*(1.0-in[0]-in[1]);
46 out[6]=2*(1.0-in[0]-in[1])*(0.5-in[0]-in[1])*(4*in[2]-4*in[2]*in[2]);
47 out[7]=2*in[0]*(-0.5+in[0])*(4*in[2]-4*in[2]*in[2]);
48 out[8]=2*in[1]*(-0.5+in[1])*(4*in[2]-4*in[2]*in[2]);
49 out[9]=4*in[0]*(1-in[0]-in[1])*(1-3*in[2]+2*in[2]*in[2]);
50 out[10]=4*in[1]*(1-in[0]-in[1])*(1-3*in[2]+2*in[2]*in[2]);
51 out[11]=4*in[0]*in[1]*(1-3*in[2]+2*in[2]*in[2]);
52 out[12]=4*in[0]*(1-in[0]-in[1])*(-in[2]+2*in[2]*in[2]);
53 out[13]=4*in[1]*(1-in[0]-in[1])*(-in[2]+2*in[2]*in[2]);
54 out[14]=4*in[0]*in[1]*(-in[2]+2*in[2]*in[2]);
57 out[15]=4*in[0]*(1-in[0]-in[1])*(4*in[2]-4*in[2]*in[2]);
58 out[16]=4*in[1]*(1-in[0]-in[1])*(4*in[2]-4*in[2]*in[2]);
59 out[17]=4*in[0]*in[1]*(4*in[2]-4*in[2]*in[2]);
66 std::vector<typename Traits::JacobianType>& out)
const
71 out[0][0][0] = in[2]-1;
72 out[0][0][1] = in[2]-1;
73 out[0][0][2] = in[0]+in[1]-1;
75 out[1][0][0] = 1-in[2];
80 out[2][0][1] = 1-in[2];
81 out[2][0][2] = -in[1];
83 out[3][0][0] = -in[2];
84 out[3][0][1] = -in[2];
85 out[3][0][2] = 1-in[0]-in[1];
96 out[6][0][0] = (-3+4*in[0]+4*in[1])*(4*in[2]-4*in[2]*in[2]);
97 out[6][0][1] = (-3+4*in[0]+4*in[1])*(4*in[2]-4*in[2]*in[2]);
98 out[6][0][2] = 2*(1-in[0]-in[1])*(0.5-in[0]-in[1])*(4-8*in[2]);
100 out[7][0][0] = (-1+4*in[0])*(4*in[2]-4*in[2]*in[2]);
102 out[7][0][2] = 2*in[0]*(-0.5+in[0])*(4-8*in[2]);
105 out[8][0][1] = (-1+4*in[1])*(4*in[2]-4*in[2]*in[2]);
106 out[8][0][2] = 2*in[1]*(-0.5+in[1])*(4-8*in[2]);
108 out[9][0][0] = (4-8*in[0]-4*in[1])*(1-3*in[2]+2*in[2]*in[2]);
109 out[9][0][1] = -4*in[0]*(1-3*in[2]+2*in[2]*in[2]);
110 out[9][0][2] = 4*in[0]*(1-in[0]-in[1])*(-3+4*in[2]);
112 out[10][0][0] = (-4*in[1])*(1-3*in[2]+2*in[2]*in[2]);
113 out[10][0][1] = (4-4*in[0]-8*in[1])*(1-3*in[2]+2*in[2]*in[2]);
114 out[10][0][2] = 4*in[1]*(1-in[0]-in[1])*(-3+4*in[2]);
116 out[11][0][0] = 4*in[1]*(1-3*in[2]+2*in[2]*in[2]);
117 out[11][0][1] = 4*in[0]*(1-3*in[2]+2*in[2]*in[2]);
118 out[11][0][2] = 4*in[0]*in[1]*(-3+4*in[2]);
120 out[12][0][0] = (4-8*in[0]-4*in[1])*(-in[2]+2*in[2]*in[2]);
121 out[12][0][1] = (-4*in[0])*(-in[2]+2*in[2]*in[2]);
122 out[12][0][2] = 4*in[0]*(1-in[0]-in[1])*(-1+4*in[2]);
124 out[13][0][0] = -4*in[1]*(-in[2]+2*in[2]*in[2]);
125 out[13][0][1] = (4-4*in[0]-8*in[1])*(-in[2]+2*in[2]*in[2]);
126 out[13][0][2] = 4*in[1]*(1-in[0]-in[1])*(-1+4*in[2]);
128 out[14][0][0] = 4*in[1]*(-in[2]+2*in[2]*in[2]);
129 out[14][0][1] = 4*in[0]*(-in[2]+2*in[2]*in[2]);
130 out[14][0][2] = 4*in[0]*in[1]*(-1+4*in[2]);
133 out[15][0][0] = (4-8*in[0]-4*in[1])*(4*in[2]-4*in[2]*in[2]);
134 out[15][0][1] = -4*in[0]*(4*in[2]-4*in[2]*in[2]);
135 out[15][0][2] = 4*in[0]*(1-in[0]-in[1])*(4-8*in[2]);
137 out[16][0][0] = -4*in[1]*(4*in[2]-4*in[2]*in[2]);
138 out[16][0][1] = (4-4*in[0]-8*in[1])*(4*in[2]-4*in[2]*in[2]);
139 out[16][0][2] = 4*in[1]*(1-in[0]-in[1])*(4-8*in[2]);
141 out[17][0][0] = 4*in[1]*(4*in[2]-4*in[2]*in[2]);
142 out[17][0][1] = 4*in[0]*(4*in[2]-4*in[2]*in[2]);
143 out[17][0][2] = 4*in[0]*in[1]*(4-8*in[2]);
147 void partial (
const std::array<unsigned int, 3>& order,
149 std::vector<typename Traits::RangeType>& out)
const
152 if (totalOrder == 0) {
153 evaluateFunction(in, out);
154 }
else if (totalOrder == 1) {
156 auto const direction = std::distance(order.begin(), std::find(order.begin(), order.end(), 1));
166 out[6] = (-3+4*in[0]+4*in[1])*(4*in[2]-4*in[2]*in[2]);
167 out[7] = (-1+4*in[0])*(4*in[2]-4*in[2]*in[2]);
169 out[9] = (4-8*in[0]-4*in[1])*(1-3*in[2]+2*in[2]*in[2]);
170 out[10] = (-4*in[1])*(1-3*in[2]+2*in[2]*in[2]);
171 out[11] = 4*in[1]*(1-3*in[2]+2*in[2]*in[2]);
172 out[12] = (4-8*in[0]-4*in[1])*(-in[2]+2*in[2]*in[2]);
173 out[13] = -4*in[1]*(-in[2]+2*in[2]*in[2]);
174 out[14] = 4*in[1]*(-in[2]+2*in[2]*in[2]);
175 out[15] = (4-8*in[0]-4*in[1])*(4*in[2]-4*in[2]*in[2]);
176 out[16] = -4*in[1]*(4*in[2]-4*in[2]*in[2]);
177 out[17] = 4*in[1]*(4*in[2]-4*in[2]*in[2]);
186 out[6] = (-3+4*in[0]+4*in[1])*(4*in[2]-4*in[2]*in[2]);
188 out[8] = (-1+4*in[1])*(4*in[2]-4*in[2]*in[2]);
189 out[9] = -4*in[0]*(1-3*in[2]+2*in[2]*in[2]);
190 out[10] = (4-4*in[0]-8*in[1])*(1-3*in[2]+2*in[2]*in[2]);
191 out[11] = 4*in[0]*(1-3*in[2]+2*in[2]*in[2]);
192 out[12] = (-4*in[0])*(-in[2]+2*in[2]*in[2]);
193 out[13] = (4-4*in[0]-8*in[1])*(-in[2]+2*in[2]*in[2]);
194 out[14] = 4*in[0]*(-in[2]+2*in[2]*in[2]);
195 out[15] = -4*in[0]*(4*in[2]-4*in[2]*in[2]);
196 out[16] = (4-4*in[0]-8*in[1])*(4*in[2]-4*in[2]*in[2]);
197 out[17] = 4*in[0]*(4*in[2]-4*in[2]*in[2]);
200 out[0] = in[0]+in[1]-1;
203 out[3] = 1-in[0]-in[1];
206 out[6] = 2*(1-in[0]-in[1])*(0.5-in[0]-in[1])*(4-8*in[2]);
207 out[7] = 2*in[0]*(-0.5+in[0])*(4-8*in[2]);
208 out[8] = 2*in[1]*(-0.5+in[1])*(4-8*in[2]);
209 out[9] = 4*in[0]*(1-in[0]-in[1])*(-3+4*in[2]);
210 out[10] = 4*in[1]*(1-in[0]-in[1])*(-3+4*in[2]);
211 out[11] = 4*in[0]*in[1]*(-3+4*in[2]);
212 out[12] = 4*in[0]*(1-in[0]-in[1])*(-1+4*in[2]);
213 out[13] = 4*in[1]*(1-in[0]-in[1])*(-1+4*in[2]);
214 out[14] = 4*in[0]*in[1]*(-1+4*in[2]);
215 out[15] = 4*in[0]*(1-in[0]-in[1])*(4-8*in[2]);
216 out[16] = 4*in[1]*(1-in[0]-in[1])*(4-8*in[2]);
217 out[17] = 4*in[0]*in[1]*(4-8*in[2]);
220 DUNE_THROW(RangeError,
"Component out of range.");
223 DUNE_THROW(NotImplemented,
"Desired derivative order is not implemented");
229 unsigned int order()
const
A dense n x m matrix.
Definition: fmatrix.hh:69
vector space out of a tensor product of fields.
Definition: fvector.hh:96
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:216
T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:290
Dune namespace.
Definition: alignedallocator.hh:14
D DomainType
domain type
Definition: localbasis.hh:43