1
// This code conforms with the UFC specification version 1.4
2
// and was automatically generated by FFC version 0.9.0.
4
#ifndef __STABILISEDSTOKES_H
5
#define __STABILISEDSTOKES_H
12
/// This class defines the interface for a finite element.
14
class stabilisedstokes_finite_element_0: public ufc::finite_element
19
stabilisedstokes_finite_element_0() : ufc::finite_element()
25
virtual ~stabilisedstokes_finite_element_0()
30
/// Return a string identifying the finite element
31
virtual const char* signature() const
33
return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)";
36
/// Return the cell shape
37
virtual ufc::shape cell_shape() const
42
/// Return the dimension of the finite element function space
43
virtual unsigned int space_dimension() const
48
/// Return the rank of the value space
49
virtual unsigned int value_rank() const
54
/// Return the dimension of the value space for axis i
55
virtual unsigned int value_dimension(unsigned int i) const
60
/// Evaluate basis function i at given point in cell
61
virtual void evaluate_basis(unsigned int i,
63
const double* coordinates,
64
const ufc::cell& c) const
66
// Extract vertex coordinates
67
const double * const * x = c.coordinates;
69
// Compute Jacobian of affine map from reference cell
70
const double J_00 = x[1][0] - x[0][0];
71
const double J_01 = x[2][0] - x[0][0];
72
const double J_10 = x[1][1] - x[0][1];
73
const double J_11 = x[2][1] - x[0][1];
75
// Compute determinant of Jacobian
76
double detJ = J_00*J_11 - J_01*J_10;
78
// Compute inverse of Jacobian
81
const double C0 = x[1][0] + x[2][0];
82
const double C1 = x[1][1] + x[2][1];
84
// Get coordinates and map to the reference (FIAT) element
85
double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
86
double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
91
// Map degree of freedom to element degree of freedom
92
const unsigned int dof = i;
94
// Array of basisvalues
95
double basisvalues[3] = {0.00000000, 0.00000000, 0.00000000};
97
// Declare helper variables
100
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
102
// Compute basisvalues
103
basisvalues[0] = 1.00000000;
104
basisvalues[1] = tmp0;
105
for (unsigned int r = 0; r < 1; r++)
107
rr = (r + 1)*(r + 1 + 1)/2 + 1;
109
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
110
}// end loop over 'r'
111
for (unsigned int r = 0; r < 2; r++)
113
for (unsigned int s = 0; s < 2 - r; s++)
115
rr = (r + s)*(r + s + 1)/2 + s;
116
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
117
}// end loop over 's'
118
}// end loop over 'r'
120
// Table(s) of coefficients
121
static const double coefficients0[3][3] = \
122
{{0.47140452, -0.28867513, -0.16666667},
123
{0.47140452, 0.28867513, -0.16666667},
124
{0.47140452, 0.00000000, 0.33333333}};
127
for (unsigned int r = 0; r < 3; r++)
129
*values += coefficients0[dof][r]*basisvalues[r];
130
}// end loop over 'r'
133
/// Evaluate all basis functions at given point in cell
134
virtual void evaluate_basis_all(double* values,
135
const double* coordinates,
136
const ufc::cell& c) const
138
// Helper variable to hold values of a single dof.
139
double dof_values = 0.00000000;
141
// Loop dofs and call evaluate_basis.
142
for (unsigned int r = 0; r < 3; r++)
144
evaluate_basis(r, &dof_values, coordinates, c);
145
values[r] = dof_values;
146
}// end loop over 'r'
149
/// Evaluate order n derivatives of basis function i at given point in cell
150
virtual void evaluate_basis_derivatives(unsigned int i,
153
const double* coordinates,
154
const ufc::cell& c) const
156
// Extract vertex coordinates
157
const double * const * x = c.coordinates;
159
// Compute Jacobian of affine map from reference cell
160
const double J_00 = x[1][0] - x[0][0];
161
const double J_01 = x[2][0] - x[0][0];
162
const double J_10 = x[1][1] - x[0][1];
163
const double J_11 = x[2][1] - x[0][1];
165
// Compute determinant of Jacobian
166
double detJ = J_00*J_11 - J_01*J_10;
168
// Compute inverse of Jacobian
169
const double K_00 = J_11 / detJ;
170
const double K_01 = -J_01 / detJ;
171
const double K_10 = -J_10 / detJ;
172
const double K_11 = J_00 / detJ;
175
const double C0 = x[1][0] + x[2][0];
176
const double C1 = x[1][1] + x[2][1];
178
// Get coordinates and map to the reference (FIAT) element
179
double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
180
double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
182
// Compute number of derivatives.
183
unsigned int num_derivatives = 1;
185
for (unsigned int r = 0; r < n; r++)
187
num_derivatives *= 2;
188
}// end loop over 'r'
190
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
191
unsigned int **combinations = new unsigned int *[num_derivatives];
192
for (unsigned int row = 0; row < num_derivatives; row++)
194
combinations[row] = new unsigned int [n];
195
for (unsigned int col = 0; col < n; col++)
196
combinations[row][col] = 0;
199
// Generate combinations of derivatives
200
for (unsigned int row = 1; row < num_derivatives; row++)
202
for (unsigned int num = 0; num < row; num++)
204
for (unsigned int col = n-1; col+1 > 0; col--)
206
if (combinations[row][col] + 1 > 1)
207
combinations[row][col] = 0;
210
combinations[row][col] += 1;
217
// Compute inverse of Jacobian
218
const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
220
// Declare transformation matrix
221
// Declare pointer to two dimensional array and initialise
222
double **transform = new double *[num_derivatives];
224
for (unsigned int j = 0; j < num_derivatives; j++)
226
transform[j] = new double [num_derivatives];
227
for (unsigned int k = 0; k < num_derivatives; k++)
231
// Construct transformation matrix
232
for (unsigned int row = 0; row < num_derivatives; row++)
234
for (unsigned int col = 0; col < num_derivatives; col++)
236
for (unsigned int k = 0; k < n; k++)
237
transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
241
// Reset values. Assuming that values is always an array.
242
for (unsigned int r = 0; r < num_derivatives; r++)
244
values[r] = 0.00000000;
245
}// end loop over 'r'
247
// Map degree of freedom to element degree of freedom
248
const unsigned int dof = i;
250
// Array of basisvalues
251
double basisvalues[3] = {0.00000000, 0.00000000, 0.00000000};
253
// Declare helper variables
256
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
258
// Compute basisvalues
259
basisvalues[0] = 1.00000000;
260
basisvalues[1] = tmp0;
261
for (unsigned int r = 0; r < 1; r++)
263
rr = (r + 1)*(r + 1 + 1)/2 + 1;
265
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
266
}// end loop over 'r'
267
for (unsigned int r = 0; r < 2; r++)
269
for (unsigned int s = 0; s < 2 - r; s++)
271
rr = (r + s)*(r + s + 1)/2 + s;
272
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
273
}// end loop over 's'
274
}// end loop over 'r'
276
// Table(s) of coefficients
277
static const double coefficients0[3][3] = \
278
{{0.47140452, -0.28867513, -0.16666667},
279
{0.47140452, 0.28867513, -0.16666667},
280
{0.47140452, 0.00000000, 0.33333333}};
282
// Tables of derivatives of the polynomial base (transpose).
283
static const double dmats0[3][3] = \
284
{{0.00000000, 0.00000000, 0.00000000},
285
{4.89897949, 0.00000000, 0.00000000},
286
{0.00000000, 0.00000000, 0.00000000}};
288
static const double dmats1[3][3] = \
289
{{0.00000000, 0.00000000, 0.00000000},
290
{2.44948974, 0.00000000, 0.00000000},
291
{4.24264069, 0.00000000, 0.00000000}};
293
// Compute reference derivatives
294
// Declare pointer to array of derivatives on FIAT element
295
double *derivatives = new double [num_derivatives];
296
for (unsigned int r = 0; r < num_derivatives; r++)
298
derivatives[r] = 0.00000000;
299
}// end loop over 'r'
301
// Declare derivative matrix (of polynomial basis).
302
double dmats[3][3] = \
303
{{1.00000000, 0.00000000, 0.00000000},
304
{0.00000000, 1.00000000, 0.00000000},
305
{0.00000000, 0.00000000, 1.00000000}};
307
// Declare (auxiliary) derivative matrix (of polynomial basis).
308
double dmats_old[3][3] = \
309
{{1.00000000, 0.00000000, 0.00000000},
310
{0.00000000, 1.00000000, 0.00000000},
311
{0.00000000, 0.00000000, 1.00000000}};
313
// Loop possible derivatives.
314
for (unsigned int r = 0; r < num_derivatives; r++)
316
// Resetting dmats values to compute next derivative.
317
for (unsigned int t = 0; t < 3; t++)
319
for (unsigned int u = 0; u < 3; u++)
321
dmats[t][u] = 0.00000000;
324
dmats[t][u] = 1.00000000;
327
}// end loop over 'u'
328
}// end loop over 't'
330
// Looping derivative order to generate dmats.
331
for (unsigned int s = 0; s < n; s++)
333
// Updating dmats_old with new values and resetting dmats.
334
for (unsigned int t = 0; t < 3; t++)
336
for (unsigned int u = 0; u < 3; u++)
338
dmats_old[t][u] = dmats[t][u];
339
dmats[t][u] = 0.00000000;
340
}// end loop over 'u'
341
}// end loop over 't'
343
// Update dmats using an inner product.
344
if (combinations[r][s] == 0)
346
for (unsigned int t = 0; t < 3; t++)
348
for (unsigned int u = 0; u < 3; u++)
350
for (unsigned int tu = 0; tu < 3; tu++)
352
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
353
}// end loop over 'tu'
354
}// end loop over 'u'
355
}// end loop over 't'
358
if (combinations[r][s] == 1)
360
for (unsigned int t = 0; t < 3; t++)
362
for (unsigned int u = 0; u < 3; u++)
364
for (unsigned int tu = 0; tu < 3; tu++)
366
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
367
}// end loop over 'tu'
368
}// end loop over 'u'
369
}// end loop over 't'
372
}// end loop over 's'
373
for (unsigned int s = 0; s < 3; s++)
375
for (unsigned int t = 0; t < 3; t++)
377
derivatives[r] += coefficients0[dof][s]*dmats[s][t]*basisvalues[t];
378
}// end loop over 't'
379
}// end loop over 's'
380
}// end loop over 'r'
382
// Transform derivatives back to physical element
383
for (unsigned int row = 0; row < num_derivatives; row++)
385
for (unsigned int col = 0; col < num_derivatives; col++)
387
values[row] += transform[row][col]*derivatives[col];
391
// Delete pointer to array of derivatives on FIAT element
392
delete [] derivatives;
394
// Delete pointer to array of combinations of derivatives and transform
395
for (unsigned int r = 0; r < num_derivatives; r++)
397
delete [] combinations[r];
398
delete [] transform[r];
399
}// end loop over 'r'
400
delete [] combinations;
404
/// Evaluate order n derivatives of all basis functions at given point in cell
405
virtual void evaluate_basis_derivatives_all(unsigned int n,
407
const double* coordinates,
408
const ufc::cell& c) const
410
// Compute number of derivatives.
411
unsigned int num_derivatives = 1;
413
for (unsigned int r = 0; r < n; r++)
415
num_derivatives *= 2;
416
}// end loop over 'r'
418
// Helper variable to hold values of a single dof.
419
double *dof_values = new double [num_derivatives];
420
for (unsigned int r = 0; r < num_derivatives; r++)
422
dof_values[r] = 0.00000000;
423
}// end loop over 'r'
425
// Loop dofs and call evaluate_basis_derivatives.
426
for (unsigned int r = 0; r < 3; r++)
428
evaluate_basis_derivatives(r, n, dof_values, coordinates, c);
429
for (unsigned int s = 0; s < num_derivatives; s++)
431
values[r*num_derivatives + s] = dof_values[s];
432
}// end loop over 's'
433
}// end loop over 'r'
436
delete [] dof_values;
439
/// Evaluate linear functional for dof i on the function f
440
virtual double evaluate_dof(unsigned int i,
441
const ufc::function& f,
442
const ufc::cell& c) const
444
// Declare variables for result of evaluation
447
// Declare variable for physical coordinates
450
const double * const * x = c.coordinates;
457
f.evaluate(vals, y, c);
465
f.evaluate(vals, y, c);
473
f.evaluate(vals, y, c);
482
/// Evaluate linear functionals for all dofs on the function f
483
virtual void evaluate_dofs(double* values,
484
const ufc::function& f,
485
const ufc::cell& c) const
487
// Declare variables for result of evaluation
490
// Declare variable for physical coordinates
493
const double * const * x = c.coordinates;
496
f.evaluate(vals, y, c);
500
f.evaluate(vals, y, c);
504
f.evaluate(vals, y, c);
508
/// Interpolate vertex values from dof values
509
virtual void interpolate_vertex_values(double* vertex_values,
510
const double* dof_values,
511
const ufc::cell& c) const
513
// Evaluate function and change variables
514
vertex_values[0] = dof_values[0];
515
vertex_values[1] = dof_values[1];
516
vertex_values[2] = dof_values[2];
519
/// Return the number of sub elements (for a mixed element)
520
virtual unsigned int num_sub_elements() const
525
/// Create a new finite element for sub element i (for a mixed element)
526
virtual ufc::finite_element* create_sub_element(unsigned int i) const
533
/// This class defines the interface for a finite element.
535
class stabilisedstokes_finite_element_1: public ufc::finite_element
540
stabilisedstokes_finite_element_1() : ufc::finite_element()
546
virtual ~stabilisedstokes_finite_element_1()
551
/// Return a string identifying the finite element
552
virtual const char* signature() const
554
return "VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2)";
557
/// Return the cell shape
558
virtual ufc::shape cell_shape() const
560
return ufc::triangle;
563
/// Return the dimension of the finite element function space
564
virtual unsigned int space_dimension() const
569
/// Return the rank of the value space
570
virtual unsigned int value_rank() const
575
/// Return the dimension of the value space for axis i
576
virtual unsigned int value_dimension(unsigned int i) const
590
/// Evaluate basis function i at given point in cell
591
virtual void evaluate_basis(unsigned int i,
593
const double* coordinates,
594
const ufc::cell& c) const
596
// Extract vertex coordinates
597
const double * const * x = c.coordinates;
599
// Compute Jacobian of affine map from reference cell
600
const double J_00 = x[1][0] - x[0][0];
601
const double J_01 = x[2][0] - x[0][0];
602
const double J_10 = x[1][1] - x[0][1];
603
const double J_11 = x[2][1] - x[0][1];
605
// Compute determinant of Jacobian
606
double detJ = J_00*J_11 - J_01*J_10;
608
// Compute inverse of Jacobian
611
const double C0 = x[1][0] + x[2][0];
612
const double C1 = x[1][1] + x[2][1];
614
// Get coordinates and map to the reference (FIAT) element
615
double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
616
double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
619
values[0] = 0.00000000;
620
values[1] = 0.00000000;
621
if (0 <= i && i <= 2)
623
// Map degree of freedom to element degree of freedom
624
const unsigned int dof = i;
626
// Array of basisvalues
627
double basisvalues[3] = {0.00000000, 0.00000000, 0.00000000};
629
// Declare helper variables
632
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
634
// Compute basisvalues
635
basisvalues[0] = 1.00000000;
636
basisvalues[1] = tmp0;
637
for (unsigned int r = 0; r < 1; r++)
639
rr = (r + 1)*(r + 1 + 1)/2 + 1;
641
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
642
}// end loop over 'r'
643
for (unsigned int r = 0; r < 2; r++)
645
for (unsigned int s = 0; s < 2 - r; s++)
647
rr = (r + s)*(r + s + 1)/2 + s;
648
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
649
}// end loop over 's'
650
}// end loop over 'r'
652
// Table(s) of coefficients
653
static const double coefficients0[3][3] = \
654
{{0.47140452, -0.28867513, -0.16666667},
655
{0.47140452, 0.28867513, -0.16666667},
656
{0.47140452, 0.00000000, 0.33333333}};
659
for (unsigned int r = 0; r < 3; r++)
661
values[0] += coefficients0[dof][r]*basisvalues[r];
662
}// end loop over 'r'
665
if (3 <= i && i <= 5)
667
// Map degree of freedom to element degree of freedom
668
const unsigned int dof = i - 3;
670
// Array of basisvalues
671
double basisvalues[3] = {0.00000000, 0.00000000, 0.00000000};
673
// Declare helper variables
676
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
678
// Compute basisvalues
679
basisvalues[0] = 1.00000000;
680
basisvalues[1] = tmp0;
681
for (unsigned int r = 0; r < 1; r++)
683
rr = (r + 1)*(r + 1 + 1)/2 + 1;
685
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
686
}// end loop over 'r'
687
for (unsigned int r = 0; r < 2; r++)
689
for (unsigned int s = 0; s < 2 - r; s++)
691
rr = (r + s)*(r + s + 1)/2 + s;
692
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
693
}// end loop over 's'
694
}// end loop over 'r'
696
// Table(s) of coefficients
697
static const double coefficients0[3][3] = \
698
{{0.47140452, -0.28867513, -0.16666667},
699
{0.47140452, 0.28867513, -0.16666667},
700
{0.47140452, 0.00000000, 0.33333333}};
703
for (unsigned int r = 0; r < 3; r++)
705
values[1] += coefficients0[dof][r]*basisvalues[r];
706
}// end loop over 'r'
711
/// Evaluate all basis functions at given point in cell
712
virtual void evaluate_basis_all(double* values,
713
const double* coordinates,
714
const ufc::cell& c) const
716
// Helper variable to hold values of a single dof.
717
double dof_values[2] = {0.00000000, 0.00000000};
719
// Loop dofs and call evaluate_basis.
720
for (unsigned int r = 0; r < 6; r++)
722
evaluate_basis(r, dof_values, coordinates, c);
723
for (unsigned int s = 0; s < 2; s++)
725
values[r*2 + s] = dof_values[s];
726
}// end loop over 's'
727
}// end loop over 'r'
730
/// Evaluate order n derivatives of basis function i at given point in cell
731
virtual void evaluate_basis_derivatives(unsigned int i,
734
const double* coordinates,
735
const ufc::cell& c) const
737
// Extract vertex coordinates
738
const double * const * x = c.coordinates;
740
// Compute Jacobian of affine map from reference cell
741
const double J_00 = x[1][0] - x[0][0];
742
const double J_01 = x[2][0] - x[0][0];
743
const double J_10 = x[1][1] - x[0][1];
744
const double J_11 = x[2][1] - x[0][1];
746
// Compute determinant of Jacobian
747
double detJ = J_00*J_11 - J_01*J_10;
749
// Compute inverse of Jacobian
750
const double K_00 = J_11 / detJ;
751
const double K_01 = -J_01 / detJ;
752
const double K_10 = -J_10 / detJ;
753
const double K_11 = J_00 / detJ;
756
const double C0 = x[1][0] + x[2][0];
757
const double C1 = x[1][1] + x[2][1];
759
// Get coordinates and map to the reference (FIAT) element
760
double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
761
double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
763
// Compute number of derivatives.
764
unsigned int num_derivatives = 1;
766
for (unsigned int r = 0; r < n; r++)
768
num_derivatives *= 2;
769
}// end loop over 'r'
771
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
772
unsigned int **combinations = new unsigned int *[num_derivatives];
773
for (unsigned int row = 0; row < num_derivatives; row++)
775
combinations[row] = new unsigned int [n];
776
for (unsigned int col = 0; col < n; col++)
777
combinations[row][col] = 0;
780
// Generate combinations of derivatives
781
for (unsigned int row = 1; row < num_derivatives; row++)
783
for (unsigned int num = 0; num < row; num++)
785
for (unsigned int col = n-1; col+1 > 0; col--)
787
if (combinations[row][col] + 1 > 1)
788
combinations[row][col] = 0;
791
combinations[row][col] += 1;
798
// Compute inverse of Jacobian
799
const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
801
// Declare transformation matrix
802
// Declare pointer to two dimensional array and initialise
803
double **transform = new double *[num_derivatives];
805
for (unsigned int j = 0; j < num_derivatives; j++)
807
transform[j] = new double [num_derivatives];
808
for (unsigned int k = 0; k < num_derivatives; k++)
812
// Construct transformation matrix
813
for (unsigned int row = 0; row < num_derivatives; row++)
815
for (unsigned int col = 0; col < num_derivatives; col++)
817
for (unsigned int k = 0; k < n; k++)
818
transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
822
// Reset values. Assuming that values is always an array.
823
for (unsigned int r = 0; r < 2*num_derivatives; r++)
825
values[r] = 0.00000000;
826
}// end loop over 'r'
828
if (0 <= i && i <= 2)
830
// Map degree of freedom to element degree of freedom
831
const unsigned int dof = i;
833
// Array of basisvalues
834
double basisvalues[3] = {0.00000000, 0.00000000, 0.00000000};
836
// Declare helper variables
839
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
841
// Compute basisvalues
842
basisvalues[0] = 1.00000000;
843
basisvalues[1] = tmp0;
844
for (unsigned int r = 0; r < 1; r++)
846
rr = (r + 1)*(r + 1 + 1)/2 + 1;
848
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
849
}// end loop over 'r'
850
for (unsigned int r = 0; r < 2; r++)
852
for (unsigned int s = 0; s < 2 - r; s++)
854
rr = (r + s)*(r + s + 1)/2 + s;
855
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
856
}// end loop over 's'
857
}// end loop over 'r'
859
// Table(s) of coefficients
860
static const double coefficients0[3][3] = \
861
{{0.47140452, -0.28867513, -0.16666667},
862
{0.47140452, 0.28867513, -0.16666667},
863
{0.47140452, 0.00000000, 0.33333333}};
865
// Tables of derivatives of the polynomial base (transpose).
866
static const double dmats0[3][3] = \
867
{{0.00000000, 0.00000000, 0.00000000},
868
{4.89897949, 0.00000000, 0.00000000},
869
{0.00000000, 0.00000000, 0.00000000}};
871
static const double dmats1[3][3] = \
872
{{0.00000000, 0.00000000, 0.00000000},
873
{2.44948974, 0.00000000, 0.00000000},
874
{4.24264069, 0.00000000, 0.00000000}};
876
// Compute reference derivatives
877
// Declare pointer to array of derivatives on FIAT element
878
double *derivatives = new double [num_derivatives];
879
for (unsigned int r = 0; r < num_derivatives; r++)
881
derivatives[r] = 0.00000000;
882
}// end loop over 'r'
884
// Declare derivative matrix (of polynomial basis).
885
double dmats[3][3] = \
886
{{1.00000000, 0.00000000, 0.00000000},
887
{0.00000000, 1.00000000, 0.00000000},
888
{0.00000000, 0.00000000, 1.00000000}};
890
// Declare (auxiliary) derivative matrix (of polynomial basis).
891
double dmats_old[3][3] = \
892
{{1.00000000, 0.00000000, 0.00000000},
893
{0.00000000, 1.00000000, 0.00000000},
894
{0.00000000, 0.00000000, 1.00000000}};
896
// Loop possible derivatives.
897
for (unsigned int r = 0; r < num_derivatives; r++)
899
// Resetting dmats values to compute next derivative.
900
for (unsigned int t = 0; t < 3; t++)
902
for (unsigned int u = 0; u < 3; u++)
904
dmats[t][u] = 0.00000000;
907
dmats[t][u] = 1.00000000;
910
}// end loop over 'u'
911
}// end loop over 't'
913
// Looping derivative order to generate dmats.
914
for (unsigned int s = 0; s < n; s++)
916
// Updating dmats_old with new values and resetting dmats.
917
for (unsigned int t = 0; t < 3; t++)
919
for (unsigned int u = 0; u < 3; u++)
921
dmats_old[t][u] = dmats[t][u];
922
dmats[t][u] = 0.00000000;
923
}// end loop over 'u'
924
}// end loop over 't'
926
// Update dmats using an inner product.
927
if (combinations[r][s] == 0)
929
for (unsigned int t = 0; t < 3; t++)
931
for (unsigned int u = 0; u < 3; u++)
933
for (unsigned int tu = 0; tu < 3; tu++)
935
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
936
}// end loop over 'tu'
937
}// end loop over 'u'
938
}// end loop over 't'
941
if (combinations[r][s] == 1)
943
for (unsigned int t = 0; t < 3; t++)
945
for (unsigned int u = 0; u < 3; u++)
947
for (unsigned int tu = 0; tu < 3; tu++)
949
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
950
}// end loop over 'tu'
951
}// end loop over 'u'
952
}// end loop over 't'
955
}// end loop over 's'
956
for (unsigned int s = 0; s < 3; s++)
958
for (unsigned int t = 0; t < 3; t++)
960
derivatives[r] += coefficients0[dof][s]*dmats[s][t]*basisvalues[t];
961
}// end loop over 't'
962
}// end loop over 's'
963
}// end loop over 'r'
965
// Transform derivatives back to physical element
966
for (unsigned int row = 0; row < num_derivatives; row++)
968
for (unsigned int col = 0; col < num_derivatives; col++)
970
values[row] += transform[row][col]*derivatives[col];
974
// Delete pointer to array of derivatives on FIAT element
975
delete [] derivatives;
977
// Delete pointer to array of combinations of derivatives and transform
978
for (unsigned int r = 0; r < num_derivatives; r++)
980
delete [] combinations[r];
981
delete [] transform[r];
982
}// end loop over 'r'
983
delete [] combinations;
987
if (3 <= i && i <= 5)
989
// Map degree of freedom to element degree of freedom
990
const unsigned int dof = i - 3;
992
// Array of basisvalues
993
double basisvalues[3] = {0.00000000, 0.00000000, 0.00000000};
995
// Declare helper variables
998
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
1000
// Compute basisvalues
1001
basisvalues[0] = 1.00000000;
1002
basisvalues[1] = tmp0;
1003
for (unsigned int r = 0; r < 1; r++)
1005
rr = (r + 1)*(r + 1 + 1)/2 + 1;
1007
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
1008
}// end loop over 'r'
1009
for (unsigned int r = 0; r < 2; r++)
1011
for (unsigned int s = 0; s < 2 - r; s++)
1013
rr = (r + s)*(r + s + 1)/2 + s;
1014
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
1015
}// end loop over 's'
1016
}// end loop over 'r'
1018
// Table(s) of coefficients
1019
static const double coefficients0[3][3] = \
1020
{{0.47140452, -0.28867513, -0.16666667},
1021
{0.47140452, 0.28867513, -0.16666667},
1022
{0.47140452, 0.00000000, 0.33333333}};
1024
// Tables of derivatives of the polynomial base (transpose).
1025
static const double dmats0[3][3] = \
1026
{{0.00000000, 0.00000000, 0.00000000},
1027
{4.89897949, 0.00000000, 0.00000000},
1028
{0.00000000, 0.00000000, 0.00000000}};
1030
static const double dmats1[3][3] = \
1031
{{0.00000000, 0.00000000, 0.00000000},
1032
{2.44948974, 0.00000000, 0.00000000},
1033
{4.24264069, 0.00000000, 0.00000000}};
1035
// Compute reference derivatives
1036
// Declare pointer to array of derivatives on FIAT element
1037
double *derivatives = new double [num_derivatives];
1038
for (unsigned int r = 0; r < num_derivatives; r++)
1040
derivatives[r] = 0.00000000;
1041
}// end loop over 'r'
1043
// Declare derivative matrix (of polynomial basis).
1044
double dmats[3][3] = \
1045
{{1.00000000, 0.00000000, 0.00000000},
1046
{0.00000000, 1.00000000, 0.00000000},
1047
{0.00000000, 0.00000000, 1.00000000}};
1049
// Declare (auxiliary) derivative matrix (of polynomial basis).
1050
double dmats_old[3][3] = \
1051
{{1.00000000, 0.00000000, 0.00000000},
1052
{0.00000000, 1.00000000, 0.00000000},
1053
{0.00000000, 0.00000000, 1.00000000}};
1055
// Loop possible derivatives.
1056
for (unsigned int r = 0; r < num_derivatives; r++)
1058
// Resetting dmats values to compute next derivative.
1059
for (unsigned int t = 0; t < 3; t++)
1061
for (unsigned int u = 0; u < 3; u++)
1063
dmats[t][u] = 0.00000000;
1066
dmats[t][u] = 1.00000000;
1069
}// end loop over 'u'
1070
}// end loop over 't'
1072
// Looping derivative order to generate dmats.
1073
for (unsigned int s = 0; s < n; s++)
1075
// Updating dmats_old with new values and resetting dmats.
1076
for (unsigned int t = 0; t < 3; t++)
1078
for (unsigned int u = 0; u < 3; u++)
1080
dmats_old[t][u] = dmats[t][u];
1081
dmats[t][u] = 0.00000000;
1082
}// end loop over 'u'
1083
}// end loop over 't'
1085
// Update dmats using an inner product.
1086
if (combinations[r][s] == 0)
1088
for (unsigned int t = 0; t < 3; t++)
1090
for (unsigned int u = 0; u < 3; u++)
1092
for (unsigned int tu = 0; tu < 3; tu++)
1094
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1095
}// end loop over 'tu'
1096
}// end loop over 'u'
1097
}// end loop over 't'
1100
if (combinations[r][s] == 1)
1102
for (unsigned int t = 0; t < 3; t++)
1104
for (unsigned int u = 0; u < 3; u++)
1106
for (unsigned int tu = 0; tu < 3; tu++)
1108
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1109
}// end loop over 'tu'
1110
}// end loop over 'u'
1111
}// end loop over 't'
1114
}// end loop over 's'
1115
for (unsigned int s = 0; s < 3; s++)
1117
for (unsigned int t = 0; t < 3; t++)
1119
derivatives[r] += coefficients0[dof][s]*dmats[s][t]*basisvalues[t];
1120
}// end loop over 't'
1121
}// end loop over 's'
1122
}// end loop over 'r'
1124
// Transform derivatives back to physical element
1125
for (unsigned int row = 0; row < num_derivatives; row++)
1127
for (unsigned int col = 0; col < num_derivatives; col++)
1129
values[num_derivatives + row] += transform[row][col]*derivatives[col];
1133
// Delete pointer to array of derivatives on FIAT element
1134
delete [] derivatives;
1136
// Delete pointer to array of combinations of derivatives and transform
1137
for (unsigned int r = 0; r < num_derivatives; r++)
1139
delete [] combinations[r];
1140
delete [] transform[r];
1141
}// end loop over 'r'
1142
delete [] combinations;
1143
delete [] transform;
1148
/// Evaluate order n derivatives of all basis functions at given point in cell
1149
virtual void evaluate_basis_derivatives_all(unsigned int n,
1151
const double* coordinates,
1152
const ufc::cell& c) const
1154
// Compute number of derivatives.
1155
unsigned int num_derivatives = 1;
1157
for (unsigned int r = 0; r < n; r++)
1159
num_derivatives *= 2;
1160
}// end loop over 'r'
1162
// Helper variable to hold values of a single dof.
1163
double *dof_values = new double [2*num_derivatives];
1164
for (unsigned int r = 0; r < 2*num_derivatives; r++)
1166
dof_values[r] = 0.00000000;
1167
}// end loop over 'r'
1169
// Loop dofs and call evaluate_basis_derivatives.
1170
for (unsigned int r = 0; r < 6; r++)
1172
evaluate_basis_derivatives(r, n, dof_values, coordinates, c);
1173
for (unsigned int s = 0; s < 2*num_derivatives; s++)
1175
values[r*2*num_derivatives + s] = dof_values[s];
1176
}// end loop over 's'
1177
}// end loop over 'r'
1180
delete [] dof_values;
1183
/// Evaluate linear functional for dof i on the function f
1184
virtual double evaluate_dof(unsigned int i,
1185
const ufc::function& f,
1186
const ufc::cell& c) const
1188
// Declare variables for result of evaluation
1191
// Declare variable for physical coordinates
1194
const double * const * x = c.coordinates;
1201
f.evaluate(vals, y, c);
1209
f.evaluate(vals, y, c);
1217
f.evaluate(vals, y, c);
1225
f.evaluate(vals, y, c);
1233
f.evaluate(vals, y, c);
1241
f.evaluate(vals, y, c);
1250
/// Evaluate linear functionals for all dofs on the function f
1251
virtual void evaluate_dofs(double* values,
1252
const ufc::function& f,
1253
const ufc::cell& c) const
1255
// Declare variables for result of evaluation
1258
// Declare variable for physical coordinates
1261
const double * const * x = c.coordinates;
1264
f.evaluate(vals, y, c);
1265
values[0] = vals[0];
1268
f.evaluate(vals, y, c);
1269
values[1] = vals[0];
1272
f.evaluate(vals, y, c);
1273
values[2] = vals[0];
1276
f.evaluate(vals, y, c);
1277
values[3] = vals[1];
1280
f.evaluate(vals, y, c);
1281
values[4] = vals[1];
1284
f.evaluate(vals, y, c);
1285
values[5] = vals[1];
1288
/// Interpolate vertex values from dof values
1289
virtual void interpolate_vertex_values(double* vertex_values,
1290
const double* dof_values,
1291
const ufc::cell& c) const
1293
// Evaluate function and change variables
1294
vertex_values[0] = dof_values[0];
1295
vertex_values[2] = dof_values[1];
1296
vertex_values[4] = dof_values[2];
1297
// Evaluate function and change variables
1298
vertex_values[1] = dof_values[3];
1299
vertex_values[3] = dof_values[4];
1300
vertex_values[5] = dof_values[5];
1303
/// Return the number of sub elements (for a mixed element)
1304
virtual unsigned int num_sub_elements() const
1309
/// Create a new finite element for sub element i (for a mixed element)
1310
virtual ufc::finite_element* create_sub_element(unsigned int i) const
1316
return new stabilisedstokes_finite_element_0();
1321
return new stabilisedstokes_finite_element_0();
1331
/// This class defines the interface for a finite element.
1333
class stabilisedstokes_finite_element_2: public ufc::finite_element
1338
stabilisedstokes_finite_element_2() : ufc::finite_element()
1344
virtual ~stabilisedstokes_finite_element_2()
1349
/// Return a string identifying the finite element
1350
virtual const char* signature() const
1352
return "MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) })";
1355
/// Return the cell shape
1356
virtual ufc::shape cell_shape() const
1358
return ufc::triangle;
1361
/// Return the dimension of the finite element function space
1362
virtual unsigned int space_dimension() const
1367
/// Return the rank of the value space
1368
virtual unsigned int value_rank() const
1373
/// Return the dimension of the value space for axis i
1374
virtual unsigned int value_dimension(unsigned int i) const
1388
/// Evaluate basis function i at given point in cell
1389
virtual void evaluate_basis(unsigned int i,
1391
const double* coordinates,
1392
const ufc::cell& c) const
1394
// Extract vertex coordinates
1395
const double * const * x = c.coordinates;
1397
// Compute Jacobian of affine map from reference cell
1398
const double J_00 = x[1][0] - x[0][0];
1399
const double J_01 = x[2][0] - x[0][0];
1400
const double J_10 = x[1][1] - x[0][1];
1401
const double J_11 = x[2][1] - x[0][1];
1403
// Compute determinant of Jacobian
1404
double detJ = J_00*J_11 - J_01*J_10;
1406
// Compute inverse of Jacobian
1408
// Compute constants
1409
const double C0 = x[1][0] + x[2][0];
1410
const double C1 = x[1][1] + x[2][1];
1412
// Get coordinates and map to the reference (FIAT) element
1413
double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
1414
double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
1417
values[0] = 0.00000000;
1418
values[1] = 0.00000000;
1419
values[2] = 0.00000000;
1420
if (0 <= i && i <= 2)
1422
// Map degree of freedom to element degree of freedom
1423
const unsigned int dof = i;
1425
// Array of basisvalues
1426
double basisvalues[3] = {0.00000000, 0.00000000, 0.00000000};
1428
// Declare helper variables
1429
unsigned int rr = 0;
1430
unsigned int ss = 0;
1431
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
1433
// Compute basisvalues
1434
basisvalues[0] = 1.00000000;
1435
basisvalues[1] = tmp0;
1436
for (unsigned int r = 0; r < 1; r++)
1438
rr = (r + 1)*(r + 1 + 1)/2 + 1;
1440
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
1441
}// end loop over 'r'
1442
for (unsigned int r = 0; r < 2; r++)
1444
for (unsigned int s = 0; s < 2 - r; s++)
1446
rr = (r + s)*(r + s + 1)/2 + s;
1447
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
1448
}// end loop over 's'
1449
}// end loop over 'r'
1451
// Table(s) of coefficients
1452
static const double coefficients0[3][3] = \
1453
{{0.47140452, -0.28867513, -0.16666667},
1454
{0.47140452, 0.28867513, -0.16666667},
1455
{0.47140452, 0.00000000, 0.33333333}};
1457
// Compute value(s).
1458
for (unsigned int r = 0; r < 3; r++)
1460
values[0] += coefficients0[dof][r]*basisvalues[r];
1461
}// end loop over 'r'
1464
if (3 <= i && i <= 5)
1466
// Map degree of freedom to element degree of freedom
1467
const unsigned int dof = i - 3;
1469
// Array of basisvalues
1470
double basisvalues[3] = {0.00000000, 0.00000000, 0.00000000};
1472
// Declare helper variables
1473
unsigned int rr = 0;
1474
unsigned int ss = 0;
1475
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
1477
// Compute basisvalues
1478
basisvalues[0] = 1.00000000;
1479
basisvalues[1] = tmp0;
1480
for (unsigned int r = 0; r < 1; r++)
1482
rr = (r + 1)*(r + 1 + 1)/2 + 1;
1484
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
1485
}// end loop over 'r'
1486
for (unsigned int r = 0; r < 2; r++)
1488
for (unsigned int s = 0; s < 2 - r; s++)
1490
rr = (r + s)*(r + s + 1)/2 + s;
1491
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
1492
}// end loop over 's'
1493
}// end loop over 'r'
1495
// Table(s) of coefficients
1496
static const double coefficients0[3][3] = \
1497
{{0.47140452, -0.28867513, -0.16666667},
1498
{0.47140452, 0.28867513, -0.16666667},
1499
{0.47140452, 0.00000000, 0.33333333}};
1501
// Compute value(s).
1502
for (unsigned int r = 0; r < 3; r++)
1504
values[1] += coefficients0[dof][r]*basisvalues[r];
1505
}// end loop over 'r'
1508
if (6 <= i && i <= 8)
1510
// Map degree of freedom to element degree of freedom
1511
const unsigned int dof = i - 6;
1513
// Array of basisvalues
1514
double basisvalues[3] = {0.00000000, 0.00000000, 0.00000000};
1516
// Declare helper variables
1517
unsigned int rr = 0;
1518
unsigned int ss = 0;
1519
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
1521
// Compute basisvalues
1522
basisvalues[0] = 1.00000000;
1523
basisvalues[1] = tmp0;
1524
for (unsigned int r = 0; r < 1; r++)
1526
rr = (r + 1)*(r + 1 + 1)/2 + 1;
1528
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
1529
}// end loop over 'r'
1530
for (unsigned int r = 0; r < 2; r++)
1532
for (unsigned int s = 0; s < 2 - r; s++)
1534
rr = (r + s)*(r + s + 1)/2 + s;
1535
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
1536
}// end loop over 's'
1537
}// end loop over 'r'
1539
// Table(s) of coefficients
1540
static const double coefficients0[3][3] = \
1541
{{0.47140452, -0.28867513, -0.16666667},
1542
{0.47140452, 0.28867513, -0.16666667},
1543
{0.47140452, 0.00000000, 0.33333333}};
1545
// Compute value(s).
1546
for (unsigned int r = 0; r < 3; r++)
1548
values[2] += coefficients0[dof][r]*basisvalues[r];
1549
}// end loop over 'r'
1554
/// Evaluate all basis functions at given point in cell
1555
virtual void evaluate_basis_all(double* values,
1556
const double* coordinates,
1557
const ufc::cell& c) const
1559
// Helper variable to hold values of a single dof.
1560
double dof_values[3] = {0.00000000, 0.00000000, 0.00000000};
1562
// Loop dofs and call evaluate_basis.
1563
for (unsigned int r = 0; r < 9; r++)
1565
evaluate_basis(r, dof_values, coordinates, c);
1566
for (unsigned int s = 0; s < 3; s++)
1568
values[r*3 + s] = dof_values[s];
1569
}// end loop over 's'
1570
}// end loop over 'r'
1573
/// Evaluate order n derivatives of basis function i at given point in cell
1574
virtual void evaluate_basis_derivatives(unsigned int i,
1577
const double* coordinates,
1578
const ufc::cell& c) const
1580
// Extract vertex coordinates
1581
const double * const * x = c.coordinates;
1583
// Compute Jacobian of affine map from reference cell
1584
const double J_00 = x[1][0] - x[0][0];
1585
const double J_01 = x[2][0] - x[0][0];
1586
const double J_10 = x[1][1] - x[0][1];
1587
const double J_11 = x[2][1] - x[0][1];
1589
// Compute determinant of Jacobian
1590
double detJ = J_00*J_11 - J_01*J_10;
1592
// Compute inverse of Jacobian
1593
const double K_00 = J_11 / detJ;
1594
const double K_01 = -J_01 / detJ;
1595
const double K_10 = -J_10 / detJ;
1596
const double K_11 = J_00 / detJ;
1598
// Compute constants
1599
const double C0 = x[1][0] + x[2][0];
1600
const double C1 = x[1][1] + x[2][1];
1602
// Get coordinates and map to the reference (FIAT) element
1603
double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
1604
double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
1606
// Compute number of derivatives.
1607
unsigned int num_derivatives = 1;
1609
for (unsigned int r = 0; r < n; r++)
1611
num_derivatives *= 2;
1612
}// end loop over 'r'
1614
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
1615
unsigned int **combinations = new unsigned int *[num_derivatives];
1616
for (unsigned int row = 0; row < num_derivatives; row++)
1618
combinations[row] = new unsigned int [n];
1619
for (unsigned int col = 0; col < n; col++)
1620
combinations[row][col] = 0;
1623
// Generate combinations of derivatives
1624
for (unsigned int row = 1; row < num_derivatives; row++)
1626
for (unsigned int num = 0; num < row; num++)
1628
for (unsigned int col = n-1; col+1 > 0; col--)
1630
if (combinations[row][col] + 1 > 1)
1631
combinations[row][col] = 0;
1634
combinations[row][col] += 1;
1641
// Compute inverse of Jacobian
1642
const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
1644
// Declare transformation matrix
1645
// Declare pointer to two dimensional array and initialise
1646
double **transform = new double *[num_derivatives];
1648
for (unsigned int j = 0; j < num_derivatives; j++)
1650
transform[j] = new double [num_derivatives];
1651
for (unsigned int k = 0; k < num_derivatives; k++)
1652
transform[j][k] = 1;
1655
// Construct transformation matrix
1656
for (unsigned int row = 0; row < num_derivatives; row++)
1658
for (unsigned int col = 0; col < num_derivatives; col++)
1660
for (unsigned int k = 0; k < n; k++)
1661
transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
1665
// Reset values. Assuming that values is always an array.
1666
for (unsigned int r = 0; r < 3*num_derivatives; r++)
1668
values[r] = 0.00000000;
1669
}// end loop over 'r'
1671
if (0 <= i && i <= 2)
1673
// Map degree of freedom to element degree of freedom
1674
const unsigned int dof = i;
1676
// Array of basisvalues
1677
double basisvalues[3] = {0.00000000, 0.00000000, 0.00000000};
1679
// Declare helper variables
1680
unsigned int rr = 0;
1681
unsigned int ss = 0;
1682
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
1684
// Compute basisvalues
1685
basisvalues[0] = 1.00000000;
1686
basisvalues[1] = tmp0;
1687
for (unsigned int r = 0; r < 1; r++)
1689
rr = (r + 1)*(r + 1 + 1)/2 + 1;
1691
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
1692
}// end loop over 'r'
1693
for (unsigned int r = 0; r < 2; r++)
1695
for (unsigned int s = 0; s < 2 - r; s++)
1697
rr = (r + s)*(r + s + 1)/2 + s;
1698
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
1699
}// end loop over 's'
1700
}// end loop over 'r'
1702
// Table(s) of coefficients
1703
static const double coefficients0[3][3] = \
1704
{{0.47140452, -0.28867513, -0.16666667},
1705
{0.47140452, 0.28867513, -0.16666667},
1706
{0.47140452, 0.00000000, 0.33333333}};
1708
// Tables of derivatives of the polynomial base (transpose).
1709
static const double dmats0[3][3] = \
1710
{{0.00000000, 0.00000000, 0.00000000},
1711
{4.89897949, 0.00000000, 0.00000000},
1712
{0.00000000, 0.00000000, 0.00000000}};
1714
static const double dmats1[3][3] = \
1715
{{0.00000000, 0.00000000, 0.00000000},
1716
{2.44948974, 0.00000000, 0.00000000},
1717
{4.24264069, 0.00000000, 0.00000000}};
1719
// Compute reference derivatives
1720
// Declare pointer to array of derivatives on FIAT element
1721
double *derivatives = new double [num_derivatives];
1722
for (unsigned int r = 0; r < num_derivatives; r++)
1724
derivatives[r] = 0.00000000;
1725
}// end loop over 'r'
1727
// Declare derivative matrix (of polynomial basis).
1728
double dmats[3][3] = \
1729
{{1.00000000, 0.00000000, 0.00000000},
1730
{0.00000000, 1.00000000, 0.00000000},
1731
{0.00000000, 0.00000000, 1.00000000}};
1733
// Declare (auxiliary) derivative matrix (of polynomial basis).
1734
double dmats_old[3][3] = \
1735
{{1.00000000, 0.00000000, 0.00000000},
1736
{0.00000000, 1.00000000, 0.00000000},
1737
{0.00000000, 0.00000000, 1.00000000}};
1739
// Loop possible derivatives.
1740
for (unsigned int r = 0; r < num_derivatives; r++)
1742
// Resetting dmats values to compute next derivative.
1743
for (unsigned int t = 0; t < 3; t++)
1745
for (unsigned int u = 0; u < 3; u++)
1747
dmats[t][u] = 0.00000000;
1750
dmats[t][u] = 1.00000000;
1753
}// end loop over 'u'
1754
}// end loop over 't'
1756
// Looping derivative order to generate dmats.
1757
for (unsigned int s = 0; s < n; s++)
1759
// Updating dmats_old with new values and resetting dmats.
1760
for (unsigned int t = 0; t < 3; t++)
1762
for (unsigned int u = 0; u < 3; u++)
1764
dmats_old[t][u] = dmats[t][u];
1765
dmats[t][u] = 0.00000000;
1766
}// end loop over 'u'
1767
}// end loop over 't'
1769
// Update dmats using an inner product.
1770
if (combinations[r][s] == 0)
1772
for (unsigned int t = 0; t < 3; t++)
1774
for (unsigned int u = 0; u < 3; u++)
1776
for (unsigned int tu = 0; tu < 3; tu++)
1778
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1779
}// end loop over 'tu'
1780
}// end loop over 'u'
1781
}// end loop over 't'
1784
if (combinations[r][s] == 1)
1786
for (unsigned int t = 0; t < 3; t++)
1788
for (unsigned int u = 0; u < 3; u++)
1790
for (unsigned int tu = 0; tu < 3; tu++)
1792
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1793
}// end loop over 'tu'
1794
}// end loop over 'u'
1795
}// end loop over 't'
1798
}// end loop over 's'
1799
for (unsigned int s = 0; s < 3; s++)
1801
for (unsigned int t = 0; t < 3; t++)
1803
derivatives[r] += coefficients0[dof][s]*dmats[s][t]*basisvalues[t];
1804
}// end loop over 't'
1805
}// end loop over 's'
1806
}// end loop over 'r'
1808
// Transform derivatives back to physical element
1809
for (unsigned int row = 0; row < num_derivatives; row++)
1811
for (unsigned int col = 0; col < num_derivatives; col++)
1813
values[row] += transform[row][col]*derivatives[col];
1817
// Delete pointer to array of derivatives on FIAT element
1818
delete [] derivatives;
1820
// Delete pointer to array of combinations of derivatives and transform
1821
for (unsigned int r = 0; r < num_derivatives; r++)
1823
delete [] combinations[r];
1824
delete [] transform[r];
1825
}// end loop over 'r'
1826
delete [] combinations;
1827
delete [] transform;
1830
if (3 <= i && i <= 5)
1832
// Map degree of freedom to element degree of freedom
1833
const unsigned int dof = i - 3;
1835
// Array of basisvalues
1836
double basisvalues[3] = {0.00000000, 0.00000000, 0.00000000};
1838
// Declare helper variables
1839
unsigned int rr = 0;
1840
unsigned int ss = 0;
1841
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
1843
// Compute basisvalues
1844
basisvalues[0] = 1.00000000;
1845
basisvalues[1] = tmp0;
1846
for (unsigned int r = 0; r < 1; r++)
1848
rr = (r + 1)*(r + 1 + 1)/2 + 1;
1850
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
1851
}// end loop over 'r'
1852
for (unsigned int r = 0; r < 2; r++)
1854
for (unsigned int s = 0; s < 2 - r; s++)
1856
rr = (r + s)*(r + s + 1)/2 + s;
1857
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
1858
}// end loop over 's'
1859
}// end loop over 'r'
1861
// Table(s) of coefficients
1862
static const double coefficients0[3][3] = \
1863
{{0.47140452, -0.28867513, -0.16666667},
1864
{0.47140452, 0.28867513, -0.16666667},
1865
{0.47140452, 0.00000000, 0.33333333}};
1867
// Tables of derivatives of the polynomial base (transpose).
1868
static const double dmats0[3][3] = \
1869
{{0.00000000, 0.00000000, 0.00000000},
1870
{4.89897949, 0.00000000, 0.00000000},
1871
{0.00000000, 0.00000000, 0.00000000}};
1873
static const double dmats1[3][3] = \
1874
{{0.00000000, 0.00000000, 0.00000000},
1875
{2.44948974, 0.00000000, 0.00000000},
1876
{4.24264069, 0.00000000, 0.00000000}};
1878
// Compute reference derivatives
1879
// Declare pointer to array of derivatives on FIAT element
1880
double *derivatives = new double [num_derivatives];
1881
for (unsigned int r = 0; r < num_derivatives; r++)
1883
derivatives[r] = 0.00000000;
1884
}// end loop over 'r'
1886
// Declare derivative matrix (of polynomial basis).
1887
double dmats[3][3] = \
1888
{{1.00000000, 0.00000000, 0.00000000},
1889
{0.00000000, 1.00000000, 0.00000000},
1890
{0.00000000, 0.00000000, 1.00000000}};
1892
// Declare (auxiliary) derivative matrix (of polynomial basis).
1893
double dmats_old[3][3] = \
1894
{{1.00000000, 0.00000000, 0.00000000},
1895
{0.00000000, 1.00000000, 0.00000000},
1896
{0.00000000, 0.00000000, 1.00000000}};
1898
// Loop possible derivatives.
1899
for (unsigned int r = 0; r < num_derivatives; r++)
1901
// Resetting dmats values to compute next derivative.
1902
for (unsigned int t = 0; t < 3; t++)
1904
for (unsigned int u = 0; u < 3; u++)
1906
dmats[t][u] = 0.00000000;
1909
dmats[t][u] = 1.00000000;
1912
}// end loop over 'u'
1913
}// end loop over 't'
1915
// Looping derivative order to generate dmats.
1916
for (unsigned int s = 0; s < n; s++)
1918
// Updating dmats_old with new values and resetting dmats.
1919
for (unsigned int t = 0; t < 3; t++)
1921
for (unsigned int u = 0; u < 3; u++)
1923
dmats_old[t][u] = dmats[t][u];
1924
dmats[t][u] = 0.00000000;
1925
}// end loop over 'u'
1926
}// end loop over 't'
1928
// Update dmats using an inner product.
1929
if (combinations[r][s] == 0)
1931
for (unsigned int t = 0; t < 3; t++)
1933
for (unsigned int u = 0; u < 3; u++)
1935
for (unsigned int tu = 0; tu < 3; tu++)
1937
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1938
}// end loop over 'tu'
1939
}// end loop over 'u'
1940
}// end loop over 't'
1943
if (combinations[r][s] == 1)
1945
for (unsigned int t = 0; t < 3; t++)
1947
for (unsigned int u = 0; u < 3; u++)
1949
for (unsigned int tu = 0; tu < 3; tu++)
1951
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1952
}// end loop over 'tu'
1953
}// end loop over 'u'
1954
}// end loop over 't'
1957
}// end loop over 's'
1958
for (unsigned int s = 0; s < 3; s++)
1960
for (unsigned int t = 0; t < 3; t++)
1962
derivatives[r] += coefficients0[dof][s]*dmats[s][t]*basisvalues[t];
1963
}// end loop over 't'
1964
}// end loop over 's'
1965
}// end loop over 'r'
1967
// Transform derivatives back to physical element
1968
for (unsigned int row = 0; row < num_derivatives; row++)
1970
for (unsigned int col = 0; col < num_derivatives; col++)
1972
values[num_derivatives + row] += transform[row][col]*derivatives[col];
1976
// Delete pointer to array of derivatives on FIAT element
1977
delete [] derivatives;
1979
// Delete pointer to array of combinations of derivatives and transform
1980
for (unsigned int r = 0; r < num_derivatives; r++)
1982
delete [] combinations[r];
1983
delete [] transform[r];
1984
}// end loop over 'r'
1985
delete [] combinations;
1986
delete [] transform;
1989
if (6 <= i && i <= 8)
1991
// Map degree of freedom to element degree of freedom
1992
const unsigned int dof = i - 6;
1994
// Array of basisvalues
1995
double basisvalues[3] = {0.00000000, 0.00000000, 0.00000000};
1997
// Declare helper variables
1998
unsigned int rr = 0;
1999
unsigned int ss = 0;
2000
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
2002
// Compute basisvalues
2003
basisvalues[0] = 1.00000000;
2004
basisvalues[1] = tmp0;
2005
for (unsigned int r = 0; r < 1; r++)
2007
rr = (r + 1)*(r + 1 + 1)/2 + 1;
2009
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
2010
}// end loop over 'r'
2011
for (unsigned int r = 0; r < 2; r++)
2013
for (unsigned int s = 0; s < 2 - r; s++)
2015
rr = (r + s)*(r + s + 1)/2 + s;
2016
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
2017
}// end loop over 's'
2018
}// end loop over 'r'
2020
// Table(s) of coefficients
2021
static const double coefficients0[3][3] = \
2022
{{0.47140452, -0.28867513, -0.16666667},
2023
{0.47140452, 0.28867513, -0.16666667},
2024
{0.47140452, 0.00000000, 0.33333333}};
2026
// Tables of derivatives of the polynomial base (transpose).
2027
static const double dmats0[3][3] = \
2028
{{0.00000000, 0.00000000, 0.00000000},
2029
{4.89897949, 0.00000000, 0.00000000},
2030
{0.00000000, 0.00000000, 0.00000000}};
2032
static const double dmats1[3][3] = \
2033
{{0.00000000, 0.00000000, 0.00000000},
2034
{2.44948974, 0.00000000, 0.00000000},
2035
{4.24264069, 0.00000000, 0.00000000}};
2037
// Compute reference derivatives
2038
// Declare pointer to array of derivatives on FIAT element
2039
double *derivatives = new double [num_derivatives];
2040
for (unsigned int r = 0; r < num_derivatives; r++)
2042
derivatives[r] = 0.00000000;
2043
}// end loop over 'r'
2045
// Declare derivative matrix (of polynomial basis).
2046
double dmats[3][3] = \
2047
{{1.00000000, 0.00000000, 0.00000000},
2048
{0.00000000, 1.00000000, 0.00000000},
2049
{0.00000000, 0.00000000, 1.00000000}};
2051
// Declare (auxiliary) derivative matrix (of polynomial basis).
2052
double dmats_old[3][3] = \
2053
{{1.00000000, 0.00000000, 0.00000000},
2054
{0.00000000, 1.00000000, 0.00000000},
2055
{0.00000000, 0.00000000, 1.00000000}};
2057
// Loop possible derivatives.
2058
for (unsigned int r = 0; r < num_derivatives; r++)
2060
// Resetting dmats values to compute next derivative.
2061
for (unsigned int t = 0; t < 3; t++)
2063
for (unsigned int u = 0; u < 3; u++)
2065
dmats[t][u] = 0.00000000;
2068
dmats[t][u] = 1.00000000;
2071
}// end loop over 'u'
2072
}// end loop over 't'
2074
// Looping derivative order to generate dmats.
2075
for (unsigned int s = 0; s < n; s++)
2077
// Updating dmats_old with new values and resetting dmats.
2078
for (unsigned int t = 0; t < 3; t++)
2080
for (unsigned int u = 0; u < 3; u++)
2082
dmats_old[t][u] = dmats[t][u];
2083
dmats[t][u] = 0.00000000;
2084
}// end loop over 'u'
2085
}// end loop over 't'
2087
// Update dmats using an inner product.
2088
if (combinations[r][s] == 0)
2090
for (unsigned int t = 0; t < 3; t++)
2092
for (unsigned int u = 0; u < 3; u++)
2094
for (unsigned int tu = 0; tu < 3; tu++)
2096
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
2097
}// end loop over 'tu'
2098
}// end loop over 'u'
2099
}// end loop over 't'
2102
if (combinations[r][s] == 1)
2104
for (unsigned int t = 0; t < 3; t++)
2106
for (unsigned int u = 0; u < 3; u++)
2108
for (unsigned int tu = 0; tu < 3; tu++)
2110
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
2111
}// end loop over 'tu'
2112
}// end loop over 'u'
2113
}// end loop over 't'
2116
}// end loop over 's'
2117
for (unsigned int s = 0; s < 3; s++)
2119
for (unsigned int t = 0; t < 3; t++)
2121
derivatives[r] += coefficients0[dof][s]*dmats[s][t]*basisvalues[t];
2122
}// end loop over 't'
2123
}// end loop over 's'
2124
}// end loop over 'r'
2126
// Transform derivatives back to physical element
2127
for (unsigned int row = 0; row < num_derivatives; row++)
2129
for (unsigned int col = 0; col < num_derivatives; col++)
2131
values[2*num_derivatives + row] += transform[row][col]*derivatives[col];
2135
// Delete pointer to array of derivatives on FIAT element
2136
delete [] derivatives;
2138
// Delete pointer to array of combinations of derivatives and transform
2139
for (unsigned int r = 0; r < num_derivatives; r++)
2141
delete [] combinations[r];
2142
delete [] transform[r];
2143
}// end loop over 'r'
2144
delete [] combinations;
2145
delete [] transform;
2150
/// Evaluate order n derivatives of all basis functions at given point in cell
2151
virtual void evaluate_basis_derivatives_all(unsigned int n,
2153
const double* coordinates,
2154
const ufc::cell& c) const
2156
// Compute number of derivatives.
2157
unsigned int num_derivatives = 1;
2159
for (unsigned int r = 0; r < n; r++)
2161
num_derivatives *= 2;
2162
}// end loop over 'r'
2164
// Helper variable to hold values of a single dof.
2165
double *dof_values = new double [3*num_derivatives];
2166
for (unsigned int r = 0; r < 3*num_derivatives; r++)
2168
dof_values[r] = 0.00000000;
2169
}// end loop over 'r'
2171
// Loop dofs and call evaluate_basis_derivatives.
2172
for (unsigned int r = 0; r < 9; r++)
2174
evaluate_basis_derivatives(r, n, dof_values, coordinates, c);
2175
for (unsigned int s = 0; s < 3*num_derivatives; s++)
2177
values[r*3*num_derivatives + s] = dof_values[s];
2178
}// end loop over 's'
2179
}// end loop over 'r'
2182
delete [] dof_values;
2185
/// Evaluate linear functional for dof i on the function f
2186
virtual double evaluate_dof(unsigned int i,
2187
const ufc::function& f,
2188
const ufc::cell& c) const
2190
// Declare variables for result of evaluation
2193
// Declare variable for physical coordinates
2196
const double * const * x = c.coordinates;
2203
f.evaluate(vals, y, c);
2211
f.evaluate(vals, y, c);
2219
f.evaluate(vals, y, c);
2227
f.evaluate(vals, y, c);
2235
f.evaluate(vals, y, c);
2243
f.evaluate(vals, y, c);
2251
f.evaluate(vals, y, c);
2259
f.evaluate(vals, y, c);
2267
f.evaluate(vals, y, c);
2276
/// Evaluate linear functionals for all dofs on the function f
2277
virtual void evaluate_dofs(double* values,
2278
const ufc::function& f,
2279
const ufc::cell& c) const
2281
// Declare variables for result of evaluation
2284
// Declare variable for physical coordinates
2287
const double * const * x = c.coordinates;
2290
f.evaluate(vals, y, c);
2291
values[0] = vals[0];
2294
f.evaluate(vals, y, c);
2295
values[1] = vals[0];
2298
f.evaluate(vals, y, c);
2299
values[2] = vals[0];
2302
f.evaluate(vals, y, c);
2303
values[3] = vals[1];
2306
f.evaluate(vals, y, c);
2307
values[4] = vals[1];
2310
f.evaluate(vals, y, c);
2311
values[5] = vals[1];
2314
f.evaluate(vals, y, c);
2315
values[6] = vals[2];
2318
f.evaluate(vals, y, c);
2319
values[7] = vals[2];
2322
f.evaluate(vals, y, c);
2323
values[8] = vals[2];
2326
/// Interpolate vertex values from dof values
2327
virtual void interpolate_vertex_values(double* vertex_values,
2328
const double* dof_values,
2329
const ufc::cell& c) const
2331
// Evaluate function and change variables
2332
vertex_values[0] = dof_values[0];
2333
vertex_values[3] = dof_values[1];
2334
vertex_values[6] = dof_values[2];
2335
// Evaluate function and change variables
2336
vertex_values[1] = dof_values[3];
2337
vertex_values[4] = dof_values[4];
2338
vertex_values[7] = dof_values[5];
2339
// Evaluate function and change variables
2340
vertex_values[2] = dof_values[6];
2341
vertex_values[5] = dof_values[7];
2342
vertex_values[8] = dof_values[8];
2345
/// Return the number of sub elements (for a mixed element)
2346
virtual unsigned int num_sub_elements() const
2351
/// Create a new finite element for sub element i (for a mixed element)
2352
virtual ufc::finite_element* create_sub_element(unsigned int i) const
2358
return new stabilisedstokes_finite_element_1();
2363
return new stabilisedstokes_finite_element_0();
2373
/// This class defines the interface for a local-to-global mapping of
2374
/// degrees of freedom (dofs).
2376
class stabilisedstokes_dof_map_0: public ufc::dof_map
2380
unsigned int _global_dimension;
2385
stabilisedstokes_dof_map_0() : ufc::dof_map()
2387
_global_dimension = 0;
2391
virtual ~stabilisedstokes_dof_map_0()
2396
/// Return a string identifying the dof map
2397
virtual const char* signature() const
2399
return "FFC dofmap for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)";
2402
/// Return true iff mesh entities of topological dimension d are needed
2403
virtual bool needs_mesh_entities(unsigned int d) const
2427
/// Initialize dof map for mesh (return true iff init_cell() is needed)
2428
virtual bool init_mesh(const ufc::mesh& m)
2430
_global_dimension = m.num_entities[0];
2434
/// Initialize dof map for given cell
2435
virtual void init_cell(const ufc::mesh& m,
2441
/// Finish initialization of dof map for cells
2442
virtual void init_cell_finalize()
2447
/// Return the dimension of the global finite element function space
2448
virtual unsigned int global_dimension() const
2450
return _global_dimension;
2453
/// Return the dimension of the local finite element function space for a cell
2454
virtual unsigned int local_dimension(const ufc::cell& c) const
2459
/// Return the maximum dimension of the local finite element function space
2460
virtual unsigned int max_local_dimension() const
2465
// Return the geometric dimension of the coordinates this dof map provides
2466
virtual unsigned int geometric_dimension() const
2471
/// Return the number of dofs on each cell facet
2472
virtual unsigned int num_facet_dofs() const
2477
/// Return the number of dofs associated with each cell entity of dimension d
2478
virtual unsigned int num_entity_dofs(unsigned int d) const
2502
/// Tabulate the local-to-global mapping of dofs on a cell
2503
virtual void tabulate_dofs(unsigned int* dofs,
2505
const ufc::cell& c) const
2507
dofs[0] = c.entity_indices[0][0];
2508
dofs[1] = c.entity_indices[0][1];
2509
dofs[2] = c.entity_indices[0][2];
2512
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
2513
virtual void tabulate_facet_dofs(unsigned int* dofs,
2514
unsigned int facet) const
2540
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
2541
virtual void tabulate_entity_dofs(unsigned int* dofs,
2542
unsigned int d, unsigned int i) const
2546
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
2555
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
2593
/// Tabulate the coordinates of all dofs on a cell
2594
virtual void tabulate_coordinates(double** coordinates,
2595
const ufc::cell& c) const
2597
const double * const * x = c.coordinates;
2599
coordinates[0][0] = x[0][0];
2600
coordinates[0][1] = x[0][1];
2601
coordinates[1][0] = x[1][0];
2602
coordinates[1][1] = x[1][1];
2603
coordinates[2][0] = x[2][0];
2604
coordinates[2][1] = x[2][1];
2607
/// Return the number of sub dof maps (for a mixed element)
2608
virtual unsigned int num_sub_dof_maps() const
2613
/// Create a new dof_map for sub dof map i (for a mixed element)
2614
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
2621
/// This class defines the interface for a local-to-global mapping of
2622
/// degrees of freedom (dofs).
2624
class stabilisedstokes_dof_map_1: public ufc::dof_map
2628
unsigned int _global_dimension;
2633
stabilisedstokes_dof_map_1() : ufc::dof_map()
2635
_global_dimension = 0;
2639
virtual ~stabilisedstokes_dof_map_1()
2644
/// Return a string identifying the dof map
2645
virtual const char* signature() const
2647
return "FFC dofmap for VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2)";
2650
/// Return true iff mesh entities of topological dimension d are needed
2651
virtual bool needs_mesh_entities(unsigned int d) const
2675
/// Initialize dof map for mesh (return true iff init_cell() is needed)
2676
virtual bool init_mesh(const ufc::mesh& m)
2678
_global_dimension = 2*m.num_entities[0];
2682
/// Initialize dof map for given cell
2683
virtual void init_cell(const ufc::mesh& m,
2689
/// Finish initialization of dof map for cells
2690
virtual void init_cell_finalize()
2695
/// Return the dimension of the global finite element function space
2696
virtual unsigned int global_dimension() const
2698
return _global_dimension;
2701
/// Return the dimension of the local finite element function space for a cell
2702
virtual unsigned int local_dimension(const ufc::cell& c) const
2707
/// Return the maximum dimension of the local finite element function space
2708
virtual unsigned int max_local_dimension() const
2713
// Return the geometric dimension of the coordinates this dof map provides
2714
virtual unsigned int geometric_dimension() const
2719
/// Return the number of dofs on each cell facet
2720
virtual unsigned int num_facet_dofs() const
2725
/// Return the number of dofs associated with each cell entity of dimension d
2726
virtual unsigned int num_entity_dofs(unsigned int d) const
2750
/// Tabulate the local-to-global mapping of dofs on a cell
2751
virtual void tabulate_dofs(unsigned int* dofs,
2753
const ufc::cell& c) const
2755
unsigned int offset = 0;
2757
dofs[0] = offset + c.entity_indices[0][0];
2758
dofs[1] = offset + c.entity_indices[0][1];
2759
dofs[2] = offset + c.entity_indices[0][2];
2760
offset += m.num_entities[0];
2761
dofs[3] = offset + c.entity_indices[0][0];
2762
dofs[4] = offset + c.entity_indices[0][1];
2763
dofs[5] = offset + c.entity_indices[0][2];
2764
offset += m.num_entities[0];
2767
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
2768
virtual void tabulate_facet_dofs(unsigned int* dofs,
2769
unsigned int facet) const
2801
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
2802
virtual void tabulate_entity_dofs(unsigned int* dofs,
2803
unsigned int d, unsigned int i) const
2807
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
2816
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
2857
/// Tabulate the coordinates of all dofs on a cell
2858
virtual void tabulate_coordinates(double** coordinates,
2859
const ufc::cell& c) const
2861
const double * const * x = c.coordinates;
2863
coordinates[0][0] = x[0][0];
2864
coordinates[0][1] = x[0][1];
2865
coordinates[1][0] = x[1][0];
2866
coordinates[1][1] = x[1][1];
2867
coordinates[2][0] = x[2][0];
2868
coordinates[2][1] = x[2][1];
2869
coordinates[3][0] = x[0][0];
2870
coordinates[3][1] = x[0][1];
2871
coordinates[4][0] = x[1][0];
2872
coordinates[4][1] = x[1][1];
2873
coordinates[5][0] = x[2][0];
2874
coordinates[5][1] = x[2][1];
2877
/// Return the number of sub dof maps (for a mixed element)
2878
virtual unsigned int num_sub_dof_maps() const
2883
/// Create a new dof_map for sub dof map i (for a mixed element)
2884
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
2890
return new stabilisedstokes_dof_map_0();
2895
return new stabilisedstokes_dof_map_0();
2905
/// This class defines the interface for a local-to-global mapping of
2906
/// degrees of freedom (dofs).
2908
class stabilisedstokes_dof_map_2: public ufc::dof_map
2912
unsigned int _global_dimension;
2917
stabilisedstokes_dof_map_2() : ufc::dof_map()
2919
_global_dimension = 0;
2923
virtual ~stabilisedstokes_dof_map_2()
2928
/// Return a string identifying the dof map
2929
virtual const char* signature() const
2931
return "FFC dofmap for MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) })";
2934
/// Return true iff mesh entities of topological dimension d are needed
2935
virtual bool needs_mesh_entities(unsigned int d) const
2959
/// Initialize dof map for mesh (return true iff init_cell() is needed)
2960
virtual bool init_mesh(const ufc::mesh& m)
2962
_global_dimension = 3*m.num_entities[0];
2966
/// Initialize dof map for given cell
2967
virtual void init_cell(const ufc::mesh& m,
2973
/// Finish initialization of dof map for cells
2974
virtual void init_cell_finalize()
2979
/// Return the dimension of the global finite element function space
2980
virtual unsigned int global_dimension() const
2982
return _global_dimension;
2985
/// Return the dimension of the local finite element function space for a cell
2986
virtual unsigned int local_dimension(const ufc::cell& c) const
2991
/// Return the maximum dimension of the local finite element function space
2992
virtual unsigned int max_local_dimension() const
2997
// Return the geometric dimension of the coordinates this dof map provides
2998
virtual unsigned int geometric_dimension() const
3003
/// Return the number of dofs on each cell facet
3004
virtual unsigned int num_facet_dofs() const
3009
/// Return the number of dofs associated with each cell entity of dimension d
3010
virtual unsigned int num_entity_dofs(unsigned int d) const
3034
/// Tabulate the local-to-global mapping of dofs on a cell
3035
virtual void tabulate_dofs(unsigned int* dofs,
3037
const ufc::cell& c) const
3039
unsigned int offset = 0;
3041
dofs[0] = offset + c.entity_indices[0][0];
3042
dofs[1] = offset + c.entity_indices[0][1];
3043
dofs[2] = offset + c.entity_indices[0][2];
3044
offset += m.num_entities[0];
3045
dofs[3] = offset + c.entity_indices[0][0];
3046
dofs[4] = offset + c.entity_indices[0][1];
3047
dofs[5] = offset + c.entity_indices[0][2];
3048
offset += m.num_entities[0];
3049
dofs[6] = offset + c.entity_indices[0][0];
3050
dofs[7] = offset + c.entity_indices[0][1];
3051
dofs[8] = offset + c.entity_indices[0][2];
3052
offset += m.num_entities[0];
3055
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
3056
virtual void tabulate_facet_dofs(unsigned int* dofs,
3057
unsigned int facet) const
3095
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
3096
virtual void tabulate_entity_dofs(unsigned int* dofs,
3097
unsigned int d, unsigned int i) const
3101
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
3110
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
3154
/// Tabulate the coordinates of all dofs on a cell
3155
virtual void tabulate_coordinates(double** coordinates,
3156
const ufc::cell& c) const
3158
const double * const * x = c.coordinates;
3160
coordinates[0][0] = x[0][0];
3161
coordinates[0][1] = x[0][1];
3162
coordinates[1][0] = x[1][0];
3163
coordinates[1][1] = x[1][1];
3164
coordinates[2][0] = x[2][0];
3165
coordinates[2][1] = x[2][1];
3166
coordinates[3][0] = x[0][0];
3167
coordinates[3][1] = x[0][1];
3168
coordinates[4][0] = x[1][0];
3169
coordinates[4][1] = x[1][1];
3170
coordinates[5][0] = x[2][0];
3171
coordinates[5][1] = x[2][1];
3172
coordinates[6][0] = x[0][0];
3173
coordinates[6][1] = x[0][1];
3174
coordinates[7][0] = x[1][0];
3175
coordinates[7][1] = x[1][1];
3176
coordinates[8][0] = x[2][0];
3177
coordinates[8][1] = x[2][1];
3180
/// Return the number of sub dof maps (for a mixed element)
3181
virtual unsigned int num_sub_dof_maps() const
3186
/// Create a new dof_map for sub dof map i (for a mixed element)
3187
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
3193
return new stabilisedstokes_dof_map_1();
3198
return new stabilisedstokes_dof_map_0();
3208
/// This class defines the interface for the tabulation of the cell
3209
/// tensor corresponding to the local contribution to a form from
3210
/// the integral over a cell.
3212
class stabilisedstokes_cell_integral_0_0: public ufc::cell_integral
3217
stabilisedstokes_cell_integral_0_0() : ufc::cell_integral()
3223
virtual ~stabilisedstokes_cell_integral_0_0()
3228
/// Tabulate the tensor for the contribution from a local cell
3229
virtual void tabulate_tensor(double* A,
3230
const double * const * w,
3231
const ufc::cell& c) const
3233
// Extract vertex coordinates
3234
const double * const * x = c.coordinates;
3236
// Compute Jacobian of affine map from reference cell
3237
const double J_00 = x[1][0] - x[0][0];
3238
const double J_01 = x[2][0] - x[0][0];
3239
const double J_10 = x[1][1] - x[0][1];
3240
const double J_11 = x[2][1] - x[0][1];
3242
// Compute determinant of Jacobian
3243
double detJ = J_00*J_11 - J_01*J_10;
3245
// Compute inverse of Jacobian
3246
const double K_00 = J_11 / detJ;
3247
const double K_01 = -J_01 / detJ;
3248
const double K_10 = -J_10 / detJ;
3249
const double K_11 = J_00 / detJ;
3252
const double det = std::abs(detJ);
3254
// Array of quadrature weights
3255
static const double W4[4] = {0.15902069, 0.09097931, 0.15902069, 0.09097931};
3256
// Quadrature points on the UFC reference element: (0.17855873, 0.15505103), (0.07503111, 0.64494897), (0.66639025, 0.15505103), (0.28001992, 0.64494897)
3258
// Value of basis functions at quadrature points.
3259
static const double FE0[4][3] = \
3260
{{0.66639025, 0.17855873, 0.15505103},
3261
{0.28001992, 0.07503111, 0.64494897},
3262
{0.17855873, 0.66639025, 0.15505103},
3263
{0.07503111, 0.28001992, 0.64494897}};
3265
static const double FE1_C0_D01[4][9] = \
3266
{{-1.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
3267
{-1.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
3268
{-1.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
3269
{-1.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000}};
3271
static const double FE1_C0_D10[4][9] = \
3272
{{-1.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
3273
{-1.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
3274
{-1.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
3275
{-1.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000}};
3277
static const double FE1_C1_D01[4][9] = \
3278
{{0.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
3279
{0.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
3280
{0.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
3281
{0.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000}};
3283
static const double FE1_C1_D10[4][9] = \
3284
{{0.00000000, 0.00000000, 0.00000000, -1.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
3285
{0.00000000, 0.00000000, 0.00000000, -1.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
3286
{0.00000000, 0.00000000, 0.00000000, -1.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
3287
{0.00000000, 0.00000000, 0.00000000, -1.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000}};
3289
static const double FE1_C2[4][9] = \
3290
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.66639025, 0.17855873, 0.15505103},
3291
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.28001992, 0.07503111, 0.64494897},
3292
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.17855873, 0.66639025, 0.15505103},
3293
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.07503111, 0.28001992, 0.64494897}};
3295
static const double FE1_C2_D01[4][9] = \
3296
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, 1.00000000},
3297
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, 1.00000000},
3298
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, 1.00000000},
3299
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, 1.00000000}};
3301
static const double FE1_C2_D10[4][9] = \
3302
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 1.00000000, 0.00000000},
3303
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 1.00000000, 0.00000000},
3304
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 1.00000000, 0.00000000},
3305
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 1.00000000, 0.00000000}};
3307
for (unsigned int r = 0; r < 81; r++)
3310
}// end loop over 'r'
3312
// Compute element tensor using UFL quadrature representation
3313
// Optimisations: ('simplify expressions', False), ('ignore zero tables', False), ('non zero columns', False), ('remove zero terms', False), ('ignore ones', False)
3315
// Loop quadrature points for integral
3316
// Number of operations to compute element tensor for following IP loop = 23352
3317
for (unsigned int ip = 0; ip < 4; ip++)
3320
// Coefficient declarations
3321
double F0 = 0.00000000;
3323
// Total number of operations to compute function values = 6
3324
for (unsigned int r = 0; r < 3; r++)
3326
F0 += FE0[ip][r]*w[0][r];
3327
}// end loop over 'r'
3329
// Number of operations for primary indices: 5832
3330
for (unsigned int j = 0; j < 9; j++)
3332
for (unsigned int k = 0; k < 9; k++)
3334
// Number of operations to compute entry: 72
3335
A[j*9 + k] += ((((((K_01*FE1_C2_D10[ip][j] + K_11*FE1_C2_D01[ip][j]))*((K_01*FE1_C2_D10[ip][k] + K_11*FE1_C2_D01[ip][k])) + ((K_00*FE1_C2_D10[ip][j] + K_10*FE1_C2_D01[ip][j]))*((K_00*FE1_C2_D10[ip][k] + K_10*FE1_C2_D01[ip][k]))))*F0*0.20000000*F0 + ((((K_00*FE1_C0_D10[ip][k] + K_10*FE1_C0_D01[ip][k]) + (K_01*FE1_C1_D10[ip][k] + K_11*FE1_C1_D01[ip][k])))*FE1_C2[ip][j] + (((((K_00*FE1_C0_D10[ip][j] + K_10*FE1_C0_D01[ip][j]) + (K_01*FE1_C1_D10[ip][j] + K_11*FE1_C1_D01[ip][j])))*FE1_C2[ip][k])*(-1.00000000) + ((((K_01*FE1_C1_D10[ip][j] + K_11*FE1_C1_D01[ip][j]))*((K_01*FE1_C1_D10[ip][k] + K_11*FE1_C1_D01[ip][k])) + ((K_01*FE1_C0_D10[ip][j] + K_11*FE1_C0_D01[ip][j]))*((K_01*FE1_C0_D10[ip][k] + K_11*FE1_C0_D01[ip][k]))) + (((K_00*FE1_C1_D10[ip][j] + K_10*FE1_C1_D01[ip][j]))*((K_00*FE1_C1_D10[ip][k] + K_10*FE1_C1_D01[ip][k])) + ((K_00*FE1_C0_D10[ip][j] + K_10*FE1_C0_D01[ip][j]))*((K_00*FE1_C0_D10[ip][k] + K_10*FE1_C0_D01[ip][k]))))))))*W4[ip]*det;
3336
}// end loop over 'k'
3337
}// end loop over 'j'
3338
}// end loop over 'ip'
3343
/// This class defines the interface for the tabulation of the cell
3344
/// tensor corresponding to the local contribution to a form from
3345
/// the integral over a cell.
3347
class stabilisedstokes_cell_integral_1_0: public ufc::cell_integral
3352
stabilisedstokes_cell_integral_1_0() : ufc::cell_integral()
3358
virtual ~stabilisedstokes_cell_integral_1_0()
3363
/// Tabulate the tensor for the contribution from a local cell
3364
virtual void tabulate_tensor(double* A,
3365
const double * const * w,
3366
const ufc::cell& c) const
3368
// Extract vertex coordinates
3369
const double * const * x = c.coordinates;
3371
// Compute Jacobian of affine map from reference cell
3372
const double J_00 = x[1][0] - x[0][0];
3373
const double J_01 = x[2][0] - x[0][0];
3374
const double J_10 = x[1][1] - x[0][1];
3375
const double J_11 = x[2][1] - x[0][1];
3377
// Compute determinant of Jacobian
3378
double detJ = J_00*J_11 - J_01*J_10;
3380
// Compute inverse of Jacobian
3381
const double K_00 = J_11 / detJ;
3382
const double K_01 = -J_01 / detJ;
3383
const double K_10 = -J_10 / detJ;
3384
const double K_11 = J_00 / detJ;
3387
const double det = std::abs(detJ);
3389
// Array of quadrature weights
3390
static const double W4[4] = {0.15902069, 0.09097931, 0.15902069, 0.09097931};
3391
// Quadrature points on the UFC reference element: (0.17855873, 0.15505103), (0.07503111, 0.64494897), (0.66639025, 0.15505103), (0.28001992, 0.64494897)
3393
// Value of basis functions at quadrature points.
3394
static const double FE0[4][3] = \
3395
{{0.66639025, 0.17855873, 0.15505103},
3396
{0.28001992, 0.07503111, 0.64494897},
3397
{0.17855873, 0.66639025, 0.15505103},
3398
{0.07503111, 0.28001992, 0.64494897}};
3400
static const double FE1_C0[4][6] = \
3401
{{0.66639025, 0.17855873, 0.15505103, 0.00000000, 0.00000000, 0.00000000},
3402
{0.28001992, 0.07503111, 0.64494897, 0.00000000, 0.00000000, 0.00000000},
3403
{0.17855873, 0.66639025, 0.15505103, 0.00000000, 0.00000000, 0.00000000},
3404
{0.07503111, 0.28001992, 0.64494897, 0.00000000, 0.00000000, 0.00000000}};
3406
static const double FE1_C1[4][6] = \
3407
{{0.00000000, 0.00000000, 0.00000000, 0.66639025, 0.17855873, 0.15505103},
3408
{0.00000000, 0.00000000, 0.00000000, 0.28001992, 0.07503111, 0.64494897},
3409
{0.00000000, 0.00000000, 0.00000000, 0.17855873, 0.66639025, 0.15505103},
3410
{0.00000000, 0.00000000, 0.00000000, 0.07503111, 0.28001992, 0.64494897}};
3412
static const double FE2_C0[4][9] = \
3413
{{0.66639025, 0.17855873, 0.15505103, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
3414
{0.28001992, 0.07503111, 0.64494897, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
3415
{0.17855873, 0.66639025, 0.15505103, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
3416
{0.07503111, 0.28001992, 0.64494897, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000}};
3418
static const double FE2_C1[4][9] = \
3419
{{0.00000000, 0.00000000, 0.00000000, 0.66639025, 0.17855873, 0.15505103, 0.00000000, 0.00000000, 0.00000000},
3420
{0.00000000, 0.00000000, 0.00000000, 0.28001992, 0.07503111, 0.64494897, 0.00000000, 0.00000000, 0.00000000},
3421
{0.00000000, 0.00000000, 0.00000000, 0.17855873, 0.66639025, 0.15505103, 0.00000000, 0.00000000, 0.00000000},
3422
{0.00000000, 0.00000000, 0.00000000, 0.07503111, 0.28001992, 0.64494897, 0.00000000, 0.00000000, 0.00000000}};
3424
static const double FE2_C2_D01[4][9] = \
3425
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, 1.00000000},
3426
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, 1.00000000},
3427
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, 1.00000000},
3428
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, 1.00000000}};
3430
static const double FE2_C2_D10[4][9] = \
3431
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 1.00000000, 0.00000000},
3432
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 1.00000000, 0.00000000},
3433
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 1.00000000, 0.00000000},
3434
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -1.00000000, 1.00000000, 0.00000000}};
3436
for (unsigned int r = 0; r < 9; r++)
3439
}// end loop over 'r'
3441
// Compute element tensor using UFL quadrature representation
3442
// Optimisations: ('simplify expressions', False), ('ignore zero tables', False), ('non zero columns', False), ('remove zero terms', False), ('ignore ones', False)
3444
// Loop quadrature points for integral
3445
// Number of operations to compute element tensor for following IP loop = 840
3446
for (unsigned int ip = 0; ip < 4; ip++)
3449
// Coefficient declarations
3450
double F0 = 0.00000000;
3451
double F1 = 0.00000000;
3452
double F2 = 0.00000000;
3454
// Total number of operations to compute function values = 6
3455
for (unsigned int r = 0; r < 3; r++)
3457
F1 += FE0[ip][r]*w[1][r];
3458
}// end loop over 'r'
3460
// Total number of operations to compute function values = 24
3461
for (unsigned int r = 0; r < 6; r++)
3463
F0 += FE1_C0[ip][r]*w[0][r];
3464
F2 += FE1_C1[ip][r]*w[0][r];
3465
}// end loop over 'r'
3467
// Number of operations for primary indices: 180
3468
for (unsigned int j = 0; j < 9; j++)
3470
// Number of operations to compute entry: 20
3471
A[j] += ((((((K_00*FE2_C2_D10[ip][j] + K_10*FE2_C2_D01[ip][j]))*F1*0.20000000*F1 + FE2_C0[ip][j]))*F0 + ((FE2_C1[ip][j] + ((K_01*FE2_C2_D10[ip][j] + K_11*FE2_C2_D01[ip][j]))*F1*0.20000000*F1))*F2))*W4[ip]*det;
3472
}// end loop over 'j'
3473
}// end loop over 'ip'
3478
/// This class defines the interface for the assembly of the global
3479
/// tensor corresponding to a form with r + n arguments, that is, a
3482
/// a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
3484
/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
3485
/// global tensor A is defined by
3487
/// A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
3489
/// where each argument Vj represents the application to the
3490
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
3491
/// fixed functions (coefficients).
3493
class stabilisedstokes_form_0: public ufc::form
3498
stabilisedstokes_form_0() : ufc::form()
3504
virtual ~stabilisedstokes_form_0()
3509
/// Return a string identifying the form
3510
virtual const char* signature() const
3512
return "Form([Integral(Sum(Product(IndexSum(Product(Indexed(ComponentTensor(Indexed(SpatialDerivative(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((Index(0),), {Index(0): 2})), MultiIndex((FixedIndex(2),), {})), MultiIndex((Index(0),), {Index(0): 2})), MultiIndex((Index(1),), {Index(1): 2})), Indexed(ComponentTensor(Indexed(SpatialDerivative(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 1), MultiIndex((Index(2),), {Index(2): 2})), MultiIndex((FixedIndex(2),), {})), MultiIndex((Index(2),), {Index(2): 2})), MultiIndex((Index(1),), {Index(1): 2}))), MultiIndex((Index(1),), {Index(1): 2})), Product(Coefficient(FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1), 0), Product(FloatValue(0.20000000000000001, (), (), {}), Coefficient(FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1), 0)))), Sum(Product(IndexSum(Indexed(ListTensor(Indexed(SpatialDerivative(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 1), MultiIndex((Index(3),), {Index(3): 2})), MultiIndex((FixedIndex(0),), {})), Indexed(SpatialDerivative(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 1), MultiIndex((Index(3),), {Index(3): 2})), MultiIndex((FixedIndex(1),), {}))), MultiIndex((Index(3),), {Index(3): 2})), MultiIndex((Index(3),), {Index(3): 2})), Indexed(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((FixedIndex(2),), {FixedIndex(2): 3}))), Sum(IndexSum(IndexSum(Product(Indexed(ComponentTensor(Indexed(ListTensor(Indexed(SpatialDerivative(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((Index(4),), {Index(4): 2})), MultiIndex((FixedIndex(0),), {})), Indexed(SpatialDerivative(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((Index(4),), {Index(4): 2})), MultiIndex((FixedIndex(1),), {}))), MultiIndex((Index(5),), {Index(5): 2})), MultiIndex((Index(5), Index(4)), {Index(4): 2, Index(5): 2})), MultiIndex((Index(6), Index(7)), {Index(7): 2, Index(6): 2})), Indexed(ComponentTensor(Indexed(ListTensor(Indexed(SpatialDerivative(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 1), MultiIndex((Index(8),), {Index(8): 2})), MultiIndex((FixedIndex(0),), {})), Indexed(SpatialDerivative(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 1), MultiIndex((Index(8),), {Index(8): 2})), MultiIndex((FixedIndex(1),), {}))), MultiIndex((Index(9),), {Index(9): 2})), MultiIndex((Index(9), Index(8)), {Index(8): 2, Index(9): 2})), MultiIndex((Index(6), Index(7)), {Index(7): 2, Index(6): 2}))), MultiIndex((Index(6),), {Index(6): 2})), MultiIndex((Index(7),), {Index(7): 2})), Product(IntValue(-1, (), (), {}), Product(IndexSum(Indexed(ListTensor(Indexed(SpatialDerivative(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((Index(10),), {Index(10): 2})), MultiIndex((FixedIndex(0),), {})), Indexed(SpatialDerivative(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((Index(10),), {Index(10): 2})), MultiIndex((FixedIndex(1),), {}))), MultiIndex((Index(10),), {Index(10): 2})), MultiIndex((Index(10),), {Index(10): 2})), Indexed(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 1), MultiIndex((FixedIndex(2),), {FixedIndex(2): 3}))))))), Measure('cell', 0, None))])";
3515
/// Return the rank of the global tensor (r)
3516
virtual unsigned int rank() const
3521
/// Return the number of coefficients (n)
3522
virtual unsigned int num_coefficients() const
3527
/// Return the number of cell integrals
3528
virtual unsigned int num_cell_integrals() const
3533
/// Return the number of exterior facet integrals
3534
virtual unsigned int num_exterior_facet_integrals() const
3539
/// Return the number of interior facet integrals
3540
virtual unsigned int num_interior_facet_integrals() const
3545
/// Create a new finite element for argument function i
3546
virtual ufc::finite_element* create_finite_element(unsigned int i) const
3552
return new stabilisedstokes_finite_element_2();
3557
return new stabilisedstokes_finite_element_2();
3562
return new stabilisedstokes_finite_element_0();
3570
/// Create a new dof map for argument function i
3571
virtual ufc::dof_map* create_dof_map(unsigned int i) const
3577
return new stabilisedstokes_dof_map_2();
3582
return new stabilisedstokes_dof_map_2();
3587
return new stabilisedstokes_dof_map_0();
3595
/// Create a new cell integral on sub domain i
3596
virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
3602
return new stabilisedstokes_cell_integral_0_0();
3610
/// Create a new exterior facet integral on sub domain i
3611
virtual ufc::exterior_facet_integral* create_exterior_facet_integral(unsigned int i) const
3616
/// Create a new interior facet integral on sub domain i
3617
virtual ufc::interior_facet_integral* create_interior_facet_integral(unsigned int i) const
3624
/// This class defines the interface for the assembly of the global
3625
/// tensor corresponding to a form with r + n arguments, that is, a
3628
/// a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
3630
/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
3631
/// global tensor A is defined by
3633
/// A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
3635
/// where each argument Vj represents the application to the
3636
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
3637
/// fixed functions (coefficients).
3639
class stabilisedstokes_form_1: public ufc::form
3644
stabilisedstokes_form_1() : ufc::form()
3650
virtual ~stabilisedstokes_form_1()
3655
/// Return a string identifying the form
3656
virtual const char* signature() const
3658
return "Form([Integral(IndexSum(Product(Indexed(Coefficient(VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), 0), MultiIndex((Index(0),), {Index(0): 2})), Indexed(Sum(ComponentTensor(Product(Indexed(ComponentTensor(Indexed(SpatialDerivative(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((Index(1),), {Index(1): 2})), MultiIndex((FixedIndex(2),), {})), MultiIndex((Index(1),), {Index(1): 2})), MultiIndex((Index(2),), {Index(2): 2})), Product(Coefficient(FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1), 1), Product(FloatValue(0.20000000000000001, (), (), {}), Coefficient(FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1), 1)))), MultiIndex((Index(2),), {Index(2): 2})), ListTensor(Indexed(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((FixedIndex(0),), {FixedIndex(0): 3})), Indexed(Argument(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 1, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((FixedIndex(1),), {FixedIndex(1): 3})))), MultiIndex((Index(0),), {Index(0): 2}))), MultiIndex((Index(0),), {Index(0): 2})), Measure('cell', 0, None))])";
3661
/// Return the rank of the global tensor (r)
3662
virtual unsigned int rank() const
3667
/// Return the number of coefficients (n)
3668
virtual unsigned int num_coefficients() const
3673
/// Return the number of cell integrals
3674
virtual unsigned int num_cell_integrals() const
3679
/// Return the number of exterior facet integrals
3680
virtual unsigned int num_exterior_facet_integrals() const
3685
/// Return the number of interior facet integrals
3686
virtual unsigned int num_interior_facet_integrals() const
3691
/// Create a new finite element for argument function i
3692
virtual ufc::finite_element* create_finite_element(unsigned int i) const
3698
return new stabilisedstokes_finite_element_2();
3703
return new stabilisedstokes_finite_element_1();
3708
return new stabilisedstokes_finite_element_0();
3716
/// Create a new dof map for argument function i
3717
virtual ufc::dof_map* create_dof_map(unsigned int i) const
3723
return new stabilisedstokes_dof_map_2();
3728
return new stabilisedstokes_dof_map_1();
3733
return new stabilisedstokes_dof_map_0();
3741
/// Create a new cell integral on sub domain i
3742
virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
3748
return new stabilisedstokes_cell_integral_1_0();
3756
/// Create a new exterior facet integral on sub domain i
3757
virtual ufc::exterior_facet_integral* create_exterior_facet_integral(unsigned int i) const
3762
/// Create a new interior facet integral on sub domain i
3763
virtual ufc::interior_facet_integral* create_interior_facet_integral(unsigned int i) const