1
// This code conforms with the UFC specification version 2.0.3
2
// and was automatically generated by FFC version 1.0-beta2+.
4
// This code was generated with the following parameters:
7
// convert_exceptions_to_warnings: True
9
// cpp_optimize_flags: '-O2'
11
// error_control: False
19
// quadrature_degree: 'auto'
20
// quadrature_rule: 'auto'
21
// representation: 'quadrature'
23
// swig_binary: 'swig'
34
/// This class defines the interface for a finite element.
36
class heat_finite_element_0: public ufc::finite_element
41
heat_finite_element_0() : ufc::finite_element()
47
virtual ~heat_finite_element_0()
52
/// Return a string identifying the finite element
53
virtual const char* signature() const
55
return "FiniteElement('Real', Cell('triangle', Space(2)), 0, None)";
58
/// Return the cell shape
59
virtual ufc::shape cell_shape() const
64
/// Return the topological dimension of the cell shape
65
virtual unsigned int topological_dimension() const
70
/// Return the geometric dimension of the cell shape
71
virtual unsigned int geometric_dimension() const
76
/// Return the dimension of the finite element function space
77
virtual unsigned int space_dimension() const
82
/// Return the rank of the value space
83
virtual unsigned int value_rank() const
88
/// Return the dimension of the value space for axis i
89
virtual unsigned int value_dimension(unsigned int i) const
94
/// Evaluate basis function i at given point in cell
95
virtual void evaluate_basis(unsigned int i,
97
const double* coordinates,
98
const ufc::cell& c) const
100
// Extract vertex coordinates
102
// Compute Jacobian of affine map from reference cell
104
// Compute determinant of Jacobian
106
// Compute inverse of Jacobian
110
// Get coordinates and map to the reference (FIAT) element
115
// Array of basisvalues.
116
double basisvalues[1] = {0.0};
118
// Declare helper variables.
120
// Compute basisvalues.
121
basisvalues[0] = 1.0;
123
// Table(s) of coefficients.
124
static const double coefficients0[1] = \
128
for (unsigned int r = 0; r < 1; r++)
130
*values += coefficients0[r]*basisvalues[r];
131
}// end loop over 'r'
134
/// Evaluate all basis functions at given point in cell
135
virtual void evaluate_basis_all(double* values,
136
const double* coordinates,
137
const ufc::cell& c) const
139
// Element is constant, calling evaluate_basis.
140
evaluate_basis(0, values, coordinates, c);
143
/// Evaluate order n derivatives of basis function i at given point in cell
144
virtual void evaluate_basis_derivatives(unsigned int i,
147
const double* coordinates,
148
const ufc::cell& c) const
150
// Extract vertex coordinates
151
const double * const * x = c.coordinates;
153
// Compute Jacobian of affine map from reference cell
154
const double J_00 = x[1][0] - x[0][0];
155
const double J_01 = x[2][0] - x[0][0];
156
const double J_10 = x[1][1] - x[0][1];
157
const double J_11 = x[2][1] - x[0][1];
159
// Compute determinant of Jacobian
160
double detJ = J_00*J_11 - J_01*J_10;
162
// Compute inverse of Jacobian
163
const double K_00 = J_11 / detJ;
164
const double K_01 = -J_01 / detJ;
165
const double K_10 = -J_10 / detJ;
166
const double K_11 = J_00 / detJ;
170
// Get coordinates and map to the reference (FIAT) element
172
// Compute number of derivatives.
173
unsigned int num_derivatives = 1;
174
for (unsigned int r = 0; r < n; r++)
176
num_derivatives *= 2;
177
}// end loop over 'r'
179
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
180
unsigned int **combinations = new unsigned int *[num_derivatives];
181
for (unsigned int row = 0; row < num_derivatives; row++)
183
combinations[row] = new unsigned int [n];
184
for (unsigned int col = 0; col < n; col++)
185
combinations[row][col] = 0;
188
// Generate combinations of derivatives
189
for (unsigned int row = 1; row < num_derivatives; row++)
191
for (unsigned int num = 0; num < row; num++)
193
for (unsigned int col = n-1; col+1 > 0; col--)
195
if (combinations[row][col] + 1 > 1)
196
combinations[row][col] = 0;
199
combinations[row][col] += 1;
206
// Compute inverse of Jacobian
207
const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
209
// Declare transformation matrix
210
// Declare pointer to two dimensional array and initialise
211
double **transform = new double *[num_derivatives];
213
for (unsigned int j = 0; j < num_derivatives; j++)
215
transform[j] = new double [num_derivatives];
216
for (unsigned int k = 0; k < num_derivatives; k++)
220
// Construct transformation matrix
221
for (unsigned int row = 0; row < num_derivatives; row++)
223
for (unsigned int col = 0; col < num_derivatives; col++)
225
for (unsigned int k = 0; k < n; k++)
226
transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
230
// Reset values. Assuming that values is always an array.
231
for (unsigned int r = 0; r < num_derivatives; r++)
234
}// end loop over 'r'
237
// Array of basisvalues.
238
double basisvalues[1] = {0.0};
240
// Declare helper variables.
242
// Compute basisvalues.
243
basisvalues[0] = 1.0;
245
// Table(s) of coefficients.
246
static const double coefficients0[1] = \
249
// Tables of derivatives of the polynomial base (transpose).
250
static const double dmats0[1][1] = \
253
static const double dmats1[1][1] = \
256
// Compute reference derivatives.
257
// Declare pointer to array of derivatives on FIAT element.
258
double *derivatives = new double[num_derivatives];
259
for (unsigned int r = 0; r < num_derivatives; r++)
261
derivatives[r] = 0.0;
262
}// end loop over 'r'
264
// Declare derivative matrix (of polynomial basis).
265
double dmats[1][1] = \
268
// Declare (auxiliary) derivative matrix (of polynomial basis).
269
double dmats_old[1][1] = \
272
// Loop possible derivatives.
273
for (unsigned int r = 0; r < num_derivatives; r++)
275
// Resetting dmats values to compute next derivative.
276
for (unsigned int t = 0; t < 1; t++)
278
for (unsigned int u = 0; u < 1; u++)
286
}// end loop over 'u'
287
}// end loop over 't'
289
// Looping derivative order to generate dmats.
290
for (unsigned int s = 0; s < n; s++)
292
// Updating dmats_old with new values and resetting dmats.
293
for (unsigned int t = 0; t < 1; t++)
295
for (unsigned int u = 0; u < 1; u++)
297
dmats_old[t][u] = dmats[t][u];
299
}// end loop over 'u'
300
}// end loop over 't'
302
// Update dmats using an inner product.
303
if (combinations[r][s] == 0)
305
for (unsigned int t = 0; t < 1; t++)
307
for (unsigned int u = 0; u < 1; u++)
309
for (unsigned int tu = 0; tu < 1; tu++)
311
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
312
}// end loop over 'tu'
313
}// end loop over 'u'
314
}// end loop over 't'
317
if (combinations[r][s] == 1)
319
for (unsigned int t = 0; t < 1; t++)
321
for (unsigned int u = 0; u < 1; u++)
323
for (unsigned int tu = 0; tu < 1; tu++)
325
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
326
}// end loop over 'tu'
327
}// end loop over 'u'
328
}// end loop over 't'
331
}// end loop over 's'
332
for (unsigned int s = 0; s < 1; s++)
334
for (unsigned int t = 0; t < 1; t++)
336
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
337
}// end loop over 't'
338
}// end loop over 's'
339
}// end loop over 'r'
341
// Transform derivatives back to physical element
342
for (unsigned int r = 0; r < num_derivatives; r++)
344
for (unsigned int s = 0; s < num_derivatives; s++)
346
values[r] += transform[r][s]*derivatives[s];
347
}// end loop over 's'
348
}// end loop over 'r'
350
// Delete pointer to array of derivatives on FIAT element
351
delete [] derivatives;
353
// Delete pointer to array of combinations of derivatives and transform
354
for (unsigned int r = 0; r < num_derivatives; r++)
356
delete [] combinations[r];
357
}// end loop over 'r'
358
delete [] combinations;
359
for (unsigned int r = 0; r < num_derivatives; r++)
361
delete [] transform[r];
362
}// end loop over 'r'
366
/// Evaluate order n derivatives of all basis functions at given point in cell
367
virtual void evaluate_basis_derivatives_all(unsigned int n,
369
const double* coordinates,
370
const ufc::cell& c) const
372
// Element is constant, calling evaluate_basis_derivatives.
373
evaluate_basis_derivatives(0, n, values, coordinates, c);
376
/// Evaluate linear functional for dof i on the function f
377
virtual double evaluate_dof(unsigned int i,
378
const ufc::function& f,
379
const ufc::cell& c) const
381
// Declare variables for result of evaluation.
384
// Declare variable for physical coordinates.
386
const double * const * x = c.coordinates;
391
y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
392
y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
393
f.evaluate(vals, y, c);
402
/// Evaluate linear functionals for all dofs on the function f
403
virtual void evaluate_dofs(double* values,
404
const ufc::function& f,
405
const ufc::cell& c) const
407
// Declare variables for result of evaluation.
410
// Declare variable for physical coordinates.
412
const double * const * x = c.coordinates;
413
y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
414
y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
415
f.evaluate(vals, y, c);
419
/// Interpolate vertex values from dof values
420
virtual void interpolate_vertex_values(double* vertex_values,
421
const double* dof_values,
422
const ufc::cell& c) const
424
// Evaluate function and change variables
425
vertex_values[0] = dof_values[0];
426
vertex_values[1] = dof_values[0];
427
vertex_values[2] = dof_values[0];
430
/// Map coordinate xhat from reference cell to coordinate x in cell
431
virtual void map_from_reference_cell(double* x,
433
const ufc::cell& c) const
435
std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
438
/// Map from coordinate x in cell to coordinate xhat in reference cell
439
virtual void map_to_reference_cell(double* xhat,
441
const ufc::cell& c) const
443
std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
446
/// Return the number of sub elements (for a mixed element)
447
virtual unsigned int num_sub_elements() const
452
/// Create a new finite element for sub element i (for a mixed element)
453
virtual ufc::finite_element* create_sub_element(unsigned int i) const
458
/// Create a new class instance
459
virtual ufc::finite_element* create() const
461
return new heat_finite_element_0();
466
/// This class defines the interface for a finite element.
468
class heat_finite_element_1: public ufc::finite_element
473
heat_finite_element_1() : ufc::finite_element()
479
virtual ~heat_finite_element_1()
484
/// Return a string identifying the finite element
485
virtual const char* signature() const
487
return "FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None)";
490
/// Return the cell shape
491
virtual ufc::shape cell_shape() const
493
return ufc::triangle;
496
/// Return the topological dimension of the cell shape
497
virtual unsigned int topological_dimension() const
502
/// Return the geometric dimension of the cell shape
503
virtual unsigned int geometric_dimension() const
508
/// Return the dimension of the finite element function space
509
virtual unsigned int space_dimension() const
514
/// Return the rank of the value space
515
virtual unsigned int value_rank() const
520
/// Return the dimension of the value space for axis i
521
virtual unsigned int value_dimension(unsigned int i) const
526
/// Evaluate basis function i at given point in cell
527
virtual void evaluate_basis(unsigned int i,
529
const double* coordinates,
530
const ufc::cell& c) const
532
// Extract vertex coordinates
533
const double * const * x = c.coordinates;
535
// Compute Jacobian of affine map from reference cell
536
const double J_00 = x[1][0] - x[0][0];
537
const double J_01 = x[2][0] - x[0][0];
538
const double J_10 = x[1][1] - x[0][1];
539
const double J_11 = x[2][1] - x[0][1];
541
// Compute determinant of Jacobian
542
double detJ = J_00*J_11 - J_01*J_10;
544
// Compute inverse of Jacobian
547
const double C0 = x[1][0] + x[2][0];
548
const double C1 = x[1][1] + x[2][1];
550
// Get coordinates and map to the reference (FIAT) element
551
double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
552
double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
561
// Array of basisvalues.
562
double basisvalues[3] = {0.0, 0.0, 0.0};
564
// Declare helper variables.
565
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
567
// Compute basisvalues.
568
basisvalues[0] = 1.0;
569
basisvalues[1] = tmp0;
570
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
571
basisvalues[0] *= std::sqrt(0.5);
572
basisvalues[2] *= std::sqrt(1.0);
573
basisvalues[1] *= std::sqrt(3.0);
575
// Table(s) of coefficients.
576
static const double coefficients0[3] = \
577
{0.47140452, -0.28867513, -0.16666667};
580
for (unsigned int r = 0; r < 3; r++)
582
*values += coefficients0[r]*basisvalues[r];
583
}// end loop over 'r'
589
// Array of basisvalues.
590
double basisvalues[3] = {0.0, 0.0, 0.0};
592
// Declare helper variables.
593
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
595
// Compute basisvalues.
596
basisvalues[0] = 1.0;
597
basisvalues[1] = tmp0;
598
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
599
basisvalues[0] *= std::sqrt(0.5);
600
basisvalues[2] *= std::sqrt(1.0);
601
basisvalues[1] *= std::sqrt(3.0);
603
// Table(s) of coefficients.
604
static const double coefficients0[3] = \
605
{0.47140452, 0.28867513, -0.16666667};
608
for (unsigned int r = 0; r < 3; r++)
610
*values += coefficients0[r]*basisvalues[r];
611
}// end loop over 'r'
617
// Array of basisvalues.
618
double basisvalues[3] = {0.0, 0.0, 0.0};
620
// Declare helper variables.
621
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
623
// Compute basisvalues.
624
basisvalues[0] = 1.0;
625
basisvalues[1] = tmp0;
626
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
627
basisvalues[0] *= std::sqrt(0.5);
628
basisvalues[2] *= std::sqrt(1.0);
629
basisvalues[1] *= std::sqrt(3.0);
631
// Table(s) of coefficients.
632
static const double coefficients0[3] = \
633
{0.47140452, 0.0, 0.33333333};
636
for (unsigned int r = 0; r < 3; r++)
638
*values += coefficients0[r]*basisvalues[r];
639
}// end loop over 'r'
646
/// Evaluate all basis functions at given point in cell
647
virtual void evaluate_basis_all(double* values,
648
const double* coordinates,
649
const ufc::cell& c) const
651
// Helper variable to hold values of a single dof.
652
double dof_values = 0.0;
654
// Loop dofs and call evaluate_basis.
655
for (unsigned int r = 0; r < 3; r++)
657
evaluate_basis(r, &dof_values, coordinates, c);
658
values[r] = dof_values;
659
}// end loop over 'r'
662
/// Evaluate order n derivatives of basis function i at given point in cell
663
virtual void evaluate_basis_derivatives(unsigned int i,
666
const double* coordinates,
667
const ufc::cell& c) const
669
// Extract vertex coordinates
670
const double * const * x = c.coordinates;
672
// Compute Jacobian of affine map from reference cell
673
const double J_00 = x[1][0] - x[0][0];
674
const double J_01 = x[2][0] - x[0][0];
675
const double J_10 = x[1][1] - x[0][1];
676
const double J_11 = x[2][1] - x[0][1];
678
// Compute determinant of Jacobian
679
double detJ = J_00*J_11 - J_01*J_10;
681
// Compute inverse of Jacobian
682
const double K_00 = J_11 / detJ;
683
const double K_01 = -J_01 / detJ;
684
const double K_10 = -J_10 / detJ;
685
const double K_11 = J_00 / detJ;
688
const double C0 = x[1][0] + x[2][0];
689
const double C1 = x[1][1] + x[2][1];
691
// Get coordinates and map to the reference (FIAT) element
692
double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
693
double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
695
// Compute number of derivatives.
696
unsigned int num_derivatives = 1;
697
for (unsigned int r = 0; r < n; r++)
699
num_derivatives *= 2;
700
}// end loop over 'r'
702
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
703
unsigned int **combinations = new unsigned int *[num_derivatives];
704
for (unsigned int row = 0; row < num_derivatives; row++)
706
combinations[row] = new unsigned int [n];
707
for (unsigned int col = 0; col < n; col++)
708
combinations[row][col] = 0;
711
// Generate combinations of derivatives
712
for (unsigned int row = 1; row < num_derivatives; row++)
714
for (unsigned int num = 0; num < row; num++)
716
for (unsigned int col = n-1; col+1 > 0; col--)
718
if (combinations[row][col] + 1 > 1)
719
combinations[row][col] = 0;
722
combinations[row][col] += 1;
729
// Compute inverse of Jacobian
730
const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
732
// Declare transformation matrix
733
// Declare pointer to two dimensional array and initialise
734
double **transform = new double *[num_derivatives];
736
for (unsigned int j = 0; j < num_derivatives; j++)
738
transform[j] = new double [num_derivatives];
739
for (unsigned int k = 0; k < num_derivatives; k++)
743
// Construct transformation matrix
744
for (unsigned int row = 0; row < num_derivatives; row++)
746
for (unsigned int col = 0; col < num_derivatives; col++)
748
for (unsigned int k = 0; k < n; k++)
749
transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
753
// Reset values. Assuming that values is always an array.
754
for (unsigned int r = 0; r < num_derivatives; r++)
757
}// end loop over 'r'
764
// Array of basisvalues.
765
double basisvalues[3] = {0.0, 0.0, 0.0};
767
// Declare helper variables.
768
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
770
// Compute basisvalues.
771
basisvalues[0] = 1.0;
772
basisvalues[1] = tmp0;
773
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
774
basisvalues[0] *= std::sqrt(0.5);
775
basisvalues[2] *= std::sqrt(1.0);
776
basisvalues[1] *= std::sqrt(3.0);
778
// Table(s) of coefficients.
779
static const double coefficients0[3] = \
780
{0.47140452, -0.28867513, -0.16666667};
782
// Tables of derivatives of the polynomial base (transpose).
783
static const double dmats0[3][3] = \
785
{4.8989795, 0.0, 0.0},
788
static const double dmats1[3][3] = \
790
{2.4494897, 0.0, 0.0},
791
{4.2426407, 0.0, 0.0}};
793
// Compute reference derivatives.
794
// Declare pointer to array of derivatives on FIAT element.
795
double *derivatives = new double[num_derivatives];
796
for (unsigned int r = 0; r < num_derivatives; r++)
798
derivatives[r] = 0.0;
799
}// end loop over 'r'
801
// Declare derivative matrix (of polynomial basis).
802
double dmats[3][3] = \
807
// Declare (auxiliary) derivative matrix (of polynomial basis).
808
double dmats_old[3][3] = \
813
// Loop possible derivatives.
814
for (unsigned int r = 0; r < num_derivatives; r++)
816
// Resetting dmats values to compute next derivative.
817
for (unsigned int t = 0; t < 3; t++)
819
for (unsigned int u = 0; u < 3; u++)
827
}// end loop over 'u'
828
}// end loop over 't'
830
// Looping derivative order to generate dmats.
831
for (unsigned int s = 0; s < n; s++)
833
// Updating dmats_old with new values and resetting dmats.
834
for (unsigned int t = 0; t < 3; t++)
836
for (unsigned int u = 0; u < 3; u++)
838
dmats_old[t][u] = dmats[t][u];
840
}// end loop over 'u'
841
}// end loop over 't'
843
// Update dmats using an inner product.
844
if (combinations[r][s] == 0)
846
for (unsigned int t = 0; t < 3; t++)
848
for (unsigned int u = 0; u < 3; u++)
850
for (unsigned int tu = 0; tu < 3; tu++)
852
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
853
}// end loop over 'tu'
854
}// end loop over 'u'
855
}// end loop over 't'
858
if (combinations[r][s] == 1)
860
for (unsigned int t = 0; t < 3; t++)
862
for (unsigned int u = 0; u < 3; u++)
864
for (unsigned int tu = 0; tu < 3; tu++)
866
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
867
}// end loop over 'tu'
868
}// end loop over 'u'
869
}// end loop over 't'
872
}// end loop over 's'
873
for (unsigned int s = 0; s < 3; s++)
875
for (unsigned int t = 0; t < 3; t++)
877
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
878
}// end loop over 't'
879
}// end loop over 's'
880
}// end loop over 'r'
882
// Transform derivatives back to physical element
883
for (unsigned int r = 0; r < num_derivatives; r++)
885
for (unsigned int s = 0; s < num_derivatives; s++)
887
values[r] += transform[r][s]*derivatives[s];
888
}// end loop over 's'
889
}// end loop over 'r'
891
// Delete pointer to array of derivatives on FIAT element
892
delete [] derivatives;
894
// Delete pointer to array of combinations of derivatives and transform
895
for (unsigned int r = 0; r < num_derivatives; r++)
897
delete [] combinations[r];
898
}// end loop over 'r'
899
delete [] combinations;
900
for (unsigned int r = 0; r < num_derivatives; r++)
902
delete [] transform[r];
903
}// end loop over 'r'
910
// Array of basisvalues.
911
double basisvalues[3] = {0.0, 0.0, 0.0};
913
// Declare helper variables.
914
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
916
// Compute basisvalues.
917
basisvalues[0] = 1.0;
918
basisvalues[1] = tmp0;
919
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
920
basisvalues[0] *= std::sqrt(0.5);
921
basisvalues[2] *= std::sqrt(1.0);
922
basisvalues[1] *= std::sqrt(3.0);
924
// Table(s) of coefficients.
925
static const double coefficients0[3] = \
926
{0.47140452, 0.28867513, -0.16666667};
928
// Tables of derivatives of the polynomial base (transpose).
929
static const double dmats0[3][3] = \
931
{4.8989795, 0.0, 0.0},
934
static const double dmats1[3][3] = \
936
{2.4494897, 0.0, 0.0},
937
{4.2426407, 0.0, 0.0}};
939
// Compute reference derivatives.
940
// Declare pointer to array of derivatives on FIAT element.
941
double *derivatives = new double[num_derivatives];
942
for (unsigned int r = 0; r < num_derivatives; r++)
944
derivatives[r] = 0.0;
945
}// end loop over 'r'
947
// Declare derivative matrix (of polynomial basis).
948
double dmats[3][3] = \
953
// Declare (auxiliary) derivative matrix (of polynomial basis).
954
double dmats_old[3][3] = \
959
// Loop possible derivatives.
960
for (unsigned int r = 0; r < num_derivatives; r++)
962
// Resetting dmats values to compute next derivative.
963
for (unsigned int t = 0; t < 3; t++)
965
for (unsigned int u = 0; u < 3; u++)
973
}// end loop over 'u'
974
}// end loop over 't'
976
// Looping derivative order to generate dmats.
977
for (unsigned int s = 0; s < n; s++)
979
// Updating dmats_old with new values and resetting dmats.
980
for (unsigned int t = 0; t < 3; t++)
982
for (unsigned int u = 0; u < 3; u++)
984
dmats_old[t][u] = dmats[t][u];
986
}// end loop over 'u'
987
}// end loop over 't'
989
// Update dmats using an inner product.
990
if (combinations[r][s] == 0)
992
for (unsigned int t = 0; t < 3; t++)
994
for (unsigned int u = 0; u < 3; u++)
996
for (unsigned int tu = 0; tu < 3; tu++)
998
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
999
}// end loop over 'tu'
1000
}// end loop over 'u'
1001
}// end loop over 't'
1004
if (combinations[r][s] == 1)
1006
for (unsigned int t = 0; t < 3; t++)
1008
for (unsigned int u = 0; u < 3; u++)
1010
for (unsigned int tu = 0; tu < 3; tu++)
1012
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1013
}// end loop over 'tu'
1014
}// end loop over 'u'
1015
}// end loop over 't'
1018
}// end loop over 's'
1019
for (unsigned int s = 0; s < 3; s++)
1021
for (unsigned int t = 0; t < 3; t++)
1023
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1024
}// end loop over 't'
1025
}// end loop over 's'
1026
}// end loop over 'r'
1028
// Transform derivatives back to physical element
1029
for (unsigned int r = 0; r < num_derivatives; r++)
1031
for (unsigned int s = 0; s < num_derivatives; s++)
1033
values[r] += transform[r][s]*derivatives[s];
1034
}// end loop over 's'
1035
}// end loop over 'r'
1037
// Delete pointer to array of derivatives on FIAT element
1038
delete [] derivatives;
1040
// Delete pointer to array of combinations of derivatives and transform
1041
for (unsigned int r = 0; r < num_derivatives; r++)
1043
delete [] combinations[r];
1044
}// end loop over 'r'
1045
delete [] combinations;
1046
for (unsigned int r = 0; r < num_derivatives; r++)
1048
delete [] transform[r];
1049
}// end loop over 'r'
1050
delete [] transform;
1056
// Array of basisvalues.
1057
double basisvalues[3] = {0.0, 0.0, 0.0};
1059
// Declare helper variables.
1060
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1062
// Compute basisvalues.
1063
basisvalues[0] = 1.0;
1064
basisvalues[1] = tmp0;
1065
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
1066
basisvalues[0] *= std::sqrt(0.5);
1067
basisvalues[2] *= std::sqrt(1.0);
1068
basisvalues[1] *= std::sqrt(3.0);
1070
// Table(s) of coefficients.
1071
static const double coefficients0[3] = \
1072
{0.47140452, 0.0, 0.33333333};
1074
// Tables of derivatives of the polynomial base (transpose).
1075
static const double dmats0[3][3] = \
1077
{4.8989795, 0.0, 0.0},
1080
static const double dmats1[3][3] = \
1082
{2.4494897, 0.0, 0.0},
1083
{4.2426407, 0.0, 0.0}};
1085
// Compute reference derivatives.
1086
// Declare pointer to array of derivatives on FIAT element.
1087
double *derivatives = new double[num_derivatives];
1088
for (unsigned int r = 0; r < num_derivatives; r++)
1090
derivatives[r] = 0.0;
1091
}// end loop over 'r'
1093
// Declare derivative matrix (of polynomial basis).
1094
double dmats[3][3] = \
1099
// Declare (auxiliary) derivative matrix (of polynomial basis).
1100
double dmats_old[3][3] = \
1105
// Loop possible derivatives.
1106
for (unsigned int r = 0; r < num_derivatives; r++)
1108
// Resetting dmats values to compute next derivative.
1109
for (unsigned int t = 0; t < 3; t++)
1111
for (unsigned int u = 0; u < 3; u++)
1119
}// end loop over 'u'
1120
}// end loop over 't'
1122
// Looping derivative order to generate dmats.
1123
for (unsigned int s = 0; s < n; s++)
1125
// Updating dmats_old with new values and resetting dmats.
1126
for (unsigned int t = 0; t < 3; t++)
1128
for (unsigned int u = 0; u < 3; u++)
1130
dmats_old[t][u] = dmats[t][u];
1132
}// end loop over 'u'
1133
}// end loop over 't'
1135
// Update dmats using an inner product.
1136
if (combinations[r][s] == 0)
1138
for (unsigned int t = 0; t < 3; t++)
1140
for (unsigned int u = 0; u < 3; u++)
1142
for (unsigned int tu = 0; tu < 3; tu++)
1144
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1145
}// end loop over 'tu'
1146
}// end loop over 'u'
1147
}// end loop over 't'
1150
if (combinations[r][s] == 1)
1152
for (unsigned int t = 0; t < 3; t++)
1154
for (unsigned int u = 0; u < 3; u++)
1156
for (unsigned int tu = 0; tu < 3; tu++)
1158
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1159
}// end loop over 'tu'
1160
}// end loop over 'u'
1161
}// end loop over 't'
1164
}// end loop over 's'
1165
for (unsigned int s = 0; s < 3; s++)
1167
for (unsigned int t = 0; t < 3; t++)
1169
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1170
}// end loop over 't'
1171
}// end loop over 's'
1172
}// end loop over 'r'
1174
// Transform derivatives back to physical element
1175
for (unsigned int r = 0; r < num_derivatives; r++)
1177
for (unsigned int s = 0; s < num_derivatives; s++)
1179
values[r] += transform[r][s]*derivatives[s];
1180
}// end loop over 's'
1181
}// end loop over 'r'
1183
// Delete pointer to array of derivatives on FIAT element
1184
delete [] derivatives;
1186
// Delete pointer to array of combinations of derivatives and transform
1187
for (unsigned int r = 0; r < num_derivatives; r++)
1189
delete [] combinations[r];
1190
}// end loop over 'r'
1191
delete [] combinations;
1192
for (unsigned int r = 0; r < num_derivatives; r++)
1194
delete [] transform[r];
1195
}// end loop over 'r'
1196
delete [] transform;
1203
/// Evaluate order n derivatives of all basis functions at given point in cell
1204
virtual void evaluate_basis_derivatives_all(unsigned int n,
1206
const double* coordinates,
1207
const ufc::cell& c) const
1209
// Compute number of derivatives.
1210
unsigned int num_derivatives = 1;
1211
for (unsigned int r = 0; r < n; r++)
1213
num_derivatives *= 2;
1214
}// end loop over 'r'
1216
// Helper variable to hold values of a single dof.
1217
double *dof_values = new double[num_derivatives];
1218
for (unsigned int r = 0; r < num_derivatives; r++)
1220
dof_values[r] = 0.0;
1221
}// end loop over 'r'
1223
// Loop dofs and call evaluate_basis_derivatives.
1224
for (unsigned int r = 0; r < 3; r++)
1226
evaluate_basis_derivatives(r, n, dof_values, coordinates, c);
1227
for (unsigned int s = 0; s < num_derivatives; s++)
1229
values[r*num_derivatives + s] = dof_values[s];
1230
}// end loop over 's'
1231
}// end loop over 'r'
1234
delete [] dof_values;
1237
/// Evaluate linear functional for dof i on the function f
1238
virtual double evaluate_dof(unsigned int i,
1239
const ufc::function& f,
1240
const ufc::cell& c) const
1242
// Declare variables for result of evaluation.
1245
// Declare variable for physical coordinates.
1247
const double * const * x = c.coordinates;
1254
f.evaluate(vals, y, c);
1262
f.evaluate(vals, y, c);
1270
f.evaluate(vals, y, c);
1279
/// Evaluate linear functionals for all dofs on the function f
1280
virtual void evaluate_dofs(double* values,
1281
const ufc::function& f,
1282
const ufc::cell& c) const
1284
// Declare variables for result of evaluation.
1287
// Declare variable for physical coordinates.
1289
const double * const * x = c.coordinates;
1292
f.evaluate(vals, y, c);
1293
values[0] = vals[0];
1296
f.evaluate(vals, y, c);
1297
values[1] = vals[0];
1300
f.evaluate(vals, y, c);
1301
values[2] = vals[0];
1304
/// Interpolate vertex values from dof values
1305
virtual void interpolate_vertex_values(double* vertex_values,
1306
const double* dof_values,
1307
const ufc::cell& c) const
1309
// Evaluate function and change variables
1310
vertex_values[0] = dof_values[0];
1311
vertex_values[1] = dof_values[1];
1312
vertex_values[2] = dof_values[2];
1315
/// Map coordinate xhat from reference cell to coordinate x in cell
1316
virtual void map_from_reference_cell(double* x,
1318
const ufc::cell& c) const
1320
std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
1323
/// Map from coordinate x in cell to coordinate xhat in reference cell
1324
virtual void map_to_reference_cell(double* xhat,
1326
const ufc::cell& c) const
1328
std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented (introduced in UFC 2.0)." << std::endl;
1331
/// Return the number of sub elements (for a mixed element)
1332
virtual unsigned int num_sub_elements() const
1337
/// Create a new finite element for sub element i (for a mixed element)
1338
virtual ufc::finite_element* create_sub_element(unsigned int i) const
1343
/// Create a new class instance
1344
virtual ufc::finite_element* create() const
1346
return new heat_finite_element_1();
1351
/// This class defines the interface for a local-to-global mapping of
1352
/// degrees of freedom (dofs).
1354
class heat_dofmap_0: public ufc::dofmap
1358
unsigned int _global_dimension;
1362
heat_dofmap_0() : ufc::dofmap()
1364
_global_dimension = 0;
1368
virtual ~heat_dofmap_0()
1373
/// Return a string identifying the dofmap
1374
virtual const char* signature() const
1376
return "FFC dofmap for FiniteElement('Real', Cell('triangle', Space(2)), 0, None)";
1379
/// Return true iff mesh entities of topological dimension d are needed
1380
virtual bool needs_mesh_entities(unsigned int d) const
1404
/// Initialize dofmap for mesh (return true iff init_cell() is needed)
1405
virtual bool init_mesh(const ufc::mesh& m)
1407
_global_dimension = 1;
1411
/// Initialize dofmap for given cell
1412
virtual void init_cell(const ufc::mesh& m,
1418
/// Finish initialization of dofmap for cells
1419
virtual void init_cell_finalize()
1424
/// Return the topological dimension of the associated cell shape
1425
virtual unsigned int topological_dimension() const
1430
/// Return the geometric dimension of the associated cell shape
1431
virtual unsigned int geometric_dimension() const
1436
/// Return the dimension of the global finite element function space
1437
virtual unsigned int global_dimension() const
1439
return _global_dimension;
1442
/// Return the dimension of the local finite element function space for a cell
1443
virtual unsigned int local_dimension(const ufc::cell& c) const
1448
/// Return the maximum dimension of the local finite element function space
1449
virtual unsigned int max_local_dimension() const
1454
/// Return the number of dofs on each cell facet
1455
virtual unsigned int num_facet_dofs() const
1460
/// Return the number of dofs associated with each cell entity of dimension d
1461
virtual unsigned int num_entity_dofs(unsigned int d) const
1485
/// Tabulate the local-to-global mapping of dofs on a cell
1486
virtual void tabulate_dofs(unsigned int* dofs,
1488
const ufc::cell& c) const
1493
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
1494
virtual void tabulate_facet_dofs(unsigned int* dofs,
1495
unsigned int facet) const
1518
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
1519
virtual void tabulate_entity_dofs(unsigned int* dofs,
1520
unsigned int d, unsigned int i) const
1524
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
1543
std::cerr << "*** FFC warning: " << "i is larger than number of entities (0)" << std::endl;
1553
/// Tabulate the coordinates of all dofs on a cell
1554
virtual void tabulate_coordinates(double** coordinates,
1555
const ufc::cell& c) const
1557
const double * const * x = c.coordinates;
1559
coordinates[0][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1560
coordinates[0][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1563
/// Return the number of sub dofmaps (for a mixed element)
1564
virtual unsigned int num_sub_dofmaps() const
1569
/// Create a new dofmap for sub dofmap i (for a mixed element)
1570
virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
1575
/// Create a new class instance
1576
virtual ufc::dofmap* create() const
1578
return new heat_dofmap_0();
1583
/// This class defines the interface for a local-to-global mapping of
1584
/// degrees of freedom (dofs).
1586
class heat_dofmap_1: public ufc::dofmap
1590
unsigned int _global_dimension;
1594
heat_dofmap_1() : ufc::dofmap()
1596
_global_dimension = 0;
1600
virtual ~heat_dofmap_1()
1605
/// Return a string identifying the dofmap
1606
virtual const char* signature() const
1608
return "FFC dofmap for FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None)";
1611
/// Return true iff mesh entities of topological dimension d are needed
1612
virtual bool needs_mesh_entities(unsigned int d) const
1636
/// Initialize dofmap for mesh (return true iff init_cell() is needed)
1637
virtual bool init_mesh(const ufc::mesh& m)
1639
_global_dimension = m.num_entities[0];
1643
/// Initialize dofmap for given cell
1644
virtual void init_cell(const ufc::mesh& m,
1650
/// Finish initialization of dofmap for cells
1651
virtual void init_cell_finalize()
1656
/// Return the topological dimension of the associated cell shape
1657
virtual unsigned int topological_dimension() const
1662
/// Return the geometric dimension of the associated cell shape
1663
virtual unsigned int geometric_dimension() const
1668
/// Return the dimension of the global finite element function space
1669
virtual unsigned int global_dimension() const
1671
return _global_dimension;
1674
/// Return the dimension of the local finite element function space for a cell
1675
virtual unsigned int local_dimension(const ufc::cell& c) const
1680
/// Return the maximum dimension of the local finite element function space
1681
virtual unsigned int max_local_dimension() const
1686
/// Return the number of dofs on each cell facet
1687
virtual unsigned int num_facet_dofs() const
1692
/// Return the number of dofs associated with each cell entity of dimension d
1693
virtual unsigned int num_entity_dofs(unsigned int d) const
1717
/// Tabulate the local-to-global mapping of dofs on a cell
1718
virtual void tabulate_dofs(unsigned int* dofs,
1720
const ufc::cell& c) const
1722
dofs[0] = c.entity_indices[0][0];
1723
dofs[1] = c.entity_indices[0][1];
1724
dofs[2] = c.entity_indices[0][2];
1727
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
1728
virtual void tabulate_facet_dofs(unsigned int* dofs,
1729
unsigned int facet) const
1755
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
1756
virtual void tabulate_entity_dofs(unsigned int* dofs,
1757
unsigned int d, unsigned int i) const
1761
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
1770
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
1808
/// Tabulate the coordinates of all dofs on a cell
1809
virtual void tabulate_coordinates(double** coordinates,
1810
const ufc::cell& c) const
1812
const double * const * x = c.coordinates;
1814
coordinates[0][0] = x[0][0];
1815
coordinates[0][1] = x[0][1];
1816
coordinates[1][0] = x[1][0];
1817
coordinates[1][1] = x[1][1];
1818
coordinates[2][0] = x[2][0];
1819
coordinates[2][1] = x[2][1];
1822
/// Return the number of sub dofmaps (for a mixed element)
1823
virtual unsigned int num_sub_dofmaps() const
1828
/// Create a new dofmap for sub dofmap i (for a mixed element)
1829
virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
1834
/// Create a new class instance
1835
virtual ufc::dofmap* create() const
1837
return new heat_dofmap_1();
1842
/// This class defines the interface for the tabulation of the cell
1843
/// tensor corresponding to the local contribution to a form from
1844
/// the integral over a cell.
1846
class heat_cell_integral_0_0: public ufc::cell_integral
1851
heat_cell_integral_0_0() : ufc::cell_integral()
1857
virtual ~heat_cell_integral_0_0()
1862
/// Tabulate the tensor for the contribution from a local cell
1863
virtual void tabulate_tensor(double* A,
1864
const double * const * w,
1865
const ufc::cell& c) const
1867
// Extract vertex coordinates
1868
const double * const * x = c.coordinates;
1870
// Compute Jacobian of affine map from reference cell
1871
const double J_00 = x[1][0] - x[0][0];
1872
const double J_01 = x[2][0] - x[0][0];
1873
const double J_10 = x[1][1] - x[0][1];
1874
const double J_11 = x[2][1] - x[0][1];
1876
// Compute determinant of Jacobian
1877
double detJ = J_00*J_11 - J_01*J_10;
1879
// Compute inverse of Jacobian
1880
const double K_00 = J_11 / detJ;
1881
const double K_01 = -J_01 / detJ;
1882
const double K_10 = -J_10 / detJ;
1883
const double K_11 = J_00 / detJ;
1886
const double det = std::abs(detJ);
1890
// Compute circumradius, assuming triangle is embedded in 2D.
1895
// Array of quadrature weights.
1896
static const double W3[3] = {0.16666667, 0.16666667, 0.16666667};
1897
// Quadrature points on the UFC reference element: (0.16666667, 0.16666667), (0.16666667, 0.66666667), (0.66666667, 0.16666667)
1899
// Value of basis functions at quadrature points.
1900
static const double FE0[3][3] = \
1901
{{0.66666667, 0.16666667, 0.16666667},
1902
{0.16666667, 0.16666667, 0.66666667},
1903
{0.16666667, 0.66666667, 0.16666667}};
1905
static const double FE0_D01[3][2] = \
1910
// Array of non-zero columns
1911
static const unsigned int nzc1[2] = {0, 1};
1913
// Array of non-zero columns
1914
static const unsigned int nzc0[2] = {0, 2};
1916
// Reset values in the element tensor.
1917
for (unsigned int r = 0; r < 9; r++)
1920
}// end loop over 'r'
1921
// Number of operations to compute geometry constants: 15.
1923
G[0] = det*w[1][0]*(K_10*K_10 + K_11*K_11);
1924
G[1] = det*w[1][0]*(K_00*K_10 + K_01*K_11);
1925
G[2] = det*w[1][0]*(K_00*K_00 + K_01*K_01);
1927
// Compute element tensor using UFL quadrature representation
1928
// Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
1930
// Loop quadrature points for integral.
1931
// Number of operations to compute element tensor for following IP loop = 264
1932
for (unsigned int ip = 0; ip < 3; ip++)
1935
// Coefficient declarations.
1938
// Total number of operations to compute function values = 6
1939
for (unsigned int r = 0; r < 3; r++)
1941
F0 += FE0[ip][r]*w[0][r];
1942
}// end loop over 'r'
1944
// Number of operations to compute ip constants: 7
1946
// Number of operations: 2
1947
I[0] = F0*G[0]*W3[ip];
1949
// Number of operations: 2
1950
I[1] = F0*G[1]*W3[ip];
1952
// Number of operations: 2
1953
I[2] = F0*G[2]*W3[ip];
1955
// Number of operations: 1
1959
// Number of operations for primary indices: 27
1960
for (unsigned int j = 0; j < 3; j++)
1962
for (unsigned int k = 0; k < 3; k++)
1964
// Number of operations to compute entry: 3
1965
A[j*3 + k] += FE0[ip][j]*FE0[ip][k]*I[3];
1966
}// end loop over 'k'
1967
}// end loop over 'j'
1969
// Number of operations for primary indices: 48
1970
for (unsigned int j = 0; j < 2; j++)
1972
for (unsigned int k = 0; k < 2; k++)
1974
// Number of operations to compute entry: 3
1975
A[nzc0[j]*3 + nzc0[k]] += FE0_D01[ip][j]*FE0_D01[ip][k]*I[0];
1976
// Number of operations to compute entry: 3
1977
A[nzc0[j]*3 + nzc1[k]] += FE0_D01[ip][j]*FE0_D01[ip][k]*I[1];
1978
// Number of operations to compute entry: 3
1979
A[nzc1[j]*3 + nzc0[k]] += FE0_D01[ip][j]*FE0_D01[ip][k]*I[1];
1980
// Number of operations to compute entry: 3
1981
A[nzc1[j]*3 + nzc1[k]] += FE0_D01[ip][j]*FE0_D01[ip][k]*I[2];
1982
}// end loop over 'k'
1983
}// end loop over 'j'
1984
}// end loop over 'ip'
1987
/// Tabulate the tensor for the contribution from a local cell
1988
/// using the specified reference cell quadrature points/weights
1989
virtual void tabulate_tensor(double* A,
1990
const double * const * w,
1992
unsigned int num_quadrature_points,
1993
const double * const * quadrature_points,
1994
const double* quadrature_weights) const
1996
std::cerr << "*** FFC warning: " << "Quadrature version of tabulate_tensor not yet implemented (introduced in UFC 2.0)." << std::endl;
2001
/// This class defines the interface for the tabulation of the cell
2002
/// tensor corresponding to the local contribution to a form from
2003
/// the integral over a cell.
2005
class heat_cell_integral_1_0: public ufc::cell_integral
2010
heat_cell_integral_1_0() : ufc::cell_integral()
2016
virtual ~heat_cell_integral_1_0()
2021
/// Tabulate the tensor for the contribution from a local cell
2022
virtual void tabulate_tensor(double* A,
2023
const double * const * w,
2024
const ufc::cell& c) const
2026
// Extract vertex coordinates
2027
const double * const * x = c.coordinates;
2029
// Compute Jacobian of affine map from reference cell
2030
const double J_00 = x[1][0] - x[0][0];
2031
const double J_01 = x[2][0] - x[0][0];
2032
const double J_10 = x[1][1] - x[0][1];
2033
const double J_11 = x[2][1] - x[0][1];
2035
// Compute determinant of Jacobian
2036
double detJ = J_00*J_11 - J_01*J_10;
2038
// Compute inverse of Jacobian
2041
const double det = std::abs(detJ);
2045
// Compute circumradius, assuming triangle is embedded in 2D.
2050
// Array of quadrature weights.
2051
static const double W3[3] = {0.16666667, 0.16666667, 0.16666667};
2052
// Quadrature points on the UFC reference element: (0.16666667, 0.16666667), (0.16666667, 0.66666667), (0.66666667, 0.16666667)
2054
// Value of basis functions at quadrature points.
2055
static const double FE0[3][3] = \
2056
{{0.66666667, 0.16666667, 0.16666667},
2057
{0.16666667, 0.16666667, 0.66666667},
2058
{0.16666667, 0.66666667, 0.16666667}};
2060
// Reset values in the element tensor.
2061
for (unsigned int r = 0; r < 3; r++)
2064
}// end loop over 'r'
2065
// Number of operations to compute geometry constants: 1.
2069
// Compute element tensor using UFL quadrature representation
2070
// Optimisations: ('eliminate zeros', True), ('ignore ones', True), ('ignore zero tables', True), ('optimisation', 'simplify_expressions'), ('remove zero terms', True)
2072
// Loop quadrature points for integral.
2073
// Number of operations to compute element tensor for following IP loop = 66
2074
for (unsigned int ip = 0; ip < 3; ip++)
2077
// Coefficient declarations.
2081
// Total number of operations to compute function values = 12
2082
for (unsigned int r = 0; r < 3; r++)
2084
F0 += FE0[ip][r]*w[0][r];
2085
F1 += FE0[ip][r]*w[1][r];
2086
}// end loop over 'r'
2088
// Number of operations to compute ip constants: 4
2090
// Number of operations: 4
2091
I[0] = W3[ip]*(F0*det + F1*G[0]);
2094
// Number of operations for primary indices: 6
2095
for (unsigned int j = 0; j < 3; j++)
2097
// Number of operations to compute entry: 2
2098
A[j] += FE0[ip][j]*I[0];
2099
}// end loop over 'j'
2100
}// end loop over 'ip'
2103
/// Tabulate the tensor for the contribution from a local cell
2104
/// using the specified reference cell quadrature points/weights
2105
virtual void tabulate_tensor(double* A,
2106
const double * const * w,
2108
unsigned int num_quadrature_points,
2109
const double * const * quadrature_points,
2110
const double* quadrature_weights) const
2112
std::cerr << "*** FFC warning: " << "Quadrature version of tabulate_tensor not yet implemented (introduced in UFC 2.0)." << std::endl;
2117
/// This class defines the interface for the assembly of the global
2118
/// tensor corresponding to a form with r + n arguments, that is, a
2121
/// a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
2123
/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
2124
/// global tensor A is defined by
2126
/// A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
2128
/// where each argument Vj represents the application to the
2129
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
2130
/// fixed functions (coefficients).
2132
class heat_form_0: public ufc::form
2137
heat_form_0() : ufc::form()
2143
virtual ~heat_form_0()
2148
/// Return a string identifying the form
2149
virtual const char* signature() const
2151
return "Form([Integral(Sum(Product(Argument(FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None), 0), Argument(FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None), 1)), Product(IndexSum(Product(Indexed(ComponentTensor(SpatialDerivative(Argument(FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None), 0), MultiIndex((Index(0),), {Index(0): 2})), MultiIndex((Index(0),), {Index(0): 2})), MultiIndex((Index(1),), {Index(1): 2})), Indexed(ComponentTensor(SpatialDerivative(Argument(FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None), 1), MultiIndex((Index(2),), {Index(2): 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', Space(2)), 1, None), 0), Constant(Cell('triangle', Space(2)), 1)))), Measure('cell', 0, None))])";
2154
/// Return the rank of the global tensor (r)
2155
virtual unsigned int rank() const
2160
/// Return the number of coefficients (n)
2161
virtual unsigned int num_coefficients() const
2166
/// Return the number of cell domains
2167
virtual unsigned int num_cell_domains() const
2172
/// Return the number of exterior facet domains
2173
virtual unsigned int num_exterior_facet_domains() const
2178
/// Return the number of interior facet domains
2179
virtual unsigned int num_interior_facet_domains() const
2184
/// Create a new finite element for argument function i
2185
virtual ufc::finite_element* create_finite_element(unsigned int i) const
2191
return new heat_finite_element_1();
2196
return new heat_finite_element_1();
2201
return new heat_finite_element_1();
2206
return new heat_finite_element_0();
2214
/// Create a new dofmap for argument function i
2215
virtual ufc::dofmap* create_dofmap(unsigned int i) const
2221
return new heat_dofmap_1();
2226
return new heat_dofmap_1();
2231
return new heat_dofmap_1();
2236
return new heat_dofmap_0();
2244
/// Create a new cell integral on sub domain i
2245
virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
2251
return new heat_cell_integral_0_0();
2259
/// Create a new exterior facet integral on sub domain i
2260
virtual ufc::exterior_facet_integral* create_exterior_facet_integral(unsigned int i) const
2265
/// Create a new interior facet integral on sub domain i
2266
virtual ufc::interior_facet_integral* create_interior_facet_integral(unsigned int i) const
2273
/// This class defines the interface for the assembly of the global
2274
/// tensor corresponding to a form with r + n arguments, that is, a
2277
/// a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
2279
/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
2280
/// global tensor A is defined by
2282
/// A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
2284
/// where each argument Vj represents the application to the
2285
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
2286
/// fixed functions (coefficients).
2288
class heat_form_1: public ufc::form
2293
heat_form_1() : ufc::form()
2299
virtual ~heat_form_1()
2304
/// Return a string identifying the form
2305
virtual const char* signature() const
2307
return "Form([Integral(Sum(Product(Argument(FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None), 0), Coefficient(FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None), 0)), Product(Argument(FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None), 0), Product(Coefficient(FiniteElement('Lagrange', Cell('triangle', Space(2)), 1, None), 1), Constant(Cell('triangle', Space(2)), 2)))), Measure('cell', 0, None))])";
2310
/// Return the rank of the global tensor (r)
2311
virtual unsigned int rank() const
2316
/// Return the number of coefficients (n)
2317
virtual unsigned int num_coefficients() const
2322
/// Return the number of cell domains
2323
virtual unsigned int num_cell_domains() const
2328
/// Return the number of exterior facet domains
2329
virtual unsigned int num_exterior_facet_domains() const
2334
/// Return the number of interior facet domains
2335
virtual unsigned int num_interior_facet_domains() const
2340
/// Create a new finite element for argument function i
2341
virtual ufc::finite_element* create_finite_element(unsigned int i) const
2347
return new heat_finite_element_1();
2352
return new heat_finite_element_1();
2357
return new heat_finite_element_1();
2362
return new heat_finite_element_0();
2370
/// Create a new dofmap for argument function i
2371
virtual ufc::dofmap* create_dofmap(unsigned int i) const
2377
return new heat_dofmap_1();
2382
return new heat_dofmap_1();
2387
return new heat_dofmap_1();
2392
return new heat_dofmap_0();
2400
/// Create a new cell integral on sub domain i
2401
virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
2407
return new heat_cell_integral_1_0();
2415
/// Create a new exterior facet integral on sub domain i
2416
virtual ufc::exterior_facet_integral* create_exterior_facet_integral(unsigned int i) const
2421
/// Create a new interior facet integral on sub domain i
2422
virtual ufc::interior_facet_integral* create_interior_facet_integral(unsigned int i) const