1
// This code conforms with the UFC specification version 2.2.0
2
// and was automatically generated by FFC version 1.2.0.
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: 'auto'
23
// swig_binary: 'swig'
26
#ifndef __POINTMEASURE_H
27
#define __POINTMEASURE_H
34
/// This class defines the interface for a finite element.
36
class pointmeasure_finite_element_0: public ufc::finite_element
41
pointmeasure_finite_element_0() : ufc::finite_element()
47
virtual ~pointmeasure_finite_element_0()
52
/// Return a string identifying the finite element
53
virtual const char* signature() const
55
return "FiniteElement('Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 2, None)";
58
/// Return the cell shape
59
virtual ufc::shape cell_shape() const
64
/// Return the topological dimension of the cell shape
65
virtual std::size_t topological_dimension() const
70
/// Return the geometric dimension of the cell shape
71
virtual std::size_t geometric_dimension() const
76
/// Return the dimension of the finite element function space
77
virtual std::size_t space_dimension() const
82
/// Return the rank of the value space
83
virtual std::size_t value_rank() const
88
/// Return the dimension of the value space for axis i
89
virtual std::size_t value_dimension(std::size_t i) const
94
/// Evaluate basis function i at given point x in cell
95
virtual void evaluate_basis(std::size_t i,
98
const double* vertex_coordinates,
99
int cell_orientation) const
103
compute_jacobian_triangle_2d(J, vertex_coordinates);
105
// Compute Jacobian inverse and determinant
108
compute_jacobian_inverse_triangle_2d(K, detJ, J);
112
const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
113
const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
115
// Get coordinates and map to the reference (FIAT) element
116
double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
117
double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
126
// Array of basisvalues
127
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
129
// Declare helper variables
130
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
131
double tmp1 = (1.0 - Y)/2.0;
132
double tmp2 = tmp1*tmp1;
134
// Compute basisvalues
135
basisvalues[0] = 1.0;
136
basisvalues[1] = tmp0;
137
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
138
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
139
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
140
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
141
basisvalues[0] *= std::sqrt(0.5);
142
basisvalues[2] *= std::sqrt(1.0);
143
basisvalues[5] *= std::sqrt(1.5);
144
basisvalues[1] *= std::sqrt(3.0);
145
basisvalues[4] *= std::sqrt(4.5);
146
basisvalues[3] *= std::sqrt(7.5);
148
// Table(s) of coefficients
149
static const double coefficients0[6] = \
150
{0.0, -0.17320508, -0.1, 0.12171612, 0.094280904, 0.054433105};
153
for (unsigned int r = 0; r < 6; r++)
155
*values += coefficients0[r]*basisvalues[r];
156
}// end loop over 'r'
162
// Array of basisvalues
163
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
165
// Declare helper variables
166
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
167
double tmp1 = (1.0 - Y)/2.0;
168
double tmp2 = tmp1*tmp1;
170
// Compute basisvalues
171
basisvalues[0] = 1.0;
172
basisvalues[1] = tmp0;
173
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
174
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
175
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
176
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
177
basisvalues[0] *= std::sqrt(0.5);
178
basisvalues[2] *= std::sqrt(1.0);
179
basisvalues[5] *= std::sqrt(1.5);
180
basisvalues[1] *= std::sqrt(3.0);
181
basisvalues[4] *= std::sqrt(4.5);
182
basisvalues[3] *= std::sqrt(7.5);
184
// Table(s) of coefficients
185
static const double coefficients0[6] = \
186
{0.0, 0.17320508, -0.1, 0.12171612, -0.094280904, 0.054433105};
189
for (unsigned int r = 0; r < 6; r++)
191
*values += coefficients0[r]*basisvalues[r];
192
}// end loop over 'r'
198
// Array of basisvalues
199
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
201
// Declare helper variables
202
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
203
double tmp1 = (1.0 - Y)/2.0;
204
double tmp2 = tmp1*tmp1;
206
// Compute basisvalues
207
basisvalues[0] = 1.0;
208
basisvalues[1] = tmp0;
209
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
210
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
211
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
212
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
213
basisvalues[0] *= std::sqrt(0.5);
214
basisvalues[2] *= std::sqrt(1.0);
215
basisvalues[5] *= std::sqrt(1.5);
216
basisvalues[1] *= std::sqrt(3.0);
217
basisvalues[4] *= std::sqrt(4.5);
218
basisvalues[3] *= std::sqrt(7.5);
220
// Table(s) of coefficients
221
static const double coefficients0[6] = \
222
{0.0, 0.0, 0.2, 0.0, 0.0, 0.16329932};
225
for (unsigned int r = 0; r < 6; r++)
227
*values += coefficients0[r]*basisvalues[r];
228
}// end loop over 'r'
234
// Array of basisvalues
235
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
237
// Declare helper variables
238
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
239
double tmp1 = (1.0 - Y)/2.0;
240
double tmp2 = tmp1*tmp1;
242
// Compute basisvalues
243
basisvalues[0] = 1.0;
244
basisvalues[1] = tmp0;
245
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
246
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
247
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
248
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
249
basisvalues[0] *= std::sqrt(0.5);
250
basisvalues[2] *= std::sqrt(1.0);
251
basisvalues[5] *= std::sqrt(1.5);
252
basisvalues[1] *= std::sqrt(3.0);
253
basisvalues[4] *= std::sqrt(4.5);
254
basisvalues[3] *= std::sqrt(7.5);
256
// Table(s) of coefficients
257
static const double coefficients0[6] = \
258
{0.47140452, 0.23094011, 0.13333333, 0.0, 0.18856181, -0.16329932};
261
for (unsigned int r = 0; r < 6; r++)
263
*values += coefficients0[r]*basisvalues[r];
264
}// end loop over 'r'
270
// Array of basisvalues
271
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
273
// Declare helper variables
274
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
275
double tmp1 = (1.0 - Y)/2.0;
276
double tmp2 = tmp1*tmp1;
278
// Compute basisvalues
279
basisvalues[0] = 1.0;
280
basisvalues[1] = tmp0;
281
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
282
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
283
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
284
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
285
basisvalues[0] *= std::sqrt(0.5);
286
basisvalues[2] *= std::sqrt(1.0);
287
basisvalues[5] *= std::sqrt(1.5);
288
basisvalues[1] *= std::sqrt(3.0);
289
basisvalues[4] *= std::sqrt(4.5);
290
basisvalues[3] *= std::sqrt(7.5);
292
// Table(s) of coefficients
293
static const double coefficients0[6] = \
294
{0.47140452, -0.23094011, 0.13333333, 0.0, -0.18856181, -0.16329932};
297
for (unsigned int r = 0; r < 6; r++)
299
*values += coefficients0[r]*basisvalues[r];
300
}// end loop over 'r'
306
// Array of basisvalues
307
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
309
// Declare helper variables
310
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
311
double tmp1 = (1.0 - Y)/2.0;
312
double tmp2 = tmp1*tmp1;
314
// Compute basisvalues
315
basisvalues[0] = 1.0;
316
basisvalues[1] = tmp0;
317
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
318
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
319
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
320
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
321
basisvalues[0] *= std::sqrt(0.5);
322
basisvalues[2] *= std::sqrt(1.0);
323
basisvalues[5] *= std::sqrt(1.5);
324
basisvalues[1] *= std::sqrt(3.0);
325
basisvalues[4] *= std::sqrt(4.5);
326
basisvalues[3] *= std::sqrt(7.5);
328
// Table(s) of coefficients
329
static const double coefficients0[6] = \
330
{0.47140452, 0.0, -0.26666667, -0.24343225, 0.0, 0.054433105};
333
for (unsigned int r = 0; r < 6; r++)
335
*values += coefficients0[r]*basisvalues[r];
336
}// end loop over 'r'
343
/// Evaluate all basis functions at given point x in cell
344
virtual void evaluate_basis_all(double* values,
346
const double* vertex_coordinates,
347
int cell_orientation) const
349
// Helper variable to hold values of a single dof.
350
double dof_values = 0.0;
352
// Loop dofs and call evaluate_basis
353
for (unsigned int r = 0; r < 6; r++)
355
evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
356
values[r] = dof_values;
357
}// end loop over 'r'
360
/// Evaluate order n derivatives of basis function i at given point x in cell
361
virtual void evaluate_basis_derivatives(std::size_t i,
365
const double* vertex_coordinates,
366
int cell_orientation) const
370
compute_jacobian_triangle_2d(J, vertex_coordinates);
372
// Compute Jacobian inverse and determinant
375
compute_jacobian_inverse_triangle_2d(K, detJ, J);
379
const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
380
const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
382
// Get coordinates and map to the reference (FIAT) element
383
double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
384
double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
386
// Compute number of derivatives.
387
unsigned int num_derivatives = 1;
388
for (unsigned int r = 0; r < n; r++)
390
num_derivatives *= 2;
391
}// end loop over 'r'
393
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
394
unsigned int **combinations = new unsigned int *[num_derivatives];
395
for (unsigned int row = 0; row < num_derivatives; row++)
397
combinations[row] = new unsigned int [n];
398
for (unsigned int col = 0; col < n; col++)
399
combinations[row][col] = 0;
402
// Generate combinations of derivatives
403
for (unsigned int row = 1; row < num_derivatives; row++)
405
for (unsigned int num = 0; num < row; num++)
407
for (unsigned int col = n-1; col+1 > 0; col--)
409
if (combinations[row][col] + 1 > 1)
410
combinations[row][col] = 0;
413
combinations[row][col] += 1;
420
// Compute inverse of Jacobian
421
const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
423
// Declare transformation matrix
424
// Declare pointer to two dimensional array and initialise
425
double **transform = new double *[num_derivatives];
427
for (unsigned int j = 0; j < num_derivatives; j++)
429
transform[j] = new double [num_derivatives];
430
for (unsigned int k = 0; k < num_derivatives; k++)
434
// Construct transformation matrix
435
for (unsigned int row = 0; row < num_derivatives; row++)
437
for (unsigned int col = 0; col < num_derivatives; col++)
439
for (unsigned int k = 0; k < n; k++)
440
transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
444
// Reset values. Assuming that values is always an array.
445
for (unsigned int r = 0; r < num_derivatives; r++)
448
}// end loop over 'r'
455
// Array of basisvalues
456
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
458
// Declare helper variables
459
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
460
double tmp1 = (1.0 - Y)/2.0;
461
double tmp2 = tmp1*tmp1;
463
// Compute basisvalues
464
basisvalues[0] = 1.0;
465
basisvalues[1] = tmp0;
466
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
467
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
468
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
469
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
470
basisvalues[0] *= std::sqrt(0.5);
471
basisvalues[2] *= std::sqrt(1.0);
472
basisvalues[5] *= std::sqrt(1.5);
473
basisvalues[1] *= std::sqrt(3.0);
474
basisvalues[4] *= std::sqrt(4.5);
475
basisvalues[3] *= std::sqrt(7.5);
477
// Table(s) of coefficients
478
static const double coefficients0[6] = \
479
{0.0, -0.17320508, -0.1, 0.12171612, 0.094280904, 0.054433105};
481
// Tables of derivatives of the polynomial base (transpose).
482
static const double dmats0[6][6] = \
483
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
484
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
485
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
486
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
487
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
488
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
490
static const double dmats1[6][6] = \
491
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
492
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
493
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
494
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
495
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
496
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
498
// Compute reference derivatives.
499
// Declare pointer to array of derivatives on FIAT element.
500
double *derivatives = new double[num_derivatives];
501
for (unsigned int r = 0; r < num_derivatives; r++)
503
derivatives[r] = 0.0;
504
}// end loop over 'r'
506
// Declare derivative matrix (of polynomial basis).
507
double dmats[6][6] = \
508
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
509
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
510
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
511
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
512
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
513
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
515
// Declare (auxiliary) derivative matrix (of polynomial basis).
516
double dmats_old[6][6] = \
517
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
518
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
519
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
520
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
521
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
522
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
524
// Loop possible derivatives.
525
for (unsigned int r = 0; r < num_derivatives; r++)
527
// Resetting dmats values to compute next derivative.
528
for (unsigned int t = 0; t < 6; t++)
530
for (unsigned int u = 0; u < 6; u++)
538
}// end loop over 'u'
539
}// end loop over 't'
541
// Looping derivative order to generate dmats.
542
for (unsigned int s = 0; s < n; s++)
544
// Updating dmats_old with new values and resetting dmats.
545
for (unsigned int t = 0; t < 6; t++)
547
for (unsigned int u = 0; u < 6; u++)
549
dmats_old[t][u] = dmats[t][u];
551
}// end loop over 'u'
552
}// end loop over 't'
554
// Update dmats using an inner product.
555
if (combinations[r][s] == 0)
557
for (unsigned int t = 0; t < 6; t++)
559
for (unsigned int u = 0; u < 6; u++)
561
for (unsigned int tu = 0; tu < 6; tu++)
563
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
564
}// end loop over 'tu'
565
}// end loop over 'u'
566
}// end loop over 't'
569
if (combinations[r][s] == 1)
571
for (unsigned int t = 0; t < 6; t++)
573
for (unsigned int u = 0; u < 6; u++)
575
for (unsigned int tu = 0; tu < 6; tu++)
577
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
578
}// end loop over 'tu'
579
}// end loop over 'u'
580
}// end loop over 't'
583
}// end loop over 's'
584
for (unsigned int s = 0; s < 6; s++)
586
for (unsigned int t = 0; t < 6; t++)
588
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
589
}// end loop over 't'
590
}// end loop over 's'
591
}// end loop over 'r'
593
// Transform derivatives back to physical element
594
for (unsigned int r = 0; r < num_derivatives; r++)
596
for (unsigned int s = 0; s < num_derivatives; s++)
598
values[r] += transform[r][s]*derivatives[s];
599
}// end loop over 's'
600
}// end loop over 'r'
602
// Delete pointer to array of derivatives on FIAT element
603
delete [] derivatives;
605
// Delete pointer to array of combinations of derivatives and transform
606
for (unsigned int r = 0; r < num_derivatives; r++)
608
delete [] combinations[r];
609
}// end loop over 'r'
610
delete [] combinations;
611
for (unsigned int r = 0; r < num_derivatives; r++)
613
delete [] transform[r];
614
}// end loop over 'r'
621
// Array of basisvalues
622
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
624
// Declare helper variables
625
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
626
double tmp1 = (1.0 - Y)/2.0;
627
double tmp2 = tmp1*tmp1;
629
// Compute basisvalues
630
basisvalues[0] = 1.0;
631
basisvalues[1] = tmp0;
632
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
633
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
634
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
635
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
636
basisvalues[0] *= std::sqrt(0.5);
637
basisvalues[2] *= std::sqrt(1.0);
638
basisvalues[5] *= std::sqrt(1.5);
639
basisvalues[1] *= std::sqrt(3.0);
640
basisvalues[4] *= std::sqrt(4.5);
641
basisvalues[3] *= std::sqrt(7.5);
643
// Table(s) of coefficients
644
static const double coefficients0[6] = \
645
{0.0, 0.17320508, -0.1, 0.12171612, -0.094280904, 0.054433105};
647
// Tables of derivatives of the polynomial base (transpose).
648
static const double dmats0[6][6] = \
649
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
650
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
651
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
652
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
653
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
654
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
656
static const double dmats1[6][6] = \
657
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
658
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
659
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
660
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
661
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
662
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
664
// Compute reference derivatives.
665
// Declare pointer to array of derivatives on FIAT element.
666
double *derivatives = new double[num_derivatives];
667
for (unsigned int r = 0; r < num_derivatives; r++)
669
derivatives[r] = 0.0;
670
}// end loop over 'r'
672
// Declare derivative matrix (of polynomial basis).
673
double dmats[6][6] = \
674
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
675
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
676
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
677
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
678
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
679
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
681
// Declare (auxiliary) derivative matrix (of polynomial basis).
682
double dmats_old[6][6] = \
683
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
684
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
685
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
686
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
687
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
688
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
690
// Loop possible derivatives.
691
for (unsigned int r = 0; r < num_derivatives; r++)
693
// Resetting dmats values to compute next derivative.
694
for (unsigned int t = 0; t < 6; t++)
696
for (unsigned int u = 0; u < 6; u++)
704
}// end loop over 'u'
705
}// end loop over 't'
707
// Looping derivative order to generate dmats.
708
for (unsigned int s = 0; s < n; s++)
710
// Updating dmats_old with new values and resetting dmats.
711
for (unsigned int t = 0; t < 6; t++)
713
for (unsigned int u = 0; u < 6; u++)
715
dmats_old[t][u] = dmats[t][u];
717
}// end loop over 'u'
718
}// end loop over 't'
720
// Update dmats using an inner product.
721
if (combinations[r][s] == 0)
723
for (unsigned int t = 0; t < 6; t++)
725
for (unsigned int u = 0; u < 6; u++)
727
for (unsigned int tu = 0; tu < 6; tu++)
729
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
730
}// end loop over 'tu'
731
}// end loop over 'u'
732
}// end loop over 't'
735
if (combinations[r][s] == 1)
737
for (unsigned int t = 0; t < 6; t++)
739
for (unsigned int u = 0; u < 6; u++)
741
for (unsigned int tu = 0; tu < 6; tu++)
743
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
744
}// end loop over 'tu'
745
}// end loop over 'u'
746
}// end loop over 't'
749
}// end loop over 's'
750
for (unsigned int s = 0; s < 6; s++)
752
for (unsigned int t = 0; t < 6; t++)
754
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
755
}// end loop over 't'
756
}// end loop over 's'
757
}// end loop over 'r'
759
// Transform derivatives back to physical element
760
for (unsigned int r = 0; r < num_derivatives; r++)
762
for (unsigned int s = 0; s < num_derivatives; s++)
764
values[r] += transform[r][s]*derivatives[s];
765
}// end loop over 's'
766
}// end loop over 'r'
768
// Delete pointer to array of derivatives on FIAT element
769
delete [] derivatives;
771
// Delete pointer to array of combinations of derivatives and transform
772
for (unsigned int r = 0; r < num_derivatives; r++)
774
delete [] combinations[r];
775
}// end loop over 'r'
776
delete [] combinations;
777
for (unsigned int r = 0; r < num_derivatives; r++)
779
delete [] transform[r];
780
}// end loop over 'r'
787
// Array of basisvalues
788
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
790
// Declare helper variables
791
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
792
double tmp1 = (1.0 - Y)/2.0;
793
double tmp2 = tmp1*tmp1;
795
// Compute basisvalues
796
basisvalues[0] = 1.0;
797
basisvalues[1] = tmp0;
798
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
799
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
800
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
801
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
802
basisvalues[0] *= std::sqrt(0.5);
803
basisvalues[2] *= std::sqrt(1.0);
804
basisvalues[5] *= std::sqrt(1.5);
805
basisvalues[1] *= std::sqrt(3.0);
806
basisvalues[4] *= std::sqrt(4.5);
807
basisvalues[3] *= std::sqrt(7.5);
809
// Table(s) of coefficients
810
static const double coefficients0[6] = \
811
{0.0, 0.0, 0.2, 0.0, 0.0, 0.16329932};
813
// Tables of derivatives of the polynomial base (transpose).
814
static const double dmats0[6][6] = \
815
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
816
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
817
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
818
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
819
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
820
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
822
static const double dmats1[6][6] = \
823
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
824
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
825
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
826
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
827
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
828
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
830
// Compute reference derivatives.
831
// Declare pointer to array of derivatives on FIAT element.
832
double *derivatives = new double[num_derivatives];
833
for (unsigned int r = 0; r < num_derivatives; r++)
835
derivatives[r] = 0.0;
836
}// end loop over 'r'
838
// Declare derivative matrix (of polynomial basis).
839
double dmats[6][6] = \
840
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
841
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
842
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
843
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
844
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
845
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
847
// Declare (auxiliary) derivative matrix (of polynomial basis).
848
double dmats_old[6][6] = \
849
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
850
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
851
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
852
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
853
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
854
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
856
// Loop possible derivatives.
857
for (unsigned int r = 0; r < num_derivatives; r++)
859
// Resetting dmats values to compute next derivative.
860
for (unsigned int t = 0; t < 6; t++)
862
for (unsigned int u = 0; u < 6; u++)
870
}// end loop over 'u'
871
}// end loop over 't'
873
// Looping derivative order to generate dmats.
874
for (unsigned int s = 0; s < n; s++)
876
// Updating dmats_old with new values and resetting dmats.
877
for (unsigned int t = 0; t < 6; t++)
879
for (unsigned int u = 0; u < 6; u++)
881
dmats_old[t][u] = dmats[t][u];
883
}// end loop over 'u'
884
}// end loop over 't'
886
// Update dmats using an inner product.
887
if (combinations[r][s] == 0)
889
for (unsigned int t = 0; t < 6; t++)
891
for (unsigned int u = 0; u < 6; u++)
893
for (unsigned int tu = 0; tu < 6; tu++)
895
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
896
}// end loop over 'tu'
897
}// end loop over 'u'
898
}// end loop over 't'
901
if (combinations[r][s] == 1)
903
for (unsigned int t = 0; t < 6; t++)
905
for (unsigned int u = 0; u < 6; u++)
907
for (unsigned int tu = 0; tu < 6; tu++)
909
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
910
}// end loop over 'tu'
911
}// end loop over 'u'
912
}// end loop over 't'
915
}// end loop over 's'
916
for (unsigned int s = 0; s < 6; s++)
918
for (unsigned int t = 0; t < 6; t++)
920
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
921
}// end loop over 't'
922
}// end loop over 's'
923
}// end loop over 'r'
925
// Transform derivatives back to physical element
926
for (unsigned int r = 0; r < num_derivatives; r++)
928
for (unsigned int s = 0; s < num_derivatives; s++)
930
values[r] += transform[r][s]*derivatives[s];
931
}// end loop over 's'
932
}// end loop over 'r'
934
// Delete pointer to array of derivatives on FIAT element
935
delete [] derivatives;
937
// Delete pointer to array of combinations of derivatives and transform
938
for (unsigned int r = 0; r < num_derivatives; r++)
940
delete [] combinations[r];
941
}// end loop over 'r'
942
delete [] combinations;
943
for (unsigned int r = 0; r < num_derivatives; r++)
945
delete [] transform[r];
946
}// end loop over 'r'
953
// Array of basisvalues
954
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
956
// Declare helper variables
957
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
958
double tmp1 = (1.0 - Y)/2.0;
959
double tmp2 = tmp1*tmp1;
961
// Compute basisvalues
962
basisvalues[0] = 1.0;
963
basisvalues[1] = tmp0;
964
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
965
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
966
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
967
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
968
basisvalues[0] *= std::sqrt(0.5);
969
basisvalues[2] *= std::sqrt(1.0);
970
basisvalues[5] *= std::sqrt(1.5);
971
basisvalues[1] *= std::sqrt(3.0);
972
basisvalues[4] *= std::sqrt(4.5);
973
basisvalues[3] *= std::sqrt(7.5);
975
// Table(s) of coefficients
976
static const double coefficients0[6] = \
977
{0.47140452, 0.23094011, 0.13333333, 0.0, 0.18856181, -0.16329932};
979
// Tables of derivatives of the polynomial base (transpose).
980
static const double dmats0[6][6] = \
981
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
982
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
983
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
984
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
985
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
986
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
988
static const double dmats1[6][6] = \
989
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
990
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
991
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
992
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
993
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
994
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
996
// Compute reference derivatives.
997
// Declare pointer to array of derivatives on FIAT element.
998
double *derivatives = new double[num_derivatives];
999
for (unsigned int r = 0; r < num_derivatives; r++)
1001
derivatives[r] = 0.0;
1002
}// end loop over 'r'
1004
// Declare derivative matrix (of polynomial basis).
1005
double dmats[6][6] = \
1006
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1007
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1008
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1009
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1010
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1011
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1013
// Declare (auxiliary) derivative matrix (of polynomial basis).
1014
double dmats_old[6][6] = \
1015
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1016
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1017
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1018
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1019
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1020
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1022
// Loop possible derivatives.
1023
for (unsigned int r = 0; r < num_derivatives; r++)
1025
// Resetting dmats values to compute next derivative.
1026
for (unsigned int t = 0; t < 6; t++)
1028
for (unsigned int u = 0; u < 6; u++)
1036
}// end loop over 'u'
1037
}// end loop over 't'
1039
// Looping derivative order to generate dmats.
1040
for (unsigned int s = 0; s < n; s++)
1042
// Updating dmats_old with new values and resetting dmats.
1043
for (unsigned int t = 0; t < 6; t++)
1045
for (unsigned int u = 0; u < 6; u++)
1047
dmats_old[t][u] = dmats[t][u];
1049
}// end loop over 'u'
1050
}// end loop over 't'
1052
// Update dmats using an inner product.
1053
if (combinations[r][s] == 0)
1055
for (unsigned int t = 0; t < 6; t++)
1057
for (unsigned int u = 0; u < 6; u++)
1059
for (unsigned int tu = 0; tu < 6; tu++)
1061
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1062
}// end loop over 'tu'
1063
}// end loop over 'u'
1064
}// end loop over 't'
1067
if (combinations[r][s] == 1)
1069
for (unsigned int t = 0; t < 6; t++)
1071
for (unsigned int u = 0; u < 6; u++)
1073
for (unsigned int tu = 0; tu < 6; tu++)
1075
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1076
}// end loop over 'tu'
1077
}// end loop over 'u'
1078
}// end loop over 't'
1081
}// end loop over 's'
1082
for (unsigned int s = 0; s < 6; s++)
1084
for (unsigned int t = 0; t < 6; t++)
1086
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1087
}// end loop over 't'
1088
}// end loop over 's'
1089
}// end loop over 'r'
1091
// Transform derivatives back to physical element
1092
for (unsigned int r = 0; r < num_derivatives; r++)
1094
for (unsigned int s = 0; s < num_derivatives; s++)
1096
values[r] += transform[r][s]*derivatives[s];
1097
}// end loop over 's'
1098
}// end loop over 'r'
1100
// Delete pointer to array of derivatives on FIAT element
1101
delete [] derivatives;
1103
// Delete pointer to array of combinations of derivatives and transform
1104
for (unsigned int r = 0; r < num_derivatives; r++)
1106
delete [] combinations[r];
1107
}// end loop over 'r'
1108
delete [] combinations;
1109
for (unsigned int r = 0; r < num_derivatives; r++)
1111
delete [] transform[r];
1112
}// end loop over 'r'
1113
delete [] transform;
1119
// Array of basisvalues
1120
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1122
// Declare helper variables
1123
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1124
double tmp1 = (1.0 - Y)/2.0;
1125
double tmp2 = tmp1*tmp1;
1127
// Compute basisvalues
1128
basisvalues[0] = 1.0;
1129
basisvalues[1] = tmp0;
1130
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1131
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
1132
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
1133
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
1134
basisvalues[0] *= std::sqrt(0.5);
1135
basisvalues[2] *= std::sqrt(1.0);
1136
basisvalues[5] *= std::sqrt(1.5);
1137
basisvalues[1] *= std::sqrt(3.0);
1138
basisvalues[4] *= std::sqrt(4.5);
1139
basisvalues[3] *= std::sqrt(7.5);
1141
// Table(s) of coefficients
1142
static const double coefficients0[6] = \
1143
{0.47140452, -0.23094011, 0.13333333, 0.0, -0.18856181, -0.16329932};
1145
// Tables of derivatives of the polynomial base (transpose).
1146
static const double dmats0[6][6] = \
1147
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1148
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
1149
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1150
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
1151
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
1152
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
1154
static const double dmats1[6][6] = \
1155
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1156
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
1157
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
1158
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
1159
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
1160
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
1162
// Compute reference derivatives.
1163
// Declare pointer to array of derivatives on FIAT element.
1164
double *derivatives = new double[num_derivatives];
1165
for (unsigned int r = 0; r < num_derivatives; r++)
1167
derivatives[r] = 0.0;
1168
}// end loop over 'r'
1170
// Declare derivative matrix (of polynomial basis).
1171
double dmats[6][6] = \
1172
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1173
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1174
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1175
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1176
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1177
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1179
// Declare (auxiliary) derivative matrix (of polynomial basis).
1180
double dmats_old[6][6] = \
1181
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1182
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1183
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1184
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1185
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1186
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1188
// Loop possible derivatives.
1189
for (unsigned int r = 0; r < num_derivatives; r++)
1191
// Resetting dmats values to compute next derivative.
1192
for (unsigned int t = 0; t < 6; t++)
1194
for (unsigned int u = 0; u < 6; u++)
1202
}// end loop over 'u'
1203
}// end loop over 't'
1205
// Looping derivative order to generate dmats.
1206
for (unsigned int s = 0; s < n; s++)
1208
// Updating dmats_old with new values and resetting dmats.
1209
for (unsigned int t = 0; t < 6; t++)
1211
for (unsigned int u = 0; u < 6; u++)
1213
dmats_old[t][u] = dmats[t][u];
1215
}// end loop over 'u'
1216
}// end loop over 't'
1218
// Update dmats using an inner product.
1219
if (combinations[r][s] == 0)
1221
for (unsigned int t = 0; t < 6; t++)
1223
for (unsigned int u = 0; u < 6; u++)
1225
for (unsigned int tu = 0; tu < 6; tu++)
1227
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1228
}// end loop over 'tu'
1229
}// end loop over 'u'
1230
}// end loop over 't'
1233
if (combinations[r][s] == 1)
1235
for (unsigned int t = 0; t < 6; t++)
1237
for (unsigned int u = 0; u < 6; u++)
1239
for (unsigned int tu = 0; tu < 6; tu++)
1241
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1242
}// end loop over 'tu'
1243
}// end loop over 'u'
1244
}// end loop over 't'
1247
}// end loop over 's'
1248
for (unsigned int s = 0; s < 6; s++)
1250
for (unsigned int t = 0; t < 6; t++)
1252
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1253
}// end loop over 't'
1254
}// end loop over 's'
1255
}// end loop over 'r'
1257
// Transform derivatives back to physical element
1258
for (unsigned int r = 0; r < num_derivatives; r++)
1260
for (unsigned int s = 0; s < num_derivatives; s++)
1262
values[r] += transform[r][s]*derivatives[s];
1263
}// end loop over 's'
1264
}// end loop over 'r'
1266
// Delete pointer to array of derivatives on FIAT element
1267
delete [] derivatives;
1269
// Delete pointer to array of combinations of derivatives and transform
1270
for (unsigned int r = 0; r < num_derivatives; r++)
1272
delete [] combinations[r];
1273
}// end loop over 'r'
1274
delete [] combinations;
1275
for (unsigned int r = 0; r < num_derivatives; r++)
1277
delete [] transform[r];
1278
}// end loop over 'r'
1279
delete [] transform;
1285
// Array of basisvalues
1286
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1288
// Declare helper variables
1289
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1290
double tmp1 = (1.0 - Y)/2.0;
1291
double tmp2 = tmp1*tmp1;
1293
// Compute basisvalues
1294
basisvalues[0] = 1.0;
1295
basisvalues[1] = tmp0;
1296
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1297
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
1298
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
1299
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
1300
basisvalues[0] *= std::sqrt(0.5);
1301
basisvalues[2] *= std::sqrt(1.0);
1302
basisvalues[5] *= std::sqrt(1.5);
1303
basisvalues[1] *= std::sqrt(3.0);
1304
basisvalues[4] *= std::sqrt(4.5);
1305
basisvalues[3] *= std::sqrt(7.5);
1307
// Table(s) of coefficients
1308
static const double coefficients0[6] = \
1309
{0.47140452, 0.0, -0.26666667, -0.24343225, 0.0, 0.054433105};
1311
// Tables of derivatives of the polynomial base (transpose).
1312
static const double dmats0[6][6] = \
1313
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1314
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
1315
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1316
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
1317
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
1318
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
1320
static const double dmats1[6][6] = \
1321
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1322
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
1323
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
1324
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
1325
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
1326
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
1328
// Compute reference derivatives.
1329
// Declare pointer to array of derivatives on FIAT element.
1330
double *derivatives = new double[num_derivatives];
1331
for (unsigned int r = 0; r < num_derivatives; r++)
1333
derivatives[r] = 0.0;
1334
}// end loop over 'r'
1336
// Declare derivative matrix (of polynomial basis).
1337
double dmats[6][6] = \
1338
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1339
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1340
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1341
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1342
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1343
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1345
// Declare (auxiliary) derivative matrix (of polynomial basis).
1346
double dmats_old[6][6] = \
1347
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1348
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1349
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1350
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1351
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1352
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1354
// Loop possible derivatives.
1355
for (unsigned int r = 0; r < num_derivatives; r++)
1357
// Resetting dmats values to compute next derivative.
1358
for (unsigned int t = 0; t < 6; t++)
1360
for (unsigned int u = 0; u < 6; u++)
1368
}// end loop over 'u'
1369
}// end loop over 't'
1371
// Looping derivative order to generate dmats.
1372
for (unsigned int s = 0; s < n; s++)
1374
// Updating dmats_old with new values and resetting dmats.
1375
for (unsigned int t = 0; t < 6; t++)
1377
for (unsigned int u = 0; u < 6; u++)
1379
dmats_old[t][u] = dmats[t][u];
1381
}// end loop over 'u'
1382
}// end loop over 't'
1384
// Update dmats using an inner product.
1385
if (combinations[r][s] == 0)
1387
for (unsigned int t = 0; t < 6; t++)
1389
for (unsigned int u = 0; u < 6; u++)
1391
for (unsigned int tu = 0; tu < 6; tu++)
1393
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1394
}// end loop over 'tu'
1395
}// end loop over 'u'
1396
}// end loop over 't'
1399
if (combinations[r][s] == 1)
1401
for (unsigned int t = 0; t < 6; t++)
1403
for (unsigned int u = 0; u < 6; u++)
1405
for (unsigned int tu = 0; tu < 6; tu++)
1407
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1408
}// end loop over 'tu'
1409
}// end loop over 'u'
1410
}// end loop over 't'
1413
}// end loop over 's'
1414
for (unsigned int s = 0; s < 6; s++)
1416
for (unsigned int t = 0; t < 6; t++)
1418
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1419
}// end loop over 't'
1420
}// end loop over 's'
1421
}// end loop over 'r'
1423
// Transform derivatives back to physical element
1424
for (unsigned int r = 0; r < num_derivatives; r++)
1426
for (unsigned int s = 0; s < num_derivatives; s++)
1428
values[r] += transform[r][s]*derivatives[s];
1429
}// end loop over 's'
1430
}// end loop over 'r'
1432
// Delete pointer to array of derivatives on FIAT element
1433
delete [] derivatives;
1435
// Delete pointer to array of combinations of derivatives and transform
1436
for (unsigned int r = 0; r < num_derivatives; r++)
1438
delete [] combinations[r];
1439
}// end loop over 'r'
1440
delete [] combinations;
1441
for (unsigned int r = 0; r < num_derivatives; r++)
1443
delete [] transform[r];
1444
}// end loop over 'r'
1445
delete [] transform;
1452
/// Evaluate order n derivatives of all basis functions at given point x in cell
1453
virtual void evaluate_basis_derivatives_all(std::size_t n,
1456
const double* vertex_coordinates,
1457
int cell_orientation) const
1459
// Compute number of derivatives.
1460
unsigned int num_derivatives = 1;
1461
for (unsigned int r = 0; r < n; r++)
1463
num_derivatives *= 2;
1464
}// end loop over 'r'
1466
// Helper variable to hold values of a single dof.
1467
double *dof_values = new double[num_derivatives];
1468
for (unsigned int r = 0; r < num_derivatives; r++)
1470
dof_values[r] = 0.0;
1471
}// end loop over 'r'
1473
// Loop dofs and call evaluate_basis_derivatives.
1474
for (unsigned int r = 0; r < 6; r++)
1476
evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
1477
for (unsigned int s = 0; s < num_derivatives; s++)
1479
values[r*num_derivatives + s] = dof_values[s];
1480
}// end loop over 's'
1481
}// end loop over 'r'
1484
delete [] dof_values;
1487
/// Evaluate linear functional for dof i on the function f
1488
virtual double evaluate_dof(std::size_t i,
1489
const ufc::function& f,
1490
const double* vertex_coordinates,
1491
int cell_orientation,
1492
const ufc::cell& c) const
1494
// Declare variables for result of evaluation
1497
// Declare variable for physical coordinates
1503
y[0] = vertex_coordinates[0];
1504
y[1] = vertex_coordinates[1];
1505
f.evaluate(vals, y, c);
1511
y[0] = vertex_coordinates[2];
1512
y[1] = vertex_coordinates[3];
1513
f.evaluate(vals, y, c);
1519
y[0] = vertex_coordinates[4];
1520
y[1] = vertex_coordinates[5];
1521
f.evaluate(vals, y, c);
1527
y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
1528
y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
1529
f.evaluate(vals, y, c);
1535
y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
1536
y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
1537
f.evaluate(vals, y, c);
1543
y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
1544
y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
1545
f.evaluate(vals, y, c);
1554
/// Evaluate linear functionals for all dofs on the function f
1555
virtual void evaluate_dofs(double* values,
1556
const ufc::function& f,
1557
const double* vertex_coordinates,
1558
int cell_orientation,
1559
const ufc::cell& c) const
1561
// Declare variables for result of evaluation
1564
// Declare variable for physical coordinates
1566
y[0] = vertex_coordinates[0];
1567
y[1] = vertex_coordinates[1];
1568
f.evaluate(vals, y, c);
1569
values[0] = vals[0];
1570
y[0] = vertex_coordinates[2];
1571
y[1] = vertex_coordinates[3];
1572
f.evaluate(vals, y, c);
1573
values[1] = vals[0];
1574
y[0] = vertex_coordinates[4];
1575
y[1] = vertex_coordinates[5];
1576
f.evaluate(vals, y, c);
1577
values[2] = vals[0];
1578
y[0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
1579
y[1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
1580
f.evaluate(vals, y, c);
1581
values[3] = vals[0];
1582
y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
1583
y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
1584
f.evaluate(vals, y, c);
1585
values[4] = vals[0];
1586
y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
1587
y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
1588
f.evaluate(vals, y, c);
1589
values[5] = vals[0];
1592
/// Interpolate vertex values from dof values
1593
virtual void interpolate_vertex_values(double* vertex_values,
1594
const double* dof_values,
1595
const double* vertex_coordinates,
1596
int cell_orientation,
1597
const ufc::cell& c) const
1599
// Evaluate function and change variables
1600
vertex_values[0] = dof_values[0];
1601
vertex_values[1] = dof_values[1];
1602
vertex_values[2] = dof_values[2];
1605
/// Map coordinate xhat from reference cell to coordinate x in cell
1606
virtual void map_from_reference_cell(double* x,
1608
const ufc::cell& c) const
1610
std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
1613
/// Map from coordinate x in cell to coordinate xhat in reference cell
1614
virtual void map_to_reference_cell(double* xhat,
1616
const ufc::cell& c) const
1618
std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
1621
/// Return the number of sub elements (for a mixed element)
1622
virtual std::size_t num_sub_elements() const
1627
/// Create a new finite element for sub element i (for a mixed element)
1628
virtual ufc::finite_element* create_sub_element(std::size_t i) const
1633
/// Create a new class instance
1634
virtual ufc::finite_element* create() const
1636
return new pointmeasure_finite_element_0();
1641
/// This class defines the interface for a finite element.
1643
class pointmeasure_finite_element_1: public ufc::finite_element
1648
pointmeasure_finite_element_1() : ufc::finite_element()
1654
virtual ~pointmeasure_finite_element_1()
1659
/// Return a string identifying the finite element
1660
virtual const char* signature() const
1662
return "FiniteElement('Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 1, None)";
1665
/// Return the cell shape
1666
virtual ufc::shape cell_shape() const
1668
return ufc::triangle;
1671
/// Return the topological dimension of the cell shape
1672
virtual std::size_t topological_dimension() const
1677
/// Return the geometric dimension of the cell shape
1678
virtual std::size_t geometric_dimension() const
1683
/// Return the dimension of the finite element function space
1684
virtual std::size_t space_dimension() const
1689
/// Return the rank of the value space
1690
virtual std::size_t value_rank() const
1695
/// Return the dimension of the value space for axis i
1696
virtual std::size_t value_dimension(std::size_t i) const
1701
/// Evaluate basis function i at given point x in cell
1702
virtual void evaluate_basis(std::size_t i,
1705
const double* vertex_coordinates,
1706
int cell_orientation) const
1710
compute_jacobian_triangle_2d(J, vertex_coordinates);
1712
// Compute Jacobian inverse and determinant
1715
compute_jacobian_inverse_triangle_2d(K, detJ, J);
1718
// Compute constants
1719
const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
1720
const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
1722
// Get coordinates and map to the reference (FIAT) element
1723
double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
1724
double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
1733
// Array of basisvalues
1734
double basisvalues[3] = {0.0, 0.0, 0.0};
1736
// Declare helper variables
1737
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1739
// Compute basisvalues
1740
basisvalues[0] = 1.0;
1741
basisvalues[1] = tmp0;
1742
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
1743
basisvalues[0] *= std::sqrt(0.5);
1744
basisvalues[2] *= std::sqrt(1.0);
1745
basisvalues[1] *= std::sqrt(3.0);
1747
// Table(s) of coefficients
1748
static const double coefficients0[3] = \
1749
{0.47140452, -0.28867513, -0.16666667};
1752
for (unsigned int r = 0; r < 3; r++)
1754
*values += coefficients0[r]*basisvalues[r];
1755
}// end loop over 'r'
1761
// Array of basisvalues
1762
double basisvalues[3] = {0.0, 0.0, 0.0};
1764
// Declare helper variables
1765
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1767
// Compute basisvalues
1768
basisvalues[0] = 1.0;
1769
basisvalues[1] = tmp0;
1770
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
1771
basisvalues[0] *= std::sqrt(0.5);
1772
basisvalues[2] *= std::sqrt(1.0);
1773
basisvalues[1] *= std::sqrt(3.0);
1775
// Table(s) of coefficients
1776
static const double coefficients0[3] = \
1777
{0.47140452, 0.28867513, -0.16666667};
1780
for (unsigned int r = 0; r < 3; r++)
1782
*values += coefficients0[r]*basisvalues[r];
1783
}// end loop over 'r'
1789
// Array of basisvalues
1790
double basisvalues[3] = {0.0, 0.0, 0.0};
1792
// Declare helper variables
1793
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1795
// Compute basisvalues
1796
basisvalues[0] = 1.0;
1797
basisvalues[1] = tmp0;
1798
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
1799
basisvalues[0] *= std::sqrt(0.5);
1800
basisvalues[2] *= std::sqrt(1.0);
1801
basisvalues[1] *= std::sqrt(3.0);
1803
// Table(s) of coefficients
1804
static const double coefficients0[3] = \
1805
{0.47140452, 0.0, 0.33333333};
1808
for (unsigned int r = 0; r < 3; r++)
1810
*values += coefficients0[r]*basisvalues[r];
1811
}// end loop over 'r'
1818
/// Evaluate all basis functions at given point x in cell
1819
virtual void evaluate_basis_all(double* values,
1821
const double* vertex_coordinates,
1822
int cell_orientation) const
1824
// Helper variable to hold values of a single dof.
1825
double dof_values = 0.0;
1827
// Loop dofs and call evaluate_basis
1828
for (unsigned int r = 0; r < 3; r++)
1830
evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
1831
values[r] = dof_values;
1832
}// end loop over 'r'
1835
/// Evaluate order n derivatives of basis function i at given point x in cell
1836
virtual void evaluate_basis_derivatives(std::size_t i,
1840
const double* vertex_coordinates,
1841
int cell_orientation) const
1845
compute_jacobian_triangle_2d(J, vertex_coordinates);
1847
// Compute Jacobian inverse and determinant
1850
compute_jacobian_inverse_triangle_2d(K, detJ, J);
1853
// Compute constants
1854
const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
1855
const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
1857
// Get coordinates and map to the reference (FIAT) element
1858
double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
1859
double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
1861
// Compute number of derivatives.
1862
unsigned int num_derivatives = 1;
1863
for (unsigned int r = 0; r < n; r++)
1865
num_derivatives *= 2;
1866
}// end loop over 'r'
1868
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
1869
unsigned int **combinations = new unsigned int *[num_derivatives];
1870
for (unsigned int row = 0; row < num_derivatives; row++)
1872
combinations[row] = new unsigned int [n];
1873
for (unsigned int col = 0; col < n; col++)
1874
combinations[row][col] = 0;
1877
// Generate combinations of derivatives
1878
for (unsigned int row = 1; row < num_derivatives; row++)
1880
for (unsigned int num = 0; num < row; num++)
1882
for (unsigned int col = n-1; col+1 > 0; col--)
1884
if (combinations[row][col] + 1 > 1)
1885
combinations[row][col] = 0;
1888
combinations[row][col] += 1;
1895
// Compute inverse of Jacobian
1896
const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
1898
// Declare transformation matrix
1899
// Declare pointer to two dimensional array and initialise
1900
double **transform = new double *[num_derivatives];
1902
for (unsigned int j = 0; j < num_derivatives; j++)
1904
transform[j] = new double [num_derivatives];
1905
for (unsigned int k = 0; k < num_derivatives; k++)
1906
transform[j][k] = 1;
1909
// Construct transformation matrix
1910
for (unsigned int row = 0; row < num_derivatives; row++)
1912
for (unsigned int col = 0; col < num_derivatives; col++)
1914
for (unsigned int k = 0; k < n; k++)
1915
transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
1919
// Reset values. Assuming that values is always an array.
1920
for (unsigned int r = 0; r < num_derivatives; r++)
1923
}// end loop over 'r'
1930
// Array of basisvalues
1931
double basisvalues[3] = {0.0, 0.0, 0.0};
1933
// Declare helper variables
1934
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1936
// Compute basisvalues
1937
basisvalues[0] = 1.0;
1938
basisvalues[1] = tmp0;
1939
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
1940
basisvalues[0] *= std::sqrt(0.5);
1941
basisvalues[2] *= std::sqrt(1.0);
1942
basisvalues[1] *= std::sqrt(3.0);
1944
// Table(s) of coefficients
1945
static const double coefficients0[3] = \
1946
{0.47140452, -0.28867513, -0.16666667};
1948
// Tables of derivatives of the polynomial base (transpose).
1949
static const double dmats0[3][3] = \
1951
{4.8989795, 0.0, 0.0},
1954
static const double dmats1[3][3] = \
1956
{2.4494897, 0.0, 0.0},
1957
{4.2426407, 0.0, 0.0}};
1959
// Compute reference derivatives.
1960
// Declare pointer to array of derivatives on FIAT element.
1961
double *derivatives = new double[num_derivatives];
1962
for (unsigned int r = 0; r < num_derivatives; r++)
1964
derivatives[r] = 0.0;
1965
}// end loop over 'r'
1967
// Declare derivative matrix (of polynomial basis).
1968
double dmats[3][3] = \
1973
// Declare (auxiliary) derivative matrix (of polynomial basis).
1974
double dmats_old[3][3] = \
1979
// Loop possible derivatives.
1980
for (unsigned int r = 0; r < num_derivatives; r++)
1982
// Resetting dmats values to compute next derivative.
1983
for (unsigned int t = 0; t < 3; t++)
1985
for (unsigned int u = 0; u < 3; u++)
1993
}// end loop over 'u'
1994
}// end loop over 't'
1996
// Looping derivative order to generate dmats.
1997
for (unsigned int s = 0; s < n; s++)
1999
// Updating dmats_old with new values and resetting dmats.
2000
for (unsigned int t = 0; t < 3; t++)
2002
for (unsigned int u = 0; u < 3; u++)
2004
dmats_old[t][u] = dmats[t][u];
2006
}// end loop over 'u'
2007
}// end loop over 't'
2009
// Update dmats using an inner product.
2010
if (combinations[r][s] == 0)
2012
for (unsigned int t = 0; t < 3; t++)
2014
for (unsigned int u = 0; u < 3; u++)
2016
for (unsigned int tu = 0; tu < 3; tu++)
2018
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
2019
}// end loop over 'tu'
2020
}// end loop over 'u'
2021
}// end loop over 't'
2024
if (combinations[r][s] == 1)
2026
for (unsigned int t = 0; t < 3; t++)
2028
for (unsigned int u = 0; u < 3; u++)
2030
for (unsigned int tu = 0; tu < 3; tu++)
2032
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
2033
}// end loop over 'tu'
2034
}// end loop over 'u'
2035
}// end loop over 't'
2038
}// end loop over 's'
2039
for (unsigned int s = 0; s < 3; s++)
2041
for (unsigned int t = 0; t < 3; t++)
2043
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
2044
}// end loop over 't'
2045
}// end loop over 's'
2046
}// end loop over 'r'
2048
// Transform derivatives back to physical element
2049
for (unsigned int r = 0; r < num_derivatives; r++)
2051
for (unsigned int s = 0; s < num_derivatives; s++)
2053
values[r] += transform[r][s]*derivatives[s];
2054
}// end loop over 's'
2055
}// end loop over 'r'
2057
// Delete pointer to array of derivatives on FIAT element
2058
delete [] derivatives;
2060
// Delete pointer to array of combinations of derivatives and transform
2061
for (unsigned int r = 0; r < num_derivatives; r++)
2063
delete [] combinations[r];
2064
}// end loop over 'r'
2065
delete [] combinations;
2066
for (unsigned int r = 0; r < num_derivatives; r++)
2068
delete [] transform[r];
2069
}// end loop over 'r'
2070
delete [] transform;
2076
// Array of basisvalues
2077
double basisvalues[3] = {0.0, 0.0, 0.0};
2079
// Declare helper variables
2080
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2082
// Compute basisvalues
2083
basisvalues[0] = 1.0;
2084
basisvalues[1] = tmp0;
2085
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
2086
basisvalues[0] *= std::sqrt(0.5);
2087
basisvalues[2] *= std::sqrt(1.0);
2088
basisvalues[1] *= std::sqrt(3.0);
2090
// Table(s) of coefficients
2091
static const double coefficients0[3] = \
2092
{0.47140452, 0.28867513, -0.16666667};
2094
// Tables of derivatives of the polynomial base (transpose).
2095
static const double dmats0[3][3] = \
2097
{4.8989795, 0.0, 0.0},
2100
static const double dmats1[3][3] = \
2102
{2.4494897, 0.0, 0.0},
2103
{4.2426407, 0.0, 0.0}};
2105
// Compute reference derivatives.
2106
// Declare pointer to array of derivatives on FIAT element.
2107
double *derivatives = new double[num_derivatives];
2108
for (unsigned int r = 0; r < num_derivatives; r++)
2110
derivatives[r] = 0.0;
2111
}// end loop over 'r'
2113
// Declare derivative matrix (of polynomial basis).
2114
double dmats[3][3] = \
2119
// Declare (auxiliary) derivative matrix (of polynomial basis).
2120
double dmats_old[3][3] = \
2125
// Loop possible derivatives.
2126
for (unsigned int r = 0; r < num_derivatives; r++)
2128
// Resetting dmats values to compute next derivative.
2129
for (unsigned int t = 0; t < 3; t++)
2131
for (unsigned int u = 0; u < 3; u++)
2139
}// end loop over 'u'
2140
}// end loop over 't'
2142
// Looping derivative order to generate dmats.
2143
for (unsigned int s = 0; s < n; s++)
2145
// Updating dmats_old with new values and resetting dmats.
2146
for (unsigned int t = 0; t < 3; t++)
2148
for (unsigned int u = 0; u < 3; u++)
2150
dmats_old[t][u] = dmats[t][u];
2152
}// end loop over 'u'
2153
}// end loop over 't'
2155
// Update dmats using an inner product.
2156
if (combinations[r][s] == 0)
2158
for (unsigned int t = 0; t < 3; t++)
2160
for (unsigned int u = 0; u < 3; u++)
2162
for (unsigned int tu = 0; tu < 3; tu++)
2164
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
2165
}// end loop over 'tu'
2166
}// end loop over 'u'
2167
}// end loop over 't'
2170
if (combinations[r][s] == 1)
2172
for (unsigned int t = 0; t < 3; t++)
2174
for (unsigned int u = 0; u < 3; u++)
2176
for (unsigned int tu = 0; tu < 3; tu++)
2178
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
2179
}// end loop over 'tu'
2180
}// end loop over 'u'
2181
}// end loop over 't'
2184
}// end loop over 's'
2185
for (unsigned int s = 0; s < 3; s++)
2187
for (unsigned int t = 0; t < 3; t++)
2189
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
2190
}// end loop over 't'
2191
}// end loop over 's'
2192
}// end loop over 'r'
2194
// Transform derivatives back to physical element
2195
for (unsigned int r = 0; r < num_derivatives; r++)
2197
for (unsigned int s = 0; s < num_derivatives; s++)
2199
values[r] += transform[r][s]*derivatives[s];
2200
}// end loop over 's'
2201
}// end loop over 'r'
2203
// Delete pointer to array of derivatives on FIAT element
2204
delete [] derivatives;
2206
// Delete pointer to array of combinations of derivatives and transform
2207
for (unsigned int r = 0; r < num_derivatives; r++)
2209
delete [] combinations[r];
2210
}// end loop over 'r'
2211
delete [] combinations;
2212
for (unsigned int r = 0; r < num_derivatives; r++)
2214
delete [] transform[r];
2215
}// end loop over 'r'
2216
delete [] transform;
2222
// Array of basisvalues
2223
double basisvalues[3] = {0.0, 0.0, 0.0};
2225
// Declare helper variables
2226
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2228
// Compute basisvalues
2229
basisvalues[0] = 1.0;
2230
basisvalues[1] = tmp0;
2231
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
2232
basisvalues[0] *= std::sqrt(0.5);
2233
basisvalues[2] *= std::sqrt(1.0);
2234
basisvalues[1] *= std::sqrt(3.0);
2236
// Table(s) of coefficients
2237
static const double coefficients0[3] = \
2238
{0.47140452, 0.0, 0.33333333};
2240
// Tables of derivatives of the polynomial base (transpose).
2241
static const double dmats0[3][3] = \
2243
{4.8989795, 0.0, 0.0},
2246
static const double dmats1[3][3] = \
2248
{2.4494897, 0.0, 0.0},
2249
{4.2426407, 0.0, 0.0}};
2251
// Compute reference derivatives.
2252
// Declare pointer to array of derivatives on FIAT element.
2253
double *derivatives = new double[num_derivatives];
2254
for (unsigned int r = 0; r < num_derivatives; r++)
2256
derivatives[r] = 0.0;
2257
}// end loop over 'r'
2259
// Declare derivative matrix (of polynomial basis).
2260
double dmats[3][3] = \
2265
// Declare (auxiliary) derivative matrix (of polynomial basis).
2266
double dmats_old[3][3] = \
2271
// Loop possible derivatives.
2272
for (unsigned int r = 0; r < num_derivatives; r++)
2274
// Resetting dmats values to compute next derivative.
2275
for (unsigned int t = 0; t < 3; t++)
2277
for (unsigned int u = 0; u < 3; u++)
2285
}// end loop over 'u'
2286
}// end loop over 't'
2288
// Looping derivative order to generate dmats.
2289
for (unsigned int s = 0; s < n; s++)
2291
// Updating dmats_old with new values and resetting dmats.
2292
for (unsigned int t = 0; t < 3; t++)
2294
for (unsigned int u = 0; u < 3; u++)
2296
dmats_old[t][u] = dmats[t][u];
2298
}// end loop over 'u'
2299
}// end loop over 't'
2301
// Update dmats using an inner product.
2302
if (combinations[r][s] == 0)
2304
for (unsigned int t = 0; t < 3; t++)
2306
for (unsigned int u = 0; u < 3; u++)
2308
for (unsigned int tu = 0; tu < 3; tu++)
2310
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
2311
}// end loop over 'tu'
2312
}// end loop over 'u'
2313
}// end loop over 't'
2316
if (combinations[r][s] == 1)
2318
for (unsigned int t = 0; t < 3; t++)
2320
for (unsigned int u = 0; u < 3; u++)
2322
for (unsigned int tu = 0; tu < 3; tu++)
2324
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
2325
}// end loop over 'tu'
2326
}// end loop over 'u'
2327
}// end loop over 't'
2330
}// end loop over 's'
2331
for (unsigned int s = 0; s < 3; s++)
2333
for (unsigned int t = 0; t < 3; t++)
2335
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
2336
}// end loop over 't'
2337
}// end loop over 's'
2338
}// end loop over 'r'
2340
// Transform derivatives back to physical element
2341
for (unsigned int r = 0; r < num_derivatives; r++)
2343
for (unsigned int s = 0; s < num_derivatives; s++)
2345
values[r] += transform[r][s]*derivatives[s];
2346
}// end loop over 's'
2347
}// end loop over 'r'
2349
// Delete pointer to array of derivatives on FIAT element
2350
delete [] derivatives;
2352
// Delete pointer to array of combinations of derivatives and transform
2353
for (unsigned int r = 0; r < num_derivatives; r++)
2355
delete [] combinations[r];
2356
}// end loop over 'r'
2357
delete [] combinations;
2358
for (unsigned int r = 0; r < num_derivatives; r++)
2360
delete [] transform[r];
2361
}// end loop over 'r'
2362
delete [] transform;
2369
/// Evaluate order n derivatives of all basis functions at given point x in cell
2370
virtual void evaluate_basis_derivatives_all(std::size_t n,
2373
const double* vertex_coordinates,
2374
int cell_orientation) const
2376
// Compute number of derivatives.
2377
unsigned int num_derivatives = 1;
2378
for (unsigned int r = 0; r < n; r++)
2380
num_derivatives *= 2;
2381
}// end loop over 'r'
2383
// Helper variable to hold values of a single dof.
2384
double *dof_values = new double[num_derivatives];
2385
for (unsigned int r = 0; r < num_derivatives; r++)
2387
dof_values[r] = 0.0;
2388
}// end loop over 'r'
2390
// Loop dofs and call evaluate_basis_derivatives.
2391
for (unsigned int r = 0; r < 3; r++)
2393
evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
2394
for (unsigned int s = 0; s < num_derivatives; s++)
2396
values[r*num_derivatives + s] = dof_values[s];
2397
}// end loop over 's'
2398
}// end loop over 'r'
2401
delete [] dof_values;
2404
/// Evaluate linear functional for dof i on the function f
2405
virtual double evaluate_dof(std::size_t i,
2406
const ufc::function& f,
2407
const double* vertex_coordinates,
2408
int cell_orientation,
2409
const ufc::cell& c) const
2411
// Declare variables for result of evaluation
2414
// Declare variable for physical coordinates
2420
y[0] = vertex_coordinates[0];
2421
y[1] = vertex_coordinates[1];
2422
f.evaluate(vals, y, c);
2428
y[0] = vertex_coordinates[2];
2429
y[1] = vertex_coordinates[3];
2430
f.evaluate(vals, y, c);
2436
y[0] = vertex_coordinates[4];
2437
y[1] = vertex_coordinates[5];
2438
f.evaluate(vals, y, c);
2447
/// Evaluate linear functionals for all dofs on the function f
2448
virtual void evaluate_dofs(double* values,
2449
const ufc::function& f,
2450
const double* vertex_coordinates,
2451
int cell_orientation,
2452
const ufc::cell& c) const
2454
// Declare variables for result of evaluation
2457
// Declare variable for physical coordinates
2459
y[0] = vertex_coordinates[0];
2460
y[1] = vertex_coordinates[1];
2461
f.evaluate(vals, y, c);
2462
values[0] = vals[0];
2463
y[0] = vertex_coordinates[2];
2464
y[1] = vertex_coordinates[3];
2465
f.evaluate(vals, y, c);
2466
values[1] = vals[0];
2467
y[0] = vertex_coordinates[4];
2468
y[1] = vertex_coordinates[5];
2469
f.evaluate(vals, y, c);
2470
values[2] = vals[0];
2473
/// Interpolate vertex values from dof values
2474
virtual void interpolate_vertex_values(double* vertex_values,
2475
const double* dof_values,
2476
const double* vertex_coordinates,
2477
int cell_orientation,
2478
const ufc::cell& c) const
2480
// Evaluate function and change variables
2481
vertex_values[0] = dof_values[0];
2482
vertex_values[1] = dof_values[1];
2483
vertex_values[2] = dof_values[2];
2486
/// Map coordinate xhat from reference cell to coordinate x in cell
2487
virtual void map_from_reference_cell(double* x,
2489
const ufc::cell& c) const
2491
std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
2494
/// Map from coordinate x in cell to coordinate xhat in reference cell
2495
virtual void map_to_reference_cell(double* xhat,
2497
const ufc::cell& c) const
2499
std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
2502
/// Return the number of sub elements (for a mixed element)
2503
virtual std::size_t num_sub_elements() const
2508
/// Create a new finite element for sub element i (for a mixed element)
2509
virtual ufc::finite_element* create_sub_element(std::size_t i) const
2514
/// Create a new class instance
2515
virtual ufc::finite_element* create() const
2517
return new pointmeasure_finite_element_1();
2522
/// This class defines the interface for a local-to-global mapping of
2523
/// degrees of freedom (dofs).
2525
class pointmeasure_dofmap_0: public ufc::dofmap
2530
pointmeasure_dofmap_0() : ufc::dofmap()
2536
virtual ~pointmeasure_dofmap_0()
2541
/// Return a string identifying the dofmap
2542
virtual const char* signature() const
2544
return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 2, None)";
2547
/// Return true iff mesh entities of topological dimension d are needed
2548
virtual bool needs_mesh_entities(std::size_t d) const
2572
/// Return the topological dimension of the associated cell shape
2573
virtual std::size_t topological_dimension() const
2578
/// Return the geometric dimension of the associated cell shape
2579
virtual std::size_t geometric_dimension() const
2584
/// Return the dimension of the global finite element function space
2585
virtual std::size_t global_dimension(const std::vector<std::size_t>&
2586
num_global_entities) const
2588
return num_global_entities[0] + num_global_entities[1];
2591
/// Return the dimension of the local finite element function space for a cell
2592
virtual std::size_t local_dimension(const ufc::cell& c) const
2597
/// Return the maximum dimension of the local finite element function space
2598
virtual std::size_t max_local_dimension() const
2603
/// Return the number of dofs on each cell facet
2604
virtual std::size_t num_facet_dofs() const
2609
/// Return the number of dofs associated with each cell entity of dimension d
2610
virtual std::size_t num_entity_dofs(std::size_t d) const
2634
/// Tabulate the local-to-global mapping of dofs on a cell
2635
virtual void tabulate_dofs(std::size_t* dofs,
2636
const std::vector<std::size_t>& num_global_entities,
2637
const ufc::cell& c) const
2639
unsigned int offset = 0;
2640
dofs[0] = offset + c.entity_indices[0][0];
2641
dofs[1] = offset + c.entity_indices[0][1];
2642
dofs[2] = offset + c.entity_indices[0][2];
2643
offset += num_global_entities[0];
2644
dofs[3] = offset + c.entity_indices[1][0];
2645
dofs[4] = offset + c.entity_indices[1][1];
2646
dofs[5] = offset + c.entity_indices[1][2];
2647
offset += num_global_entities[1];
2650
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
2651
virtual void tabulate_facet_dofs(std::size_t* dofs,
2652
std::size_t facet) const
2681
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
2682
virtual void tabulate_entity_dofs(std::size_t* dofs,
2683
std::size_t d, std::size_t i) const
2687
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
2696
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
2724
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
2757
/// Tabulate the coordinates of all dofs on a cell
2758
virtual void tabulate_coordinates(double** dof_coordinates,
2759
const double* vertex_coordinates) const
2761
dof_coordinates[0][0] = vertex_coordinates[0];
2762
dof_coordinates[0][1] = vertex_coordinates[1];
2763
dof_coordinates[1][0] = vertex_coordinates[2];
2764
dof_coordinates[1][1] = vertex_coordinates[3];
2765
dof_coordinates[2][0] = vertex_coordinates[4];
2766
dof_coordinates[2][1] = vertex_coordinates[5];
2767
dof_coordinates[3][0] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[4];
2768
dof_coordinates[3][1] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[5];
2769
dof_coordinates[4][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[4];
2770
dof_coordinates[4][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[5];
2771
dof_coordinates[5][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[2];
2772
dof_coordinates[5][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[3];
2775
/// Return the number of sub dofmaps (for a mixed element)
2776
virtual std::size_t num_sub_dofmaps() const
2781
/// Create a new dofmap for sub dofmap i (for a mixed element)
2782
virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
2787
/// Create a new class instance
2788
virtual ufc::dofmap* create() const
2790
return new pointmeasure_dofmap_0();
2795
/// This class defines the interface for a local-to-global mapping of
2796
/// degrees of freedom (dofs).
2798
class pointmeasure_dofmap_1: public ufc::dofmap
2803
pointmeasure_dofmap_1() : ufc::dofmap()
2809
virtual ~pointmeasure_dofmap_1()
2814
/// Return a string identifying the dofmap
2815
virtual const char* signature() const
2817
return "FFC dofmap for FiniteElement('Lagrange', Domain(Cell('triangle', 2), 'triangle_multiverse', 2, 2), 1, None)";
2820
/// Return true iff mesh entities of topological dimension d are needed
2821
virtual bool needs_mesh_entities(std::size_t d) const
2845
/// Return the topological dimension of the associated cell shape
2846
virtual std::size_t topological_dimension() const
2851
/// Return the geometric dimension of the associated cell shape
2852
virtual std::size_t geometric_dimension() const
2857
/// Return the dimension of the global finite element function space
2858
virtual std::size_t global_dimension(const std::vector<std::size_t>&
2859
num_global_entities) const
2861
return num_global_entities[0];
2864
/// Return the dimension of the local finite element function space for a cell
2865
virtual std::size_t local_dimension(const ufc::cell& c) const
2870
/// Return the maximum dimension of the local finite element function space
2871
virtual std::size_t max_local_dimension() const
2876
/// Return the number of dofs on each cell facet
2877
virtual std::size_t num_facet_dofs() const
2882
/// Return the number of dofs associated with each cell entity of dimension d
2883
virtual std::size_t num_entity_dofs(std::size_t d) const
2907
/// Tabulate the local-to-global mapping of dofs on a cell
2908
virtual void tabulate_dofs(std::size_t* dofs,
2909
const std::vector<std::size_t>& num_global_entities,
2910
const ufc::cell& c) const
2912
dofs[0] = c.entity_indices[0][0];
2913
dofs[1] = c.entity_indices[0][1];
2914
dofs[2] = c.entity_indices[0][2];
2917
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
2918
virtual void tabulate_facet_dofs(std::size_t* dofs,
2919
std::size_t facet) const
2945
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
2946
virtual void tabulate_entity_dofs(std::size_t* dofs,
2947
std::size_t d, std::size_t i) const
2951
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
2960
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
2998
/// Tabulate the coordinates of all dofs on a cell
2999
virtual void tabulate_coordinates(double** dof_coordinates,
3000
const double* vertex_coordinates) const
3002
dof_coordinates[0][0] = vertex_coordinates[0];
3003
dof_coordinates[0][1] = vertex_coordinates[1];
3004
dof_coordinates[1][0] = vertex_coordinates[2];
3005
dof_coordinates[1][1] = vertex_coordinates[3];
3006
dof_coordinates[2][0] = vertex_coordinates[4];
3007
dof_coordinates[2][1] = vertex_coordinates[5];
3010
/// Return the number of sub dofmaps (for a mixed element)
3011
virtual std::size_t num_sub_dofmaps() const
3016
/// Create a new dofmap for sub dofmap i (for a mixed element)
3017
virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
3022
/// Create a new class instance
3023
virtual ufc::dofmap* create() const
3025
return new pointmeasure_dofmap_1();
3030
/// This class defines the interface for the tabulation of the cell
3031
/// tensor corresponding to the local contribution to a form from
3032
/// the integral over a cell.
3034
class pointmeasure_cell_integral_0_otherwise: public ufc::cell_integral
3039
pointmeasure_cell_integral_0_otherwise() : ufc::cell_integral()
3045
virtual ~pointmeasure_cell_integral_0_otherwise()
3050
/// Tabulate the tensor for the contribution from a local cell
3051
virtual void tabulate_tensor(double* A,
3052
const double * const * w,
3053
const double* vertex_coordinates,
3054
int cell_orientation) const
3056
// Number of operations (multiply-add pairs) for Jacobian data: 3
3057
// Number of operations (multiply-add pairs) for geometry tensor: 0
3058
// Number of operations (multiply-add pairs) for tensor contraction: 4
3059
// Total number of operations (multiply-add pairs): 7
3063
compute_jacobian_triangle_2d(J, vertex_coordinates);
3065
// Compute Jacobian inverse and determinant
3068
compute_jacobian_inverse_triangle_2d(K, detJ, J);
3071
const double det = std::abs(detJ);
3073
// Compute geometry tensor
3074
const double G0_ = det;
3076
// Compute element tensor
3077
A[0] = 0.083333333*G0_;
3078
A[1] = 0.041666667*G0_;
3079
A[2] = 0.041666667*G0_;
3080
A[3] = 0.041666667*G0_;
3081
A[4] = 0.083333333*G0_;
3082
A[5] = 0.041666667*G0_;
3083
A[6] = 0.041666667*G0_;
3084
A[7] = 0.041666667*G0_;
3085
A[8] = 0.083333333*G0_;
3090
/// This class defines the interface for the tabulation of
3091
/// an expression evaluated at exactly one point.
3093
class pointmeasure_point_integral_0_1: public ufc::point_integral
3098
pointmeasure_point_integral_0_1() : ufc::point_integral()
3104
virtual ~pointmeasure_point_integral_0_1()
3109
/// Tabulate the tensor for the contribution from the local vertex
3110
virtual void tabulate_tensor(double* A,
3111
const double * const * w,
3112
const double* vertex_coordinates,
3113
std::size_t vertex) const
3117
compute_jacobian_triangle_2d(J, vertex_coordinates);
3119
// Compute Jacobian inverse and determinant
3122
compute_jacobian_inverse_triangle_2d(K, detJ, J);
3126
// Get vertices on edge
3128
// Compute scale factor (length of edge scaled by length of reference interval)
3131
// Array of quadrature weights.
3132
static const double W1 = 1.0;
3133
// Quadrature points on the UFC reference element: ()
3135
// Value of basis functions at quadrature points.
3136
static const double FE0_v0[1][3] = \
3139
static const double FE0_v1[1][3] = \
3142
static const double FE0_v2[1][3] = \
3145
// Reset values in the element tensor.
3146
for (unsigned int r = 0; r < 9; r++)
3149
}// end loop over 'r'
3151
// Compute element tensor using UFL quadrature representation
3152
// Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
3157
// Total number of operations to compute element tensor (from this point): 69
3159
// Loop quadrature points for integral.
3160
// Number of operations to compute element tensor for following IP loop = 69
3161
// Only 1 integration point, omitting IP loop.
3163
// Coefficient declarations.
3166
// Total number of operations to compute function values = 6
3167
for (unsigned int r = 0; r < 3; r++)
3169
F0 += FE0_v0[0][r]*w[0][r];
3170
}// end loop over 'r'
3172
// Number of operations for primary indices: 63
3173
for (unsigned int j = 0; j < 3; j++)
3175
for (unsigned int k = 0; k < 3; k++)
3177
// Number of operations to compute entry: 7
3178
A[j*3 + k] += (FE0_v0[0][j]*FE0_v0[0][k] + FE0_v0[0][j]*FE0_v0[0][k]*F0*F0)*W1;
3179
}// end loop over 'k'
3180
}// end loop over 'j'
3185
// Total number of operations to compute element tensor (from this point): 69
3187
// Loop quadrature points for integral.
3188
// Number of operations to compute element tensor for following IP loop = 69
3189
// Only 1 integration point, omitting IP loop.
3191
// Coefficient declarations.
3194
// Total number of operations to compute function values = 6
3195
for (unsigned int r = 0; r < 3; r++)
3197
F0 += FE0_v1[0][r]*w[0][r];
3198
}// end loop over 'r'
3200
// Number of operations for primary indices: 63
3201
for (unsigned int j = 0; j < 3; j++)
3203
for (unsigned int k = 0; k < 3; k++)
3205
// Number of operations to compute entry: 7
3206
A[j*3 + k] += (FE0_v1[0][j]*FE0_v1[0][k]*F0*F0 + FE0_v1[0][j]*FE0_v1[0][k])*W1;
3207
}// end loop over 'k'
3208
}// end loop over 'j'
3213
// Total number of operations to compute element tensor (from this point): 69
3215
// Loop quadrature points for integral.
3216
// Number of operations to compute element tensor for following IP loop = 69
3217
// Only 1 integration point, omitting IP loop.
3219
// Coefficient declarations.
3222
// Total number of operations to compute function values = 6
3223
for (unsigned int r = 0; r < 3; r++)
3225
F0 += FE0_v2[0][r]*w[0][r];
3226
}// end loop over 'r'
3228
// Number of operations for primary indices: 63
3229
for (unsigned int j = 0; j < 3; j++)
3231
for (unsigned int k = 0; k < 3; k++)
3233
// Number of operations to compute entry: 7
3234
A[j*3 + k] += (FE0_v2[0][j]*FE0_v2[0][k]*F0*F0 + FE0_v2[0][j]*FE0_v2[0][k])*W1;
3235
}// end loop over 'k'
3236
}// end loop over 'j'
3245
/// This class defines the interface for the tabulation of
3246
/// an expression evaluated at exactly one point.
3248
class pointmeasure_point_integral_0_otherwise: public ufc::point_integral
3253
pointmeasure_point_integral_0_otherwise() : ufc::point_integral()
3259
virtual ~pointmeasure_point_integral_0_otherwise()
3264
/// Tabulate the tensor for the contribution from the local vertex
3265
virtual void tabulate_tensor(double* A,
3266
const double * const * w,
3267
const double* vertex_coordinates,
3268
std::size_t vertex) const
3272
compute_jacobian_triangle_2d(J, vertex_coordinates);
3274
// Compute Jacobian inverse and determinant
3277
compute_jacobian_inverse_triangle_2d(K, detJ, J);
3281
// Get vertices on edge
3283
// Compute scale factor (length of edge scaled by length of reference interval)
3286
// Array of quadrature weights.
3287
static const double W1 = 1.0;
3288
// Quadrature points on the UFC reference element: ()
3290
// Value of basis functions at quadrature points.
3291
static const double FE0_v0[1][3] = \
3294
static const double FE0_v1[1][3] = \
3297
static const double FE0_v2[1][3] = \
3300
// Reset values in the element tensor.
3301
for (unsigned int r = 0; r < 9; r++)
3304
}// end loop over 'r'
3306
// Compute element tensor using UFL quadrature representation
3307
// Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
3312
// Total number of operations to compute element tensor (from this point): 27
3314
// Loop quadrature points for integral.
3315
// Number of operations to compute element tensor for following IP loop = 27
3316
// Only 1 integration point, omitting IP loop.
3318
// Number of operations for primary indices: 27
3319
for (unsigned int j = 0; j < 3; j++)
3321
for (unsigned int k = 0; k < 3; k++)
3323
// Number of operations to compute entry: 3
3324
A[j*3 + k] += FE0_v0[0][j]*FE0_v0[0][k]*W1;
3325
}// end loop over 'k'
3326
}// end loop over 'j'
3331
// Total number of operations to compute element tensor (from this point): 27
3333
// Loop quadrature points for integral.
3334
// Number of operations to compute element tensor for following IP loop = 27
3335
// Only 1 integration point, omitting IP loop.
3337
// Number of operations for primary indices: 27
3338
for (unsigned int j = 0; j < 3; j++)
3340
for (unsigned int k = 0; k < 3; k++)
3342
// Number of operations to compute entry: 3
3343
A[j*3 + k] += FE0_v1[0][j]*FE0_v1[0][k]*W1;
3344
}// end loop over 'k'
3345
}// end loop over 'j'
3350
// Total number of operations to compute element tensor (from this point): 27
3352
// Loop quadrature points for integral.
3353
// Number of operations to compute element tensor for following IP loop = 27
3354
// Only 1 integration point, omitting IP loop.
3356
// Number of operations for primary indices: 27
3357
for (unsigned int j = 0; j < 3; j++)
3359
for (unsigned int k = 0; k < 3; k++)
3361
// Number of operations to compute entry: 3
3362
A[j*3 + k] += FE0_v2[0][j]*FE0_v2[0][k]*W1;
3363
}// end loop over 'k'
3364
}// end loop over 'j'
3373
/// This class defines the interface for the tabulation of
3374
/// an expression evaluated at exactly one point.
3376
class pointmeasure_point_integral_1_otherwise: public ufc::point_integral
3381
pointmeasure_point_integral_1_otherwise() : ufc::point_integral()
3387
virtual ~pointmeasure_point_integral_1_otherwise()
3392
/// Tabulate the tensor for the contribution from the local vertex
3393
virtual void tabulate_tensor(double* A,
3394
const double * const * w,
3395
const double* vertex_coordinates,
3396
std::size_t vertex) const
3400
compute_jacobian_triangle_2d(J, vertex_coordinates);
3402
// Compute Jacobian inverse and determinant
3405
compute_jacobian_inverse_triangle_2d(K, detJ, J);
3409
// Get vertices on edge
3411
// Compute scale factor (length of edge scaled by length of reference interval)
3414
// Array of quadrature weights.
3415
static const double W1 = 1.0;
3416
// Quadrature points on the UFC reference element: ()
3418
// Value of basis functions at quadrature points.
3419
static const double FE0_v0[1][3] = \
3422
static const double FE0_v1[1][3] = \
3425
static const double FE0_v2[1][3] = \
3428
static const double FE1_v0[1][6] = \
3429
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
3431
static const double FE1_v1[1][6] = \
3432
{{0.0, 1.0, 0.0, 0.0, 0.0, 0.0}};
3434
static const double FE1_v2[1][6] = \
3435
{{0.0, 0.0, 1.0, 0.0, 0.0, 0.0}};
3437
// Reset values in the element tensor.
3438
for (unsigned int r = 0; r < 3; r++)
3441
}// end loop over 'r'
3443
// Compute element tensor using UFL quadrature representation
3444
// Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
3449
// Total number of operations to compute element tensor (from this point): 21
3451
// Loop quadrature points for integral.
3452
// Number of operations to compute element tensor for following IP loop = 21
3453
// Only 1 integration point, omitting IP loop.
3455
// Coefficient declarations.
3458
// Total number of operations to compute function values = 12
3459
for (unsigned int r = 0; r < 6; r++)
3461
F0 += FE1_v0[0][r]*w[0][r];
3462
}// end loop over 'r'
3464
// Number of operations for primary indices: 9
3465
for (unsigned int j = 0; j < 3; j++)
3467
// Number of operations to compute entry: 3
3468
A[j] += FE0_v0[0][j]*F0*W1;
3469
}// end loop over 'j'
3474
// Total number of operations to compute element tensor (from this point): 21
3476
// Loop quadrature points for integral.
3477
// Number of operations to compute element tensor for following IP loop = 21
3478
// Only 1 integration point, omitting IP loop.
3480
// Coefficient declarations.
3483
// Total number of operations to compute function values = 12
3484
for (unsigned int r = 0; r < 6; r++)
3486
F0 += FE1_v1[0][r]*w[0][r];
3487
}// end loop over 'r'
3489
// Number of operations for primary indices: 9
3490
for (unsigned int j = 0; j < 3; j++)
3492
// Number of operations to compute entry: 3
3493
A[j] += FE0_v1[0][j]*F0*W1;
3494
}// end loop over 'j'
3499
// Total number of operations to compute element tensor (from this point): 21
3501
// Loop quadrature points for integral.
3502
// Number of operations to compute element tensor for following IP loop = 21
3503
// Only 1 integration point, omitting IP loop.
3505
// Coefficient declarations.
3508
// Total number of operations to compute function values = 12
3509
for (unsigned int r = 0; r < 6; r++)
3511
F0 += FE1_v2[0][r]*w[0][r];
3512
}// end loop over 'r'
3514
// Number of operations for primary indices: 9
3515
for (unsigned int j = 0; j < 3; j++)
3517
// Number of operations to compute entry: 3
3518
A[j] += FE0_v2[0][j]*F0*W1;
3519
}// end loop over 'j'
3528
/// This class defines the interface for the assembly of the global
3529
/// tensor corresponding to a form with r + n arguments, that is, a
3532
/// a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
3534
/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
3535
/// global tensor A is defined by
3537
/// A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
3539
/// where each argument Vj represents the application to the
3540
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
3541
/// fixed functions (coefficients).
3543
class pointmeasure_form_0: public ufc::form
3548
pointmeasure_form_0() : ufc::form()
3554
virtual ~pointmeasure_form_0()
3559
/// Return a string identifying the form
3560
virtual const char* signature() const
3562
return "856f5aa1a8f7253511ba78602090dc3cf582e71ee4c859de2e80d2fd37c92108a283e09a2ae620c72f13f280a38368ed9c5e78e015492db3cbebd6d8f66016fe";
3565
/// Return the rank of the global tensor (r)
3566
virtual std::size_t rank() const
3571
/// Return the number of coefficients (n)
3572
virtual std::size_t num_coefficients() const
3577
/// Return the number of cell domains
3578
virtual std::size_t num_cell_domains() const
3583
/// Return the number of exterior facet domains
3584
virtual std::size_t num_exterior_facet_domains() const
3589
/// Return the number of interior facet domains
3590
virtual std::size_t num_interior_facet_domains() const
3595
/// Return the number of point domains
3596
virtual std::size_t num_point_domains() const
3601
/// Return whether the form has any cell integrals
3602
virtual bool has_cell_integrals() const
3607
/// Return whether the form has any exterior facet integrals
3608
virtual bool has_exterior_facet_integrals() const
3613
/// Return whether the form has any interior facet integrals
3614
virtual bool has_interior_facet_integrals() const
3619
/// Return whether the form has any point integrals
3620
virtual bool has_point_integrals() const
3625
/// Create a new finite element for argument function i
3626
virtual ufc::finite_element* create_finite_element(std::size_t i) const
3632
return new pointmeasure_finite_element_1();
3637
return new pointmeasure_finite_element_1();
3642
return new pointmeasure_finite_element_1();
3650
/// Create a new dofmap for argument function i
3651
virtual ufc::dofmap* create_dofmap(std::size_t i) const
3657
return new pointmeasure_dofmap_1();
3662
return new pointmeasure_dofmap_1();
3667
return new pointmeasure_dofmap_1();
3675
/// Create a new cell integral on sub domain i
3676
virtual ufc::cell_integral* create_cell_integral(std::size_t i) const
3681
/// Create a new exterior facet integral on sub domain i
3682
virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const
3687
/// Create a new interior facet integral on sub domain i
3688
virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const
3693
/// Create a new point integral on sub domain i
3694
virtual ufc::point_integral* create_point_integral(std::size_t i) const
3700
return new pointmeasure_point_integral_0_1();
3708
/// Create a new cell integral on everywhere else
3709
virtual ufc::cell_integral* create_default_cell_integral() const
3711
return new pointmeasure_cell_integral_0_otherwise();
3714
/// Create a new exterior facet integral on everywhere else
3715
virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
3720
/// Create a new interior facet integral on everywhere else
3721
virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
3726
/// Create a new point integral on everywhere else
3727
virtual ufc::point_integral* create_default_point_integral() const
3729
return new pointmeasure_point_integral_0_otherwise();
3734
/// This class defines the interface for the assembly of the global
3735
/// tensor corresponding to a form with r + n arguments, that is, a
3738
/// a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
3740
/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
3741
/// global tensor A is defined by
3743
/// A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
3745
/// where each argument Vj represents the application to the
3746
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
3747
/// fixed functions (coefficients).
3749
class pointmeasure_form_1: public ufc::form
3754
pointmeasure_form_1() : ufc::form()
3760
virtual ~pointmeasure_form_1()
3765
/// Return a string identifying the form
3766
virtual const char* signature() const
3768
return "cbc400c8cb006d3574d6a58223a2c80d90b230d781feaabb65968d87ac0550f09264f2d1f32621512f1d42a7bc048c03d38e4482a1abf0fba8fad9c1cab8cc38";
3771
/// Return the rank of the global tensor (r)
3772
virtual std::size_t rank() const
3777
/// Return the number of coefficients (n)
3778
virtual std::size_t num_coefficients() const
3783
/// Return the number of cell domains
3784
virtual std::size_t num_cell_domains() const
3789
/// Return the number of exterior facet domains
3790
virtual std::size_t num_exterior_facet_domains() const
3795
/// Return the number of interior facet domains
3796
virtual std::size_t num_interior_facet_domains() const
3801
/// Return the number of point domains
3802
virtual std::size_t num_point_domains() const
3807
/// Return whether the form has any cell integrals
3808
virtual bool has_cell_integrals() const
3813
/// Return whether the form has any exterior facet integrals
3814
virtual bool has_exterior_facet_integrals() const
3819
/// Return whether the form has any interior facet integrals
3820
virtual bool has_interior_facet_integrals() const
3825
/// Return whether the form has any point integrals
3826
virtual bool has_point_integrals() const
3831
/// Create a new finite element for argument function i
3832
virtual ufc::finite_element* create_finite_element(std::size_t i) const
3838
return new pointmeasure_finite_element_1();
3843
return new pointmeasure_finite_element_0();
3851
/// Create a new dofmap for argument function i
3852
virtual ufc::dofmap* create_dofmap(std::size_t i) const
3858
return new pointmeasure_dofmap_1();
3863
return new pointmeasure_dofmap_0();
3871
/// Create a new cell integral on sub domain i
3872
virtual ufc::cell_integral* create_cell_integral(std::size_t i) const
3877
/// Create a new exterior facet integral on sub domain i
3878
virtual ufc::exterior_facet_integral* create_exterior_facet_integral(std::size_t i) const
3883
/// Create a new interior facet integral on sub domain i
3884
virtual ufc::interior_facet_integral* create_interior_facet_integral(std::size_t i) const
3889
/// Create a new point integral on sub domain i
3890
virtual ufc::point_integral* create_point_integral(std::size_t i) const
3895
/// Create a new cell integral on everywhere else
3896
virtual ufc::cell_integral* create_default_cell_integral() const
3901
/// Create a new exterior facet integral on everywhere else
3902
virtual ufc::exterior_facet_integral* create_default_exterior_facet_integral() const
3907
/// Create a new interior facet integral on everywhere else
3908
virtual ufc::interior_facet_integral* create_default_interior_facet_integral() const
3913
/// Create a new point integral on everywhere else
3914
virtual ufc::point_integral* create_default_point_integral() const
3916
return new pointmeasure_point_integral_1_otherwise();