1
// Automatically generated by FFC, the FEniCS Form Compiler, version 0.2.5.
2
// For further information, go to http://www/fenics.org/ffc/.
3
// Licensed under the GNU GPL Version 2.
5
#ifndef __POISSON2D_3_H
6
#define __POISSON2D_3_H
8
#include <dolfin/Mesh.h>
9
#include <dolfin/Cell.h>
10
#include <dolfin/Point.h>
11
#include <dolfin/Vector.h>
12
#include <dolfin/AffineMap.h>
13
#include <dolfin/FiniteElement.h>
14
#include <dolfin/FiniteElementSpec.h>
15
#include <dolfin/LinearForm.h>
16
#include <dolfin/BilinearForm.h>
18
namespace dolfin { namespace Poisson2D_3 {
20
/// This class contains the form to be evaluated, including
21
/// contributions from the interior and boundary of the domain.
23
class BilinearForm : public dolfin::BilinearForm
27
class TestElement : public dolfin::FiniteElement
31
TestElement() : dolfin::FiniteElement(), tensordims(0), subelements(0)
33
// Element is scalar, don't need to initialize tensordims
35
// Element is simple, don't need to initialize subelements
40
if ( tensordims ) delete [] tensordims;
43
for (unsigned int i = 0; i < elementdim(); i++)
44
delete subelements[i];
45
delete [] subelements;
49
inline unsigned int spacedim() const
54
inline unsigned int shapedim() const
59
inline unsigned int tensordim(unsigned int i) const
61
dolfin_error("Element is scalar.");
65
inline unsigned int elementdim() const
70
inline unsigned int rank() const
75
void nodemap(int nodes[], const Cell& cell, const Mesh& mesh) const
77
static unsigned int edge_reordering_0[2][2] = {{0, 1}, {1, 0}};
78
nodes[0] = cell.vertexID(0);
79
nodes[1] = cell.vertexID(1);
80
nodes[2] = cell.vertexID(2);
81
int alignment = cell.edgeAlignment(0);
82
int offset = mesh.numVertices();
83
nodes[3] = offset + 2*cell.edgeID(0) + edge_reordering_0[alignment][0];
84
nodes[4] = offset + 2*cell.edgeID(0) + edge_reordering_0[alignment][1];
85
alignment = cell.edgeAlignment(1);
86
nodes[5] = offset + 2*cell.edgeID(1) + edge_reordering_0[alignment][0];
87
nodes[6] = offset + 2*cell.edgeID(1) + edge_reordering_0[alignment][1];
88
alignment = cell.edgeAlignment(2);
89
nodes[7] = offset + 2*cell.edgeID(2) + edge_reordering_0[alignment][0];
90
nodes[8] = offset + 2*cell.edgeID(2) + edge_reordering_0[alignment][1];
91
offset = offset + 2*mesh.numEdges();
92
nodes[9] = offset + cell.id();
95
void pointmap(Point points[], unsigned int components[], const AffineMap& map) const
97
points[0] = map(0.000000000000000e+00, 0.000000000000000e+00);
98
points[1] = map(1.000000000000000e+00, 0.000000000000000e+00);
99
points[2] = map(0.000000000000000e+00, 1.000000000000000e+00);
100
points[3] = map(6.666666666666667e-01, 3.333333333333333e-01);
101
points[4] = map(3.333333333333334e-01, 6.666666666666666e-01);
102
points[5] = map(0.000000000000000e+00, 6.666666666666667e-01);
103
points[6] = map(0.000000000000000e+00, 3.333333333333334e-01);
104
points[7] = map(3.333333333333333e-01, 0.000000000000000e+00);
105
points[8] = map(6.666666666666666e-01, 0.000000000000000e+00);
106
points[9] = map(3.333333333333333e-01, 3.333333333333333e-01);
119
void vertexeval(real values[], unsigned int vertex, const real x[], const Mesh& mesh) const
121
// FIXME: Temporary fix for Lagrange elements
122
values[0] = x[vertex];
125
const FiniteElement& operator[] (unsigned int i) const
130
FiniteElement& operator[] (unsigned int i)
135
FiniteElementSpec spec() const
137
FiniteElementSpec s("Lagrange", "triangle", 3);
143
unsigned int* tensordims;
144
FiniteElement** subelements;
148
class TrialElement : public dolfin::FiniteElement
152
TrialElement() : dolfin::FiniteElement(), tensordims(0), subelements(0)
154
// Element is scalar, don't need to initialize tensordims
156
// Element is simple, don't need to initialize subelements
161
if ( tensordims ) delete [] tensordims;
164
for (unsigned int i = 0; i < elementdim(); i++)
165
delete subelements[i];
166
delete [] subelements;
170
inline unsigned int spacedim() const
175
inline unsigned int shapedim() const
180
inline unsigned int tensordim(unsigned int i) const
182
dolfin_error("Element is scalar.");
186
inline unsigned int elementdim() const
191
inline unsigned int rank() const
196
void nodemap(int nodes[], const Cell& cell, const Mesh& mesh) const
198
static unsigned int edge_reordering_0[2][2] = {{0, 1}, {1, 0}};
199
nodes[0] = cell.vertexID(0);
200
nodes[1] = cell.vertexID(1);
201
nodes[2] = cell.vertexID(2);
202
int alignment = cell.edgeAlignment(0);
203
int offset = mesh.numVertices();
204
nodes[3] = offset + 2*cell.edgeID(0) + edge_reordering_0[alignment][0];
205
nodes[4] = offset + 2*cell.edgeID(0) + edge_reordering_0[alignment][1];
206
alignment = cell.edgeAlignment(1);
207
nodes[5] = offset + 2*cell.edgeID(1) + edge_reordering_0[alignment][0];
208
nodes[6] = offset + 2*cell.edgeID(1) + edge_reordering_0[alignment][1];
209
alignment = cell.edgeAlignment(2);
210
nodes[7] = offset + 2*cell.edgeID(2) + edge_reordering_0[alignment][0];
211
nodes[8] = offset + 2*cell.edgeID(2) + edge_reordering_0[alignment][1];
212
offset = offset + 2*mesh.numEdges();
213
nodes[9] = offset + cell.id();
216
void pointmap(Point points[], unsigned int components[], const AffineMap& map) const
218
points[0] = map(0.000000000000000e+00, 0.000000000000000e+00);
219
points[1] = map(1.000000000000000e+00, 0.000000000000000e+00);
220
points[2] = map(0.000000000000000e+00, 1.000000000000000e+00);
221
points[3] = map(6.666666666666667e-01, 3.333333333333333e-01);
222
points[4] = map(3.333333333333334e-01, 6.666666666666666e-01);
223
points[5] = map(0.000000000000000e+00, 6.666666666666667e-01);
224
points[6] = map(0.000000000000000e+00, 3.333333333333334e-01);
225
points[7] = map(3.333333333333333e-01, 0.000000000000000e+00);
226
points[8] = map(6.666666666666666e-01, 0.000000000000000e+00);
227
points[9] = map(3.333333333333333e-01, 3.333333333333333e-01);
240
void vertexeval(real values[], unsigned int vertex, const real x[], const Mesh& mesh) const
242
// FIXME: Temporary fix for Lagrange elements
243
values[0] = x[vertex];
246
const FiniteElement& operator[] (unsigned int i) const
251
FiniteElement& operator[] (unsigned int i)
256
FiniteElementSpec spec() const
258
FiniteElementSpec s("Lagrange", "triangle", 3);
264
unsigned int* tensordims;
265
FiniteElement** subelements;
269
BilinearForm() : dolfin::BilinearForm(0)
271
// Create finite element for test space
272
_test = new TestElement();
274
// Create finite element for trial space
275
_trial = new TrialElement();
278
void eval(real block[], const AffineMap& map) const
280
// Compute geometry tensors
281
const real G0_0_0 = map.det*(map.g00*map.g00 + map.g01*map.g01);
282
const real G0_0_1 = map.det*(map.g00*map.g10 + map.g01*map.g11);
283
const real G0_1_0 = map.det*(map.g10*map.g00 + map.g11*map.g01);
284
const real G0_1_1 = map.det*(map.g10*map.g10 + map.g11*map.g11);
286
// Compute element tensor
287
block[0] = 4.249999999999998e-01*G0_0_0 + 4.249999999999995e-01*G0_0_1 + 4.249999999999996e-01*G0_1_0 + 4.249999999999993e-01*G0_1_1;
288
block[1] = -8.750000000000012e-02*G0_0_0 - 8.750000000000020e-02*G0_1_0;
289
block[2] = -8.750000000000001e-02*G0_0_1 - 8.750000000000005e-02*G0_1_1;
290
block[3] = -3.749999999999987e-02*G0_0_0 - 3.750000000000012e-02*G0_0_1 - 3.749999999999996e-02*G0_1_0 - 3.750000000000038e-02*G0_1_1;
291
block[4] = -3.750000000000003e-02*G0_0_0 - 3.749999999999992e-02*G0_0_1 - 3.750000000000013e-02*G0_1_0 - 3.749999999999980e-02*G0_1_1;
292
block[5] = 3.750000000000010e-02*G0_0_0 + 3.374999999999996e-01*G0_0_1 + 3.750000000000017e-02*G0_1_0 + 3.374999999999997e-01*G0_1_1;
293
block[6] = 3.750000000000024e-02*G0_0_0 - 6.749999999999989e-01*G0_0_1 + 3.749999999999991e-02*G0_1_0 - 6.749999999999988e-01*G0_1_1;
294
block[7] = -6.749999999999997e-01*G0_0_0 + 3.749999999999988e-02*G0_0_1 - 6.749999999999996e-01*G0_1_0 + 3.749999999999964e-02*G0_1_1;
295
block[8] = 3.375000000000001e-01*G0_0_0 + 3.750000000000022e-02*G0_0_1 + 3.375000000000001e-01*G0_1_0 + 3.750000000000051e-02*G0_1_1;
296
block[9] = 0.000000000000000e+00;
297
block[10] = -8.750000000000013e-02*G0_0_0 - 8.750000000000022e-02*G0_0_1;
298
block[11] = 4.249999999999997e-01*G0_0_0;
299
block[12] = 8.750000000000011e-02*G0_0_1;
300
block[13] = 3.750000000000030e-02*G0_0_0 + 7.124999999999994e-01*G0_0_1;
301
block[14] = 3.750000000000041e-02*G0_0_0 - 2.999999999999993e-01*G0_0_1;
302
block[15] = -3.750000000000044e-02*G0_0_0;
303
block[16] = -3.749999999999944e-02*G0_0_0;
304
block[17] = 3.375000000000000e-01*G0_0_0 + 3.000000000000002e-01*G0_0_1;
305
block[18] = -6.749999999999996e-01*G0_0_0 - 7.124999999999994e-01*G0_0_1;
306
block[19] = 0.000000000000000e+00;
307
block[20] = -8.750000000000001e-02*G0_1_0 - 8.750000000000005e-02*G0_1_1;
308
block[21] = 8.750000000000011e-02*G0_1_0;
309
block[22] = 4.249999999999997e-01*G0_1_1;
310
block[23] = -2.999999999999994e-01*G0_1_0 + 3.750000000000030e-02*G0_1_1;
311
block[24] = 7.124999999999992e-01*G0_1_0 + 3.749999999999998e-02*G0_1_1;
312
block[25] = -7.124999999999992e-01*G0_1_0 - 6.749999999999997e-01*G0_1_1;
313
block[26] = 2.999999999999999e-01*G0_1_0 + 3.375000000000001e-01*G0_1_1;
314
block[27] = -3.749999999999994e-02*G0_1_1;
315
block[28] = -3.750000000000028e-02*G0_1_1;
316
block[29] = 0.000000000000000e+00;
317
block[30] = -3.749999999999987e-02*G0_0_0 - 3.749999999999996e-02*G0_0_1 - 3.750000000000010e-02*G0_1_0 - 3.750000000000037e-02*G0_1_1;
318
block[31] = 3.750000000000024e-02*G0_0_0 + 7.124999999999992e-01*G0_1_0;
319
block[32] = -2.999999999999994e-01*G0_0_1 + 3.750000000000028e-02*G0_1_1;
320
block[33] = 1.687499999999997e+00*G0_0_0 + 8.437499999999991e-01*G0_0_1 + 8.437499999999991e-01*G0_1_0 + 1.687499999999998e+00*G0_1_1;
321
block[34] = -3.374999999999996e-01*G0_0_0 + 8.437499999999984e-01*G0_0_1 - 1.687499999999994e-01*G0_1_0 - 3.374999999999997e-01*G0_1_1;
322
block[35] = 3.374999999999995e-01*G0_0_0 + 1.687500000000000e-01*G0_0_1 + 1.687499999999993e-01*G0_1_0;
323
block[36] = 3.374999999999992e-01*G0_0_0 + 1.687499999999993e-01*G0_0_1 + 1.687500000000002e-01*G0_1_0;
324
block[37] = 1.687499999999996e-01*G0_0_1 + 1.687499999999996e-01*G0_1_0 + 3.374999999999994e-01*G0_1_1;
325
block[38] = -8.437499999999994e-01*G0_0_1 - 8.437499999999989e-01*G0_1_0 - 1.687499999999998e+00*G0_1_1;
326
block[39] = -2.024999999999996e+00*G0_0_0 - 1.012499999999998e+00*G0_0_1 - 1.012500000000000e+00*G0_1_0;
327
block[40] = -3.750000000000003e-02*G0_0_0 - 3.750000000000012e-02*G0_0_1 - 3.749999999999992e-02*G0_1_0 - 3.749999999999982e-02*G0_1_1;
328
block[41] = 3.750000000000041e-02*G0_0_0 - 2.999999999999993e-01*G0_1_0;
329
block[42] = 7.124999999999992e-01*G0_0_1 + 3.749999999999996e-02*G0_1_1;
330
block[43] = -3.374999999999995e-01*G0_0_0 - 1.687499999999994e-01*G0_0_1 + 8.437499999999984e-01*G0_1_0 - 3.374999999999997e-01*G0_1_1;
331
block[44] = 1.687499999999998e+00*G0_0_0 + 8.437499999999987e-01*G0_0_1 + 8.437499999999984e-01*G0_1_0 + 1.687499999999998e+00*G0_1_1;
332
block[45] = -1.687499999999998e+00*G0_0_0 - 8.437499999999996e-01*G0_0_1 - 8.437499999999987e-01*G0_1_0;
333
block[46] = 3.374999999999999e-01*G0_0_0 + 1.687500000000003e-01*G0_0_1 + 1.687499999999994e-01*G0_1_0;
334
block[47] = 1.687499999999998e-01*G0_0_1 + 1.687499999999996e-01*G0_1_0 + 3.374999999999996e-01*G0_1_1;
335
block[48] = 1.687499999999992e-01*G0_0_1 + 1.687499999999996e-01*G0_1_0 + 3.374999999999992e-01*G0_1_1;
336
block[49] = -1.012499999999998e+00*G0_0_1 - 1.012499999999998e+00*G0_1_0 - 2.024999999999997e+00*G0_1_1;
337
block[50] = 3.750000000000009e-02*G0_0_0 + 3.750000000000017e-02*G0_0_1 + 3.374999999999996e-01*G0_1_0 + 3.374999999999996e-01*G0_1_1;
338
block[51] = -3.750000000000045e-02*G0_0_0;
339
block[52] = -7.124999999999994e-01*G0_0_1 - 6.749999999999996e-01*G0_1_1;
340
block[53] = 3.374999999999995e-01*G0_0_0 + 1.687499999999993e-01*G0_0_1 + 1.687500000000000e-01*G0_1_0;
341
block[54] = -1.687499999999998e+00*G0_0_0 - 8.437499999999987e-01*G0_0_1 - 8.437499999999996e-01*G0_1_0;
342
block[55] = 1.687499999999998e+00*G0_0_0 + 8.437499999999996e-01*G0_0_1 + 8.437499999999996e-01*G0_1_0 + 1.687499999999999e+00*G0_1_1;
343
block[56] = -3.374999999999999e-01*G0_0_0 - 1.687500000000005e-01*G0_0_1 - 1.181249999999999e+00*G0_1_0 - 1.349999999999999e+00*G0_1_1;
344
block[57] = -1.687499999999997e-01*G0_0_1 - 1.687500000000000e-01*G0_1_0;
345
block[58] = -1.687499999999992e-01*G0_0_1 - 1.687499999999993e-01*G0_1_0;
346
block[59] = 1.012499999999998e+00*G0_0_1 + 1.012500000000000e+00*G0_1_0;
347
block[60] = 3.750000000000023e-02*G0_0_0 + 3.749999999999988e-02*G0_0_1 - 6.749999999999989e-01*G0_1_0 - 6.749999999999988e-01*G0_1_1;
348
block[61] = -3.749999999999945e-02*G0_0_0;
349
block[62] = 2.999999999999999e-01*G0_0_1 + 3.375000000000001e-01*G0_1_1;
350
block[63] = 3.374999999999992e-01*G0_0_0 + 1.687500000000003e-01*G0_0_1 + 1.687499999999994e-01*G0_1_0;
351
block[64] = 3.374999999999999e-01*G0_0_0 + 1.687499999999994e-01*G0_0_1 + 1.687500000000004e-01*G0_1_0;
352
block[65] = -3.374999999999999e-01*G0_0_0 - 1.181249999999999e+00*G0_0_1 - 1.687500000000005e-01*G0_1_0 - 1.349999999999999e+00*G0_1_1;
353
block[66] = 1.687499999999999e+00*G0_0_0 + 8.437499999999993e-01*G0_0_1 + 8.437499999999993e-01*G0_1_0 + 1.687499999999998e+00*G0_1_1;
354
block[67] = 8.437499999999999e-01*G0_0_1 + 8.437499999999993e-01*G0_1_0;
355
block[68] = -1.687500000000006e-01*G0_0_1 - 1.687500000000005e-01*G0_1_0;
356
block[69] = -2.024999999999998e+00*G0_0_0 - 1.012499999999999e+00*G0_0_1 - 1.012499999999999e+00*G0_1_0;
357
block[70] = -6.749999999999997e-01*G0_0_0 - 6.749999999999995e-01*G0_0_1 + 3.749999999999985e-02*G0_1_0 + 3.749999999999964e-02*G0_1_1;
358
block[71] = 3.375000000000000e-01*G0_0_0 + 3.000000000000002e-01*G0_1_0;
359
block[72] = -3.749999999999996e-02*G0_1_1;
360
block[73] = 1.687499999999996e-01*G0_0_1 + 1.687499999999996e-01*G0_1_0 + 3.374999999999994e-01*G0_1_1;
361
block[74] = 1.687499999999996e-01*G0_0_1 + 1.687499999999998e-01*G0_1_0 + 3.374999999999996e-01*G0_1_1;
362
block[75] = -1.687500000000000e-01*G0_0_1 - 1.687499999999997e-01*G0_1_0;
363
block[76] = 8.437499999999993e-01*G0_0_1 + 8.437499999999999e-01*G0_1_0;
364
block[77] = 1.687499999999999e+00*G0_0_0 + 8.437500000000001e-01*G0_0_1 + 8.437500000000002e-01*G0_1_0 + 1.687500000000000e+00*G0_1_1;
365
block[78] = -1.350000000000000e+00*G0_0_0 - 1.687500000000001e-01*G0_0_1 - 1.181250000000000e+00*G0_1_0 - 3.375000000000000e-01*G0_1_1;
366
block[79] = -1.012499999999999e+00*G0_0_1 - 1.012500000000000e+00*G0_1_0 - 2.024999999999999e+00*G0_1_1;
367
block[80] = 3.375000000000001e-01*G0_0_0 + 3.375000000000001e-01*G0_0_1 + 3.750000000000021e-02*G0_1_0 + 3.750000000000050e-02*G0_1_1;
368
block[81] = -6.749999999999996e-01*G0_0_0 - 7.124999999999992e-01*G0_1_0;
369
block[82] = -3.750000000000027e-02*G0_1_1;
370
block[83] = -8.437499999999990e-01*G0_0_1 - 8.437499999999994e-01*G0_1_0 - 1.687499999999998e+00*G0_1_1;
371
block[84] = 1.687499999999996e-01*G0_0_1 + 1.687499999999992e-01*G0_1_0 + 3.374999999999991e-01*G0_1_1;
372
block[85] = -1.687499999999992e-01*G0_0_1 - 1.687499999999992e-01*G0_1_0;
373
block[86] = -1.687500000000005e-01*G0_0_1 - 1.687500000000006e-01*G0_1_0;
374
block[87] = -1.350000000000000e+00*G0_0_0 - 1.181250000000000e+00*G0_0_1 - 1.687500000000001e-01*G0_1_0 - 3.375000000000000e-01*G0_1_1;
375
block[88] = 1.687499999999999e+00*G0_0_0 + 8.437499999999996e-01*G0_0_1 + 8.437499999999993e-01*G0_1_0 + 1.687499999999998e+00*G0_1_1;
376
block[89] = 1.012500000000000e+00*G0_0_1 + 1.012500000000000e+00*G0_1_0;
377
block[90] = 0.000000000000000e+00;
378
block[91] = 0.000000000000000e+00;
379
block[92] = 0.000000000000000e+00;
380
block[93] = -2.024999999999997e+00*G0_0_0 - 1.012500000000000e+00*G0_0_1 - 1.012499999999998e+00*G0_1_0;
381
block[94] = -1.012499999999998e+00*G0_0_1 - 1.012499999999998e+00*G0_1_0 - 2.024999999999997e+00*G0_1_1;
382
block[95] = 1.012500000000000e+00*G0_0_1 + 1.012499999999998e+00*G0_1_0;
383
block[96] = -2.024999999999999e+00*G0_0_0 - 1.012499999999999e+00*G0_0_1 - 1.012499999999999e+00*G0_1_0;
384
block[97] = -1.012500000000000e+00*G0_0_1 - 1.012499999999999e+00*G0_1_0 - 2.024999999999999e+00*G0_1_1;
385
block[98] = 1.012500000000000e+00*G0_0_1 + 1.012500000000000e+00*G0_1_0;
386
block[99] = 4.049999999999995e+00*G0_0_0 + 2.024999999999998e+00*G0_0_1 + 2.024999999999997e+00*G0_1_0 + 4.049999999999995e+00*G0_1_1;
391
/// This class contains the form to be evaluated, including
392
/// contributions from the interior and boundary of the domain.
394
class LinearForm : public dolfin::LinearForm
398
class TestElement : public dolfin::FiniteElement
402
TestElement() : dolfin::FiniteElement(), tensordims(0), subelements(0)
404
// Element is scalar, don't need to initialize tensordims
406
// Element is simple, don't need to initialize subelements
411
if ( tensordims ) delete [] tensordims;
414
for (unsigned int i = 0; i < elementdim(); i++)
415
delete subelements[i];
416
delete [] subelements;
420
inline unsigned int spacedim() const
425
inline unsigned int shapedim() const
430
inline unsigned int tensordim(unsigned int i) const
432
dolfin_error("Element is scalar.");
436
inline unsigned int elementdim() const
441
inline unsigned int rank() const
446
void nodemap(int nodes[], const Cell& cell, const Mesh& mesh) const
448
static unsigned int edge_reordering_0[2][2] = {{0, 1}, {1, 0}};
449
nodes[0] = cell.vertexID(0);
450
nodes[1] = cell.vertexID(1);
451
nodes[2] = cell.vertexID(2);
452
int alignment = cell.edgeAlignment(0);
453
int offset = mesh.numVertices();
454
nodes[3] = offset + 2*cell.edgeID(0) + edge_reordering_0[alignment][0];
455
nodes[4] = offset + 2*cell.edgeID(0) + edge_reordering_0[alignment][1];
456
alignment = cell.edgeAlignment(1);
457
nodes[5] = offset + 2*cell.edgeID(1) + edge_reordering_0[alignment][0];
458
nodes[6] = offset + 2*cell.edgeID(1) + edge_reordering_0[alignment][1];
459
alignment = cell.edgeAlignment(2);
460
nodes[7] = offset + 2*cell.edgeID(2) + edge_reordering_0[alignment][0];
461
nodes[8] = offset + 2*cell.edgeID(2) + edge_reordering_0[alignment][1];
462
offset = offset + 2*mesh.numEdges();
463
nodes[9] = offset + cell.id();
466
void pointmap(Point points[], unsigned int components[], const AffineMap& map) const
468
points[0] = map(0.000000000000000e+00, 0.000000000000000e+00);
469
points[1] = map(1.000000000000000e+00, 0.000000000000000e+00);
470
points[2] = map(0.000000000000000e+00, 1.000000000000000e+00);
471
points[3] = map(6.666666666666667e-01, 3.333333333333333e-01);
472
points[4] = map(3.333333333333334e-01, 6.666666666666666e-01);
473
points[5] = map(0.000000000000000e+00, 6.666666666666667e-01);
474
points[6] = map(0.000000000000000e+00, 3.333333333333334e-01);
475
points[7] = map(3.333333333333333e-01, 0.000000000000000e+00);
476
points[8] = map(6.666666666666666e-01, 0.000000000000000e+00);
477
points[9] = map(3.333333333333333e-01, 3.333333333333333e-01);
490
void vertexeval(real values[], unsigned int vertex, const real x[], const Mesh& mesh) const
492
// FIXME: Temporary fix for Lagrange elements
493
values[0] = x[vertex];
496
const FiniteElement& operator[] (unsigned int i) const
501
FiniteElement& operator[] (unsigned int i)
506
FiniteElementSpec spec() const
508
FiniteElementSpec s("Lagrange", "triangle", 3);
514
unsigned int* tensordims;
515
FiniteElement** subelements;
519
class FunctionElement_0 : public dolfin::FiniteElement
523
FunctionElement_0() : dolfin::FiniteElement(), tensordims(0), subelements(0)
525
// Element is scalar, don't need to initialize tensordims
527
// Element is simple, don't need to initialize subelements
532
if ( tensordims ) delete [] tensordims;
535
for (unsigned int i = 0; i < elementdim(); i++)
536
delete subelements[i];
537
delete [] subelements;
541
inline unsigned int spacedim() const
546
inline unsigned int shapedim() const
551
inline unsigned int tensordim(unsigned int i) const
553
dolfin_error("Element is scalar.");
557
inline unsigned int elementdim() const
562
inline unsigned int rank() const
567
void nodemap(int nodes[], const Cell& cell, const Mesh& mesh) const
569
static unsigned int edge_reordering_0[2][2] = {{0, 1}, {1, 0}};
570
nodes[0] = cell.vertexID(0);
571
nodes[1] = cell.vertexID(1);
572
nodes[2] = cell.vertexID(2);
573
int alignment = cell.edgeAlignment(0);
574
int offset = mesh.numVertices();
575
nodes[3] = offset + 2*cell.edgeID(0) + edge_reordering_0[alignment][0];
576
nodes[4] = offset + 2*cell.edgeID(0) + edge_reordering_0[alignment][1];
577
alignment = cell.edgeAlignment(1);
578
nodes[5] = offset + 2*cell.edgeID(1) + edge_reordering_0[alignment][0];
579
nodes[6] = offset + 2*cell.edgeID(1) + edge_reordering_0[alignment][1];
580
alignment = cell.edgeAlignment(2);
581
nodes[7] = offset + 2*cell.edgeID(2) + edge_reordering_0[alignment][0];
582
nodes[8] = offset + 2*cell.edgeID(2) + edge_reordering_0[alignment][1];
583
offset = offset + 2*mesh.numEdges();
584
nodes[9] = offset + cell.id();
587
void pointmap(Point points[], unsigned int components[], const AffineMap& map) const
589
points[0] = map(0.000000000000000e+00, 0.000000000000000e+00);
590
points[1] = map(1.000000000000000e+00, 0.000000000000000e+00);
591
points[2] = map(0.000000000000000e+00, 1.000000000000000e+00);
592
points[3] = map(6.666666666666667e-01, 3.333333333333333e-01);
593
points[4] = map(3.333333333333334e-01, 6.666666666666666e-01);
594
points[5] = map(0.000000000000000e+00, 6.666666666666667e-01);
595
points[6] = map(0.000000000000000e+00, 3.333333333333334e-01);
596
points[7] = map(3.333333333333333e-01, 0.000000000000000e+00);
597
points[8] = map(6.666666666666666e-01, 0.000000000000000e+00);
598
points[9] = map(3.333333333333333e-01, 3.333333333333333e-01);
611
void vertexeval(real values[], unsigned int vertex, const real x[], const Mesh& mesh) const
613
// FIXME: Temporary fix for Lagrange elements
614
values[0] = x[vertex];
617
const FiniteElement& operator[] (unsigned int i) const
622
FiniteElement& operator[] (unsigned int i)
627
FiniteElementSpec spec() const
629
FiniteElementSpec s("Lagrange", "triangle", 3);
635
unsigned int* tensordims;
636
FiniteElement** subelements;
640
LinearForm(Function& w0) : dolfin::LinearForm(1)
642
// Create finite element for test space
643
_test = new TestElement();
646
add(w0, new FunctionElement_0());
649
void eval(real block[], const AffineMap& map) const
651
// Compute coefficients
652
const real c0_0 = c[0][0];
653
const real c0_1 = c[0][1];
654
const real c0_2 = c[0][2];
655
const real c0_3 = c[0][3];
656
const real c0_4 = c[0][4];
657
const real c0_5 = c[0][5];
658
const real c0_6 = c[0][6];
659
const real c0_7 = c[0][7];
660
const real c0_8 = c[0][8];
661
const real c0_9 = c[0][9];
663
// Compute geometry tensors
664
const real G0_0 = map.det*c0_0;
665
const real G0_1 = map.det*c0_1;
666
const real G0_2 = map.det*c0_2;
667
const real G0_3 = map.det*c0_3;
668
const real G0_4 = map.det*c0_4;
669
const real G0_5 = map.det*c0_5;
670
const real G0_6 = map.det*c0_6;
671
const real G0_7 = map.det*c0_7;
672
const real G0_8 = map.det*c0_8;
673
const real G0_9 = map.det*c0_9;
675
// Compute element tensor
676
block[0] = 5.654761904761898e-03*G0_0 + 8.184523809523806e-04*G0_1 + 8.184523809523796e-04*G0_2 + 2.008928571428569e-03*G0_3 + 2.008928571428570e-03*G0_4 + 1.339285714285713e-03*G0_6 + 1.339285714285708e-03*G0_7 + 2.678571428571429e-03*G0_9;
677
block[1] = 8.184523809523809e-04*G0_0 + 5.654761904761895e-03*G0_1 + 8.184523809523795e-04*G0_2 + 1.339285714285700e-03*G0_3 + 2.008928571428572e-03*G0_5 + 2.008928571428566e-03*G0_6 + 1.339285714285706e-03*G0_8 + 2.678571428571416e-03*G0_9;
678
block[2] = 8.184523809523796e-04*G0_0 + 8.184523809523796e-04*G0_1 + 5.654761904761899e-03*G0_2 + 1.339285714285713e-03*G0_4 + 1.339285714285709e-03*G0_5 + 2.008928571428571e-03*G0_7 + 2.008928571428569e-03*G0_8 + 2.678571428571422e-03*G0_9;
679
block[3] = 2.008928571428569e-03*G0_0 + 1.339285714285700e-03*G0_1 + 4.017857142857136e-02*G0_3 - 1.406249999999998e-02*G0_4 - 1.004464285714285e-02*G0_5 - 4.017857142857147e-03*G0_6 - 1.004464285714285e-02*G0_7 + 2.008928571428570e-02*G0_8 + 1.205357142857144e-02*G0_9;
680
block[4] = 2.008928571428570e-03*G0_0 + 1.339285714285713e-03*G0_2 - 1.406249999999998e-02*G0_3 + 4.017857142857139e-02*G0_4 + 2.008928571428570e-02*G0_5 - 1.004464285714285e-02*G0_6 - 4.017857142857136e-03*G0_7 - 1.004464285714285e-02*G0_8 + 1.205357142857142e-02*G0_9;
681
block[5] = 2.008928571428572e-03*G0_1 + 1.339285714285710e-03*G0_2 - 1.004464285714285e-02*G0_3 + 2.008928571428570e-02*G0_4 + 4.017857142857139e-02*G0_5 - 1.406249999999999e-02*G0_6 - 1.004464285714284e-02*G0_7 - 4.017857142857138e-03*G0_8 + 1.205357142857142e-02*G0_9;
682
block[6] = 1.339285714285713e-03*G0_0 + 2.008928571428566e-03*G0_1 - 4.017857142857146e-03*G0_3 - 1.004464285714285e-02*G0_4 - 1.406249999999999e-02*G0_5 + 4.017857142857138e-02*G0_6 + 2.008928571428570e-02*G0_7 - 1.004464285714285e-02*G0_8 + 1.205357142857141e-02*G0_9;
683
block[7] = 1.339285714285707e-03*G0_0 + 2.008928571428571e-03*G0_2 - 1.004464285714285e-02*G0_3 - 4.017857142857136e-03*G0_4 - 1.004464285714284e-02*G0_5 + 2.008928571428570e-02*G0_6 + 4.017857142857141e-02*G0_7 - 1.406249999999999e-02*G0_8 + 1.205357142857142e-02*G0_9;
684
block[8] = 1.339285714285706e-03*G0_1 + 2.008928571428569e-03*G0_2 + 2.008928571428570e-02*G0_3 - 1.004464285714285e-02*G0_4 - 4.017857142857138e-03*G0_5 - 1.004464285714285e-02*G0_6 - 1.406249999999999e-02*G0_7 + 4.017857142857140e-02*G0_8 + 1.205357142857143e-02*G0_9;
685
block[9] = 2.678571428571429e-03*G0_0 + 2.678571428571416e-03*G0_1 + 2.678571428571422e-03*G0_2 + 1.205357142857144e-02*G0_3 + 1.205357142857142e-02*G0_4 + 1.205357142857142e-02*G0_5 + 1.205357142857141e-02*G0_6 + 1.205357142857142e-02*G0_7 + 1.205357142857143e-02*G0_8 + 1.446428571428571e-01*G0_9;