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 __X_ELEMENT9_H
27
#define __X_ELEMENT9_H
34
/// This class defines the interface for a finite element.
36
class x_element9_finite_element_0: public ufc::finite_element
41
x_element9_finite_element_0() : ufc::finite_element()
47
virtual ~x_element9_finite_element_0()
52
/// Return a string identifying the finite element
53
virtual const char* signature() const
55
return "FiniteElement('Raviart-Thomas', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 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
103
/// Evaluate basis function i at given point x in cell
104
virtual void evaluate_basis(std::size_t i,
107
const double* vertex_coordinates,
108
int cell_orientation) const
112
compute_jacobian_triangle_3d(J, vertex_coordinates);
114
// Compute Jacobian inverse and determinant
117
compute_jacobian_inverse_triangle_3d(K, detJ, J);
121
if (cell_orientation == -1)
122
throw std::runtime_error("cell orientation must be defined (not -1)");
123
// (If cell_orientation == 1 = down, multiply det(J) by -1)
124
else if (cell_orientation == 1)
128
const double b0 = vertex_coordinates[0];
129
const double b1 = vertex_coordinates[1];
130
const double b2 = vertex_coordinates[2];
132
// P_FFC = J^dag (p - b), P_FIAT = 2*P_FFC - (1, 1)
133
double X = 2*(K[0]*(x[0] - b0) + K[1]*(x[1] - b1) + K[2]*(x[2] - b2)) - 1.0;
134
double Y = 2*(K[3]*(x[0] - b0) + K[4]*(x[1] - b1) + K[5]*(x[2] - b2)) - 1.0;
145
// Array of basisvalues
146
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
148
// Declare helper variables
149
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
150
double tmp1 = (1.0 - Y)/2.0;
151
double tmp2 = tmp1*tmp1;
153
// Compute basisvalues
154
basisvalues[0] = 1.0;
155
basisvalues[1] = tmp0;
156
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
157
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
158
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
159
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
160
basisvalues[0] *= std::sqrt(0.5);
161
basisvalues[2] *= std::sqrt(1.0);
162
basisvalues[5] *= std::sqrt(1.5);
163
basisvalues[1] *= std::sqrt(3.0);
164
basisvalues[4] *= std::sqrt(4.5);
165
basisvalues[3] *= std::sqrt(7.5);
167
// Table(s) of coefficients
168
static const double coefficients0[6] = \
169
{0.23570226, 0.40414519, -0.23333333, 0.18257419, -0.14142136, 0.081649658};
171
static const double coefficients1[6] = \
172
{-0.11785113, 0.17320508, -0.23333333, 0.0, 0.14142136, -0.12247449};
175
for (unsigned int r = 0; r < 6; r++)
177
values[0] += coefficients0[r]*basisvalues[r];
178
values[1] += coefficients1[r]*basisvalues[r];
179
}// end loop over 'r'
181
// Using contravariant Piola transform to map values back to the physical element
182
const double tmp_ref0 = values[0];
183
const double tmp_ref1 = values[1];
184
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
185
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
186
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
192
// Array of basisvalues
193
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
195
// Declare helper variables
196
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
197
double tmp1 = (1.0 - Y)/2.0;
198
double tmp2 = tmp1*tmp1;
200
// Compute basisvalues
201
basisvalues[0] = 1.0;
202
basisvalues[1] = tmp0;
203
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
204
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
205
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
206
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
207
basisvalues[0] *= std::sqrt(0.5);
208
basisvalues[2] *= std::sqrt(1.0);
209
basisvalues[5] *= std::sqrt(1.5);
210
basisvalues[1] *= std::sqrt(3.0);
211
basisvalues[4] *= std::sqrt(4.5);
212
basisvalues[3] *= std::sqrt(7.5);
214
// Table(s) of coefficients
215
static const double coefficients0[6] = \
216
{-0.11785113, -0.11547005, 0.26666667, 0.0, 0.14142136, -0.12247449};
218
static const double coefficients1[6] = \
219
{0.23570226, 0.0, 0.46666667, 0.0, 0.0, 0.24494897};
222
for (unsigned int r = 0; r < 6; r++)
224
values[0] += coefficients0[r]*basisvalues[r];
225
values[1] += coefficients1[r]*basisvalues[r];
226
}// end loop over 'r'
228
// Using contravariant Piola transform to map values back to the physical element
229
const double tmp_ref0 = values[0];
230
const double tmp_ref1 = values[1];
231
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
232
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
233
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
239
// Array of basisvalues
240
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
242
// Declare helper variables
243
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
244
double tmp1 = (1.0 - Y)/2.0;
245
double tmp2 = tmp1*tmp1;
247
// Compute basisvalues
248
basisvalues[0] = 1.0;
249
basisvalues[1] = tmp0;
250
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
251
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
252
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
253
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
254
basisvalues[0] *= std::sqrt(0.5);
255
basisvalues[2] *= std::sqrt(1.0);
256
basisvalues[5] *= std::sqrt(1.5);
257
basisvalues[1] *= std::sqrt(3.0);
258
basisvalues[4] *= std::sqrt(4.5);
259
basisvalues[3] *= std::sqrt(7.5);
261
// Table(s) of coefficients
262
static const double coefficients0[6] = \
263
{0.11785113, -0.57735027, -0.46666667, 0.18257419, 0.0, -0.040824829};
265
static const double coefficients1[6] = \
266
{0.11785113, 0.17320508, 0.23333333, 0.0, 0.14142136, 0.12247449};
269
for (unsigned int r = 0; r < 6; r++)
271
values[0] += coefficients0[r]*basisvalues[r];
272
values[1] += coefficients1[r]*basisvalues[r];
273
}// end loop over 'r'
275
// Using contravariant Piola transform to map values back to the physical element
276
const double tmp_ref0 = values[0];
277
const double tmp_ref1 = values[1];
278
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
279
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
280
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
286
// Array of basisvalues
287
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
289
// Declare helper variables
290
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
291
double tmp1 = (1.0 - Y)/2.0;
292
double tmp2 = tmp1*tmp1;
294
// Compute basisvalues
295
basisvalues[0] = 1.0;
296
basisvalues[1] = tmp0;
297
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
298
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
299
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
300
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
301
basisvalues[0] *= std::sqrt(0.5);
302
basisvalues[2] *= std::sqrt(1.0);
303
basisvalues[5] *= std::sqrt(1.5);
304
basisvalues[1] *= std::sqrt(3.0);
305
basisvalues[4] *= std::sqrt(4.5);
306
basisvalues[3] *= std::sqrt(7.5);
308
// Table(s) of coefficients
309
static const double coefficients0[6] = \
310
{0.11785113, 0.11547005, 0.73333333, 0.0, -0.14142136, 0.12247449};
312
static const double coefficients1[6] = \
313
{-0.23570226, 0.0, -0.46666667, 0.0, 0.0, -0.24494897};
316
for (unsigned int r = 0; r < 6; r++)
318
values[0] += coefficients0[r]*basisvalues[r];
319
values[1] += coefficients1[r]*basisvalues[r];
320
}// end loop over 'r'
322
// Using contravariant Piola transform to map values back to the physical element
323
const double tmp_ref0 = values[0];
324
const double tmp_ref1 = values[1];
325
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
326
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
327
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
333
// Array of basisvalues
334
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
336
// Declare helper variables
337
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
338
double tmp1 = (1.0 - Y)/2.0;
339
double tmp2 = tmp1*tmp1;
341
// Compute basisvalues
342
basisvalues[0] = 1.0;
343
basisvalues[1] = tmp0;
344
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
345
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
346
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
347
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
348
basisvalues[0] *= std::sqrt(0.5);
349
basisvalues[2] *= std::sqrt(1.0);
350
basisvalues[5] *= std::sqrt(1.5);
351
basisvalues[1] *= std::sqrt(3.0);
352
basisvalues[4] *= std::sqrt(4.5);
353
basisvalues[3] *= std::sqrt(7.5);
355
// Table(s) of coefficients
356
static const double coefficients0[6] = \
357
{-0.11785113, -0.28867513, -0.033333333, -0.18257419, 0.0, 0.040824829};
359
static const double coefficients1[6] = \
360
{-0.11785113, 0.69282032, 0.26666667, 0.0, -0.14142136, -0.12247449};
363
for (unsigned int r = 0; r < 6; r++)
365
values[0] += coefficients0[r]*basisvalues[r];
366
values[1] += coefficients1[r]*basisvalues[r];
367
}// end loop over 'r'
369
// Using contravariant Piola transform to map values back to the physical element
370
const double tmp_ref0 = values[0];
371
const double tmp_ref1 = values[1];
372
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
373
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
374
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
380
// Array of basisvalues
381
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
383
// Declare helper variables
384
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
385
double tmp1 = (1.0 - Y)/2.0;
386
double tmp2 = tmp1*tmp1;
388
// Compute basisvalues
389
basisvalues[0] = 1.0;
390
basisvalues[1] = tmp0;
391
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
392
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
393
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
394
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
395
basisvalues[0] *= std::sqrt(0.5);
396
basisvalues[2] *= std::sqrt(1.0);
397
basisvalues[5] *= std::sqrt(1.5);
398
basisvalues[1] *= std::sqrt(3.0);
399
basisvalues[4] *= std::sqrt(4.5);
400
basisvalues[3] *= std::sqrt(7.5);
402
// Table(s) of coefficients
403
static const double coefficients0[6] = \
404
{0.23570226, 0.40414519, -0.23333333, 0.18257419, -0.14142136, 0.081649658};
406
static const double coefficients1[6] = \
407
{-0.11785113, -0.69282032, 0.26666667, 0.0, 0.14142136, -0.12247449};
410
for (unsigned int r = 0; r < 6; r++)
412
values[0] += coefficients0[r]*basisvalues[r];
413
values[1] += coefficients1[r]*basisvalues[r];
414
}// end loop over 'r'
416
// Using contravariant Piola transform to map values back to the physical element
417
const double tmp_ref0 = values[0];
418
const double tmp_ref1 = values[1];
419
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
420
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
421
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
427
// Array of basisvalues
428
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
430
// Declare helper variables
431
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
432
double tmp1 = (1.0 - Y)/2.0;
433
double tmp2 = tmp1*tmp1;
435
// Compute basisvalues
436
basisvalues[0] = 1.0;
437
basisvalues[1] = tmp0;
438
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
439
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
440
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
441
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
442
basisvalues[0] *= std::sqrt(0.5);
443
basisvalues[2] *= std::sqrt(1.0);
444
basisvalues[5] *= std::sqrt(1.5);
445
basisvalues[1] *= std::sqrt(3.0);
446
basisvalues[4] *= std::sqrt(4.5);
447
basisvalues[3] *= std::sqrt(7.5);
449
// Table(s) of coefficients
450
static const double coefficients0[6] = \
451
{1.0606602, 0.17320508, -0.3, -0.36514837, 0.14142136, -0.040824829};
453
static const double coefficients1[6] = \
454
{0.0, -0.34641016, 0.0, 0.0, -0.28284271, 0.0};
457
for (unsigned int r = 0; r < 6; r++)
459
values[0] += coefficients0[r]*basisvalues[r];
460
values[1] += coefficients1[r]*basisvalues[r];
461
}// end loop over 'r'
463
// Using contravariant Piola transform to map values back to the physical element
464
const double tmp_ref0 = values[0];
465
const double tmp_ref1 = values[1];
466
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
467
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
468
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
474
// Array of basisvalues
475
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
477
// Declare helper variables
478
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
479
double tmp1 = (1.0 - Y)/2.0;
480
double tmp2 = tmp1*tmp1;
482
// Compute basisvalues
483
basisvalues[0] = 1.0;
484
basisvalues[1] = tmp0;
485
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
486
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
487
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
488
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
489
basisvalues[0] *= std::sqrt(0.5);
490
basisvalues[2] *= std::sqrt(1.0);
491
basisvalues[5] *= std::sqrt(1.5);
492
basisvalues[1] *= std::sqrt(3.0);
493
basisvalues[4] *= std::sqrt(4.5);
494
basisvalues[3] *= std::sqrt(7.5);
496
// Table(s) of coefficients
497
static const double coefficients0[6] = \
498
{0.0, -0.17320508, -0.3, -0.18257419, -0.14142136, 0.16329932};
500
static const double coefficients1[6] = \
501
{1.0606602, -0.17320508, 0.3, 0.0, -0.14142136, -0.36742346};
504
for (unsigned int r = 0; r < 6; r++)
506
values[0] += coefficients0[r]*basisvalues[r];
507
values[1] += coefficients1[r]*basisvalues[r];
508
}// end loop over 'r'
510
// Using contravariant Piola transform to map values back to the physical element
511
const double tmp_ref0 = values[0];
512
const double tmp_ref1 = values[1];
513
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
514
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
515
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
522
/// Evaluate all basis functions at given point x in cell
523
virtual void evaluate_basis_all(double* values,
525
const double* vertex_coordinates,
526
int cell_orientation) const
528
// Helper variable to hold values of a single dof.
529
double dof_values[3] = {0.0, 0.0, 0.0};
531
// Loop dofs and call evaluate_basis
532
for (unsigned int r = 0; r < 8; r++)
534
evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
535
for (unsigned int s = 0; s < 3; s++)
537
values[r*3 + s] = dof_values[s];
538
}// end loop over 's'
539
}// end loop over 'r'
542
/// Evaluate order n derivatives of basis function i at given point x in cell
543
virtual void evaluate_basis_derivatives(std::size_t i,
547
const double* vertex_coordinates,
548
int cell_orientation) const
552
compute_jacobian_triangle_3d(J, vertex_coordinates);
554
// Compute Jacobian inverse and determinant
557
compute_jacobian_inverse_triangle_3d(K, detJ, J);
561
if (cell_orientation == -1)
562
throw std::runtime_error("cell orientation must be defined (not -1)");
563
// (If cell_orientation == 1 = down, multiply det(J) by -1)
564
else if (cell_orientation == 1)
568
const double b0 = vertex_coordinates[0];
569
const double b1 = vertex_coordinates[1];
570
const double b2 = vertex_coordinates[2];
572
// P_FFC = J^dag (p - b), P_FIAT = 2*P_FFC - (1, 1)
573
double X = 2*(K[0]*(x[0] - b0) + K[1]*(x[1] - b1) + K[2]*(x[2] - b2)) - 1.0;
574
double Y = 2*(K[3]*(x[0] - b0) + K[4]*(x[1] - b1) + K[5]*(x[2] - b2)) - 1.0;
577
// Compute number of derivatives.
578
unsigned int num_derivatives_t = 1;
579
for (unsigned int r = 0; r < n; r++)
581
num_derivatives_t *= 2;
582
}// end loop over 'r'
584
// Compute number of derivatives.
585
unsigned int num_derivatives_g = 1;
586
for (unsigned int r = 0; r < n; r++)
588
num_derivatives_g *= 3;
589
}// end loop over 'r'
591
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
592
unsigned int **combinations_t = new unsigned int *[num_derivatives_t];
593
for (unsigned int row = 0; row < num_derivatives_t; row++)
595
combinations_t[row] = new unsigned int [n];
596
for (unsigned int col = 0; col < n; col++)
597
combinations_t[row][col] = 0;
600
// Generate combinations of derivatives
601
for (unsigned int row = 1; row < num_derivatives_t; row++)
603
for (unsigned int num = 0; num < row; num++)
605
for (unsigned int col = n-1; col+1 > 0; col--)
607
if (combinations_t[row][col] + 1 > 1)
608
combinations_t[row][col] = 0;
611
combinations_t[row][col] += 1;
618
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
619
unsigned int **combinations_g = new unsigned int *[num_derivatives_g];
620
for (unsigned int row = 0; row < num_derivatives_g; row++)
622
combinations_g[row] = new unsigned int [n];
623
for (unsigned int col = 0; col < n; col++)
624
combinations_g[row][col] = 0;
627
// Generate combinations of derivatives
628
for (unsigned int row = 1; row < num_derivatives_g; row++)
630
for (unsigned int num = 0; num < row; num++)
632
for (unsigned int col = n-1; col+1 > 0; col--)
634
if (combinations_g[row][col] + 1 > 2)
635
combinations_g[row][col] = 0;
638
combinations_g[row][col] += 1;
645
// Compute inverse of Jacobian
646
const double Jinv[2][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}};
648
// Declare transformation matrix
649
// Declare pointer to two dimensional array and initialise
650
double **transform = new double *[num_derivatives_g];
652
for (unsigned int j = 0; j < num_derivatives_g; j++)
654
transform[j] = new double [num_derivatives_t];
655
for (unsigned int k = 0; k < num_derivatives_t; k++)
659
// Construct transformation matrix
660
for (unsigned int row = 0; row < num_derivatives_g; row++)
662
for (unsigned int col = 0; col < num_derivatives_t; col++)
664
for (unsigned int k = 0; k < n; k++)
665
transform[row][col] *= Jinv[combinations_t[col][k]][combinations_g[row][k]];
669
// Reset values. Assuming that values is always an array.
670
for (unsigned int r = 0; r < 3*num_derivatives_g; r++)
673
}// end loop over 'r'
680
// Array of basisvalues
681
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
683
// Declare helper variables
684
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
685
double tmp1 = (1.0 - Y)/2.0;
686
double tmp2 = tmp1*tmp1;
688
// Compute basisvalues
689
basisvalues[0] = 1.0;
690
basisvalues[1] = tmp0;
691
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
692
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
693
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
694
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
695
basisvalues[0] *= std::sqrt(0.5);
696
basisvalues[2] *= std::sqrt(1.0);
697
basisvalues[5] *= std::sqrt(1.5);
698
basisvalues[1] *= std::sqrt(3.0);
699
basisvalues[4] *= std::sqrt(4.5);
700
basisvalues[3] *= std::sqrt(7.5);
702
// Table(s) of coefficients
703
static const double coefficients0[6] = \
704
{0.23570226, 0.40414519, -0.23333333, 0.18257419, -0.14142136, 0.081649658};
706
static const double coefficients1[6] = \
707
{-0.11785113, 0.17320508, -0.23333333, 0.0, 0.14142136, -0.12247449};
709
// Tables of derivatives of the polynomial base (transpose).
710
static const double dmats0[6][6] = \
711
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
712
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
713
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
714
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
715
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
716
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
718
static const double dmats1[6][6] = \
719
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
720
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
721
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
722
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
723
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
724
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
726
// Compute reference derivatives.
727
// Declare pointer to array of derivatives on FIAT element.
728
double *derivatives = new double[2*num_derivatives_t];
729
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
731
derivatives[r] = 0.0;
732
}// end loop over 'r'
734
// Declare pointer to array of reference derivatives on physical element.
735
double *derivatives_p = new double[3*num_derivatives_t];
736
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
738
derivatives_p[r] = 0.0;
739
}// end loop over 'r'
741
// Declare derivative matrix (of polynomial basis).
742
double dmats[6][6] = \
743
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
744
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
745
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
746
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
747
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
748
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
750
// Declare (auxiliary) derivative matrix (of polynomial basis).
751
double dmats_old[6][6] = \
752
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
753
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
754
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
755
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
756
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
757
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
759
// Loop possible derivatives.
760
for (unsigned int r = 0; r < num_derivatives_t; r++)
762
// Resetting dmats values to compute next derivative.
763
for (unsigned int t = 0; t < 6; t++)
765
for (unsigned int u = 0; u < 6; u++)
773
}// end loop over 'u'
774
}// end loop over 't'
776
// Looping derivative order to generate dmats.
777
for (unsigned int s = 0; s < n; s++)
779
// Updating dmats_old with new values and resetting dmats.
780
for (unsigned int t = 0; t < 6; t++)
782
for (unsigned int u = 0; u < 6; u++)
784
dmats_old[t][u] = dmats[t][u];
786
}// end loop over 'u'
787
}// end loop over 't'
789
// Update dmats using an inner product.
790
if (combinations_t[r][s] == 0)
792
for (unsigned int t = 0; t < 6; t++)
794
for (unsigned int u = 0; u < 6; u++)
796
for (unsigned int tu = 0; tu < 6; tu++)
798
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
799
}// end loop over 'tu'
800
}// end loop over 'u'
801
}// end loop over 't'
804
if (combinations_t[r][s] == 1)
806
for (unsigned int t = 0; t < 6; t++)
808
for (unsigned int u = 0; u < 6; u++)
810
for (unsigned int tu = 0; tu < 6; tu++)
812
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
813
}// end loop over 'tu'
814
}// end loop over 'u'
815
}// end loop over 't'
818
}// end loop over 's'
819
for (unsigned int s = 0; s < 6; s++)
821
for (unsigned int t = 0; t < 6; t++)
823
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
824
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
825
}// end loop over 't'
826
}// end loop over 's'
828
// Using contravariant Piola transform to map values back to the physical element.
829
const double tmp_ref0 = derivatives[r];
830
const double tmp_ref1 = derivatives[num_derivatives_t + r];
831
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
832
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
833
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
834
}// end loop over 'r'
836
// Transform derivatives back to physical element
837
for (unsigned int r = 0; r < num_derivatives_g; r++)
839
for (unsigned int s = 0; s < num_derivatives_t; s++)
841
values[r] += transform[r][s]*derivatives_p[s];
842
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
843
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
844
}// end loop over 's'
845
}// end loop over 'r'
847
// Delete pointer to array of derivatives on FIAT element
848
delete [] derivatives;
850
// Delete pointer to array of reference derivatives on physical element.
851
delete [] derivatives_p;
853
// Delete pointer to array of combinations of derivatives and transform
854
for (unsigned int r = 0; r < num_derivatives_t; r++)
856
delete [] combinations_t[r];
857
}// end loop over 'r'
858
delete [] combinations_t;
859
for (unsigned int r = 0; r < num_derivatives_g; r++)
861
delete [] combinations_g[r];
862
}// end loop over 'r'
863
delete [] combinations_g;
864
for (unsigned int r = 0; r < num_derivatives_g; r++)
866
delete [] transform[r];
867
}// end loop over 'r'
874
// Array of basisvalues
875
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
877
// Declare helper variables
878
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
879
double tmp1 = (1.0 - Y)/2.0;
880
double tmp2 = tmp1*tmp1;
882
// Compute basisvalues
883
basisvalues[0] = 1.0;
884
basisvalues[1] = tmp0;
885
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
886
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
887
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
888
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
889
basisvalues[0] *= std::sqrt(0.5);
890
basisvalues[2] *= std::sqrt(1.0);
891
basisvalues[5] *= std::sqrt(1.5);
892
basisvalues[1] *= std::sqrt(3.0);
893
basisvalues[4] *= std::sqrt(4.5);
894
basisvalues[3] *= std::sqrt(7.5);
896
// Table(s) of coefficients
897
static const double coefficients0[6] = \
898
{-0.11785113, -0.11547005, 0.26666667, 0.0, 0.14142136, -0.12247449};
900
static const double coefficients1[6] = \
901
{0.23570226, 0.0, 0.46666667, 0.0, 0.0, 0.24494897};
903
// Tables of derivatives of the polynomial base (transpose).
904
static const double dmats0[6][6] = \
905
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
906
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
907
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
908
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
909
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
910
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
912
static const double dmats1[6][6] = \
913
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
914
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
915
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
916
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
917
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
918
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
920
// Compute reference derivatives.
921
// Declare pointer to array of derivatives on FIAT element.
922
double *derivatives = new double[2*num_derivatives_t];
923
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
925
derivatives[r] = 0.0;
926
}// end loop over 'r'
928
// Declare pointer to array of reference derivatives on physical element.
929
double *derivatives_p = new double[3*num_derivatives_t];
930
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
932
derivatives_p[r] = 0.0;
933
}// end loop over 'r'
935
// Declare derivative matrix (of polynomial basis).
936
double dmats[6][6] = \
937
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
938
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
939
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
940
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
941
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
942
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
944
// Declare (auxiliary) derivative matrix (of polynomial basis).
945
double dmats_old[6][6] = \
946
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
947
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
948
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
949
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
950
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
951
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
953
// Loop possible derivatives.
954
for (unsigned int r = 0; r < num_derivatives_t; r++)
956
// Resetting dmats values to compute next derivative.
957
for (unsigned int t = 0; t < 6; t++)
959
for (unsigned int u = 0; u < 6; u++)
967
}// end loop over 'u'
968
}// end loop over 't'
970
// Looping derivative order to generate dmats.
971
for (unsigned int s = 0; s < n; s++)
973
// Updating dmats_old with new values and resetting dmats.
974
for (unsigned int t = 0; t < 6; t++)
976
for (unsigned int u = 0; u < 6; u++)
978
dmats_old[t][u] = dmats[t][u];
980
}// end loop over 'u'
981
}// end loop over 't'
983
// Update dmats using an inner product.
984
if (combinations_t[r][s] == 0)
986
for (unsigned int t = 0; t < 6; t++)
988
for (unsigned int u = 0; u < 6; u++)
990
for (unsigned int tu = 0; tu < 6; tu++)
992
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
993
}// end loop over 'tu'
994
}// end loop over 'u'
995
}// end loop over 't'
998
if (combinations_t[r][s] == 1)
1000
for (unsigned int t = 0; t < 6; t++)
1002
for (unsigned int u = 0; u < 6; u++)
1004
for (unsigned int tu = 0; tu < 6; tu++)
1006
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1007
}// end loop over 'tu'
1008
}// end loop over 'u'
1009
}// end loop over 't'
1012
}// end loop over 's'
1013
for (unsigned int s = 0; s < 6; s++)
1015
for (unsigned int t = 0; t < 6; t++)
1017
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1018
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
1019
}// end loop over 't'
1020
}// end loop over 's'
1022
// Using contravariant Piola transform to map values back to the physical element.
1023
const double tmp_ref0 = derivatives[r];
1024
const double tmp_ref1 = derivatives[num_derivatives_t + r];
1025
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
1026
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
1027
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
1028
}// end loop over 'r'
1030
// Transform derivatives back to physical element
1031
for (unsigned int r = 0; r < num_derivatives_g; r++)
1033
for (unsigned int s = 0; s < num_derivatives_t; s++)
1035
values[r] += transform[r][s]*derivatives_p[s];
1036
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
1037
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
1038
}// end loop over 's'
1039
}// end loop over 'r'
1041
// Delete pointer to array of derivatives on FIAT element
1042
delete [] derivatives;
1044
// Delete pointer to array of reference derivatives on physical element.
1045
delete [] derivatives_p;
1047
// Delete pointer to array of combinations of derivatives and transform
1048
for (unsigned int r = 0; r < num_derivatives_t; r++)
1050
delete [] combinations_t[r];
1051
}// end loop over 'r'
1052
delete [] combinations_t;
1053
for (unsigned int r = 0; r < num_derivatives_g; r++)
1055
delete [] combinations_g[r];
1056
}// end loop over 'r'
1057
delete [] combinations_g;
1058
for (unsigned int r = 0; r < num_derivatives_g; r++)
1060
delete [] transform[r];
1061
}// end loop over 'r'
1062
delete [] transform;
1068
// Array of basisvalues
1069
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1071
// Declare helper variables
1072
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1073
double tmp1 = (1.0 - Y)/2.0;
1074
double tmp2 = tmp1*tmp1;
1076
// Compute basisvalues
1077
basisvalues[0] = 1.0;
1078
basisvalues[1] = tmp0;
1079
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1080
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
1081
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
1082
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
1083
basisvalues[0] *= std::sqrt(0.5);
1084
basisvalues[2] *= std::sqrt(1.0);
1085
basisvalues[5] *= std::sqrt(1.5);
1086
basisvalues[1] *= std::sqrt(3.0);
1087
basisvalues[4] *= std::sqrt(4.5);
1088
basisvalues[3] *= std::sqrt(7.5);
1090
// Table(s) of coefficients
1091
static const double coefficients0[6] = \
1092
{0.11785113, -0.57735027, -0.46666667, 0.18257419, 0.0, -0.040824829};
1094
static const double coefficients1[6] = \
1095
{0.11785113, 0.17320508, 0.23333333, 0.0, 0.14142136, 0.12247449};
1097
// Tables of derivatives of the polynomial base (transpose).
1098
static const double dmats0[6][6] = \
1099
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1100
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
1101
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1102
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
1103
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
1104
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
1106
static const double dmats1[6][6] = \
1107
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1108
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
1109
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
1110
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
1111
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
1112
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
1114
// Compute reference derivatives.
1115
// Declare pointer to array of derivatives on FIAT element.
1116
double *derivatives = new double[2*num_derivatives_t];
1117
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
1119
derivatives[r] = 0.0;
1120
}// end loop over 'r'
1122
// Declare pointer to array of reference derivatives on physical element.
1123
double *derivatives_p = new double[3*num_derivatives_t];
1124
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
1126
derivatives_p[r] = 0.0;
1127
}// end loop over 'r'
1129
// Declare derivative matrix (of polynomial basis).
1130
double dmats[6][6] = \
1131
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1132
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1133
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1134
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1135
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1136
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1138
// Declare (auxiliary) derivative matrix (of polynomial basis).
1139
double dmats_old[6][6] = \
1140
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1141
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1142
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1143
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1144
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1145
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1147
// Loop possible derivatives.
1148
for (unsigned int r = 0; r < num_derivatives_t; r++)
1150
// Resetting dmats values to compute next derivative.
1151
for (unsigned int t = 0; t < 6; t++)
1153
for (unsigned int u = 0; u < 6; u++)
1161
}// end loop over 'u'
1162
}// end loop over 't'
1164
// Looping derivative order to generate dmats.
1165
for (unsigned int s = 0; s < n; s++)
1167
// Updating dmats_old with new values and resetting dmats.
1168
for (unsigned int t = 0; t < 6; t++)
1170
for (unsigned int u = 0; u < 6; u++)
1172
dmats_old[t][u] = dmats[t][u];
1174
}// end loop over 'u'
1175
}// end loop over 't'
1177
// Update dmats using an inner product.
1178
if (combinations_t[r][s] == 0)
1180
for (unsigned int t = 0; t < 6; t++)
1182
for (unsigned int u = 0; u < 6; u++)
1184
for (unsigned int tu = 0; tu < 6; tu++)
1186
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1187
}// end loop over 'tu'
1188
}// end loop over 'u'
1189
}// end loop over 't'
1192
if (combinations_t[r][s] == 1)
1194
for (unsigned int t = 0; t < 6; t++)
1196
for (unsigned int u = 0; u < 6; u++)
1198
for (unsigned int tu = 0; tu < 6; tu++)
1200
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1201
}// end loop over 'tu'
1202
}// end loop over 'u'
1203
}// end loop over 't'
1206
}// end loop over 's'
1207
for (unsigned int s = 0; s < 6; s++)
1209
for (unsigned int t = 0; t < 6; t++)
1211
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1212
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
1213
}// end loop over 't'
1214
}// end loop over 's'
1216
// Using contravariant Piola transform to map values back to the physical element.
1217
const double tmp_ref0 = derivatives[r];
1218
const double tmp_ref1 = derivatives[num_derivatives_t + r];
1219
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
1220
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
1221
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
1222
}// end loop over 'r'
1224
// Transform derivatives back to physical element
1225
for (unsigned int r = 0; r < num_derivatives_g; r++)
1227
for (unsigned int s = 0; s < num_derivatives_t; s++)
1229
values[r] += transform[r][s]*derivatives_p[s];
1230
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
1231
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
1232
}// end loop over 's'
1233
}// end loop over 'r'
1235
// Delete pointer to array of derivatives on FIAT element
1236
delete [] derivatives;
1238
// Delete pointer to array of reference derivatives on physical element.
1239
delete [] derivatives_p;
1241
// Delete pointer to array of combinations of derivatives and transform
1242
for (unsigned int r = 0; r < num_derivatives_t; r++)
1244
delete [] combinations_t[r];
1245
}// end loop over 'r'
1246
delete [] combinations_t;
1247
for (unsigned int r = 0; r < num_derivatives_g; r++)
1249
delete [] combinations_g[r];
1250
}// end loop over 'r'
1251
delete [] combinations_g;
1252
for (unsigned int r = 0; r < num_derivatives_g; r++)
1254
delete [] transform[r];
1255
}// end loop over 'r'
1256
delete [] transform;
1262
// Array of basisvalues
1263
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1265
// Declare helper variables
1266
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1267
double tmp1 = (1.0 - Y)/2.0;
1268
double tmp2 = tmp1*tmp1;
1270
// Compute basisvalues
1271
basisvalues[0] = 1.0;
1272
basisvalues[1] = tmp0;
1273
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1274
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
1275
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
1276
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
1277
basisvalues[0] *= std::sqrt(0.5);
1278
basisvalues[2] *= std::sqrt(1.0);
1279
basisvalues[5] *= std::sqrt(1.5);
1280
basisvalues[1] *= std::sqrt(3.0);
1281
basisvalues[4] *= std::sqrt(4.5);
1282
basisvalues[3] *= std::sqrt(7.5);
1284
// Table(s) of coefficients
1285
static const double coefficients0[6] = \
1286
{0.11785113, 0.11547005, 0.73333333, 0.0, -0.14142136, 0.12247449};
1288
static const double coefficients1[6] = \
1289
{-0.23570226, 0.0, -0.46666667, 0.0, 0.0, -0.24494897};
1291
// Tables of derivatives of the polynomial base (transpose).
1292
static const double dmats0[6][6] = \
1293
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1294
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
1295
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1296
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
1297
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
1298
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
1300
static const double dmats1[6][6] = \
1301
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1302
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
1303
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
1304
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
1305
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
1306
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
1308
// Compute reference derivatives.
1309
// Declare pointer to array of derivatives on FIAT element.
1310
double *derivatives = new double[2*num_derivatives_t];
1311
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
1313
derivatives[r] = 0.0;
1314
}// end loop over 'r'
1316
// Declare pointer to array of reference derivatives on physical element.
1317
double *derivatives_p = new double[3*num_derivatives_t];
1318
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
1320
derivatives_p[r] = 0.0;
1321
}// end loop over 'r'
1323
// Declare derivative matrix (of polynomial basis).
1324
double dmats[6][6] = \
1325
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1326
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1327
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1328
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1329
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1330
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1332
// Declare (auxiliary) derivative matrix (of polynomial basis).
1333
double dmats_old[6][6] = \
1334
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1335
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1336
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1337
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1338
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1339
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1341
// Loop possible derivatives.
1342
for (unsigned int r = 0; r < num_derivatives_t; r++)
1344
// Resetting dmats values to compute next derivative.
1345
for (unsigned int t = 0; t < 6; t++)
1347
for (unsigned int u = 0; u < 6; u++)
1355
}// end loop over 'u'
1356
}// end loop over 't'
1358
// Looping derivative order to generate dmats.
1359
for (unsigned int s = 0; s < n; s++)
1361
// Updating dmats_old with new values and resetting dmats.
1362
for (unsigned int t = 0; t < 6; t++)
1364
for (unsigned int u = 0; u < 6; u++)
1366
dmats_old[t][u] = dmats[t][u];
1368
}// end loop over 'u'
1369
}// end loop over 't'
1371
// Update dmats using an inner product.
1372
if (combinations_t[r][s] == 0)
1374
for (unsigned int t = 0; t < 6; t++)
1376
for (unsigned int u = 0; u < 6; u++)
1378
for (unsigned int tu = 0; tu < 6; tu++)
1380
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1381
}// end loop over 'tu'
1382
}// end loop over 'u'
1383
}// end loop over 't'
1386
if (combinations_t[r][s] == 1)
1388
for (unsigned int t = 0; t < 6; t++)
1390
for (unsigned int u = 0; u < 6; u++)
1392
for (unsigned int tu = 0; tu < 6; tu++)
1394
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1395
}// end loop over 'tu'
1396
}// end loop over 'u'
1397
}// end loop over 't'
1400
}// end loop over 's'
1401
for (unsigned int s = 0; s < 6; s++)
1403
for (unsigned int t = 0; t < 6; t++)
1405
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1406
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
1407
}// end loop over 't'
1408
}// end loop over 's'
1410
// Using contravariant Piola transform to map values back to the physical element.
1411
const double tmp_ref0 = derivatives[r];
1412
const double tmp_ref1 = derivatives[num_derivatives_t + r];
1413
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
1414
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
1415
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
1416
}// end loop over 'r'
1418
// Transform derivatives back to physical element
1419
for (unsigned int r = 0; r < num_derivatives_g; r++)
1421
for (unsigned int s = 0; s < num_derivatives_t; s++)
1423
values[r] += transform[r][s]*derivatives_p[s];
1424
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
1425
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
1426
}// end loop over 's'
1427
}// end loop over 'r'
1429
// Delete pointer to array of derivatives on FIAT element
1430
delete [] derivatives;
1432
// Delete pointer to array of reference derivatives on physical element.
1433
delete [] derivatives_p;
1435
// Delete pointer to array of combinations of derivatives and transform
1436
for (unsigned int r = 0; r < num_derivatives_t; r++)
1438
delete [] combinations_t[r];
1439
}// end loop over 'r'
1440
delete [] combinations_t;
1441
for (unsigned int r = 0; r < num_derivatives_g; r++)
1443
delete [] combinations_g[r];
1444
}// end loop over 'r'
1445
delete [] combinations_g;
1446
for (unsigned int r = 0; r < num_derivatives_g; r++)
1448
delete [] transform[r];
1449
}// end loop over 'r'
1450
delete [] transform;
1456
// Array of basisvalues
1457
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1459
// Declare helper variables
1460
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1461
double tmp1 = (1.0 - Y)/2.0;
1462
double tmp2 = tmp1*tmp1;
1464
// Compute basisvalues
1465
basisvalues[0] = 1.0;
1466
basisvalues[1] = tmp0;
1467
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1468
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
1469
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
1470
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
1471
basisvalues[0] *= std::sqrt(0.5);
1472
basisvalues[2] *= std::sqrt(1.0);
1473
basisvalues[5] *= std::sqrt(1.5);
1474
basisvalues[1] *= std::sqrt(3.0);
1475
basisvalues[4] *= std::sqrt(4.5);
1476
basisvalues[3] *= std::sqrt(7.5);
1478
// Table(s) of coefficients
1479
static const double coefficients0[6] = \
1480
{-0.11785113, -0.28867513, -0.033333333, -0.18257419, 0.0, 0.040824829};
1482
static const double coefficients1[6] = \
1483
{-0.11785113, 0.69282032, 0.26666667, 0.0, -0.14142136, -0.12247449};
1485
// Tables of derivatives of the polynomial base (transpose).
1486
static const double dmats0[6][6] = \
1487
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1488
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
1489
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1490
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
1491
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
1492
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
1494
static const double dmats1[6][6] = \
1495
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1496
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
1497
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
1498
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
1499
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
1500
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
1502
// Compute reference derivatives.
1503
// Declare pointer to array of derivatives on FIAT element.
1504
double *derivatives = new double[2*num_derivatives_t];
1505
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
1507
derivatives[r] = 0.0;
1508
}// end loop over 'r'
1510
// Declare pointer to array of reference derivatives on physical element.
1511
double *derivatives_p = new double[3*num_derivatives_t];
1512
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
1514
derivatives_p[r] = 0.0;
1515
}// end loop over 'r'
1517
// Declare derivative matrix (of polynomial basis).
1518
double dmats[6][6] = \
1519
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1520
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1521
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1522
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1523
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1524
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1526
// Declare (auxiliary) derivative matrix (of polynomial basis).
1527
double dmats_old[6][6] = \
1528
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1529
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1530
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1531
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1532
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1533
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1535
// Loop possible derivatives.
1536
for (unsigned int r = 0; r < num_derivatives_t; r++)
1538
// Resetting dmats values to compute next derivative.
1539
for (unsigned int t = 0; t < 6; t++)
1541
for (unsigned int u = 0; u < 6; u++)
1549
}// end loop over 'u'
1550
}// end loop over 't'
1552
// Looping derivative order to generate dmats.
1553
for (unsigned int s = 0; s < n; s++)
1555
// Updating dmats_old with new values and resetting dmats.
1556
for (unsigned int t = 0; t < 6; t++)
1558
for (unsigned int u = 0; u < 6; u++)
1560
dmats_old[t][u] = dmats[t][u];
1562
}// end loop over 'u'
1563
}// end loop over 't'
1565
// Update dmats using an inner product.
1566
if (combinations_t[r][s] == 0)
1568
for (unsigned int t = 0; t < 6; t++)
1570
for (unsigned int u = 0; u < 6; u++)
1572
for (unsigned int tu = 0; tu < 6; tu++)
1574
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1575
}// end loop over 'tu'
1576
}// end loop over 'u'
1577
}// end loop over 't'
1580
if (combinations_t[r][s] == 1)
1582
for (unsigned int t = 0; t < 6; t++)
1584
for (unsigned int u = 0; u < 6; u++)
1586
for (unsigned int tu = 0; tu < 6; tu++)
1588
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1589
}// end loop over 'tu'
1590
}// end loop over 'u'
1591
}// end loop over 't'
1594
}// end loop over 's'
1595
for (unsigned int s = 0; s < 6; s++)
1597
for (unsigned int t = 0; t < 6; t++)
1599
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1600
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
1601
}// end loop over 't'
1602
}// end loop over 's'
1604
// Using contravariant Piola transform to map values back to the physical element.
1605
const double tmp_ref0 = derivatives[r];
1606
const double tmp_ref1 = derivatives[num_derivatives_t + r];
1607
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
1608
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
1609
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
1610
}// end loop over 'r'
1612
// Transform derivatives back to physical element
1613
for (unsigned int r = 0; r < num_derivatives_g; r++)
1615
for (unsigned int s = 0; s < num_derivatives_t; s++)
1617
values[r] += transform[r][s]*derivatives_p[s];
1618
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
1619
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
1620
}// end loop over 's'
1621
}// end loop over 'r'
1623
// Delete pointer to array of derivatives on FIAT element
1624
delete [] derivatives;
1626
// Delete pointer to array of reference derivatives on physical element.
1627
delete [] derivatives_p;
1629
// Delete pointer to array of combinations of derivatives and transform
1630
for (unsigned int r = 0; r < num_derivatives_t; r++)
1632
delete [] combinations_t[r];
1633
}// end loop over 'r'
1634
delete [] combinations_t;
1635
for (unsigned int r = 0; r < num_derivatives_g; r++)
1637
delete [] combinations_g[r];
1638
}// end loop over 'r'
1639
delete [] combinations_g;
1640
for (unsigned int r = 0; r < num_derivatives_g; r++)
1642
delete [] transform[r];
1643
}// end loop over 'r'
1644
delete [] transform;
1650
// Array of basisvalues
1651
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1653
// Declare helper variables
1654
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1655
double tmp1 = (1.0 - Y)/2.0;
1656
double tmp2 = tmp1*tmp1;
1658
// Compute basisvalues
1659
basisvalues[0] = 1.0;
1660
basisvalues[1] = tmp0;
1661
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1662
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
1663
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
1664
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
1665
basisvalues[0] *= std::sqrt(0.5);
1666
basisvalues[2] *= std::sqrt(1.0);
1667
basisvalues[5] *= std::sqrt(1.5);
1668
basisvalues[1] *= std::sqrt(3.0);
1669
basisvalues[4] *= std::sqrt(4.5);
1670
basisvalues[3] *= std::sqrt(7.5);
1672
// Table(s) of coefficients
1673
static const double coefficients0[6] = \
1674
{0.23570226, 0.40414519, -0.23333333, 0.18257419, -0.14142136, 0.081649658};
1676
static const double coefficients1[6] = \
1677
{-0.11785113, -0.69282032, 0.26666667, 0.0, 0.14142136, -0.12247449};
1679
// Tables of derivatives of the polynomial base (transpose).
1680
static const double dmats0[6][6] = \
1681
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1682
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
1683
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1684
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
1685
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
1686
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
1688
static const double dmats1[6][6] = \
1689
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1690
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
1691
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
1692
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
1693
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
1694
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
1696
// Compute reference derivatives.
1697
// Declare pointer to array of derivatives on FIAT element.
1698
double *derivatives = new double[2*num_derivatives_t];
1699
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
1701
derivatives[r] = 0.0;
1702
}// end loop over 'r'
1704
// Declare pointer to array of reference derivatives on physical element.
1705
double *derivatives_p = new double[3*num_derivatives_t];
1706
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
1708
derivatives_p[r] = 0.0;
1709
}// end loop over 'r'
1711
// Declare derivative matrix (of polynomial basis).
1712
double dmats[6][6] = \
1713
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1714
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1715
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1716
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1717
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1718
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1720
// Declare (auxiliary) derivative matrix (of polynomial basis).
1721
double dmats_old[6][6] = \
1722
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1723
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1724
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1725
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1726
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1727
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1729
// Loop possible derivatives.
1730
for (unsigned int r = 0; r < num_derivatives_t; r++)
1732
// Resetting dmats values to compute next derivative.
1733
for (unsigned int t = 0; t < 6; t++)
1735
for (unsigned int u = 0; u < 6; u++)
1743
}// end loop over 'u'
1744
}// end loop over 't'
1746
// Looping derivative order to generate dmats.
1747
for (unsigned int s = 0; s < n; s++)
1749
// Updating dmats_old with new values and resetting dmats.
1750
for (unsigned int t = 0; t < 6; t++)
1752
for (unsigned int u = 0; u < 6; u++)
1754
dmats_old[t][u] = dmats[t][u];
1756
}// end loop over 'u'
1757
}// end loop over 't'
1759
// Update dmats using an inner product.
1760
if (combinations_t[r][s] == 0)
1762
for (unsigned int t = 0; t < 6; t++)
1764
for (unsigned int u = 0; u < 6; u++)
1766
for (unsigned int tu = 0; tu < 6; tu++)
1768
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1769
}// end loop over 'tu'
1770
}// end loop over 'u'
1771
}// end loop over 't'
1774
if (combinations_t[r][s] == 1)
1776
for (unsigned int t = 0; t < 6; t++)
1778
for (unsigned int u = 0; u < 6; u++)
1780
for (unsigned int tu = 0; tu < 6; tu++)
1782
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1783
}// end loop over 'tu'
1784
}// end loop over 'u'
1785
}// end loop over 't'
1788
}// end loop over 's'
1789
for (unsigned int s = 0; s < 6; s++)
1791
for (unsigned int t = 0; t < 6; t++)
1793
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1794
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
1795
}// end loop over 't'
1796
}// end loop over 's'
1798
// Using contravariant Piola transform to map values back to the physical element.
1799
const double tmp_ref0 = derivatives[r];
1800
const double tmp_ref1 = derivatives[num_derivatives_t + r];
1801
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
1802
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
1803
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
1804
}// end loop over 'r'
1806
// Transform derivatives back to physical element
1807
for (unsigned int r = 0; r < num_derivatives_g; r++)
1809
for (unsigned int s = 0; s < num_derivatives_t; s++)
1811
values[r] += transform[r][s]*derivatives_p[s];
1812
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
1813
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
1814
}// end loop over 's'
1815
}// end loop over 'r'
1817
// Delete pointer to array of derivatives on FIAT element
1818
delete [] derivatives;
1820
// Delete pointer to array of reference derivatives on physical element.
1821
delete [] derivatives_p;
1823
// Delete pointer to array of combinations of derivatives and transform
1824
for (unsigned int r = 0; r < num_derivatives_t; r++)
1826
delete [] combinations_t[r];
1827
}// end loop over 'r'
1828
delete [] combinations_t;
1829
for (unsigned int r = 0; r < num_derivatives_g; r++)
1831
delete [] combinations_g[r];
1832
}// end loop over 'r'
1833
delete [] combinations_g;
1834
for (unsigned int r = 0; r < num_derivatives_g; r++)
1836
delete [] transform[r];
1837
}// end loop over 'r'
1838
delete [] transform;
1844
// Array of basisvalues
1845
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
1847
// Declare helper variables
1848
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
1849
double tmp1 = (1.0 - Y)/2.0;
1850
double tmp2 = tmp1*tmp1;
1852
// Compute basisvalues
1853
basisvalues[0] = 1.0;
1854
basisvalues[1] = tmp0;
1855
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1856
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
1857
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
1858
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
1859
basisvalues[0] *= std::sqrt(0.5);
1860
basisvalues[2] *= std::sqrt(1.0);
1861
basisvalues[5] *= std::sqrt(1.5);
1862
basisvalues[1] *= std::sqrt(3.0);
1863
basisvalues[4] *= std::sqrt(4.5);
1864
basisvalues[3] *= std::sqrt(7.5);
1866
// Table(s) of coefficients
1867
static const double coefficients0[6] = \
1868
{1.0606602, 0.17320508, -0.3, -0.36514837, 0.14142136, -0.040824829};
1870
static const double coefficients1[6] = \
1871
{0.0, -0.34641016, 0.0, 0.0, -0.28284271, 0.0};
1873
// Tables of derivatives of the polynomial base (transpose).
1874
static const double dmats0[6][6] = \
1875
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1876
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
1877
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1878
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
1879
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
1880
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
1882
static const double dmats1[6][6] = \
1883
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1884
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
1885
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
1886
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
1887
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
1888
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
1890
// Compute reference derivatives.
1891
// Declare pointer to array of derivatives on FIAT element.
1892
double *derivatives = new double[2*num_derivatives_t];
1893
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
1895
derivatives[r] = 0.0;
1896
}// end loop over 'r'
1898
// Declare pointer to array of reference derivatives on physical element.
1899
double *derivatives_p = new double[3*num_derivatives_t];
1900
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
1902
derivatives_p[r] = 0.0;
1903
}// end loop over 'r'
1905
// Declare derivative matrix (of polynomial basis).
1906
double dmats[6][6] = \
1907
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1908
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1909
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1910
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1911
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1912
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1914
// Declare (auxiliary) derivative matrix (of polynomial basis).
1915
double dmats_old[6][6] = \
1916
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
1917
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
1918
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
1919
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
1920
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
1921
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
1923
// Loop possible derivatives.
1924
for (unsigned int r = 0; r < num_derivatives_t; r++)
1926
// Resetting dmats values to compute next derivative.
1927
for (unsigned int t = 0; t < 6; t++)
1929
for (unsigned int u = 0; u < 6; u++)
1937
}// end loop over 'u'
1938
}// end loop over 't'
1940
// Looping derivative order to generate dmats.
1941
for (unsigned int s = 0; s < n; s++)
1943
// Updating dmats_old with new values and resetting dmats.
1944
for (unsigned int t = 0; t < 6; t++)
1946
for (unsigned int u = 0; u < 6; u++)
1948
dmats_old[t][u] = dmats[t][u];
1950
}// end loop over 'u'
1951
}// end loop over 't'
1953
// Update dmats using an inner product.
1954
if (combinations_t[r][s] == 0)
1956
for (unsigned int t = 0; t < 6; t++)
1958
for (unsigned int u = 0; u < 6; u++)
1960
for (unsigned int tu = 0; tu < 6; tu++)
1962
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1963
}// end loop over 'tu'
1964
}// end loop over 'u'
1965
}// end loop over 't'
1968
if (combinations_t[r][s] == 1)
1970
for (unsigned int t = 0; t < 6; t++)
1972
for (unsigned int u = 0; u < 6; u++)
1974
for (unsigned int tu = 0; tu < 6; tu++)
1976
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1977
}// end loop over 'tu'
1978
}// end loop over 'u'
1979
}// end loop over 't'
1982
}// end loop over 's'
1983
for (unsigned int s = 0; s < 6; s++)
1985
for (unsigned int t = 0; t < 6; t++)
1987
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1988
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
1989
}// end loop over 't'
1990
}// end loop over 's'
1992
// Using contravariant Piola transform to map values back to the physical element.
1993
const double tmp_ref0 = derivatives[r];
1994
const double tmp_ref1 = derivatives[num_derivatives_t + r];
1995
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
1996
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
1997
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
1998
}// end loop over 'r'
2000
// Transform derivatives back to physical element
2001
for (unsigned int r = 0; r < num_derivatives_g; r++)
2003
for (unsigned int s = 0; s < num_derivatives_t; s++)
2005
values[r] += transform[r][s]*derivatives_p[s];
2006
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
2007
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
2008
}// end loop over 's'
2009
}// end loop over 'r'
2011
// Delete pointer to array of derivatives on FIAT element
2012
delete [] derivatives;
2014
// Delete pointer to array of reference derivatives on physical element.
2015
delete [] derivatives_p;
2017
// Delete pointer to array of combinations of derivatives and transform
2018
for (unsigned int r = 0; r < num_derivatives_t; r++)
2020
delete [] combinations_t[r];
2021
}// end loop over 'r'
2022
delete [] combinations_t;
2023
for (unsigned int r = 0; r < num_derivatives_g; r++)
2025
delete [] combinations_g[r];
2026
}// end loop over 'r'
2027
delete [] combinations_g;
2028
for (unsigned int r = 0; r < num_derivatives_g; r++)
2030
delete [] transform[r];
2031
}// end loop over 'r'
2032
delete [] transform;
2038
// Array of basisvalues
2039
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
2041
// Declare helper variables
2042
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2043
double tmp1 = (1.0 - Y)/2.0;
2044
double tmp2 = tmp1*tmp1;
2046
// Compute basisvalues
2047
basisvalues[0] = 1.0;
2048
basisvalues[1] = tmp0;
2049
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
2050
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
2051
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
2052
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
2053
basisvalues[0] *= std::sqrt(0.5);
2054
basisvalues[2] *= std::sqrt(1.0);
2055
basisvalues[5] *= std::sqrt(1.5);
2056
basisvalues[1] *= std::sqrt(3.0);
2057
basisvalues[4] *= std::sqrt(4.5);
2058
basisvalues[3] *= std::sqrt(7.5);
2060
// Table(s) of coefficients
2061
static const double coefficients0[6] = \
2062
{0.0, -0.17320508, -0.3, -0.18257419, -0.14142136, 0.16329932};
2064
static const double coefficients1[6] = \
2065
{1.0606602, -0.17320508, 0.3, 0.0, -0.14142136, -0.36742346};
2067
// Tables of derivatives of the polynomial base (transpose).
2068
static const double dmats0[6][6] = \
2069
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
2070
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
2071
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
2072
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
2073
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
2074
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
2076
static const double dmats1[6][6] = \
2077
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
2078
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
2079
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
2080
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
2081
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
2082
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
2084
// Compute reference derivatives.
2085
// Declare pointer to array of derivatives on FIAT element.
2086
double *derivatives = new double[2*num_derivatives_t];
2087
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
2089
derivatives[r] = 0.0;
2090
}// end loop over 'r'
2092
// Declare pointer to array of reference derivatives on physical element.
2093
double *derivatives_p = new double[3*num_derivatives_t];
2094
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
2096
derivatives_p[r] = 0.0;
2097
}// end loop over 'r'
2099
// Declare derivative matrix (of polynomial basis).
2100
double dmats[6][6] = \
2101
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
2102
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
2103
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
2104
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
2105
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
2106
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
2108
// Declare (auxiliary) derivative matrix (of polynomial basis).
2109
double dmats_old[6][6] = \
2110
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
2111
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
2112
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
2113
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
2114
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
2115
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
2117
// Loop possible derivatives.
2118
for (unsigned int r = 0; r < num_derivatives_t; r++)
2120
// Resetting dmats values to compute next derivative.
2121
for (unsigned int t = 0; t < 6; t++)
2123
for (unsigned int u = 0; u < 6; u++)
2131
}// end loop over 'u'
2132
}// end loop over 't'
2134
// Looping derivative order to generate dmats.
2135
for (unsigned int s = 0; s < n; s++)
2137
// Updating dmats_old with new values and resetting dmats.
2138
for (unsigned int t = 0; t < 6; t++)
2140
for (unsigned int u = 0; u < 6; u++)
2142
dmats_old[t][u] = dmats[t][u];
2144
}// end loop over 'u'
2145
}// end loop over 't'
2147
// Update dmats using an inner product.
2148
if (combinations_t[r][s] == 0)
2150
for (unsigned int t = 0; t < 6; t++)
2152
for (unsigned int u = 0; u < 6; u++)
2154
for (unsigned int tu = 0; tu < 6; tu++)
2156
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
2157
}// end loop over 'tu'
2158
}// end loop over 'u'
2159
}// end loop over 't'
2162
if (combinations_t[r][s] == 1)
2164
for (unsigned int t = 0; t < 6; t++)
2166
for (unsigned int u = 0; u < 6; u++)
2168
for (unsigned int tu = 0; tu < 6; tu++)
2170
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
2171
}// end loop over 'tu'
2172
}// end loop over 'u'
2173
}// end loop over 't'
2176
}// end loop over 's'
2177
for (unsigned int s = 0; s < 6; s++)
2179
for (unsigned int t = 0; t < 6; t++)
2181
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
2182
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
2183
}// end loop over 't'
2184
}// end loop over 's'
2186
// Using contravariant Piola transform to map values back to the physical element.
2187
const double tmp_ref0 = derivatives[r];
2188
const double tmp_ref1 = derivatives[num_derivatives_t + r];
2189
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
2190
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
2191
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
2192
}// end loop over 'r'
2194
// Transform derivatives back to physical element
2195
for (unsigned int r = 0; r < num_derivatives_g; r++)
2197
for (unsigned int s = 0; s < num_derivatives_t; s++)
2199
values[r] += transform[r][s]*derivatives_p[s];
2200
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
2201
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
2202
}// end loop over 's'
2203
}// end loop over 'r'
2205
// Delete pointer to array of derivatives on FIAT element
2206
delete [] derivatives;
2208
// Delete pointer to array of reference derivatives on physical element.
2209
delete [] derivatives_p;
2211
// Delete pointer to array of combinations of derivatives and transform
2212
for (unsigned int r = 0; r < num_derivatives_t; r++)
2214
delete [] combinations_t[r];
2215
}// end loop over 'r'
2216
delete [] combinations_t;
2217
for (unsigned int r = 0; r < num_derivatives_g; r++)
2219
delete [] combinations_g[r];
2220
}// end loop over 'r'
2221
delete [] combinations_g;
2222
for (unsigned int r = 0; r < num_derivatives_g; r++)
2224
delete [] transform[r];
2225
}// end loop over 'r'
2226
delete [] transform;
2233
/// Evaluate order n derivatives of all basis functions at given point x in cell
2234
virtual void evaluate_basis_derivatives_all(std::size_t n,
2237
const double* vertex_coordinates,
2238
int cell_orientation) const
2240
// Compute number of derivatives.
2241
unsigned int num_derivatives_g = 1;
2242
for (unsigned int r = 0; r < n; r++)
2244
num_derivatives_g *= 3;
2245
}// end loop over 'r'
2247
// Helper variable to hold values of a single dof.
2248
double *dof_values = new double[3*num_derivatives_g];
2249
for (unsigned int r = 0; r < 3*num_derivatives_g; r++)
2251
dof_values[r] = 0.0;
2252
}// end loop over 'r'
2254
// Loop dofs and call evaluate_basis_derivatives.
2255
for (unsigned int r = 0; r < 8; r++)
2257
evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
2258
for (unsigned int s = 0; s < 3*num_derivatives_g; s++)
2260
values[r*3*num_derivatives_g + s] = dof_values[s];
2261
}// end loop over 's'
2262
}// end loop over 'r'
2265
delete [] dof_values;
2268
/// Evaluate linear functional for dof i on the function f
2269
virtual double evaluate_dof(std::size_t i,
2270
const ufc::function& f,
2271
const double* vertex_coordinates,
2272
int cell_orientation,
2273
const ufc::cell& c) const
2275
// Declare variables for result of evaluation
2278
// Declare variable for physical coordinates
2284
compute_jacobian_triangle_3d(J, vertex_coordinates);
2287
// Compute Jacobian inverse and determinant
2290
compute_jacobian_inverse_triangle_3d(K, detJ, J);
2294
// Check orientation
2295
if (cell_orientation == -1)
2296
throw std::runtime_error("cell orientation must be defined (not -1)");
2297
// (If cell_orientation == 1 = down, multiply det(J) by -1)
2298
else if (cell_orientation == 1)
2304
y[0] = 0.66666667*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
2305
y[1] = 0.66666667*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
2306
y[2] = 0.66666667*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
2307
f.evaluate(vals, y, c);
2308
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2])) + (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
2314
y[0] = 0.33333333*vertex_coordinates[3] + 0.66666667*vertex_coordinates[6];
2315
y[1] = 0.33333333*vertex_coordinates[4] + 0.66666667*vertex_coordinates[7];
2316
y[2] = 0.33333333*vertex_coordinates[5] + 0.66666667*vertex_coordinates[8];
2317
f.evaluate(vals, y, c);
2318
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2])) + (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
2324
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[6];
2325
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[7];
2326
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[8];
2327
f.evaluate(vals, y, c);
2328
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
2334
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[6];
2335
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[7];
2336
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[8];
2337
f.evaluate(vals, y, c);
2338
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
2344
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3];
2345
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4];
2346
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5];
2347
f.evaluate(vals, y, c);
2348
result = (-1.0)*(detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
2354
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[3];
2355
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[4];
2356
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[5];
2357
f.evaluate(vals, y, c);
2358
result = (-1.0)*(detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
2364
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
2365
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
2366
y[2] = 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
2367
f.evaluate(vals, y, c);
2368
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
2374
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
2375
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
2376
y[2] = 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
2377
f.evaluate(vals, y, c);
2378
result = (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
2387
/// Evaluate linear functionals for all dofs on the function f
2388
virtual void evaluate_dofs(double* values,
2389
const ufc::function& f,
2390
const double* vertex_coordinates,
2391
int cell_orientation,
2392
const ufc::cell& c) const
2394
// Declare variables for result of evaluation
2397
// Declare variable for physical coordinates
2403
compute_jacobian_triangle_3d(J, vertex_coordinates);
2406
// Compute Jacobian inverse and determinant
2409
compute_jacobian_inverse_triangle_3d(K, detJ, J);
2413
// Check orientation
2414
if (cell_orientation == -1)
2415
throw std::runtime_error("cell orientation must be defined (not -1)");
2416
// (If cell_orientation == 1 = down, multiply det(J) by -1)
2417
else if (cell_orientation == 1)
2419
y[0] = 0.66666667*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
2420
y[1] = 0.66666667*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
2421
y[2] = 0.66666667*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
2422
f.evaluate(vals, y, c);
2423
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2])) + (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
2425
y[0] = 0.33333333*vertex_coordinates[3] + 0.66666667*vertex_coordinates[6];
2426
y[1] = 0.33333333*vertex_coordinates[4] + 0.66666667*vertex_coordinates[7];
2427
y[2] = 0.33333333*vertex_coordinates[5] + 0.66666667*vertex_coordinates[8];
2428
f.evaluate(vals, y, c);
2429
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2])) + (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
2431
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[6];
2432
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[7];
2433
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[8];
2434
f.evaluate(vals, y, c);
2435
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
2437
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[6];
2438
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[7];
2439
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[8];
2440
f.evaluate(vals, y, c);
2441
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
2443
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3];
2444
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4];
2445
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5];
2446
f.evaluate(vals, y, c);
2447
result = (-1.0)*(detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
2449
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[3];
2450
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[4];
2451
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[5];
2452
f.evaluate(vals, y, c);
2453
result = (-1.0)*(detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
2455
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
2456
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
2457
y[2] = 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
2458
f.evaluate(vals, y, c);
2459
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
2461
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
2462
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
2463
y[2] = 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
2464
f.evaluate(vals, y, c);
2465
result = (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
2469
/// Interpolate vertex values from dof values
2470
virtual void interpolate_vertex_values(double* vertex_values,
2471
const double* dof_values,
2472
const double* vertex_coordinates,
2473
int cell_orientation,
2474
const ufc::cell& c) const
2478
compute_jacobian_triangle_3d(J, vertex_coordinates);
2481
// Compute Jacobian inverse and determinant
2484
compute_jacobian_inverse_triangle_3d(K, detJ, J);
2488
// Check orientation
2489
if (cell_orientation == -1)
2490
throw std::runtime_error("cell orientation must be defined (not -1)");
2491
// (If cell_orientation == 1 = down, multiply det(J) by -1)
2492
else if (cell_orientation == 1)
2495
// Evaluate function and change variables
2496
vertex_values[0] = dof_values[2]*(1.0/detJ)*J[0]*2.0 + dof_values[3]*((1.0/detJ)*(J[0]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[1]*(-2.0))) + dof_values[5]*(1.0/detJ)*J[1];
2497
vertex_values[2] = dof_values[0]*(1.0/detJ)*J[0]*2.0 + dof_values[1]*((1.0/detJ)*(J[0]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[0]*(-1.0) + J[1])) + dof_values[5]*((1.0/detJ)*(J[0]*2.0 + J[1]*(-2.0)));
2498
vertex_values[4] = dof_values[0]*((1.0/detJ)*(J[1]*(-1.0))) + dof_values[1]*(1.0/detJ)*J[1]*2.0 + dof_values[2]*((1.0/detJ)*(J[0]*(-1.0) + J[1])) + dof_values[3]*((1.0/detJ)*(J[0]*2.0 + J[1]*(-2.0)));
2499
vertex_values[1] = dof_values[2]*(1.0/detJ)*J[2]*2.0 + dof_values[3]*((1.0/detJ)*(J[2]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[3]*(-2.0))) + dof_values[5]*(1.0/detJ)*J[3];
2500
vertex_values[3] = dof_values[0]*(1.0/detJ)*J[2]*2.0 + dof_values[1]*((1.0/detJ)*(J[2]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[2]*(-1.0) + J[3])) + dof_values[5]*((1.0/detJ)*(J[2]*2.0 + J[3]*(-2.0)));
2501
vertex_values[5] = dof_values[0]*((1.0/detJ)*(J[3]*(-1.0))) + dof_values[1]*(1.0/detJ)*J[3]*2.0 + dof_values[2]*((1.0/detJ)*(J[2]*(-1.0) + J[3])) + dof_values[3]*((1.0/detJ)*(J[2]*2.0 + J[3]*(-2.0)));
2504
/// Map coordinate xhat from reference cell to coordinate x in cell
2505
virtual void map_from_reference_cell(double* x,
2507
const ufc::cell& c) const
2509
std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
2512
/// Map from coordinate x in cell to coordinate xhat in reference cell
2513
virtual void map_to_reference_cell(double* xhat,
2515
const ufc::cell& c) const
2517
std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
2520
/// Return the number of sub elements (for a mixed element)
2521
virtual std::size_t num_sub_elements() const
2526
/// Create a new finite element for sub element i (for a mixed element)
2527
virtual ufc::finite_element* create_sub_element(std::size_t i) const
2532
/// Create a new class instance
2533
virtual ufc::finite_element* create() const
2535
return new x_element9_finite_element_0();
2540
/// This class defines the interface for a finite element.
2542
class x_element9_finite_element_1: public ufc::finite_element
2547
x_element9_finite_element_1() : ufc::finite_element()
2553
virtual ~x_element9_finite_element_1()
2558
/// Return a string identifying the finite element
2559
virtual const char* signature() const
2561
return "FiniteElement('Brezzi-Douglas-Marini', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 1, None)";
2564
/// Return the cell shape
2565
virtual ufc::shape cell_shape() const
2567
return ufc::triangle;
2570
/// Return the topological dimension of the cell shape
2571
virtual std::size_t topological_dimension() const
2576
/// Return the geometric dimension of the cell shape
2577
virtual std::size_t geometric_dimension() const
2582
/// Return the dimension of the finite element function space
2583
virtual std::size_t space_dimension() const
2588
/// Return the rank of the value space
2589
virtual std::size_t value_rank() const
2594
/// Return the dimension of the value space for axis i
2595
virtual std::size_t value_dimension(std::size_t i) const
2609
/// Evaluate basis function i at given point x in cell
2610
virtual void evaluate_basis(std::size_t i,
2613
const double* vertex_coordinates,
2614
int cell_orientation) const
2618
compute_jacobian_triangle_3d(J, vertex_coordinates);
2620
// Compute Jacobian inverse and determinant
2623
compute_jacobian_inverse_triangle_3d(K, detJ, J);
2626
// Check orientation
2627
if (cell_orientation == -1)
2628
throw std::runtime_error("cell orientation must be defined (not -1)");
2629
// (If cell_orientation == 1 = down, multiply det(J) by -1)
2630
else if (cell_orientation == 1)
2634
const double b0 = vertex_coordinates[0];
2635
const double b1 = vertex_coordinates[1];
2636
const double b2 = vertex_coordinates[2];
2638
// P_FFC = J^dag (p - b), P_FIAT = 2*P_FFC - (1, 1)
2639
double X = 2*(K[0]*(x[0] - b0) + K[1]*(x[1] - b1) + K[2]*(x[2] - b2)) - 1.0;
2640
double Y = 2*(K[3]*(x[0] - b0) + K[4]*(x[1] - b1) + K[5]*(x[2] - b2)) - 1.0;
2651
// Array of basisvalues
2652
double basisvalues[3] = {0.0, 0.0, 0.0};
2654
// Declare helper variables
2655
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2657
// Compute basisvalues
2658
basisvalues[0] = 1.0;
2659
basisvalues[1] = tmp0;
2660
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
2661
basisvalues[0] *= std::sqrt(0.5);
2662
basisvalues[2] *= std::sqrt(1.0);
2663
basisvalues[1] *= std::sqrt(3.0);
2665
// Table(s) of coefficients
2666
static const double coefficients0[3] = \
2667
{0.94280904, 0.57735027, -0.33333333};
2669
static const double coefficients1[3] = \
2670
{-0.47140452, 0.0, -0.33333333};
2673
for (unsigned int r = 0; r < 3; r++)
2675
values[0] += coefficients0[r]*basisvalues[r];
2676
values[1] += coefficients1[r]*basisvalues[r];
2677
}// end loop over 'r'
2679
// Using contravariant Piola transform to map values back to the physical element
2680
const double tmp_ref0 = values[0];
2681
const double tmp_ref1 = values[1];
2682
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
2683
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
2684
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
2690
// Array of basisvalues
2691
double basisvalues[3] = {0.0, 0.0, 0.0};
2693
// Declare helper variables
2694
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2696
// Compute basisvalues
2697
basisvalues[0] = 1.0;
2698
basisvalues[1] = tmp0;
2699
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
2700
basisvalues[0] *= std::sqrt(0.5);
2701
basisvalues[2] *= std::sqrt(1.0);
2702
basisvalues[1] *= std::sqrt(3.0);
2704
// Table(s) of coefficients
2705
static const double coefficients0[3] = \
2706
{-0.47140452, -0.28867513, 0.16666667};
2708
static const double coefficients1[3] = \
2709
{0.94280904, 0.0, 0.66666667};
2712
for (unsigned int r = 0; r < 3; r++)
2714
values[0] += coefficients0[r]*basisvalues[r];
2715
values[1] += coefficients1[r]*basisvalues[r];
2716
}// end loop over 'r'
2718
// Using contravariant Piola transform to map values back to the physical element
2719
const double tmp_ref0 = values[0];
2720
const double tmp_ref1 = values[1];
2721
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
2722
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
2723
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
2729
// Array of basisvalues
2730
double basisvalues[3] = {0.0, 0.0, 0.0};
2732
// Declare helper variables
2733
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2735
// Compute basisvalues
2736
basisvalues[0] = 1.0;
2737
basisvalues[1] = tmp0;
2738
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
2739
basisvalues[0] *= std::sqrt(0.5);
2740
basisvalues[2] *= std::sqrt(1.0);
2741
basisvalues[1] *= std::sqrt(3.0);
2743
// Table(s) of coefficients
2744
static const double coefficients0[3] = \
2745
{0.47140452, -0.57735027, -0.66666667};
2747
static const double coefficients1[3] = \
2748
{0.47140452, 0.0, 0.33333333};
2751
for (unsigned int r = 0; r < 3; r++)
2753
values[0] += coefficients0[r]*basisvalues[r];
2754
values[1] += coefficients1[r]*basisvalues[r];
2755
}// end loop over 'r'
2757
// Using contravariant Piola transform to map values back to the physical element
2758
const double tmp_ref0 = values[0];
2759
const double tmp_ref1 = values[1];
2760
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
2761
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
2762
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
2768
// Array of basisvalues
2769
double basisvalues[3] = {0.0, 0.0, 0.0};
2771
// Declare helper variables
2772
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2774
// Compute basisvalues
2775
basisvalues[0] = 1.0;
2776
basisvalues[1] = tmp0;
2777
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
2778
basisvalues[0] *= std::sqrt(0.5);
2779
basisvalues[2] *= std::sqrt(1.0);
2780
basisvalues[1] *= std::sqrt(3.0);
2782
// Table(s) of coefficients
2783
static const double coefficients0[3] = \
2784
{0.47140452, 0.28867513, 0.83333333};
2786
static const double coefficients1[3] = \
2787
{-0.94280904, 0.0, -0.66666667};
2790
for (unsigned int r = 0; r < 3; r++)
2792
values[0] += coefficients0[r]*basisvalues[r];
2793
values[1] += coefficients1[r]*basisvalues[r];
2794
}// end loop over 'r'
2796
// Using contravariant Piola transform to map values back to the physical element
2797
const double tmp_ref0 = values[0];
2798
const double tmp_ref1 = values[1];
2799
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
2800
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
2801
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
2807
// Array of basisvalues
2808
double basisvalues[3] = {0.0, 0.0, 0.0};
2810
// Declare helper variables
2811
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2813
// Compute basisvalues
2814
basisvalues[0] = 1.0;
2815
basisvalues[1] = tmp0;
2816
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
2817
basisvalues[0] *= std::sqrt(0.5);
2818
basisvalues[2] *= std::sqrt(1.0);
2819
basisvalues[1] *= std::sqrt(3.0);
2821
// Table(s) of coefficients
2822
static const double coefficients0[3] = \
2823
{-0.47140452, -0.28867513, 0.16666667};
2825
static const double coefficients1[3] = \
2826
{-0.47140452, 0.8660254, 0.16666667};
2829
for (unsigned int r = 0; r < 3; r++)
2831
values[0] += coefficients0[r]*basisvalues[r];
2832
values[1] += coefficients1[r]*basisvalues[r];
2833
}// end loop over 'r'
2835
// Using contravariant Piola transform to map values back to the physical element
2836
const double tmp_ref0 = values[0];
2837
const double tmp_ref1 = values[1];
2838
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
2839
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
2840
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
2846
// Array of basisvalues
2847
double basisvalues[3] = {0.0, 0.0, 0.0};
2849
// Declare helper variables
2850
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
2852
// Compute basisvalues
2853
basisvalues[0] = 1.0;
2854
basisvalues[1] = tmp0;
2855
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
2856
basisvalues[0] *= std::sqrt(0.5);
2857
basisvalues[2] *= std::sqrt(1.0);
2858
basisvalues[1] *= std::sqrt(3.0);
2860
// Table(s) of coefficients
2861
static const double coefficients0[3] = \
2862
{0.94280904, 0.57735027, -0.33333333};
2864
static const double coefficients1[3] = \
2865
{-0.47140452, -0.8660254, 0.16666667};
2868
for (unsigned int r = 0; r < 3; r++)
2870
values[0] += coefficients0[r]*basisvalues[r];
2871
values[1] += coefficients1[r]*basisvalues[r];
2872
}// end loop over 'r'
2874
// Using contravariant Piola transform to map values back to the physical element
2875
const double tmp_ref0 = values[0];
2876
const double tmp_ref1 = values[1];
2877
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
2878
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
2879
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
2886
/// Evaluate all basis functions at given point x in cell
2887
virtual void evaluate_basis_all(double* values,
2889
const double* vertex_coordinates,
2890
int cell_orientation) const
2892
// Helper variable to hold values of a single dof.
2893
double dof_values[3] = {0.0, 0.0, 0.0};
2895
// Loop dofs and call evaluate_basis
2896
for (unsigned int r = 0; r < 6; r++)
2898
evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
2899
for (unsigned int s = 0; s < 3; s++)
2901
values[r*3 + s] = dof_values[s];
2902
}// end loop over 's'
2903
}// end loop over 'r'
2906
/// Evaluate order n derivatives of basis function i at given point x in cell
2907
virtual void evaluate_basis_derivatives(std::size_t i,
2911
const double* vertex_coordinates,
2912
int cell_orientation) const
2916
compute_jacobian_triangle_3d(J, vertex_coordinates);
2918
// Compute Jacobian inverse and determinant
2921
compute_jacobian_inverse_triangle_3d(K, detJ, J);
2924
// Check orientation
2925
if (cell_orientation == -1)
2926
throw std::runtime_error("cell orientation must be defined (not -1)");
2927
// (If cell_orientation == 1 = down, multiply det(J) by -1)
2928
else if (cell_orientation == 1)
2932
const double b0 = vertex_coordinates[0];
2933
const double b1 = vertex_coordinates[1];
2934
const double b2 = vertex_coordinates[2];
2936
// P_FFC = J^dag (p - b), P_FIAT = 2*P_FFC - (1, 1)
2937
double X = 2*(K[0]*(x[0] - b0) + K[1]*(x[1] - b1) + K[2]*(x[2] - b2)) - 1.0;
2938
double Y = 2*(K[3]*(x[0] - b0) + K[4]*(x[1] - b1) + K[5]*(x[2] - b2)) - 1.0;
2941
// Compute number of derivatives.
2942
unsigned int num_derivatives_t = 1;
2943
for (unsigned int r = 0; r < n; r++)
2945
num_derivatives_t *= 2;
2946
}// end loop over 'r'
2948
// Compute number of derivatives.
2949
unsigned int num_derivatives_g = 1;
2950
for (unsigned int r = 0; r < n; r++)
2952
num_derivatives_g *= 3;
2953
}// end loop over 'r'
2955
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
2956
unsigned int **combinations_t = new unsigned int *[num_derivatives_t];
2957
for (unsigned int row = 0; row < num_derivatives_t; row++)
2959
combinations_t[row] = new unsigned int [n];
2960
for (unsigned int col = 0; col < n; col++)
2961
combinations_t[row][col] = 0;
2964
// Generate combinations of derivatives
2965
for (unsigned int row = 1; row < num_derivatives_t; row++)
2967
for (unsigned int num = 0; num < row; num++)
2969
for (unsigned int col = n-1; col+1 > 0; col--)
2971
if (combinations_t[row][col] + 1 > 1)
2972
combinations_t[row][col] = 0;
2975
combinations_t[row][col] += 1;
2982
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
2983
unsigned int **combinations_g = new unsigned int *[num_derivatives_g];
2984
for (unsigned int row = 0; row < num_derivatives_g; row++)
2986
combinations_g[row] = new unsigned int [n];
2987
for (unsigned int col = 0; col < n; col++)
2988
combinations_g[row][col] = 0;
2991
// Generate combinations of derivatives
2992
for (unsigned int row = 1; row < num_derivatives_g; row++)
2994
for (unsigned int num = 0; num < row; num++)
2996
for (unsigned int col = n-1; col+1 > 0; col--)
2998
if (combinations_g[row][col] + 1 > 2)
2999
combinations_g[row][col] = 0;
3002
combinations_g[row][col] += 1;
3009
// Compute inverse of Jacobian
3010
const double Jinv[2][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}};
3012
// Declare transformation matrix
3013
// Declare pointer to two dimensional array and initialise
3014
double **transform = new double *[num_derivatives_g];
3016
for (unsigned int j = 0; j < num_derivatives_g; j++)
3018
transform[j] = new double [num_derivatives_t];
3019
for (unsigned int k = 0; k < num_derivatives_t; k++)
3020
transform[j][k] = 1;
3023
// Construct transformation matrix
3024
for (unsigned int row = 0; row < num_derivatives_g; row++)
3026
for (unsigned int col = 0; col < num_derivatives_t; col++)
3028
for (unsigned int k = 0; k < n; k++)
3029
transform[row][col] *= Jinv[combinations_t[col][k]][combinations_g[row][k]];
3033
// Reset values. Assuming that values is always an array.
3034
for (unsigned int r = 0; r < 3*num_derivatives_g; r++)
3037
}// end loop over 'r'
3044
// Array of basisvalues
3045
double basisvalues[3] = {0.0, 0.0, 0.0};
3047
// Declare helper variables
3048
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
3050
// Compute basisvalues
3051
basisvalues[0] = 1.0;
3052
basisvalues[1] = tmp0;
3053
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
3054
basisvalues[0] *= std::sqrt(0.5);
3055
basisvalues[2] *= std::sqrt(1.0);
3056
basisvalues[1] *= std::sqrt(3.0);
3058
// Table(s) of coefficients
3059
static const double coefficients0[3] = \
3060
{0.94280904, 0.57735027, -0.33333333};
3062
static const double coefficients1[3] = \
3063
{-0.47140452, 0.0, -0.33333333};
3065
// Tables of derivatives of the polynomial base (transpose).
3066
static const double dmats0[3][3] = \
3068
{4.8989795, 0.0, 0.0},
3071
static const double dmats1[3][3] = \
3073
{2.4494897, 0.0, 0.0},
3074
{4.2426407, 0.0, 0.0}};
3076
// Compute reference derivatives.
3077
// Declare pointer to array of derivatives on FIAT element.
3078
double *derivatives = new double[2*num_derivatives_t];
3079
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
3081
derivatives[r] = 0.0;
3082
}// end loop over 'r'
3084
// Declare pointer to array of reference derivatives on physical element.
3085
double *derivatives_p = new double[3*num_derivatives_t];
3086
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
3088
derivatives_p[r] = 0.0;
3089
}// end loop over 'r'
3091
// Declare derivative matrix (of polynomial basis).
3092
double dmats[3][3] = \
3097
// Declare (auxiliary) derivative matrix (of polynomial basis).
3098
double dmats_old[3][3] = \
3103
// Loop possible derivatives.
3104
for (unsigned int r = 0; r < num_derivatives_t; r++)
3106
// Resetting dmats values to compute next derivative.
3107
for (unsigned int t = 0; t < 3; t++)
3109
for (unsigned int u = 0; u < 3; u++)
3117
}// end loop over 'u'
3118
}// end loop over 't'
3120
// Looping derivative order to generate dmats.
3121
for (unsigned int s = 0; s < n; s++)
3123
// Updating dmats_old with new values and resetting dmats.
3124
for (unsigned int t = 0; t < 3; t++)
3126
for (unsigned int u = 0; u < 3; u++)
3128
dmats_old[t][u] = dmats[t][u];
3130
}// end loop over 'u'
3131
}// end loop over 't'
3133
// Update dmats using an inner product.
3134
if (combinations_t[r][s] == 0)
3136
for (unsigned int t = 0; t < 3; t++)
3138
for (unsigned int u = 0; u < 3; u++)
3140
for (unsigned int tu = 0; tu < 3; tu++)
3142
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
3143
}// end loop over 'tu'
3144
}// end loop over 'u'
3145
}// end loop over 't'
3148
if (combinations_t[r][s] == 1)
3150
for (unsigned int t = 0; t < 3; t++)
3152
for (unsigned int u = 0; u < 3; u++)
3154
for (unsigned int tu = 0; tu < 3; tu++)
3156
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
3157
}// end loop over 'tu'
3158
}// end loop over 'u'
3159
}// end loop over 't'
3162
}// end loop over 's'
3163
for (unsigned int s = 0; s < 3; s++)
3165
for (unsigned int t = 0; t < 3; t++)
3167
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
3168
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
3169
}// end loop over 't'
3170
}// end loop over 's'
3172
// Using contravariant Piola transform to map values back to the physical element.
3173
const double tmp_ref0 = derivatives[r];
3174
const double tmp_ref1 = derivatives[num_derivatives_t + r];
3175
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
3176
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
3177
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
3178
}// end loop over 'r'
3180
// Transform derivatives back to physical element
3181
for (unsigned int r = 0; r < num_derivatives_g; r++)
3183
for (unsigned int s = 0; s < num_derivatives_t; s++)
3185
values[r] += transform[r][s]*derivatives_p[s];
3186
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
3187
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
3188
}// end loop over 's'
3189
}// end loop over 'r'
3191
// Delete pointer to array of derivatives on FIAT element
3192
delete [] derivatives;
3194
// Delete pointer to array of reference derivatives on physical element.
3195
delete [] derivatives_p;
3197
// Delete pointer to array of combinations of derivatives and transform
3198
for (unsigned int r = 0; r < num_derivatives_t; r++)
3200
delete [] combinations_t[r];
3201
}// end loop over 'r'
3202
delete [] combinations_t;
3203
for (unsigned int r = 0; r < num_derivatives_g; r++)
3205
delete [] combinations_g[r];
3206
}// end loop over 'r'
3207
delete [] combinations_g;
3208
for (unsigned int r = 0; r < num_derivatives_g; r++)
3210
delete [] transform[r];
3211
}// end loop over 'r'
3212
delete [] transform;
3218
// Array of basisvalues
3219
double basisvalues[3] = {0.0, 0.0, 0.0};
3221
// Declare helper variables
3222
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
3224
// Compute basisvalues
3225
basisvalues[0] = 1.0;
3226
basisvalues[1] = tmp0;
3227
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
3228
basisvalues[0] *= std::sqrt(0.5);
3229
basisvalues[2] *= std::sqrt(1.0);
3230
basisvalues[1] *= std::sqrt(3.0);
3232
// Table(s) of coefficients
3233
static const double coefficients0[3] = \
3234
{-0.47140452, -0.28867513, 0.16666667};
3236
static const double coefficients1[3] = \
3237
{0.94280904, 0.0, 0.66666667};
3239
// Tables of derivatives of the polynomial base (transpose).
3240
static const double dmats0[3][3] = \
3242
{4.8989795, 0.0, 0.0},
3245
static const double dmats1[3][3] = \
3247
{2.4494897, 0.0, 0.0},
3248
{4.2426407, 0.0, 0.0}};
3250
// Compute reference derivatives.
3251
// Declare pointer to array of derivatives on FIAT element.
3252
double *derivatives = new double[2*num_derivatives_t];
3253
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
3255
derivatives[r] = 0.0;
3256
}// end loop over 'r'
3258
// Declare pointer to array of reference derivatives on physical element.
3259
double *derivatives_p = new double[3*num_derivatives_t];
3260
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
3262
derivatives_p[r] = 0.0;
3263
}// end loop over 'r'
3265
// Declare derivative matrix (of polynomial basis).
3266
double dmats[3][3] = \
3271
// Declare (auxiliary) derivative matrix (of polynomial basis).
3272
double dmats_old[3][3] = \
3277
// Loop possible derivatives.
3278
for (unsigned int r = 0; r < num_derivatives_t; r++)
3280
// Resetting dmats values to compute next derivative.
3281
for (unsigned int t = 0; t < 3; t++)
3283
for (unsigned int u = 0; u < 3; u++)
3291
}// end loop over 'u'
3292
}// end loop over 't'
3294
// Looping derivative order to generate dmats.
3295
for (unsigned int s = 0; s < n; s++)
3297
// Updating dmats_old with new values and resetting dmats.
3298
for (unsigned int t = 0; t < 3; t++)
3300
for (unsigned int u = 0; u < 3; u++)
3302
dmats_old[t][u] = dmats[t][u];
3304
}// end loop over 'u'
3305
}// end loop over 't'
3307
// Update dmats using an inner product.
3308
if (combinations_t[r][s] == 0)
3310
for (unsigned int t = 0; t < 3; t++)
3312
for (unsigned int u = 0; u < 3; u++)
3314
for (unsigned int tu = 0; tu < 3; tu++)
3316
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
3317
}// end loop over 'tu'
3318
}// end loop over 'u'
3319
}// end loop over 't'
3322
if (combinations_t[r][s] == 1)
3324
for (unsigned int t = 0; t < 3; t++)
3326
for (unsigned int u = 0; u < 3; u++)
3328
for (unsigned int tu = 0; tu < 3; tu++)
3330
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
3331
}// end loop over 'tu'
3332
}// end loop over 'u'
3333
}// end loop over 't'
3336
}// end loop over 's'
3337
for (unsigned int s = 0; s < 3; s++)
3339
for (unsigned int t = 0; t < 3; t++)
3341
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
3342
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
3343
}// end loop over 't'
3344
}// end loop over 's'
3346
// Using contravariant Piola transform to map values back to the physical element.
3347
const double tmp_ref0 = derivatives[r];
3348
const double tmp_ref1 = derivatives[num_derivatives_t + r];
3349
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
3350
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
3351
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
3352
}// end loop over 'r'
3354
// Transform derivatives back to physical element
3355
for (unsigned int r = 0; r < num_derivatives_g; r++)
3357
for (unsigned int s = 0; s < num_derivatives_t; s++)
3359
values[r] += transform[r][s]*derivatives_p[s];
3360
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
3361
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
3362
}// end loop over 's'
3363
}// end loop over 'r'
3365
// Delete pointer to array of derivatives on FIAT element
3366
delete [] derivatives;
3368
// Delete pointer to array of reference derivatives on physical element.
3369
delete [] derivatives_p;
3371
// Delete pointer to array of combinations of derivatives and transform
3372
for (unsigned int r = 0; r < num_derivatives_t; r++)
3374
delete [] combinations_t[r];
3375
}// end loop over 'r'
3376
delete [] combinations_t;
3377
for (unsigned int r = 0; r < num_derivatives_g; r++)
3379
delete [] combinations_g[r];
3380
}// end loop over 'r'
3381
delete [] combinations_g;
3382
for (unsigned int r = 0; r < num_derivatives_g; r++)
3384
delete [] transform[r];
3385
}// end loop over 'r'
3386
delete [] transform;
3392
// Array of basisvalues
3393
double basisvalues[3] = {0.0, 0.0, 0.0};
3395
// Declare helper variables
3396
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
3398
// Compute basisvalues
3399
basisvalues[0] = 1.0;
3400
basisvalues[1] = tmp0;
3401
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
3402
basisvalues[0] *= std::sqrt(0.5);
3403
basisvalues[2] *= std::sqrt(1.0);
3404
basisvalues[1] *= std::sqrt(3.0);
3406
// Table(s) of coefficients
3407
static const double coefficients0[3] = \
3408
{0.47140452, -0.57735027, -0.66666667};
3410
static const double coefficients1[3] = \
3411
{0.47140452, 0.0, 0.33333333};
3413
// Tables of derivatives of the polynomial base (transpose).
3414
static const double dmats0[3][3] = \
3416
{4.8989795, 0.0, 0.0},
3419
static const double dmats1[3][3] = \
3421
{2.4494897, 0.0, 0.0},
3422
{4.2426407, 0.0, 0.0}};
3424
// Compute reference derivatives.
3425
// Declare pointer to array of derivatives on FIAT element.
3426
double *derivatives = new double[2*num_derivatives_t];
3427
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
3429
derivatives[r] = 0.0;
3430
}// end loop over 'r'
3432
// Declare pointer to array of reference derivatives on physical element.
3433
double *derivatives_p = new double[3*num_derivatives_t];
3434
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
3436
derivatives_p[r] = 0.0;
3437
}// end loop over 'r'
3439
// Declare derivative matrix (of polynomial basis).
3440
double dmats[3][3] = \
3445
// Declare (auxiliary) derivative matrix (of polynomial basis).
3446
double dmats_old[3][3] = \
3451
// Loop possible derivatives.
3452
for (unsigned int r = 0; r < num_derivatives_t; r++)
3454
// Resetting dmats values to compute next derivative.
3455
for (unsigned int t = 0; t < 3; t++)
3457
for (unsigned int u = 0; u < 3; u++)
3465
}// end loop over 'u'
3466
}// end loop over 't'
3468
// Looping derivative order to generate dmats.
3469
for (unsigned int s = 0; s < n; s++)
3471
// Updating dmats_old with new values and resetting dmats.
3472
for (unsigned int t = 0; t < 3; t++)
3474
for (unsigned int u = 0; u < 3; u++)
3476
dmats_old[t][u] = dmats[t][u];
3478
}// end loop over 'u'
3479
}// end loop over 't'
3481
// Update dmats using an inner product.
3482
if (combinations_t[r][s] == 0)
3484
for (unsigned int t = 0; t < 3; t++)
3486
for (unsigned int u = 0; u < 3; u++)
3488
for (unsigned int tu = 0; tu < 3; tu++)
3490
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
3491
}// end loop over 'tu'
3492
}// end loop over 'u'
3493
}// end loop over 't'
3496
if (combinations_t[r][s] == 1)
3498
for (unsigned int t = 0; t < 3; t++)
3500
for (unsigned int u = 0; u < 3; u++)
3502
for (unsigned int tu = 0; tu < 3; tu++)
3504
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
3505
}// end loop over 'tu'
3506
}// end loop over 'u'
3507
}// end loop over 't'
3510
}// end loop over 's'
3511
for (unsigned int s = 0; s < 3; s++)
3513
for (unsigned int t = 0; t < 3; t++)
3515
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
3516
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
3517
}// end loop over 't'
3518
}// end loop over 's'
3520
// Using contravariant Piola transform to map values back to the physical element.
3521
const double tmp_ref0 = derivatives[r];
3522
const double tmp_ref1 = derivatives[num_derivatives_t + r];
3523
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
3524
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
3525
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
3526
}// end loop over 'r'
3528
// Transform derivatives back to physical element
3529
for (unsigned int r = 0; r < num_derivatives_g; r++)
3531
for (unsigned int s = 0; s < num_derivatives_t; s++)
3533
values[r] += transform[r][s]*derivatives_p[s];
3534
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
3535
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
3536
}// end loop over 's'
3537
}// end loop over 'r'
3539
// Delete pointer to array of derivatives on FIAT element
3540
delete [] derivatives;
3542
// Delete pointer to array of reference derivatives on physical element.
3543
delete [] derivatives_p;
3545
// Delete pointer to array of combinations of derivatives and transform
3546
for (unsigned int r = 0; r < num_derivatives_t; r++)
3548
delete [] combinations_t[r];
3549
}// end loop over 'r'
3550
delete [] combinations_t;
3551
for (unsigned int r = 0; r < num_derivatives_g; r++)
3553
delete [] combinations_g[r];
3554
}// end loop over 'r'
3555
delete [] combinations_g;
3556
for (unsigned int r = 0; r < num_derivatives_g; r++)
3558
delete [] transform[r];
3559
}// end loop over 'r'
3560
delete [] transform;
3566
// Array of basisvalues
3567
double basisvalues[3] = {0.0, 0.0, 0.0};
3569
// Declare helper variables
3570
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
3572
// Compute basisvalues
3573
basisvalues[0] = 1.0;
3574
basisvalues[1] = tmp0;
3575
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
3576
basisvalues[0] *= std::sqrt(0.5);
3577
basisvalues[2] *= std::sqrt(1.0);
3578
basisvalues[1] *= std::sqrt(3.0);
3580
// Table(s) of coefficients
3581
static const double coefficients0[3] = \
3582
{0.47140452, 0.28867513, 0.83333333};
3584
static const double coefficients1[3] = \
3585
{-0.94280904, 0.0, -0.66666667};
3587
// Tables of derivatives of the polynomial base (transpose).
3588
static const double dmats0[3][3] = \
3590
{4.8989795, 0.0, 0.0},
3593
static const double dmats1[3][3] = \
3595
{2.4494897, 0.0, 0.0},
3596
{4.2426407, 0.0, 0.0}};
3598
// Compute reference derivatives.
3599
// Declare pointer to array of derivatives on FIAT element.
3600
double *derivatives = new double[2*num_derivatives_t];
3601
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
3603
derivatives[r] = 0.0;
3604
}// end loop over 'r'
3606
// Declare pointer to array of reference derivatives on physical element.
3607
double *derivatives_p = new double[3*num_derivatives_t];
3608
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
3610
derivatives_p[r] = 0.0;
3611
}// end loop over 'r'
3613
// Declare derivative matrix (of polynomial basis).
3614
double dmats[3][3] = \
3619
// Declare (auxiliary) derivative matrix (of polynomial basis).
3620
double dmats_old[3][3] = \
3625
// Loop possible derivatives.
3626
for (unsigned int r = 0; r < num_derivatives_t; r++)
3628
// Resetting dmats values to compute next derivative.
3629
for (unsigned int t = 0; t < 3; t++)
3631
for (unsigned int u = 0; u < 3; u++)
3639
}// end loop over 'u'
3640
}// end loop over 't'
3642
// Looping derivative order to generate dmats.
3643
for (unsigned int s = 0; s < n; s++)
3645
// Updating dmats_old with new values and resetting dmats.
3646
for (unsigned int t = 0; t < 3; t++)
3648
for (unsigned int u = 0; u < 3; u++)
3650
dmats_old[t][u] = dmats[t][u];
3652
}// end loop over 'u'
3653
}// end loop over 't'
3655
// Update dmats using an inner product.
3656
if (combinations_t[r][s] == 0)
3658
for (unsigned int t = 0; t < 3; t++)
3660
for (unsigned int u = 0; u < 3; u++)
3662
for (unsigned int tu = 0; tu < 3; tu++)
3664
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
3665
}// end loop over 'tu'
3666
}// end loop over 'u'
3667
}// end loop over 't'
3670
if (combinations_t[r][s] == 1)
3672
for (unsigned int t = 0; t < 3; t++)
3674
for (unsigned int u = 0; u < 3; u++)
3676
for (unsigned int tu = 0; tu < 3; tu++)
3678
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
3679
}// end loop over 'tu'
3680
}// end loop over 'u'
3681
}// end loop over 't'
3684
}// end loop over 's'
3685
for (unsigned int s = 0; s < 3; s++)
3687
for (unsigned int t = 0; t < 3; t++)
3689
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
3690
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
3691
}// end loop over 't'
3692
}// end loop over 's'
3694
// Using contravariant Piola transform to map values back to the physical element.
3695
const double tmp_ref0 = derivatives[r];
3696
const double tmp_ref1 = derivatives[num_derivatives_t + r];
3697
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
3698
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
3699
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
3700
}// end loop over 'r'
3702
// Transform derivatives back to physical element
3703
for (unsigned int r = 0; r < num_derivatives_g; r++)
3705
for (unsigned int s = 0; s < num_derivatives_t; s++)
3707
values[r] += transform[r][s]*derivatives_p[s];
3708
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
3709
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
3710
}// end loop over 's'
3711
}// end loop over 'r'
3713
// Delete pointer to array of derivatives on FIAT element
3714
delete [] derivatives;
3716
// Delete pointer to array of reference derivatives on physical element.
3717
delete [] derivatives_p;
3719
// Delete pointer to array of combinations of derivatives and transform
3720
for (unsigned int r = 0; r < num_derivatives_t; r++)
3722
delete [] combinations_t[r];
3723
}// end loop over 'r'
3724
delete [] combinations_t;
3725
for (unsigned int r = 0; r < num_derivatives_g; r++)
3727
delete [] combinations_g[r];
3728
}// end loop over 'r'
3729
delete [] combinations_g;
3730
for (unsigned int r = 0; r < num_derivatives_g; r++)
3732
delete [] transform[r];
3733
}// end loop over 'r'
3734
delete [] transform;
3740
// Array of basisvalues
3741
double basisvalues[3] = {0.0, 0.0, 0.0};
3743
// Declare helper variables
3744
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
3746
// Compute basisvalues
3747
basisvalues[0] = 1.0;
3748
basisvalues[1] = tmp0;
3749
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
3750
basisvalues[0] *= std::sqrt(0.5);
3751
basisvalues[2] *= std::sqrt(1.0);
3752
basisvalues[1] *= std::sqrt(3.0);
3754
// Table(s) of coefficients
3755
static const double coefficients0[3] = \
3756
{-0.47140452, -0.28867513, 0.16666667};
3758
static const double coefficients1[3] = \
3759
{-0.47140452, 0.8660254, 0.16666667};
3761
// Tables of derivatives of the polynomial base (transpose).
3762
static const double dmats0[3][3] = \
3764
{4.8989795, 0.0, 0.0},
3767
static const double dmats1[3][3] = \
3769
{2.4494897, 0.0, 0.0},
3770
{4.2426407, 0.0, 0.0}};
3772
// Compute reference derivatives.
3773
// Declare pointer to array of derivatives on FIAT element.
3774
double *derivatives = new double[2*num_derivatives_t];
3775
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
3777
derivatives[r] = 0.0;
3778
}// end loop over 'r'
3780
// Declare pointer to array of reference derivatives on physical element.
3781
double *derivatives_p = new double[3*num_derivatives_t];
3782
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
3784
derivatives_p[r] = 0.0;
3785
}// end loop over 'r'
3787
// Declare derivative matrix (of polynomial basis).
3788
double dmats[3][3] = \
3793
// Declare (auxiliary) derivative matrix (of polynomial basis).
3794
double dmats_old[3][3] = \
3799
// Loop possible derivatives.
3800
for (unsigned int r = 0; r < num_derivatives_t; r++)
3802
// Resetting dmats values to compute next derivative.
3803
for (unsigned int t = 0; t < 3; t++)
3805
for (unsigned int u = 0; u < 3; u++)
3813
}// end loop over 'u'
3814
}// end loop over 't'
3816
// Looping derivative order to generate dmats.
3817
for (unsigned int s = 0; s < n; s++)
3819
// Updating dmats_old with new values and resetting dmats.
3820
for (unsigned int t = 0; t < 3; t++)
3822
for (unsigned int u = 0; u < 3; u++)
3824
dmats_old[t][u] = dmats[t][u];
3826
}// end loop over 'u'
3827
}// end loop over 't'
3829
// Update dmats using an inner product.
3830
if (combinations_t[r][s] == 0)
3832
for (unsigned int t = 0; t < 3; t++)
3834
for (unsigned int u = 0; u < 3; u++)
3836
for (unsigned int tu = 0; tu < 3; tu++)
3838
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
3839
}// end loop over 'tu'
3840
}// end loop over 'u'
3841
}// end loop over 't'
3844
if (combinations_t[r][s] == 1)
3846
for (unsigned int t = 0; t < 3; t++)
3848
for (unsigned int u = 0; u < 3; u++)
3850
for (unsigned int tu = 0; tu < 3; tu++)
3852
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
3853
}// end loop over 'tu'
3854
}// end loop over 'u'
3855
}// end loop over 't'
3858
}// end loop over 's'
3859
for (unsigned int s = 0; s < 3; s++)
3861
for (unsigned int t = 0; t < 3; t++)
3863
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
3864
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
3865
}// end loop over 't'
3866
}// end loop over 's'
3868
// Using contravariant Piola transform to map values back to the physical element.
3869
const double tmp_ref0 = derivatives[r];
3870
const double tmp_ref1 = derivatives[num_derivatives_t + r];
3871
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
3872
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
3873
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
3874
}// end loop over 'r'
3876
// Transform derivatives back to physical element
3877
for (unsigned int r = 0; r < num_derivatives_g; r++)
3879
for (unsigned int s = 0; s < num_derivatives_t; s++)
3881
values[r] += transform[r][s]*derivatives_p[s];
3882
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
3883
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
3884
}// end loop over 's'
3885
}// end loop over 'r'
3887
// Delete pointer to array of derivatives on FIAT element
3888
delete [] derivatives;
3890
// Delete pointer to array of reference derivatives on physical element.
3891
delete [] derivatives_p;
3893
// Delete pointer to array of combinations of derivatives and transform
3894
for (unsigned int r = 0; r < num_derivatives_t; r++)
3896
delete [] combinations_t[r];
3897
}// end loop over 'r'
3898
delete [] combinations_t;
3899
for (unsigned int r = 0; r < num_derivatives_g; r++)
3901
delete [] combinations_g[r];
3902
}// end loop over 'r'
3903
delete [] combinations_g;
3904
for (unsigned int r = 0; r < num_derivatives_g; r++)
3906
delete [] transform[r];
3907
}// end loop over 'r'
3908
delete [] transform;
3914
// Array of basisvalues
3915
double basisvalues[3] = {0.0, 0.0, 0.0};
3917
// Declare helper variables
3918
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
3920
// Compute basisvalues
3921
basisvalues[0] = 1.0;
3922
basisvalues[1] = tmp0;
3923
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
3924
basisvalues[0] *= std::sqrt(0.5);
3925
basisvalues[2] *= std::sqrt(1.0);
3926
basisvalues[1] *= std::sqrt(3.0);
3928
// Table(s) of coefficients
3929
static const double coefficients0[3] = \
3930
{0.94280904, 0.57735027, -0.33333333};
3932
static const double coefficients1[3] = \
3933
{-0.47140452, -0.8660254, 0.16666667};
3935
// Tables of derivatives of the polynomial base (transpose).
3936
static const double dmats0[3][3] = \
3938
{4.8989795, 0.0, 0.0},
3941
static const double dmats1[3][3] = \
3943
{2.4494897, 0.0, 0.0},
3944
{4.2426407, 0.0, 0.0}};
3946
// Compute reference derivatives.
3947
// Declare pointer to array of derivatives on FIAT element.
3948
double *derivatives = new double[2*num_derivatives_t];
3949
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
3951
derivatives[r] = 0.0;
3952
}// end loop over 'r'
3954
// Declare pointer to array of reference derivatives on physical element.
3955
double *derivatives_p = new double[3*num_derivatives_t];
3956
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
3958
derivatives_p[r] = 0.0;
3959
}// end loop over 'r'
3961
// Declare derivative matrix (of polynomial basis).
3962
double dmats[3][3] = \
3967
// Declare (auxiliary) derivative matrix (of polynomial basis).
3968
double dmats_old[3][3] = \
3973
// Loop possible derivatives.
3974
for (unsigned int r = 0; r < num_derivatives_t; r++)
3976
// Resetting dmats values to compute next derivative.
3977
for (unsigned int t = 0; t < 3; t++)
3979
for (unsigned int u = 0; u < 3; u++)
3987
}// end loop over 'u'
3988
}// end loop over 't'
3990
// Looping derivative order to generate dmats.
3991
for (unsigned int s = 0; s < n; s++)
3993
// Updating dmats_old with new values and resetting dmats.
3994
for (unsigned int t = 0; t < 3; t++)
3996
for (unsigned int u = 0; u < 3; u++)
3998
dmats_old[t][u] = dmats[t][u];
4000
}// end loop over 'u'
4001
}// end loop over 't'
4003
// Update dmats using an inner product.
4004
if (combinations_t[r][s] == 0)
4006
for (unsigned int t = 0; t < 3; t++)
4008
for (unsigned int u = 0; u < 3; u++)
4010
for (unsigned int tu = 0; tu < 3; tu++)
4012
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
4013
}// end loop over 'tu'
4014
}// end loop over 'u'
4015
}// end loop over 't'
4018
if (combinations_t[r][s] == 1)
4020
for (unsigned int t = 0; t < 3; t++)
4022
for (unsigned int u = 0; u < 3; u++)
4024
for (unsigned int tu = 0; tu < 3; tu++)
4026
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
4027
}// end loop over 'tu'
4028
}// end loop over 'u'
4029
}// end loop over 't'
4032
}// end loop over 's'
4033
for (unsigned int s = 0; s < 3; s++)
4035
for (unsigned int t = 0; t < 3; t++)
4037
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
4038
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
4039
}// end loop over 't'
4040
}// end loop over 's'
4042
// Using contravariant Piola transform to map values back to the physical element.
4043
const double tmp_ref0 = derivatives[r];
4044
const double tmp_ref1 = derivatives[num_derivatives_t + r];
4045
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
4046
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
4047
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
4048
}// end loop over 'r'
4050
// Transform derivatives back to physical element
4051
for (unsigned int r = 0; r < num_derivatives_g; r++)
4053
for (unsigned int s = 0; s < num_derivatives_t; s++)
4055
values[r] += transform[r][s]*derivatives_p[s];
4056
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
4057
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
4058
}// end loop over 's'
4059
}// end loop over 'r'
4061
// Delete pointer to array of derivatives on FIAT element
4062
delete [] derivatives;
4064
// Delete pointer to array of reference derivatives on physical element.
4065
delete [] derivatives_p;
4067
// Delete pointer to array of combinations of derivatives and transform
4068
for (unsigned int r = 0; r < num_derivatives_t; r++)
4070
delete [] combinations_t[r];
4071
}// end loop over 'r'
4072
delete [] combinations_t;
4073
for (unsigned int r = 0; r < num_derivatives_g; r++)
4075
delete [] combinations_g[r];
4076
}// end loop over 'r'
4077
delete [] combinations_g;
4078
for (unsigned int r = 0; r < num_derivatives_g; r++)
4080
delete [] transform[r];
4081
}// end loop over 'r'
4082
delete [] transform;
4089
/// Evaluate order n derivatives of all basis functions at given point x in cell
4090
virtual void evaluate_basis_derivatives_all(std::size_t n,
4093
const double* vertex_coordinates,
4094
int cell_orientation) const
4096
// Compute number of derivatives.
4097
unsigned int num_derivatives_g = 1;
4098
for (unsigned int r = 0; r < n; r++)
4100
num_derivatives_g *= 3;
4101
}// end loop over 'r'
4103
// Helper variable to hold values of a single dof.
4104
double *dof_values = new double[3*num_derivatives_g];
4105
for (unsigned int r = 0; r < 3*num_derivatives_g; r++)
4107
dof_values[r] = 0.0;
4108
}// end loop over 'r'
4110
// Loop dofs and call evaluate_basis_derivatives.
4111
for (unsigned int r = 0; r < 6; r++)
4113
evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
4114
for (unsigned int s = 0; s < 3*num_derivatives_g; s++)
4116
values[r*3*num_derivatives_g + s] = dof_values[s];
4117
}// end loop over 's'
4118
}// end loop over 'r'
4121
delete [] dof_values;
4124
/// Evaluate linear functional for dof i on the function f
4125
virtual double evaluate_dof(std::size_t i,
4126
const ufc::function& f,
4127
const double* vertex_coordinates,
4128
int cell_orientation,
4129
const ufc::cell& c) const
4131
// Declare variables for result of evaluation
4134
// Declare variable for physical coordinates
4140
compute_jacobian_triangle_3d(J, vertex_coordinates);
4143
// Compute Jacobian inverse and determinant
4146
compute_jacobian_inverse_triangle_3d(K, detJ, J);
4150
// Check orientation
4151
if (cell_orientation == -1)
4152
throw std::runtime_error("cell orientation must be defined (not -1)");
4153
// (If cell_orientation == 1 = down, multiply det(J) by -1)
4154
else if (cell_orientation == 1)
4160
y[0] = 0.66666667*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
4161
y[1] = 0.66666667*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
4162
y[2] = 0.66666667*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
4163
f.evaluate(vals, y, c);
4164
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2])) + (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
4170
y[0] = 0.33333333*vertex_coordinates[3] + 0.66666667*vertex_coordinates[6];
4171
y[1] = 0.33333333*vertex_coordinates[4] + 0.66666667*vertex_coordinates[7];
4172
y[2] = 0.33333333*vertex_coordinates[5] + 0.66666667*vertex_coordinates[8];
4173
f.evaluate(vals, y, c);
4174
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2])) + (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
4180
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[6];
4181
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[7];
4182
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[8];
4183
f.evaluate(vals, y, c);
4184
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
4190
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[6];
4191
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[7];
4192
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[8];
4193
f.evaluate(vals, y, c);
4194
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
4200
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3];
4201
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4];
4202
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5];
4203
f.evaluate(vals, y, c);
4204
result = (-1.0)*(detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
4210
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[3];
4211
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[4];
4212
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[5];
4213
f.evaluate(vals, y, c);
4214
result = (-1.0)*(detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
4223
/// Evaluate linear functionals for all dofs on the function f
4224
virtual void evaluate_dofs(double* values,
4225
const ufc::function& f,
4226
const double* vertex_coordinates,
4227
int cell_orientation,
4228
const ufc::cell& c) const
4230
// Declare variables for result of evaluation
4233
// Declare variable for physical coordinates
4239
compute_jacobian_triangle_3d(J, vertex_coordinates);
4242
// Compute Jacobian inverse and determinant
4245
compute_jacobian_inverse_triangle_3d(K, detJ, J);
4249
// Check orientation
4250
if (cell_orientation == -1)
4251
throw std::runtime_error("cell orientation must be defined (not -1)");
4252
// (If cell_orientation == 1 = down, multiply det(J) by -1)
4253
else if (cell_orientation == 1)
4255
y[0] = 0.66666667*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
4256
y[1] = 0.66666667*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
4257
y[2] = 0.66666667*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
4258
f.evaluate(vals, y, c);
4259
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2])) + (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
4261
y[0] = 0.33333333*vertex_coordinates[3] + 0.66666667*vertex_coordinates[6];
4262
y[1] = 0.33333333*vertex_coordinates[4] + 0.66666667*vertex_coordinates[7];
4263
y[2] = 0.33333333*vertex_coordinates[5] + 0.66666667*vertex_coordinates[8];
4264
f.evaluate(vals, y, c);
4265
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2])) + (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
4267
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[6];
4268
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[7];
4269
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[8];
4270
f.evaluate(vals, y, c);
4271
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
4273
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[6];
4274
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[7];
4275
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[8];
4276
f.evaluate(vals, y, c);
4277
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
4279
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3];
4280
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4];
4281
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5];
4282
f.evaluate(vals, y, c);
4283
result = (-1.0)*(detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
4285
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[3];
4286
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[4];
4287
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[5];
4288
f.evaluate(vals, y, c);
4289
result = (-1.0)*(detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
4293
/// Interpolate vertex values from dof values
4294
virtual void interpolate_vertex_values(double* vertex_values,
4295
const double* dof_values,
4296
const double* vertex_coordinates,
4297
int cell_orientation,
4298
const ufc::cell& c) const
4302
compute_jacobian_triangle_3d(J, vertex_coordinates);
4305
// Compute Jacobian inverse and determinant
4308
compute_jacobian_inverse_triangle_3d(K, detJ, J);
4312
// Check orientation
4313
if (cell_orientation == -1)
4314
throw std::runtime_error("cell orientation must be defined (not -1)");
4315
// (If cell_orientation == 1 = down, multiply det(J) by -1)
4316
else if (cell_orientation == 1)
4319
// Evaluate function and change variables
4320
vertex_values[0] = dof_values[2]*(1.0/detJ)*J[0]*2.0 + dof_values[3]*((1.0/detJ)*(J[0]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[1]*(-2.0))) + dof_values[5]*(1.0/detJ)*J[1];
4321
vertex_values[2] = dof_values[0]*(1.0/detJ)*J[0]*2.0 + dof_values[1]*((1.0/detJ)*(J[0]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[0]*(-1.0) + J[1])) + dof_values[5]*((1.0/detJ)*(J[0]*2.0 + J[1]*(-2.0)));
4322
vertex_values[4] = dof_values[0]*((1.0/detJ)*(J[1]*(-1.0))) + dof_values[1]*(1.0/detJ)*J[1]*2.0 + dof_values[2]*((1.0/detJ)*(J[0]*(-1.0) + J[1])) + dof_values[3]*((1.0/detJ)*(J[0]*2.0 + J[1]*(-2.0)));
4323
vertex_values[1] = dof_values[2]*(1.0/detJ)*J[2]*2.0 + dof_values[3]*((1.0/detJ)*(J[2]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[3]*(-2.0))) + dof_values[5]*(1.0/detJ)*J[3];
4324
vertex_values[3] = dof_values[0]*(1.0/detJ)*J[2]*2.0 + dof_values[1]*((1.0/detJ)*(J[2]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[2]*(-1.0) + J[3])) + dof_values[5]*((1.0/detJ)*(J[2]*2.0 + J[3]*(-2.0)));
4325
vertex_values[5] = dof_values[0]*((1.0/detJ)*(J[3]*(-1.0))) + dof_values[1]*(1.0/detJ)*J[3]*2.0 + dof_values[2]*((1.0/detJ)*(J[2]*(-1.0) + J[3])) + dof_values[3]*((1.0/detJ)*(J[2]*2.0 + J[3]*(-2.0)));
4328
/// Map coordinate xhat from reference cell to coordinate x in cell
4329
virtual void map_from_reference_cell(double* x,
4331
const ufc::cell& c) const
4333
std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
4336
/// Map from coordinate x in cell to coordinate xhat in reference cell
4337
virtual void map_to_reference_cell(double* xhat,
4339
const ufc::cell& c) const
4341
std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
4344
/// Return the number of sub elements (for a mixed element)
4345
virtual std::size_t num_sub_elements() const
4350
/// Create a new finite element for sub element i (for a mixed element)
4351
virtual ufc::finite_element* create_sub_element(std::size_t i) const
4356
/// Create a new class instance
4357
virtual ufc::finite_element* create() const
4359
return new x_element9_finite_element_1();
4364
/// This class defines the interface for a finite element.
4366
class x_element9_finite_element_2: public ufc::finite_element
4371
x_element9_finite_element_2() : ufc::finite_element()
4377
virtual ~x_element9_finite_element_2()
4382
/// Return a string identifying the finite element
4383
virtual const char* signature() const
4385
return "FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 1, None)";
4388
/// Return the cell shape
4389
virtual ufc::shape cell_shape() const
4391
return ufc::triangle;
4394
/// Return the topological dimension of the cell shape
4395
virtual std::size_t topological_dimension() const
4400
/// Return the geometric dimension of the cell shape
4401
virtual std::size_t geometric_dimension() const
4406
/// Return the dimension of the finite element function space
4407
virtual std::size_t space_dimension() const
4412
/// Return the rank of the value space
4413
virtual std::size_t value_rank() const
4418
/// Return the dimension of the value space for axis i
4419
virtual std::size_t value_dimension(std::size_t i) const
4433
/// Evaluate basis function i at given point x in cell
4434
virtual void evaluate_basis(std::size_t i,
4437
const double* vertex_coordinates,
4438
int cell_orientation) const
4442
compute_jacobian_triangle_3d(J, vertex_coordinates);
4444
// Compute Jacobian inverse and determinant
4447
compute_jacobian_inverse_triangle_3d(K, detJ, J);
4450
const double b0 = vertex_coordinates[0];
4451
const double b1 = vertex_coordinates[1];
4452
const double b2 = vertex_coordinates[2];
4454
// P_FFC = J^dag (p - b), P_FIAT = 2*P_FFC - (1, 1)
4455
double X = 2*(K[0]*(x[0] - b0) + K[1]*(x[1] - b1) + K[2]*(x[2] - b2)) - 1.0;
4456
double Y = 2*(K[3]*(x[0] - b0) + K[4]*(x[1] - b1) + K[5]*(x[2] - b2)) - 1.0;
4467
// Array of basisvalues
4468
double basisvalues[3] = {0.0, 0.0, 0.0};
4470
// Declare helper variables
4471
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
4473
// Compute basisvalues
4474
basisvalues[0] = 1.0;
4475
basisvalues[1] = tmp0;
4476
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
4477
basisvalues[0] *= std::sqrt(0.5);
4478
basisvalues[2] *= std::sqrt(1.0);
4479
basisvalues[1] *= std::sqrt(3.0);
4481
// Table(s) of coefficients
4482
static const double coefficients0[3] = \
4483
{-0.47140452, 0.0, -0.33333333};
4485
static const double coefficients1[3] = \
4486
{0.47140452, 0.28867513, -0.16666667};
4489
for (unsigned int r = 0; r < 3; r++)
4491
values[0] += coefficients0[r]*basisvalues[r];
4492
values[1] += coefficients1[r]*basisvalues[r];
4493
}// end loop over 'r'
4495
// Using covariant Piola transform to map values back to the physical element
4496
const double tmp_ref0 = values[0];
4497
const double tmp_ref1 = values[1];
4498
values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1);
4499
values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1);
4500
values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1);
4506
// Array of basisvalues
4507
double basisvalues[3] = {0.0, 0.0, 0.0};
4509
// Declare helper variables
4510
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
4512
// Compute basisvalues
4513
basisvalues[0] = 1.0;
4514
basisvalues[1] = tmp0;
4515
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
4516
basisvalues[0] *= std::sqrt(0.5);
4517
basisvalues[2] *= std::sqrt(1.0);
4518
basisvalues[1] *= std::sqrt(3.0);
4520
// Table(s) of coefficients
4521
static const double coefficients0[3] = \
4522
{0.47140452, 0.0, 0.33333333};
4524
static const double coefficients1[3] = \
4525
{0.94280904, -0.28867513, 0.16666667};
4528
for (unsigned int r = 0; r < 3; r++)
4530
values[0] += coefficients0[r]*basisvalues[r];
4531
values[1] += coefficients1[r]*basisvalues[r];
4532
}// end loop over 'r'
4534
// Using covariant Piola transform to map values back to the physical element
4535
const double tmp_ref0 = values[0];
4536
const double tmp_ref1 = values[1];
4537
values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1);
4538
values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1);
4539
values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1);
4545
// Array of basisvalues
4546
double basisvalues[3] = {0.0, 0.0, 0.0};
4548
// Declare helper variables
4549
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
4551
// Compute basisvalues
4552
basisvalues[0] = 1.0;
4553
basisvalues[1] = tmp0;
4554
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
4555
basisvalues[0] *= std::sqrt(0.5);
4556
basisvalues[2] *= std::sqrt(1.0);
4557
basisvalues[1] *= std::sqrt(3.0);
4559
// Table(s) of coefficients
4560
static const double coefficients0[3] = \
4561
{0.94280904, 0.0, -0.33333333};
4563
static const double coefficients1[3] = \
4564
{0.47140452, 0.28867513, -0.16666667};
4567
for (unsigned int r = 0; r < 3; r++)
4569
values[0] += coefficients0[r]*basisvalues[r];
4570
values[1] += coefficients1[r]*basisvalues[r];
4571
}// end loop over 'r'
4573
// Using covariant Piola transform to map values back to the physical element
4574
const double tmp_ref0 = values[0];
4575
const double tmp_ref1 = values[1];
4576
values[0] = (K[0]*tmp_ref0 + K[3]*tmp_ref1);
4577
values[1] = (K[1]*tmp_ref0 + K[4]*tmp_ref1);
4578
values[2] = (K[2]*tmp_ref0 + K[5]*tmp_ref1);
4585
/// Evaluate all basis functions at given point x in cell
4586
virtual void evaluate_basis_all(double* values,
4588
const double* vertex_coordinates,
4589
int cell_orientation) const
4591
// Helper variable to hold values of a single dof.
4592
double dof_values[3] = {0.0, 0.0, 0.0};
4594
// Loop dofs and call evaluate_basis
4595
for (unsigned int r = 0; r < 3; r++)
4597
evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
4598
for (unsigned int s = 0; s < 3; s++)
4600
values[r*3 + s] = dof_values[s];
4601
}// end loop over 's'
4602
}// end loop over 'r'
4605
/// Evaluate order n derivatives of basis function i at given point x in cell
4606
virtual void evaluate_basis_derivatives(std::size_t i,
4610
const double* vertex_coordinates,
4611
int cell_orientation) const
4615
compute_jacobian_triangle_3d(J, vertex_coordinates);
4617
// Compute Jacobian inverse and determinant
4620
compute_jacobian_inverse_triangle_3d(K, detJ, J);
4623
const double b0 = vertex_coordinates[0];
4624
const double b1 = vertex_coordinates[1];
4625
const double b2 = vertex_coordinates[2];
4627
// P_FFC = J^dag (p - b), P_FIAT = 2*P_FFC - (1, 1)
4628
double X = 2*(K[0]*(x[0] - b0) + K[1]*(x[1] - b1) + K[2]*(x[2] - b2)) - 1.0;
4629
double Y = 2*(K[3]*(x[0] - b0) + K[4]*(x[1] - b1) + K[5]*(x[2] - b2)) - 1.0;
4632
// Compute number of derivatives.
4633
unsigned int num_derivatives_t = 1;
4634
for (unsigned int r = 0; r < n; r++)
4636
num_derivatives_t *= 2;
4637
}// end loop over 'r'
4639
// Compute number of derivatives.
4640
unsigned int num_derivatives_g = 1;
4641
for (unsigned int r = 0; r < n; r++)
4643
num_derivatives_g *= 3;
4644
}// end loop over 'r'
4646
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
4647
unsigned int **combinations_t = new unsigned int *[num_derivatives_t];
4648
for (unsigned int row = 0; row < num_derivatives_t; row++)
4650
combinations_t[row] = new unsigned int [n];
4651
for (unsigned int col = 0; col < n; col++)
4652
combinations_t[row][col] = 0;
4655
// Generate combinations of derivatives
4656
for (unsigned int row = 1; row < num_derivatives_t; row++)
4658
for (unsigned int num = 0; num < row; num++)
4660
for (unsigned int col = n-1; col+1 > 0; col--)
4662
if (combinations_t[row][col] + 1 > 1)
4663
combinations_t[row][col] = 0;
4666
combinations_t[row][col] += 1;
4673
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
4674
unsigned int **combinations_g = new unsigned int *[num_derivatives_g];
4675
for (unsigned int row = 0; row < num_derivatives_g; row++)
4677
combinations_g[row] = new unsigned int [n];
4678
for (unsigned int col = 0; col < n; col++)
4679
combinations_g[row][col] = 0;
4682
// Generate combinations of derivatives
4683
for (unsigned int row = 1; row < num_derivatives_g; row++)
4685
for (unsigned int num = 0; num < row; num++)
4687
for (unsigned int col = n-1; col+1 > 0; col--)
4689
if (combinations_g[row][col] + 1 > 2)
4690
combinations_g[row][col] = 0;
4693
combinations_g[row][col] += 1;
4700
// Compute inverse of Jacobian
4701
const double Jinv[2][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}};
4703
// Declare transformation matrix
4704
// Declare pointer to two dimensional array and initialise
4705
double **transform = new double *[num_derivatives_g];
4707
for (unsigned int j = 0; j < num_derivatives_g; j++)
4709
transform[j] = new double [num_derivatives_t];
4710
for (unsigned int k = 0; k < num_derivatives_t; k++)
4711
transform[j][k] = 1;
4714
// Construct transformation matrix
4715
for (unsigned int row = 0; row < num_derivatives_g; row++)
4717
for (unsigned int col = 0; col < num_derivatives_t; col++)
4719
for (unsigned int k = 0; k < n; k++)
4720
transform[row][col] *= Jinv[combinations_t[col][k]][combinations_g[row][k]];
4724
// Reset values. Assuming that values is always an array.
4725
for (unsigned int r = 0; r < 3*num_derivatives_g; r++)
4728
}// end loop over 'r'
4735
// Array of basisvalues
4736
double basisvalues[3] = {0.0, 0.0, 0.0};
4738
// Declare helper variables
4739
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
4741
// Compute basisvalues
4742
basisvalues[0] = 1.0;
4743
basisvalues[1] = tmp0;
4744
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
4745
basisvalues[0] *= std::sqrt(0.5);
4746
basisvalues[2] *= std::sqrt(1.0);
4747
basisvalues[1] *= std::sqrt(3.0);
4749
// Table(s) of coefficients
4750
static const double coefficients0[3] = \
4751
{-0.47140452, 0.0, -0.33333333};
4753
static const double coefficients1[3] = \
4754
{0.47140452, 0.28867513, -0.16666667};
4756
// Tables of derivatives of the polynomial base (transpose).
4757
static const double dmats0[3][3] = \
4759
{4.8989795, 0.0, 0.0},
4762
static const double dmats1[3][3] = \
4764
{2.4494897, 0.0, 0.0},
4765
{4.2426407, 0.0, 0.0}};
4767
// Compute reference derivatives.
4768
// Declare pointer to array of derivatives on FIAT element.
4769
double *derivatives = new double[2*num_derivatives_t];
4770
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
4772
derivatives[r] = 0.0;
4773
}// end loop over 'r'
4775
// Declare pointer to array of reference derivatives on physical element.
4776
double *derivatives_p = new double[3*num_derivatives_t];
4777
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
4779
derivatives_p[r] = 0.0;
4780
}// end loop over 'r'
4782
// Declare derivative matrix (of polynomial basis).
4783
double dmats[3][3] = \
4788
// Declare (auxiliary) derivative matrix (of polynomial basis).
4789
double dmats_old[3][3] = \
4794
// Loop possible derivatives.
4795
for (unsigned int r = 0; r < num_derivatives_t; r++)
4797
// Resetting dmats values to compute next derivative.
4798
for (unsigned int t = 0; t < 3; t++)
4800
for (unsigned int u = 0; u < 3; u++)
4808
}// end loop over 'u'
4809
}// end loop over 't'
4811
// Looping derivative order to generate dmats.
4812
for (unsigned int s = 0; s < n; s++)
4814
// Updating dmats_old with new values and resetting dmats.
4815
for (unsigned int t = 0; t < 3; t++)
4817
for (unsigned int u = 0; u < 3; u++)
4819
dmats_old[t][u] = dmats[t][u];
4821
}// end loop over 'u'
4822
}// end loop over 't'
4824
// Update dmats using an inner product.
4825
if (combinations_t[r][s] == 0)
4827
for (unsigned int t = 0; t < 3; t++)
4829
for (unsigned int u = 0; u < 3; u++)
4831
for (unsigned int tu = 0; tu < 3; tu++)
4833
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
4834
}// end loop over 'tu'
4835
}// end loop over 'u'
4836
}// end loop over 't'
4839
if (combinations_t[r][s] == 1)
4841
for (unsigned int t = 0; t < 3; t++)
4843
for (unsigned int u = 0; u < 3; u++)
4845
for (unsigned int tu = 0; tu < 3; tu++)
4847
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
4848
}// end loop over 'tu'
4849
}// end loop over 'u'
4850
}// end loop over 't'
4853
}// end loop over 's'
4854
for (unsigned int s = 0; s < 3; s++)
4856
for (unsigned int t = 0; t < 3; t++)
4858
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
4859
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
4860
}// end loop over 't'
4861
}// end loop over 's'
4863
// Using covariant Piola transform to map values back to the physical element
4864
const double tmp_ref0 = derivatives[r];
4865
const double tmp_ref1 = derivatives[num_derivatives_t + r];
4866
derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1);
4867
derivatives_p[num_derivatives_t + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1);
4868
derivatives_p[2*num_derivatives_t + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1);
4869
}// end loop over 'r'
4871
// Transform derivatives back to physical element
4872
for (unsigned int r = 0; r < num_derivatives_g; r++)
4874
for (unsigned int s = 0; s < num_derivatives_t; s++)
4876
values[r] += transform[r][s]*derivatives_p[s];
4877
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
4878
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
4879
}// end loop over 's'
4880
}// end loop over 'r'
4882
// Delete pointer to array of derivatives on FIAT element
4883
delete [] derivatives;
4885
// Delete pointer to array of reference derivatives on physical element.
4886
delete [] derivatives_p;
4888
// Delete pointer to array of combinations of derivatives and transform
4889
for (unsigned int r = 0; r < num_derivatives_t; r++)
4891
delete [] combinations_t[r];
4892
}// end loop over 'r'
4893
delete [] combinations_t;
4894
for (unsigned int r = 0; r < num_derivatives_g; r++)
4896
delete [] combinations_g[r];
4897
}// end loop over 'r'
4898
delete [] combinations_g;
4899
for (unsigned int r = 0; r < num_derivatives_g; r++)
4901
delete [] transform[r];
4902
}// end loop over 'r'
4903
delete [] transform;
4909
// Array of basisvalues
4910
double basisvalues[3] = {0.0, 0.0, 0.0};
4912
// Declare helper variables
4913
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
4915
// Compute basisvalues
4916
basisvalues[0] = 1.0;
4917
basisvalues[1] = tmp0;
4918
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
4919
basisvalues[0] *= std::sqrt(0.5);
4920
basisvalues[2] *= std::sqrt(1.0);
4921
basisvalues[1] *= std::sqrt(3.0);
4923
// Table(s) of coefficients
4924
static const double coefficients0[3] = \
4925
{0.47140452, 0.0, 0.33333333};
4927
static const double coefficients1[3] = \
4928
{0.94280904, -0.28867513, 0.16666667};
4930
// Tables of derivatives of the polynomial base (transpose).
4931
static const double dmats0[3][3] = \
4933
{4.8989795, 0.0, 0.0},
4936
static const double dmats1[3][3] = \
4938
{2.4494897, 0.0, 0.0},
4939
{4.2426407, 0.0, 0.0}};
4941
// Compute reference derivatives.
4942
// Declare pointer to array of derivatives on FIAT element.
4943
double *derivatives = new double[2*num_derivatives_t];
4944
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
4946
derivatives[r] = 0.0;
4947
}// end loop over 'r'
4949
// Declare pointer to array of reference derivatives on physical element.
4950
double *derivatives_p = new double[3*num_derivatives_t];
4951
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
4953
derivatives_p[r] = 0.0;
4954
}// end loop over 'r'
4956
// Declare derivative matrix (of polynomial basis).
4957
double dmats[3][3] = \
4962
// Declare (auxiliary) derivative matrix (of polynomial basis).
4963
double dmats_old[3][3] = \
4968
// Loop possible derivatives.
4969
for (unsigned int r = 0; r < num_derivatives_t; r++)
4971
// Resetting dmats values to compute next derivative.
4972
for (unsigned int t = 0; t < 3; t++)
4974
for (unsigned int u = 0; u < 3; u++)
4982
}// end loop over 'u'
4983
}// end loop over 't'
4985
// Looping derivative order to generate dmats.
4986
for (unsigned int s = 0; s < n; s++)
4988
// Updating dmats_old with new values and resetting dmats.
4989
for (unsigned int t = 0; t < 3; t++)
4991
for (unsigned int u = 0; u < 3; u++)
4993
dmats_old[t][u] = dmats[t][u];
4995
}// end loop over 'u'
4996
}// end loop over 't'
4998
// Update dmats using an inner product.
4999
if (combinations_t[r][s] == 0)
5001
for (unsigned int t = 0; t < 3; t++)
5003
for (unsigned int u = 0; u < 3; u++)
5005
for (unsigned int tu = 0; tu < 3; tu++)
5007
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
5008
}// end loop over 'tu'
5009
}// end loop over 'u'
5010
}// end loop over 't'
5013
if (combinations_t[r][s] == 1)
5015
for (unsigned int t = 0; t < 3; t++)
5017
for (unsigned int u = 0; u < 3; u++)
5019
for (unsigned int tu = 0; tu < 3; tu++)
5021
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
5022
}// end loop over 'tu'
5023
}// end loop over 'u'
5024
}// end loop over 't'
5027
}// end loop over 's'
5028
for (unsigned int s = 0; s < 3; s++)
5030
for (unsigned int t = 0; t < 3; t++)
5032
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
5033
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
5034
}// end loop over 't'
5035
}// end loop over 's'
5037
// Using covariant Piola transform to map values back to the physical element
5038
const double tmp_ref0 = derivatives[r];
5039
const double tmp_ref1 = derivatives[num_derivatives_t + r];
5040
derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1);
5041
derivatives_p[num_derivatives_t + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1);
5042
derivatives_p[2*num_derivatives_t + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1);
5043
}// end loop over 'r'
5045
// Transform derivatives back to physical element
5046
for (unsigned int r = 0; r < num_derivatives_g; r++)
5048
for (unsigned int s = 0; s < num_derivatives_t; s++)
5050
values[r] += transform[r][s]*derivatives_p[s];
5051
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
5052
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
5053
}// end loop over 's'
5054
}// end loop over 'r'
5056
// Delete pointer to array of derivatives on FIAT element
5057
delete [] derivatives;
5059
// Delete pointer to array of reference derivatives on physical element.
5060
delete [] derivatives_p;
5062
// Delete pointer to array of combinations of derivatives and transform
5063
for (unsigned int r = 0; r < num_derivatives_t; r++)
5065
delete [] combinations_t[r];
5066
}// end loop over 'r'
5067
delete [] combinations_t;
5068
for (unsigned int r = 0; r < num_derivatives_g; r++)
5070
delete [] combinations_g[r];
5071
}// end loop over 'r'
5072
delete [] combinations_g;
5073
for (unsigned int r = 0; r < num_derivatives_g; r++)
5075
delete [] transform[r];
5076
}// end loop over 'r'
5077
delete [] transform;
5083
// Array of basisvalues
5084
double basisvalues[3] = {0.0, 0.0, 0.0};
5086
// Declare helper variables
5087
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5089
// Compute basisvalues
5090
basisvalues[0] = 1.0;
5091
basisvalues[1] = tmp0;
5092
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
5093
basisvalues[0] *= std::sqrt(0.5);
5094
basisvalues[2] *= std::sqrt(1.0);
5095
basisvalues[1] *= std::sqrt(3.0);
5097
// Table(s) of coefficients
5098
static const double coefficients0[3] = \
5099
{0.94280904, 0.0, -0.33333333};
5101
static const double coefficients1[3] = \
5102
{0.47140452, 0.28867513, -0.16666667};
5104
// Tables of derivatives of the polynomial base (transpose).
5105
static const double dmats0[3][3] = \
5107
{4.8989795, 0.0, 0.0},
5110
static const double dmats1[3][3] = \
5112
{2.4494897, 0.0, 0.0},
5113
{4.2426407, 0.0, 0.0}};
5115
// Compute reference derivatives.
5116
// Declare pointer to array of derivatives on FIAT element.
5117
double *derivatives = new double[2*num_derivatives_t];
5118
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
5120
derivatives[r] = 0.0;
5121
}// end loop over 'r'
5123
// Declare pointer to array of reference derivatives on physical element.
5124
double *derivatives_p = new double[3*num_derivatives_t];
5125
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
5127
derivatives_p[r] = 0.0;
5128
}// end loop over 'r'
5130
// Declare derivative matrix (of polynomial basis).
5131
double dmats[3][3] = \
5136
// Declare (auxiliary) derivative matrix (of polynomial basis).
5137
double dmats_old[3][3] = \
5142
// Loop possible derivatives.
5143
for (unsigned int r = 0; r < num_derivatives_t; r++)
5145
// Resetting dmats values to compute next derivative.
5146
for (unsigned int t = 0; t < 3; t++)
5148
for (unsigned int u = 0; u < 3; u++)
5156
}// end loop over 'u'
5157
}// end loop over 't'
5159
// Looping derivative order to generate dmats.
5160
for (unsigned int s = 0; s < n; s++)
5162
// Updating dmats_old with new values and resetting dmats.
5163
for (unsigned int t = 0; t < 3; t++)
5165
for (unsigned int u = 0; u < 3; u++)
5167
dmats_old[t][u] = dmats[t][u];
5169
}// end loop over 'u'
5170
}// end loop over 't'
5172
// Update dmats using an inner product.
5173
if (combinations_t[r][s] == 0)
5175
for (unsigned int t = 0; t < 3; t++)
5177
for (unsigned int u = 0; u < 3; u++)
5179
for (unsigned int tu = 0; tu < 3; tu++)
5181
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
5182
}// end loop over 'tu'
5183
}// end loop over 'u'
5184
}// end loop over 't'
5187
if (combinations_t[r][s] == 1)
5189
for (unsigned int t = 0; t < 3; t++)
5191
for (unsigned int u = 0; u < 3; u++)
5193
for (unsigned int tu = 0; tu < 3; tu++)
5195
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
5196
}// end loop over 'tu'
5197
}// end loop over 'u'
5198
}// end loop over 't'
5201
}// end loop over 's'
5202
for (unsigned int s = 0; s < 3; s++)
5204
for (unsigned int t = 0; t < 3; t++)
5206
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
5207
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
5208
}// end loop over 't'
5209
}// end loop over 's'
5211
// Using covariant Piola transform to map values back to the physical element
5212
const double tmp_ref0 = derivatives[r];
5213
const double tmp_ref1 = derivatives[num_derivatives_t + r];
5214
derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1);
5215
derivatives_p[num_derivatives_t + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1);
5216
derivatives_p[2*num_derivatives_t + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1);
5217
}// end loop over 'r'
5219
// Transform derivatives back to physical element
5220
for (unsigned int r = 0; r < num_derivatives_g; r++)
5222
for (unsigned int s = 0; s < num_derivatives_t; s++)
5224
values[r] += transform[r][s]*derivatives_p[s];
5225
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
5226
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
5227
}// end loop over 's'
5228
}// end loop over 'r'
5230
// Delete pointer to array of derivatives on FIAT element
5231
delete [] derivatives;
5233
// Delete pointer to array of reference derivatives on physical element.
5234
delete [] derivatives_p;
5236
// Delete pointer to array of combinations of derivatives and transform
5237
for (unsigned int r = 0; r < num_derivatives_t; r++)
5239
delete [] combinations_t[r];
5240
}// end loop over 'r'
5241
delete [] combinations_t;
5242
for (unsigned int r = 0; r < num_derivatives_g; r++)
5244
delete [] combinations_g[r];
5245
}// end loop over 'r'
5246
delete [] combinations_g;
5247
for (unsigned int r = 0; r < num_derivatives_g; r++)
5249
delete [] transform[r];
5250
}// end loop over 'r'
5251
delete [] transform;
5258
/// Evaluate order n derivatives of all basis functions at given point x in cell
5259
virtual void evaluate_basis_derivatives_all(std::size_t n,
5262
const double* vertex_coordinates,
5263
int cell_orientation) const
5265
// Compute number of derivatives.
5266
unsigned int num_derivatives_g = 1;
5267
for (unsigned int r = 0; r < n; r++)
5269
num_derivatives_g *= 3;
5270
}// end loop over 'r'
5272
// Helper variable to hold values of a single dof.
5273
double *dof_values = new double[3*num_derivatives_g];
5274
for (unsigned int r = 0; r < 3*num_derivatives_g; r++)
5276
dof_values[r] = 0.0;
5277
}// end loop over 'r'
5279
// Loop dofs and call evaluate_basis_derivatives.
5280
for (unsigned int r = 0; r < 3; r++)
5282
evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
5283
for (unsigned int s = 0; s < 3*num_derivatives_g; s++)
5285
values[r*3*num_derivatives_g + s] = dof_values[s];
5286
}// end loop over 's'
5287
}// end loop over 'r'
5290
delete [] dof_values;
5293
/// Evaluate linear functional for dof i on the function f
5294
virtual double evaluate_dof(std::size_t i,
5295
const ufc::function& f,
5296
const double* vertex_coordinates,
5297
int cell_orientation,
5298
const ufc::cell& c) const
5300
// Declare variables for result of evaluation
5303
// Declare variable for physical coordinates
5309
compute_jacobian_triangle_3d(J, vertex_coordinates);
5314
y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
5315
y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
5316
y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
5317
f.evaluate(vals, y, c);
5318
result = (-1.0)*(J[0]*vals[0] + J[2]*vals[1] + J[4]*vals[2]) + (J[1]*vals[0] + J[3]*vals[1] + J[5]*vals[2]);
5324
y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
5325
y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
5326
y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
5327
f.evaluate(vals, y, c);
5328
result = (J[1]*vals[0] + J[3]*vals[1] + J[5]*vals[2]);
5334
y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
5335
y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
5336
y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
5337
f.evaluate(vals, y, c);
5338
result = (J[0]*vals[0] + J[2]*vals[1] + J[4]*vals[2]);
5347
/// Evaluate linear functionals for all dofs on the function f
5348
virtual void evaluate_dofs(double* values,
5349
const ufc::function& f,
5350
const double* vertex_coordinates,
5351
int cell_orientation,
5352
const ufc::cell& c) const
5354
// Declare variables for result of evaluation
5357
// Declare variable for physical coordinates
5363
compute_jacobian_triangle_3d(J, vertex_coordinates);
5364
y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
5365
y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
5366
y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
5367
f.evaluate(vals, y, c);
5368
result = (-1.0)*(J[0]*vals[0] + J[2]*vals[1] + J[4]*vals[2]) + (J[1]*vals[0] + J[3]*vals[1] + J[5]*vals[2]);
5370
y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
5371
y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
5372
y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
5373
f.evaluate(vals, y, c);
5374
result = (J[1]*vals[0] + J[3]*vals[1] + J[5]*vals[2]);
5376
y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
5377
y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
5378
y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
5379
f.evaluate(vals, y, c);
5380
result = (J[0]*vals[0] + J[2]*vals[1] + J[4]*vals[2]);
5384
/// Interpolate vertex values from dof values
5385
virtual void interpolate_vertex_values(double* vertex_values,
5386
const double* dof_values,
5387
const double* vertex_coordinates,
5388
int cell_orientation,
5389
const ufc::cell& c) const
5393
compute_jacobian_triangle_3d(J, vertex_coordinates);
5396
// Compute Jacobian inverse and determinant
5399
compute_jacobian_inverse_triangle_3d(K, detJ, J);
5401
// Evaluate function and change variables
5402
vertex_values[0] = dof_values[1]*K[3] + dof_values[2]*K[0];
5403
vertex_values[2] = dof_values[0]*K[3] + dof_values[2]*(K[0] + K[3]);
5404
vertex_values[4] = dof_values[0]*(K[0]*(-1.0)) + dof_values[1]*(K[0] + K[3]);
5405
vertex_values[1] = dof_values[1]*K[4] + dof_values[2]*K[1];
5406
vertex_values[3] = dof_values[0]*K[4] + dof_values[2]*(K[1] + K[4]);
5407
vertex_values[5] = dof_values[0]*(K[1]*(-1.0)) + dof_values[1]*(K[1] + K[4]);
5410
/// Map coordinate xhat from reference cell to coordinate x in cell
5411
virtual void map_from_reference_cell(double* x,
5413
const ufc::cell& c) const
5415
std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
5418
/// Map from coordinate x in cell to coordinate xhat in reference cell
5419
virtual void map_to_reference_cell(double* xhat,
5421
const ufc::cell& c) const
5423
std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
5426
/// Return the number of sub elements (for a mixed element)
5427
virtual std::size_t num_sub_elements() const
5432
/// Create a new finite element for sub element i (for a mixed element)
5433
virtual ufc::finite_element* create_sub_element(std::size_t i) const
5438
/// Create a new class instance
5439
virtual ufc::finite_element* create() const
5441
return new x_element9_finite_element_2();
5446
/// This class defines the interface for a finite element.
5448
class x_element9_finite_element_3: public ufc::finite_element
5453
x_element9_finite_element_3() : ufc::finite_element()
5459
virtual ~x_element9_finite_element_3()
5464
/// Return a string identifying the finite element
5465
virtual const char* signature() const
5467
return "FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 1, None)";
5470
/// Return the cell shape
5471
virtual ufc::shape cell_shape() const
5473
return ufc::triangle;
5476
/// Return the topological dimension of the cell shape
5477
virtual std::size_t topological_dimension() const
5482
/// Return the geometric dimension of the cell shape
5483
virtual std::size_t geometric_dimension() const
5488
/// Return the dimension of the finite element function space
5489
virtual std::size_t space_dimension() const
5494
/// Return the rank of the value space
5495
virtual std::size_t value_rank() const
5500
/// Return the dimension of the value space for axis i
5501
virtual std::size_t value_dimension(std::size_t i) const
5506
/// Evaluate basis function i at given point x in cell
5507
virtual void evaluate_basis(std::size_t i,
5510
const double* vertex_coordinates,
5511
int cell_orientation) const
5515
compute_jacobian_triangle_3d(J, vertex_coordinates);
5517
// Compute Jacobian inverse and determinant
5520
compute_jacobian_inverse_triangle_3d(K, detJ, J);
5523
const double b0 = vertex_coordinates[0];
5524
const double b1 = vertex_coordinates[1];
5525
const double b2 = vertex_coordinates[2];
5527
// P_FFC = J^dag (p - b), P_FIAT = 2*P_FFC - (1, 1)
5528
double X = 2*(K[0]*(x[0] - b0) + K[1]*(x[1] - b1) + K[2]*(x[2] - b2)) - 1.0;
5529
double Y = 2*(K[3]*(x[0] - b0) + K[4]*(x[1] - b1) + K[5]*(x[2] - b2)) - 1.0;
5539
// Array of basisvalues
5540
double basisvalues[3] = {0.0, 0.0, 0.0};
5542
// Declare helper variables
5543
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5545
// Compute basisvalues
5546
basisvalues[0] = 1.0;
5547
basisvalues[1] = tmp0;
5548
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
5549
basisvalues[0] *= std::sqrt(0.5);
5550
basisvalues[2] *= std::sqrt(1.0);
5551
basisvalues[1] *= std::sqrt(3.0);
5553
// Table(s) of coefficients
5554
static const double coefficients0[3] = \
5555
{0.47140452, -0.28867513, -0.16666667};
5558
for (unsigned int r = 0; r < 3; r++)
5560
*values += coefficients0[r]*basisvalues[r];
5561
}// end loop over 'r'
5567
// Array of basisvalues
5568
double basisvalues[3] = {0.0, 0.0, 0.0};
5570
// Declare helper variables
5571
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5573
// Compute basisvalues
5574
basisvalues[0] = 1.0;
5575
basisvalues[1] = tmp0;
5576
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
5577
basisvalues[0] *= std::sqrt(0.5);
5578
basisvalues[2] *= std::sqrt(1.0);
5579
basisvalues[1] *= std::sqrt(3.0);
5581
// Table(s) of coefficients
5582
static const double coefficients0[3] = \
5583
{0.47140452, 0.28867513, -0.16666667};
5586
for (unsigned int r = 0; r < 3; r++)
5588
*values += coefficients0[r]*basisvalues[r];
5589
}// end loop over 'r'
5595
// Array of basisvalues
5596
double basisvalues[3] = {0.0, 0.0, 0.0};
5598
// Declare helper variables
5599
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5601
// Compute basisvalues
5602
basisvalues[0] = 1.0;
5603
basisvalues[1] = tmp0;
5604
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
5605
basisvalues[0] *= std::sqrt(0.5);
5606
basisvalues[2] *= std::sqrt(1.0);
5607
basisvalues[1] *= std::sqrt(3.0);
5609
// Table(s) of coefficients
5610
static const double coefficients0[3] = \
5611
{0.47140452, 0.0, 0.33333333};
5614
for (unsigned int r = 0; r < 3; r++)
5616
*values += coefficients0[r]*basisvalues[r];
5617
}// end loop over 'r'
5624
/// Evaluate all basis functions at given point x in cell
5625
virtual void evaluate_basis_all(double* values,
5627
const double* vertex_coordinates,
5628
int cell_orientation) const
5630
// Helper variable to hold values of a single dof.
5631
double dof_values = 0.0;
5633
// Loop dofs and call evaluate_basis
5634
for (unsigned int r = 0; r < 3; r++)
5636
evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
5637
values[r] = dof_values;
5638
}// end loop over 'r'
5641
/// Evaluate order n derivatives of basis function i at given point x in cell
5642
virtual void evaluate_basis_derivatives(std::size_t i,
5646
const double* vertex_coordinates,
5647
int cell_orientation) const
5651
compute_jacobian_triangle_3d(J, vertex_coordinates);
5653
// Compute Jacobian inverse and determinant
5656
compute_jacobian_inverse_triangle_3d(K, detJ, J);
5659
const double b0 = vertex_coordinates[0];
5660
const double b1 = vertex_coordinates[1];
5661
const double b2 = vertex_coordinates[2];
5663
// P_FFC = J^dag (p - b), P_FIAT = 2*P_FFC - (1, 1)
5664
double X = 2*(K[0]*(x[0] - b0) + K[1]*(x[1] - b1) + K[2]*(x[2] - b2)) - 1.0;
5665
double Y = 2*(K[3]*(x[0] - b0) + K[4]*(x[1] - b1) + K[5]*(x[2] - b2)) - 1.0;
5668
// Compute number of derivatives.
5669
unsigned int num_derivatives_t = 1;
5670
for (unsigned int r = 0; r < n; r++)
5672
num_derivatives_t *= 2;
5673
}// end loop over 'r'
5675
// Compute number of derivatives.
5676
unsigned int num_derivatives_g = 1;
5677
for (unsigned int r = 0; r < n; r++)
5679
num_derivatives_g *= 3;
5680
}// end loop over 'r'
5682
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
5683
unsigned int **combinations_t = new unsigned int *[num_derivatives_t];
5684
for (unsigned int row = 0; row < num_derivatives_t; row++)
5686
combinations_t[row] = new unsigned int [n];
5687
for (unsigned int col = 0; col < n; col++)
5688
combinations_t[row][col] = 0;
5691
// Generate combinations of derivatives
5692
for (unsigned int row = 1; row < num_derivatives_t; row++)
5694
for (unsigned int num = 0; num < row; num++)
5696
for (unsigned int col = n-1; col+1 > 0; col--)
5698
if (combinations_t[row][col] + 1 > 1)
5699
combinations_t[row][col] = 0;
5702
combinations_t[row][col] += 1;
5709
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
5710
unsigned int **combinations_g = new unsigned int *[num_derivatives_g];
5711
for (unsigned int row = 0; row < num_derivatives_g; row++)
5713
combinations_g[row] = new unsigned int [n];
5714
for (unsigned int col = 0; col < n; col++)
5715
combinations_g[row][col] = 0;
5718
// Generate combinations of derivatives
5719
for (unsigned int row = 1; row < num_derivatives_g; row++)
5721
for (unsigned int num = 0; num < row; num++)
5723
for (unsigned int col = n-1; col+1 > 0; col--)
5725
if (combinations_g[row][col] + 1 > 2)
5726
combinations_g[row][col] = 0;
5729
combinations_g[row][col] += 1;
5736
// Compute inverse of Jacobian
5737
const double Jinv[2][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}};
5739
// Declare transformation matrix
5740
// Declare pointer to two dimensional array and initialise
5741
double **transform = new double *[num_derivatives_g];
5743
for (unsigned int j = 0; j < num_derivatives_g; j++)
5745
transform[j] = new double [num_derivatives_t];
5746
for (unsigned int k = 0; k < num_derivatives_t; k++)
5747
transform[j][k] = 1;
5750
// Construct transformation matrix
5751
for (unsigned int row = 0; row < num_derivatives_g; row++)
5753
for (unsigned int col = 0; col < num_derivatives_t; col++)
5755
for (unsigned int k = 0; k < n; k++)
5756
transform[row][col] *= Jinv[combinations_t[col][k]][combinations_g[row][k]];
5760
// Reset values. Assuming that values is always an array.
5761
for (unsigned int r = 0; r < num_derivatives_g; r++)
5764
}// end loop over 'r'
5771
// Array of basisvalues
5772
double basisvalues[3] = {0.0, 0.0, 0.0};
5774
// Declare helper variables
5775
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5777
// Compute basisvalues
5778
basisvalues[0] = 1.0;
5779
basisvalues[1] = tmp0;
5780
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
5781
basisvalues[0] *= std::sqrt(0.5);
5782
basisvalues[2] *= std::sqrt(1.0);
5783
basisvalues[1] *= std::sqrt(3.0);
5785
// Table(s) of coefficients
5786
static const double coefficients0[3] = \
5787
{0.47140452, -0.28867513, -0.16666667};
5789
// Tables of derivatives of the polynomial base (transpose).
5790
static const double dmats0[3][3] = \
5792
{4.8989795, 0.0, 0.0},
5795
static const double dmats1[3][3] = \
5797
{2.4494897, 0.0, 0.0},
5798
{4.2426407, 0.0, 0.0}};
5800
// Compute reference derivatives.
5801
// Declare pointer to array of derivatives on FIAT element.
5802
double *derivatives = new double[num_derivatives_t];
5803
for (unsigned int r = 0; r < num_derivatives_t; r++)
5805
derivatives[r] = 0.0;
5806
}// end loop over 'r'
5808
// Declare derivative matrix (of polynomial basis).
5809
double dmats[3][3] = \
5814
// Declare (auxiliary) derivative matrix (of polynomial basis).
5815
double dmats_old[3][3] = \
5820
// Loop possible derivatives.
5821
for (unsigned int r = 0; r < num_derivatives_t; r++)
5823
// Resetting dmats values to compute next derivative.
5824
for (unsigned int t = 0; t < 3; t++)
5826
for (unsigned int u = 0; u < 3; u++)
5834
}// end loop over 'u'
5835
}// end loop over 't'
5837
// Looping derivative order to generate dmats.
5838
for (unsigned int s = 0; s < n; s++)
5840
// Updating dmats_old with new values and resetting dmats.
5841
for (unsigned int t = 0; t < 3; t++)
5843
for (unsigned int u = 0; u < 3; u++)
5845
dmats_old[t][u] = dmats[t][u];
5847
}// end loop over 'u'
5848
}// end loop over 't'
5850
// Update dmats using an inner product.
5851
if (combinations_t[r][s] == 0)
5853
for (unsigned int t = 0; t < 3; t++)
5855
for (unsigned int u = 0; u < 3; u++)
5857
for (unsigned int tu = 0; tu < 3; tu++)
5859
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
5860
}// end loop over 'tu'
5861
}// end loop over 'u'
5862
}// end loop over 't'
5865
if (combinations_t[r][s] == 1)
5867
for (unsigned int t = 0; t < 3; t++)
5869
for (unsigned int u = 0; u < 3; u++)
5871
for (unsigned int tu = 0; tu < 3; tu++)
5873
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
5874
}// end loop over 'tu'
5875
}// end loop over 'u'
5876
}// end loop over 't'
5879
}// end loop over 's'
5880
for (unsigned int s = 0; s < 3; s++)
5882
for (unsigned int t = 0; t < 3; t++)
5884
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
5885
}// end loop over 't'
5886
}// end loop over 's'
5887
}// end loop over 'r'
5889
// Transform derivatives back to physical element
5890
for (unsigned int r = 0; r < num_derivatives_g; r++)
5892
for (unsigned int s = 0; s < num_derivatives_t; s++)
5894
values[r] += transform[r][s]*derivatives[s];
5895
}// end loop over 's'
5896
}// end loop over 'r'
5898
// Delete pointer to array of derivatives on FIAT element
5899
delete [] derivatives;
5901
// Delete pointer to array of combinations of derivatives and transform
5902
for (unsigned int r = 0; r < num_derivatives_t; r++)
5904
delete [] combinations_t[r];
5905
}// end loop over 'r'
5906
delete [] combinations_t;
5907
for (unsigned int r = 0; r < num_derivatives_g; r++)
5909
delete [] combinations_g[r];
5910
}// end loop over 'r'
5911
delete [] combinations_g;
5912
for (unsigned int r = 0; r < num_derivatives_g; r++)
5914
delete [] transform[r];
5915
}// end loop over 'r'
5916
delete [] transform;
5922
// Array of basisvalues
5923
double basisvalues[3] = {0.0, 0.0, 0.0};
5925
// Declare helper variables
5926
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
5928
// Compute basisvalues
5929
basisvalues[0] = 1.0;
5930
basisvalues[1] = tmp0;
5931
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
5932
basisvalues[0] *= std::sqrt(0.5);
5933
basisvalues[2] *= std::sqrt(1.0);
5934
basisvalues[1] *= std::sqrt(3.0);
5936
// Table(s) of coefficients
5937
static const double coefficients0[3] = \
5938
{0.47140452, 0.28867513, -0.16666667};
5940
// Tables of derivatives of the polynomial base (transpose).
5941
static const double dmats0[3][3] = \
5943
{4.8989795, 0.0, 0.0},
5946
static const double dmats1[3][3] = \
5948
{2.4494897, 0.0, 0.0},
5949
{4.2426407, 0.0, 0.0}};
5951
// Compute reference derivatives.
5952
// Declare pointer to array of derivatives on FIAT element.
5953
double *derivatives = new double[num_derivatives_t];
5954
for (unsigned int r = 0; r < num_derivatives_t; r++)
5956
derivatives[r] = 0.0;
5957
}// end loop over 'r'
5959
// Declare derivative matrix (of polynomial basis).
5960
double dmats[3][3] = \
5965
// Declare (auxiliary) derivative matrix (of polynomial basis).
5966
double dmats_old[3][3] = \
5971
// Loop possible derivatives.
5972
for (unsigned int r = 0; r < num_derivatives_t; r++)
5974
// Resetting dmats values to compute next derivative.
5975
for (unsigned int t = 0; t < 3; t++)
5977
for (unsigned int u = 0; u < 3; u++)
5985
}// end loop over 'u'
5986
}// end loop over 't'
5988
// Looping derivative order to generate dmats.
5989
for (unsigned int s = 0; s < n; s++)
5991
// Updating dmats_old with new values and resetting dmats.
5992
for (unsigned int t = 0; t < 3; t++)
5994
for (unsigned int u = 0; u < 3; u++)
5996
dmats_old[t][u] = dmats[t][u];
5998
}// end loop over 'u'
5999
}// end loop over 't'
6001
// Update dmats using an inner product.
6002
if (combinations_t[r][s] == 0)
6004
for (unsigned int t = 0; t < 3; t++)
6006
for (unsigned int u = 0; u < 3; u++)
6008
for (unsigned int tu = 0; tu < 3; tu++)
6010
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
6011
}// end loop over 'tu'
6012
}// end loop over 'u'
6013
}// end loop over 't'
6016
if (combinations_t[r][s] == 1)
6018
for (unsigned int t = 0; t < 3; t++)
6020
for (unsigned int u = 0; u < 3; u++)
6022
for (unsigned int tu = 0; tu < 3; tu++)
6024
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
6025
}// end loop over 'tu'
6026
}// end loop over 'u'
6027
}// end loop over 't'
6030
}// end loop over 's'
6031
for (unsigned int s = 0; s < 3; s++)
6033
for (unsigned int t = 0; t < 3; t++)
6035
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
6036
}// end loop over 't'
6037
}// end loop over 's'
6038
}// end loop over 'r'
6040
// Transform derivatives back to physical element
6041
for (unsigned int r = 0; r < num_derivatives_g; r++)
6043
for (unsigned int s = 0; s < num_derivatives_t; s++)
6045
values[r] += transform[r][s]*derivatives[s];
6046
}// end loop over 's'
6047
}// end loop over 'r'
6049
// Delete pointer to array of derivatives on FIAT element
6050
delete [] derivatives;
6052
// Delete pointer to array of combinations of derivatives and transform
6053
for (unsigned int r = 0; r < num_derivatives_t; r++)
6055
delete [] combinations_t[r];
6056
}// end loop over 'r'
6057
delete [] combinations_t;
6058
for (unsigned int r = 0; r < num_derivatives_g; r++)
6060
delete [] combinations_g[r];
6061
}// end loop over 'r'
6062
delete [] combinations_g;
6063
for (unsigned int r = 0; r < num_derivatives_g; r++)
6065
delete [] transform[r];
6066
}// end loop over 'r'
6067
delete [] transform;
6073
// Array of basisvalues
6074
double basisvalues[3] = {0.0, 0.0, 0.0};
6076
// Declare helper variables
6077
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6079
// Compute basisvalues
6080
basisvalues[0] = 1.0;
6081
basisvalues[1] = tmp0;
6082
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
6083
basisvalues[0] *= std::sqrt(0.5);
6084
basisvalues[2] *= std::sqrt(1.0);
6085
basisvalues[1] *= std::sqrt(3.0);
6087
// Table(s) of coefficients
6088
static const double coefficients0[3] = \
6089
{0.47140452, 0.0, 0.33333333};
6091
// Tables of derivatives of the polynomial base (transpose).
6092
static const double dmats0[3][3] = \
6094
{4.8989795, 0.0, 0.0},
6097
static const double dmats1[3][3] = \
6099
{2.4494897, 0.0, 0.0},
6100
{4.2426407, 0.0, 0.0}};
6102
// Compute reference derivatives.
6103
// Declare pointer to array of derivatives on FIAT element.
6104
double *derivatives = new double[num_derivatives_t];
6105
for (unsigned int r = 0; r < num_derivatives_t; r++)
6107
derivatives[r] = 0.0;
6108
}// end loop over 'r'
6110
// Declare derivative matrix (of polynomial basis).
6111
double dmats[3][3] = \
6116
// Declare (auxiliary) derivative matrix (of polynomial basis).
6117
double dmats_old[3][3] = \
6122
// Loop possible derivatives.
6123
for (unsigned int r = 0; r < num_derivatives_t; r++)
6125
// Resetting dmats values to compute next derivative.
6126
for (unsigned int t = 0; t < 3; t++)
6128
for (unsigned int u = 0; u < 3; u++)
6136
}// end loop over 'u'
6137
}// end loop over 't'
6139
// Looping derivative order to generate dmats.
6140
for (unsigned int s = 0; s < n; s++)
6142
// Updating dmats_old with new values and resetting dmats.
6143
for (unsigned int t = 0; t < 3; t++)
6145
for (unsigned int u = 0; u < 3; u++)
6147
dmats_old[t][u] = dmats[t][u];
6149
}// end loop over 'u'
6150
}// end loop over 't'
6152
// Update dmats using an inner product.
6153
if (combinations_t[r][s] == 0)
6155
for (unsigned int t = 0; t < 3; t++)
6157
for (unsigned int u = 0; u < 3; u++)
6159
for (unsigned int tu = 0; tu < 3; tu++)
6161
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
6162
}// end loop over 'tu'
6163
}// end loop over 'u'
6164
}// end loop over 't'
6167
if (combinations_t[r][s] == 1)
6169
for (unsigned int t = 0; t < 3; t++)
6171
for (unsigned int u = 0; u < 3; u++)
6173
for (unsigned int tu = 0; tu < 3; tu++)
6175
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
6176
}// end loop over 'tu'
6177
}// end loop over 'u'
6178
}// end loop over 't'
6181
}// end loop over 's'
6182
for (unsigned int s = 0; s < 3; s++)
6184
for (unsigned int t = 0; t < 3; t++)
6186
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
6187
}// end loop over 't'
6188
}// end loop over 's'
6189
}// end loop over 'r'
6191
// Transform derivatives back to physical element
6192
for (unsigned int r = 0; r < num_derivatives_g; r++)
6194
for (unsigned int s = 0; s < num_derivatives_t; s++)
6196
values[r] += transform[r][s]*derivatives[s];
6197
}// end loop over 's'
6198
}// end loop over 'r'
6200
// Delete pointer to array of derivatives on FIAT element
6201
delete [] derivatives;
6203
// Delete pointer to array of combinations of derivatives and transform
6204
for (unsigned int r = 0; r < num_derivatives_t; r++)
6206
delete [] combinations_t[r];
6207
}// end loop over 'r'
6208
delete [] combinations_t;
6209
for (unsigned int r = 0; r < num_derivatives_g; r++)
6211
delete [] combinations_g[r];
6212
}// end loop over 'r'
6213
delete [] combinations_g;
6214
for (unsigned int r = 0; r < num_derivatives_g; r++)
6216
delete [] transform[r];
6217
}// end loop over 'r'
6218
delete [] transform;
6225
/// Evaluate order n derivatives of all basis functions at given point x in cell
6226
virtual void evaluate_basis_derivatives_all(std::size_t n,
6229
const double* vertex_coordinates,
6230
int cell_orientation) const
6232
// Compute number of derivatives.
6233
unsigned int num_derivatives_g = 1;
6234
for (unsigned int r = 0; r < n; r++)
6236
num_derivatives_g *= 3;
6237
}// end loop over 'r'
6239
// Helper variable to hold values of a single dof.
6240
double *dof_values = new double[num_derivatives_g];
6241
for (unsigned int r = 0; r < num_derivatives_g; r++)
6243
dof_values[r] = 0.0;
6244
}// end loop over 'r'
6246
// Loop dofs and call evaluate_basis_derivatives.
6247
for (unsigned int r = 0; r < 3; r++)
6249
evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
6250
for (unsigned int s = 0; s < num_derivatives_g; s++)
6252
values[r*num_derivatives_g + s] = dof_values[s];
6253
}// end loop over 's'
6254
}// end loop over 'r'
6257
delete [] dof_values;
6260
/// Evaluate linear functional for dof i on the function f
6261
virtual double evaluate_dof(std::size_t i,
6262
const ufc::function& f,
6263
const double* vertex_coordinates,
6264
int cell_orientation,
6265
const ufc::cell& c) const
6267
// Declare variables for result of evaluation
6270
// Declare variable for physical coordinates
6276
y[0] = vertex_coordinates[0];
6277
y[1] = vertex_coordinates[1];
6278
y[2] = vertex_coordinates[2];
6279
f.evaluate(vals, y, c);
6285
y[0] = vertex_coordinates[3];
6286
y[1] = vertex_coordinates[4];
6287
y[2] = vertex_coordinates[5];
6288
f.evaluate(vals, y, c);
6294
y[0] = vertex_coordinates[6];
6295
y[1] = vertex_coordinates[7];
6296
y[2] = vertex_coordinates[8];
6297
f.evaluate(vals, y, c);
6306
/// Evaluate linear functionals for all dofs on the function f
6307
virtual void evaluate_dofs(double* values,
6308
const ufc::function& f,
6309
const double* vertex_coordinates,
6310
int cell_orientation,
6311
const ufc::cell& c) const
6313
// Declare variables for result of evaluation
6316
// Declare variable for physical coordinates
6318
y[0] = vertex_coordinates[0];
6319
y[1] = vertex_coordinates[1];
6320
y[2] = vertex_coordinates[2];
6321
f.evaluate(vals, y, c);
6322
values[0] = vals[0];
6323
y[0] = vertex_coordinates[3];
6324
y[1] = vertex_coordinates[4];
6325
y[2] = vertex_coordinates[5];
6326
f.evaluate(vals, y, c);
6327
values[1] = vals[0];
6328
y[0] = vertex_coordinates[6];
6329
y[1] = vertex_coordinates[7];
6330
y[2] = vertex_coordinates[8];
6331
f.evaluate(vals, y, c);
6332
values[2] = vals[0];
6335
/// Interpolate vertex values from dof values
6336
virtual void interpolate_vertex_values(double* vertex_values,
6337
const double* dof_values,
6338
const double* vertex_coordinates,
6339
int cell_orientation,
6340
const ufc::cell& c) const
6342
// Evaluate function and change variables
6343
vertex_values[0] = dof_values[0];
6344
vertex_values[1] = dof_values[1];
6345
vertex_values[2] = dof_values[2];
6348
/// Map coordinate xhat from reference cell to coordinate x in cell
6349
virtual void map_from_reference_cell(double* x,
6351
const ufc::cell& c) const
6353
std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
6356
/// Map from coordinate x in cell to coordinate xhat in reference cell
6357
virtual void map_to_reference_cell(double* xhat,
6359
const ufc::cell& c) const
6361
std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
6364
/// Return the number of sub elements (for a mixed element)
6365
virtual std::size_t num_sub_elements() const
6370
/// Create a new finite element for sub element i (for a mixed element)
6371
virtual ufc::finite_element* create_sub_element(std::size_t i) const
6376
/// Create a new class instance
6377
virtual ufc::finite_element* create() const
6379
return new x_element9_finite_element_3();
6384
/// This class defines the interface for a finite element.
6386
class x_element9_finite_element_4: public ufc::finite_element
6391
x_element9_finite_element_4() : ufc::finite_element()
6397
virtual ~x_element9_finite_element_4()
6402
/// Return a string identifying the finite element
6403
virtual const char* signature() const
6405
return "MixedElement(*[FiniteElement('Raviart-Thomas', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 2, None), FiniteElement('Brezzi-Douglas-Marini', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 1, None), FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 1, None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 1, None)], **{'value_shape': (10,) })";
6408
/// Return the cell shape
6409
virtual ufc::shape cell_shape() const
6411
return ufc::triangle;
6414
/// Return the topological dimension of the cell shape
6415
virtual std::size_t topological_dimension() const
6420
/// Return the geometric dimension of the cell shape
6421
virtual std::size_t geometric_dimension() const
6426
/// Return the dimension of the finite element function space
6427
virtual std::size_t space_dimension() const
6432
/// Return the rank of the value space
6433
virtual std::size_t value_rank() const
6438
/// Return the dimension of the value space for axis i
6439
virtual std::size_t value_dimension(std::size_t i) const
6453
/// Evaluate basis function i at given point x in cell
6454
virtual void evaluate_basis(std::size_t i,
6457
const double* vertex_coordinates,
6458
int cell_orientation) const
6462
compute_jacobian_triangle_3d(J, vertex_coordinates);
6464
// Compute Jacobian inverse and determinant
6467
compute_jacobian_inverse_triangle_3d(K, detJ, J);
6470
// Check orientation
6471
if (cell_orientation == -1)
6472
throw std::runtime_error("cell orientation must be defined (not -1)");
6473
// (If cell_orientation == 1 = down, multiply det(J) by -1)
6474
else if (cell_orientation == 1)
6478
const double b0 = vertex_coordinates[0];
6479
const double b1 = vertex_coordinates[1];
6480
const double b2 = vertex_coordinates[2];
6482
// P_FFC = J^dag (p - b), P_FIAT = 2*P_FFC - (1, 1)
6483
double X = 2*(K[0]*(x[0] - b0) + K[1]*(x[1] - b1) + K[2]*(x[2] - b2)) - 1.0;
6484
double Y = 2*(K[3]*(x[0] - b0) + K[4]*(x[1] - b1) + K[5]*(x[2] - b2)) - 1.0;
6500
// Array of basisvalues
6501
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6503
// Declare helper variables
6504
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6505
double tmp1 = (1.0 - Y)/2.0;
6506
double tmp2 = tmp1*tmp1;
6508
// Compute basisvalues
6509
basisvalues[0] = 1.0;
6510
basisvalues[1] = tmp0;
6511
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
6512
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
6513
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
6514
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
6515
basisvalues[0] *= std::sqrt(0.5);
6516
basisvalues[2] *= std::sqrt(1.0);
6517
basisvalues[5] *= std::sqrt(1.5);
6518
basisvalues[1] *= std::sqrt(3.0);
6519
basisvalues[4] *= std::sqrt(4.5);
6520
basisvalues[3] *= std::sqrt(7.5);
6522
// Table(s) of coefficients
6523
static const double coefficients0[6] = \
6524
{0.23570226, 0.40414519, -0.23333333, 0.18257419, -0.14142136, 0.081649658};
6526
static const double coefficients1[6] = \
6527
{-0.11785113, 0.17320508, -0.23333333, 0.0, 0.14142136, -0.12247449};
6530
for (unsigned int r = 0; r < 6; r++)
6532
values[0] += coefficients0[r]*basisvalues[r];
6533
values[1] += coefficients1[r]*basisvalues[r];
6534
}// end loop over 'r'
6536
// Using contravariant Piola transform to map values back to the physical element
6537
const double tmp_ref0 = values[0];
6538
const double tmp_ref1 = values[1];
6539
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
6540
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6541
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
6547
// Array of basisvalues
6548
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6550
// Declare helper variables
6551
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6552
double tmp1 = (1.0 - Y)/2.0;
6553
double tmp2 = tmp1*tmp1;
6555
// Compute basisvalues
6556
basisvalues[0] = 1.0;
6557
basisvalues[1] = tmp0;
6558
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
6559
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
6560
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
6561
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
6562
basisvalues[0] *= std::sqrt(0.5);
6563
basisvalues[2] *= std::sqrt(1.0);
6564
basisvalues[5] *= std::sqrt(1.5);
6565
basisvalues[1] *= std::sqrt(3.0);
6566
basisvalues[4] *= std::sqrt(4.5);
6567
basisvalues[3] *= std::sqrt(7.5);
6569
// Table(s) of coefficients
6570
static const double coefficients0[6] = \
6571
{-0.11785113, -0.11547005, 0.26666667, 0.0, 0.14142136, -0.12247449};
6573
static const double coefficients1[6] = \
6574
{0.23570226, 0.0, 0.46666667, 0.0, 0.0, 0.24494897};
6577
for (unsigned int r = 0; r < 6; r++)
6579
values[0] += coefficients0[r]*basisvalues[r];
6580
values[1] += coefficients1[r]*basisvalues[r];
6581
}// end loop over 'r'
6583
// Using contravariant Piola transform to map values back to the physical element
6584
const double tmp_ref0 = values[0];
6585
const double tmp_ref1 = values[1];
6586
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
6587
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6588
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
6594
// Array of basisvalues
6595
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6597
// Declare helper variables
6598
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6599
double tmp1 = (1.0 - Y)/2.0;
6600
double tmp2 = tmp1*tmp1;
6602
// Compute basisvalues
6603
basisvalues[0] = 1.0;
6604
basisvalues[1] = tmp0;
6605
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
6606
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
6607
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
6608
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
6609
basisvalues[0] *= std::sqrt(0.5);
6610
basisvalues[2] *= std::sqrt(1.0);
6611
basisvalues[5] *= std::sqrt(1.5);
6612
basisvalues[1] *= std::sqrt(3.0);
6613
basisvalues[4] *= std::sqrt(4.5);
6614
basisvalues[3] *= std::sqrt(7.5);
6616
// Table(s) of coefficients
6617
static const double coefficients0[6] = \
6618
{0.11785113, -0.57735027, -0.46666667, 0.18257419, 0.0, -0.040824829};
6620
static const double coefficients1[6] = \
6621
{0.11785113, 0.17320508, 0.23333333, 0.0, 0.14142136, 0.12247449};
6624
for (unsigned int r = 0; r < 6; r++)
6626
values[0] += coefficients0[r]*basisvalues[r];
6627
values[1] += coefficients1[r]*basisvalues[r];
6628
}// end loop over 'r'
6630
// Using contravariant Piola transform to map values back to the physical element
6631
const double tmp_ref0 = values[0];
6632
const double tmp_ref1 = values[1];
6633
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
6634
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6635
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
6641
// Array of basisvalues
6642
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6644
// Declare helper variables
6645
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6646
double tmp1 = (1.0 - Y)/2.0;
6647
double tmp2 = tmp1*tmp1;
6649
// Compute basisvalues
6650
basisvalues[0] = 1.0;
6651
basisvalues[1] = tmp0;
6652
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
6653
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
6654
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
6655
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
6656
basisvalues[0] *= std::sqrt(0.5);
6657
basisvalues[2] *= std::sqrt(1.0);
6658
basisvalues[5] *= std::sqrt(1.5);
6659
basisvalues[1] *= std::sqrt(3.0);
6660
basisvalues[4] *= std::sqrt(4.5);
6661
basisvalues[3] *= std::sqrt(7.5);
6663
// Table(s) of coefficients
6664
static const double coefficients0[6] = \
6665
{0.11785113, 0.11547005, 0.73333333, 0.0, -0.14142136, 0.12247449};
6667
static const double coefficients1[6] = \
6668
{-0.23570226, 0.0, -0.46666667, 0.0, 0.0, -0.24494897};
6671
for (unsigned int r = 0; r < 6; r++)
6673
values[0] += coefficients0[r]*basisvalues[r];
6674
values[1] += coefficients1[r]*basisvalues[r];
6675
}// end loop over 'r'
6677
// Using contravariant Piola transform to map values back to the physical element
6678
const double tmp_ref0 = values[0];
6679
const double tmp_ref1 = values[1];
6680
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
6681
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6682
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
6688
// Array of basisvalues
6689
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6691
// Declare helper variables
6692
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6693
double tmp1 = (1.0 - Y)/2.0;
6694
double tmp2 = tmp1*tmp1;
6696
// Compute basisvalues
6697
basisvalues[0] = 1.0;
6698
basisvalues[1] = tmp0;
6699
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
6700
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
6701
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
6702
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
6703
basisvalues[0] *= std::sqrt(0.5);
6704
basisvalues[2] *= std::sqrt(1.0);
6705
basisvalues[5] *= std::sqrt(1.5);
6706
basisvalues[1] *= std::sqrt(3.0);
6707
basisvalues[4] *= std::sqrt(4.5);
6708
basisvalues[3] *= std::sqrt(7.5);
6710
// Table(s) of coefficients
6711
static const double coefficients0[6] = \
6712
{-0.11785113, -0.28867513, -0.033333333, -0.18257419, 0.0, 0.040824829};
6714
static const double coefficients1[6] = \
6715
{-0.11785113, 0.69282032, 0.26666667, 0.0, -0.14142136, -0.12247449};
6718
for (unsigned int r = 0; r < 6; r++)
6720
values[0] += coefficients0[r]*basisvalues[r];
6721
values[1] += coefficients1[r]*basisvalues[r];
6722
}// end loop over 'r'
6724
// Using contravariant Piola transform to map values back to the physical element
6725
const double tmp_ref0 = values[0];
6726
const double tmp_ref1 = values[1];
6727
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
6728
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6729
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
6735
// Array of basisvalues
6736
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6738
// Declare helper variables
6739
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6740
double tmp1 = (1.0 - Y)/2.0;
6741
double tmp2 = tmp1*tmp1;
6743
// Compute basisvalues
6744
basisvalues[0] = 1.0;
6745
basisvalues[1] = tmp0;
6746
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
6747
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
6748
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
6749
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
6750
basisvalues[0] *= std::sqrt(0.5);
6751
basisvalues[2] *= std::sqrt(1.0);
6752
basisvalues[5] *= std::sqrt(1.5);
6753
basisvalues[1] *= std::sqrt(3.0);
6754
basisvalues[4] *= std::sqrt(4.5);
6755
basisvalues[3] *= std::sqrt(7.5);
6757
// Table(s) of coefficients
6758
static const double coefficients0[6] = \
6759
{0.23570226, 0.40414519, -0.23333333, 0.18257419, -0.14142136, 0.081649658};
6761
static const double coefficients1[6] = \
6762
{-0.11785113, -0.69282032, 0.26666667, 0.0, 0.14142136, -0.12247449};
6765
for (unsigned int r = 0; r < 6; r++)
6767
values[0] += coefficients0[r]*basisvalues[r];
6768
values[1] += coefficients1[r]*basisvalues[r];
6769
}// end loop over 'r'
6771
// Using contravariant Piola transform to map values back to the physical element
6772
const double tmp_ref0 = values[0];
6773
const double tmp_ref1 = values[1];
6774
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
6775
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6776
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
6782
// Array of basisvalues
6783
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6785
// Declare helper variables
6786
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6787
double tmp1 = (1.0 - Y)/2.0;
6788
double tmp2 = tmp1*tmp1;
6790
// Compute basisvalues
6791
basisvalues[0] = 1.0;
6792
basisvalues[1] = tmp0;
6793
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
6794
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
6795
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
6796
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
6797
basisvalues[0] *= std::sqrt(0.5);
6798
basisvalues[2] *= std::sqrt(1.0);
6799
basisvalues[5] *= std::sqrt(1.5);
6800
basisvalues[1] *= std::sqrt(3.0);
6801
basisvalues[4] *= std::sqrt(4.5);
6802
basisvalues[3] *= std::sqrt(7.5);
6804
// Table(s) of coefficients
6805
static const double coefficients0[6] = \
6806
{1.0606602, 0.17320508, -0.3, -0.36514837, 0.14142136, -0.040824829};
6808
static const double coefficients1[6] = \
6809
{0.0, -0.34641016, 0.0, 0.0, -0.28284271, 0.0};
6812
for (unsigned int r = 0; r < 6; r++)
6814
values[0] += coefficients0[r]*basisvalues[r];
6815
values[1] += coefficients1[r]*basisvalues[r];
6816
}// end loop over 'r'
6818
// Using contravariant Piola transform to map values back to the physical element
6819
const double tmp_ref0 = values[0];
6820
const double tmp_ref1 = values[1];
6821
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
6822
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6823
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
6829
// Array of basisvalues
6830
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
6832
// Declare helper variables
6833
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6834
double tmp1 = (1.0 - Y)/2.0;
6835
double tmp2 = tmp1*tmp1;
6837
// Compute basisvalues
6838
basisvalues[0] = 1.0;
6839
basisvalues[1] = tmp0;
6840
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
6841
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
6842
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
6843
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
6844
basisvalues[0] *= std::sqrt(0.5);
6845
basisvalues[2] *= std::sqrt(1.0);
6846
basisvalues[5] *= std::sqrt(1.5);
6847
basisvalues[1] *= std::sqrt(3.0);
6848
basisvalues[4] *= std::sqrt(4.5);
6849
basisvalues[3] *= std::sqrt(7.5);
6851
// Table(s) of coefficients
6852
static const double coefficients0[6] = \
6853
{0.0, -0.17320508, -0.3, -0.18257419, -0.14142136, 0.16329932};
6855
static const double coefficients1[6] = \
6856
{1.0606602, -0.17320508, 0.3, 0.0, -0.14142136, -0.36742346};
6859
for (unsigned int r = 0; r < 6; r++)
6861
values[0] += coefficients0[r]*basisvalues[r];
6862
values[1] += coefficients1[r]*basisvalues[r];
6863
}// end loop over 'r'
6865
// Using contravariant Piola transform to map values back to the physical element
6866
const double tmp_ref0 = values[0];
6867
const double tmp_ref1 = values[1];
6868
values[0] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
6869
values[1] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6870
values[2] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
6876
// Array of basisvalues
6877
double basisvalues[3] = {0.0, 0.0, 0.0};
6879
// Declare helper variables
6880
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6882
// Compute basisvalues
6883
basisvalues[0] = 1.0;
6884
basisvalues[1] = tmp0;
6885
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
6886
basisvalues[0] *= std::sqrt(0.5);
6887
basisvalues[2] *= std::sqrt(1.0);
6888
basisvalues[1] *= std::sqrt(3.0);
6890
// Table(s) of coefficients
6891
static const double coefficients0[3] = \
6892
{0.94280904, 0.57735027, -0.33333333};
6894
static const double coefficients1[3] = \
6895
{-0.47140452, 0.0, -0.33333333};
6898
for (unsigned int r = 0; r < 3; r++)
6900
values[2] += coefficients0[r]*basisvalues[r];
6901
values[3] += coefficients1[r]*basisvalues[r];
6902
}// end loop over 'r'
6904
// Using contravariant Piola transform to map values back to the physical element
6905
const double tmp_ref0 = values[2];
6906
const double tmp_ref1 = values[3];
6907
values[2] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
6908
values[3] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6909
values[4] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
6915
// Array of basisvalues
6916
double basisvalues[3] = {0.0, 0.0, 0.0};
6918
// Declare helper variables
6919
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6921
// Compute basisvalues
6922
basisvalues[0] = 1.0;
6923
basisvalues[1] = tmp0;
6924
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
6925
basisvalues[0] *= std::sqrt(0.5);
6926
basisvalues[2] *= std::sqrt(1.0);
6927
basisvalues[1] *= std::sqrt(3.0);
6929
// Table(s) of coefficients
6930
static const double coefficients0[3] = \
6931
{-0.47140452, -0.28867513, 0.16666667};
6933
static const double coefficients1[3] = \
6934
{0.94280904, 0.0, 0.66666667};
6937
for (unsigned int r = 0; r < 3; r++)
6939
values[2] += coefficients0[r]*basisvalues[r];
6940
values[3] += coefficients1[r]*basisvalues[r];
6941
}// end loop over 'r'
6943
// Using contravariant Piola transform to map values back to the physical element
6944
const double tmp_ref0 = values[2];
6945
const double tmp_ref1 = values[3];
6946
values[2] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
6947
values[3] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6948
values[4] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
6954
// Array of basisvalues
6955
double basisvalues[3] = {0.0, 0.0, 0.0};
6957
// Declare helper variables
6958
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6960
// Compute basisvalues
6961
basisvalues[0] = 1.0;
6962
basisvalues[1] = tmp0;
6963
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
6964
basisvalues[0] *= std::sqrt(0.5);
6965
basisvalues[2] *= std::sqrt(1.0);
6966
basisvalues[1] *= std::sqrt(3.0);
6968
// Table(s) of coefficients
6969
static const double coefficients0[3] = \
6970
{0.47140452, -0.57735027, -0.66666667};
6972
static const double coefficients1[3] = \
6973
{0.47140452, 0.0, 0.33333333};
6976
for (unsigned int r = 0; r < 3; r++)
6978
values[2] += coefficients0[r]*basisvalues[r];
6979
values[3] += coefficients1[r]*basisvalues[r];
6980
}// end loop over 'r'
6982
// Using contravariant Piola transform to map values back to the physical element
6983
const double tmp_ref0 = values[2];
6984
const double tmp_ref1 = values[3];
6985
values[2] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
6986
values[3] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
6987
values[4] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
6993
// Array of basisvalues
6994
double basisvalues[3] = {0.0, 0.0, 0.0};
6996
// Declare helper variables
6997
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
6999
// Compute basisvalues
7000
basisvalues[0] = 1.0;
7001
basisvalues[1] = tmp0;
7002
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
7003
basisvalues[0] *= std::sqrt(0.5);
7004
basisvalues[2] *= std::sqrt(1.0);
7005
basisvalues[1] *= std::sqrt(3.0);
7007
// Table(s) of coefficients
7008
static const double coefficients0[3] = \
7009
{0.47140452, 0.28867513, 0.83333333};
7011
static const double coefficients1[3] = \
7012
{-0.94280904, 0.0, -0.66666667};
7015
for (unsigned int r = 0; r < 3; r++)
7017
values[2] += coefficients0[r]*basisvalues[r];
7018
values[3] += coefficients1[r]*basisvalues[r];
7019
}// end loop over 'r'
7021
// Using contravariant Piola transform to map values back to the physical element
7022
const double tmp_ref0 = values[2];
7023
const double tmp_ref1 = values[3];
7024
values[2] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
7025
values[3] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
7026
values[4] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
7032
// Array of basisvalues
7033
double basisvalues[3] = {0.0, 0.0, 0.0};
7035
// Declare helper variables
7036
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7038
// Compute basisvalues
7039
basisvalues[0] = 1.0;
7040
basisvalues[1] = tmp0;
7041
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
7042
basisvalues[0] *= std::sqrt(0.5);
7043
basisvalues[2] *= std::sqrt(1.0);
7044
basisvalues[1] *= std::sqrt(3.0);
7046
// Table(s) of coefficients
7047
static const double coefficients0[3] = \
7048
{-0.47140452, -0.28867513, 0.16666667};
7050
static const double coefficients1[3] = \
7051
{-0.47140452, 0.8660254, 0.16666667};
7054
for (unsigned int r = 0; r < 3; r++)
7056
values[2] += coefficients0[r]*basisvalues[r];
7057
values[3] += coefficients1[r]*basisvalues[r];
7058
}// end loop over 'r'
7060
// Using contravariant Piola transform to map values back to the physical element
7061
const double tmp_ref0 = values[2];
7062
const double tmp_ref1 = values[3];
7063
values[2] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
7064
values[3] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
7065
values[4] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
7071
// Array of basisvalues
7072
double basisvalues[3] = {0.0, 0.0, 0.0};
7074
// Declare helper variables
7075
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7077
// Compute basisvalues
7078
basisvalues[0] = 1.0;
7079
basisvalues[1] = tmp0;
7080
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
7081
basisvalues[0] *= std::sqrt(0.5);
7082
basisvalues[2] *= std::sqrt(1.0);
7083
basisvalues[1] *= std::sqrt(3.0);
7085
// Table(s) of coefficients
7086
static const double coefficients0[3] = \
7087
{0.94280904, 0.57735027, -0.33333333};
7089
static const double coefficients1[3] = \
7090
{-0.47140452, -0.8660254, 0.16666667};
7093
for (unsigned int r = 0; r < 3; r++)
7095
values[2] += coefficients0[r]*basisvalues[r];
7096
values[3] += coefficients1[r]*basisvalues[r];
7097
}// end loop over 'r'
7099
// Using contravariant Piola transform to map values back to the physical element
7100
const double tmp_ref0 = values[2];
7101
const double tmp_ref1 = values[3];
7102
values[2] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
7103
values[3] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
7104
values[4] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
7110
// Array of basisvalues
7111
double basisvalues[3] = {0.0, 0.0, 0.0};
7113
// Declare helper variables
7114
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7116
// Compute basisvalues
7117
basisvalues[0] = 1.0;
7118
basisvalues[1] = tmp0;
7119
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
7120
basisvalues[0] *= std::sqrt(0.5);
7121
basisvalues[2] *= std::sqrt(1.0);
7122
basisvalues[1] *= std::sqrt(3.0);
7124
// Table(s) of coefficients
7125
static const double coefficients0[3] = \
7126
{-0.47140452, 0.0, -0.33333333};
7128
static const double coefficients1[3] = \
7129
{0.47140452, 0.28867513, -0.16666667};
7132
for (unsigned int r = 0; r < 3; r++)
7134
values[4] += coefficients0[r]*basisvalues[r];
7135
values[5] += coefficients1[r]*basisvalues[r];
7136
}// end loop over 'r'
7138
// Using covariant Piola transform to map values back to the physical element
7139
const double tmp_ref0 = values[4];
7140
const double tmp_ref1 = values[5];
7141
values[4] = (K[0]*tmp_ref0 + K[3]*tmp_ref1);
7142
values[5] = (K[1]*tmp_ref0 + K[4]*tmp_ref1);
7143
values[6] = (K[2]*tmp_ref0 + K[5]*tmp_ref1);
7149
// Array of basisvalues
7150
double basisvalues[3] = {0.0, 0.0, 0.0};
7152
// Declare helper variables
7153
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7155
// Compute basisvalues
7156
basisvalues[0] = 1.0;
7157
basisvalues[1] = tmp0;
7158
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
7159
basisvalues[0] *= std::sqrt(0.5);
7160
basisvalues[2] *= std::sqrt(1.0);
7161
basisvalues[1] *= std::sqrt(3.0);
7163
// Table(s) of coefficients
7164
static const double coefficients0[3] = \
7165
{0.47140452, 0.0, 0.33333333};
7167
static const double coefficients1[3] = \
7168
{0.94280904, -0.28867513, 0.16666667};
7171
for (unsigned int r = 0; r < 3; r++)
7173
values[4] += coefficients0[r]*basisvalues[r];
7174
values[5] += coefficients1[r]*basisvalues[r];
7175
}// end loop over 'r'
7177
// Using covariant Piola transform to map values back to the physical element
7178
const double tmp_ref0 = values[4];
7179
const double tmp_ref1 = values[5];
7180
values[4] = (K[0]*tmp_ref0 + K[3]*tmp_ref1);
7181
values[5] = (K[1]*tmp_ref0 + K[4]*tmp_ref1);
7182
values[6] = (K[2]*tmp_ref0 + K[5]*tmp_ref1);
7188
// Array of basisvalues
7189
double basisvalues[3] = {0.0, 0.0, 0.0};
7191
// Declare helper variables
7192
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7194
// Compute basisvalues
7195
basisvalues[0] = 1.0;
7196
basisvalues[1] = tmp0;
7197
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
7198
basisvalues[0] *= std::sqrt(0.5);
7199
basisvalues[2] *= std::sqrt(1.0);
7200
basisvalues[1] *= std::sqrt(3.0);
7202
// Table(s) of coefficients
7203
static const double coefficients0[3] = \
7204
{0.94280904, 0.0, -0.33333333};
7206
static const double coefficients1[3] = \
7207
{0.47140452, 0.28867513, -0.16666667};
7210
for (unsigned int r = 0; r < 3; r++)
7212
values[4] += coefficients0[r]*basisvalues[r];
7213
values[5] += coefficients1[r]*basisvalues[r];
7214
}// end loop over 'r'
7216
// Using covariant Piola transform to map values back to the physical element
7217
const double tmp_ref0 = values[4];
7218
const double tmp_ref1 = values[5];
7219
values[4] = (K[0]*tmp_ref0 + K[3]*tmp_ref1);
7220
values[5] = (K[1]*tmp_ref0 + K[4]*tmp_ref1);
7221
values[6] = (K[2]*tmp_ref0 + K[5]*tmp_ref1);
7227
// Array of basisvalues
7228
double basisvalues[3] = {0.0, 0.0, 0.0};
7230
// Declare helper variables
7231
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7233
// Compute basisvalues
7234
basisvalues[0] = 1.0;
7235
basisvalues[1] = tmp0;
7236
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
7237
basisvalues[0] *= std::sqrt(0.5);
7238
basisvalues[2] *= std::sqrt(1.0);
7239
basisvalues[1] *= std::sqrt(3.0);
7241
// Table(s) of coefficients
7242
static const double coefficients0[3] = \
7243
{0.47140452, -0.28867513, -0.16666667};
7246
for (unsigned int r = 0; r < 3; r++)
7248
values[6] += coefficients0[r]*basisvalues[r];
7249
}// end loop over 'r'
7255
// Array of basisvalues
7256
double basisvalues[3] = {0.0, 0.0, 0.0};
7258
// Declare helper variables
7259
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7261
// Compute basisvalues
7262
basisvalues[0] = 1.0;
7263
basisvalues[1] = tmp0;
7264
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
7265
basisvalues[0] *= std::sqrt(0.5);
7266
basisvalues[2] *= std::sqrt(1.0);
7267
basisvalues[1] *= std::sqrt(3.0);
7269
// Table(s) of coefficients
7270
static const double coefficients0[3] = \
7271
{0.47140452, 0.28867513, -0.16666667};
7274
for (unsigned int r = 0; r < 3; r++)
7276
values[6] += coefficients0[r]*basisvalues[r];
7277
}// end loop over 'r'
7283
// Array of basisvalues
7284
double basisvalues[3] = {0.0, 0.0, 0.0};
7286
// Declare helper variables
7287
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7289
// Compute basisvalues
7290
basisvalues[0] = 1.0;
7291
basisvalues[1] = tmp0;
7292
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
7293
basisvalues[0] *= std::sqrt(0.5);
7294
basisvalues[2] *= std::sqrt(1.0);
7295
basisvalues[1] *= std::sqrt(3.0);
7297
// Table(s) of coefficients
7298
static const double coefficients0[3] = \
7299
{0.47140452, 0.0, 0.33333333};
7302
for (unsigned int r = 0; r < 3; r++)
7304
values[6] += coefficients0[r]*basisvalues[r];
7305
}// end loop over 'r'
7312
/// Evaluate all basis functions at given point x in cell
7313
virtual void evaluate_basis_all(double* values,
7315
const double* vertex_coordinates,
7316
int cell_orientation) const
7318
// Helper variable to hold values of a single dof.
7319
double dof_values[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
7321
// Loop dofs and call evaluate_basis
7322
for (unsigned int r = 0; r < 20; r++)
7324
evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
7325
for (unsigned int s = 0; s < 10; s++)
7327
values[r*10 + s] = dof_values[s];
7328
}// end loop over 's'
7329
}// end loop over 'r'
7332
/// Evaluate order n derivatives of basis function i at given point x in cell
7333
virtual void evaluate_basis_derivatives(std::size_t i,
7337
const double* vertex_coordinates,
7338
int cell_orientation) const
7342
compute_jacobian_triangle_3d(J, vertex_coordinates);
7344
// Compute Jacobian inverse and determinant
7347
compute_jacobian_inverse_triangle_3d(K, detJ, J);
7350
// Check orientation
7351
if (cell_orientation == -1)
7352
throw std::runtime_error("cell orientation must be defined (not -1)");
7353
// (If cell_orientation == 1 = down, multiply det(J) by -1)
7354
else if (cell_orientation == 1)
7358
const double b0 = vertex_coordinates[0];
7359
const double b1 = vertex_coordinates[1];
7360
const double b2 = vertex_coordinates[2];
7362
// P_FFC = J^dag (p - b), P_FIAT = 2*P_FFC - (1, 1)
7363
double X = 2*(K[0]*(x[0] - b0) + K[1]*(x[1] - b1) + K[2]*(x[2] - b2)) - 1.0;
7364
double Y = 2*(K[3]*(x[0] - b0) + K[4]*(x[1] - b1) + K[5]*(x[2] - b2)) - 1.0;
7367
// Compute number of derivatives.
7368
unsigned int num_derivatives_t = 1;
7369
for (unsigned int r = 0; r < n; r++)
7371
num_derivatives_t *= 2;
7372
}// end loop over 'r'
7374
// Compute number of derivatives.
7375
unsigned int num_derivatives_g = 1;
7376
for (unsigned int r = 0; r < n; r++)
7378
num_derivatives_g *= 3;
7379
}// end loop over 'r'
7381
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
7382
unsigned int **combinations_t = new unsigned int *[num_derivatives_t];
7383
for (unsigned int row = 0; row < num_derivatives_t; row++)
7385
combinations_t[row] = new unsigned int [n];
7386
for (unsigned int col = 0; col < n; col++)
7387
combinations_t[row][col] = 0;
7390
// Generate combinations of derivatives
7391
for (unsigned int row = 1; row < num_derivatives_t; row++)
7393
for (unsigned int num = 0; num < row; num++)
7395
for (unsigned int col = n-1; col+1 > 0; col--)
7397
if (combinations_t[row][col] + 1 > 1)
7398
combinations_t[row][col] = 0;
7401
combinations_t[row][col] += 1;
7408
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
7409
unsigned int **combinations_g = new unsigned int *[num_derivatives_g];
7410
for (unsigned int row = 0; row < num_derivatives_g; row++)
7412
combinations_g[row] = new unsigned int [n];
7413
for (unsigned int col = 0; col < n; col++)
7414
combinations_g[row][col] = 0;
7417
// Generate combinations of derivatives
7418
for (unsigned int row = 1; row < num_derivatives_g; row++)
7420
for (unsigned int num = 0; num < row; num++)
7422
for (unsigned int col = n-1; col+1 > 0; col--)
7424
if (combinations_g[row][col] + 1 > 2)
7425
combinations_g[row][col] = 0;
7428
combinations_g[row][col] += 1;
7435
// Compute inverse of Jacobian
7436
const double Jinv[2][3] = {{K[0], K[1], K[2]}, {K[3], K[4], K[5]}};
7438
// Declare transformation matrix
7439
// Declare pointer to two dimensional array and initialise
7440
double **transform = new double *[num_derivatives_g];
7442
for (unsigned int j = 0; j < num_derivatives_g; j++)
7444
transform[j] = new double [num_derivatives_t];
7445
for (unsigned int k = 0; k < num_derivatives_t; k++)
7446
transform[j][k] = 1;
7449
// Construct transformation matrix
7450
for (unsigned int row = 0; row < num_derivatives_g; row++)
7452
for (unsigned int col = 0; col < num_derivatives_t; col++)
7454
for (unsigned int k = 0; k < n; k++)
7455
transform[row][col] *= Jinv[combinations_t[col][k]][combinations_g[row][k]];
7459
// Reset values. Assuming that values is always an array.
7460
for (unsigned int r = 0; r < 10*num_derivatives_g; r++)
7463
}// end loop over 'r'
7470
// Array of basisvalues
7471
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
7473
// Declare helper variables
7474
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7475
double tmp1 = (1.0 - Y)/2.0;
7476
double tmp2 = tmp1*tmp1;
7478
// Compute basisvalues
7479
basisvalues[0] = 1.0;
7480
basisvalues[1] = tmp0;
7481
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
7482
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
7483
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
7484
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
7485
basisvalues[0] *= std::sqrt(0.5);
7486
basisvalues[2] *= std::sqrt(1.0);
7487
basisvalues[5] *= std::sqrt(1.5);
7488
basisvalues[1] *= std::sqrt(3.0);
7489
basisvalues[4] *= std::sqrt(4.5);
7490
basisvalues[3] *= std::sqrt(7.5);
7492
// Table(s) of coefficients
7493
static const double coefficients0[6] = \
7494
{0.23570226, 0.40414519, -0.23333333, 0.18257419, -0.14142136, 0.081649658};
7496
static const double coefficients1[6] = \
7497
{-0.11785113, 0.17320508, -0.23333333, 0.0, 0.14142136, -0.12247449};
7499
// Tables of derivatives of the polynomial base (transpose).
7500
static const double dmats0[6][6] = \
7501
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7502
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
7503
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7504
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
7505
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
7506
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
7508
static const double dmats1[6][6] = \
7509
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7510
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
7511
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
7512
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
7513
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
7514
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
7516
// Compute reference derivatives.
7517
// Declare pointer to array of derivatives on FIAT element.
7518
double *derivatives = new double[2*num_derivatives_t];
7519
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
7521
derivatives[r] = 0.0;
7522
}// end loop over 'r'
7524
// Declare pointer to array of reference derivatives on physical element.
7525
double *derivatives_p = new double[3*num_derivatives_t];
7526
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
7528
derivatives_p[r] = 0.0;
7529
}// end loop over 'r'
7531
// Declare derivative matrix (of polynomial basis).
7532
double dmats[6][6] = \
7533
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7534
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
7535
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
7536
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
7537
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
7538
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
7540
// Declare (auxiliary) derivative matrix (of polynomial basis).
7541
double dmats_old[6][6] = \
7542
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7543
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
7544
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
7545
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
7546
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
7547
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
7549
// Loop possible derivatives.
7550
for (unsigned int r = 0; r < num_derivatives_t; r++)
7552
// Resetting dmats values to compute next derivative.
7553
for (unsigned int t = 0; t < 6; t++)
7555
for (unsigned int u = 0; u < 6; u++)
7563
}// end loop over 'u'
7564
}// end loop over 't'
7566
// Looping derivative order to generate dmats.
7567
for (unsigned int s = 0; s < n; s++)
7569
// Updating dmats_old with new values and resetting dmats.
7570
for (unsigned int t = 0; t < 6; t++)
7572
for (unsigned int u = 0; u < 6; u++)
7574
dmats_old[t][u] = dmats[t][u];
7576
}// end loop over 'u'
7577
}// end loop over 't'
7579
// Update dmats using an inner product.
7580
if (combinations_t[r][s] == 0)
7582
for (unsigned int t = 0; t < 6; t++)
7584
for (unsigned int u = 0; u < 6; u++)
7586
for (unsigned int tu = 0; tu < 6; tu++)
7588
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
7589
}// end loop over 'tu'
7590
}// end loop over 'u'
7591
}// end loop over 't'
7594
if (combinations_t[r][s] == 1)
7596
for (unsigned int t = 0; t < 6; t++)
7598
for (unsigned int u = 0; u < 6; u++)
7600
for (unsigned int tu = 0; tu < 6; tu++)
7602
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
7603
}// end loop over 'tu'
7604
}// end loop over 'u'
7605
}// end loop over 't'
7608
}// end loop over 's'
7609
for (unsigned int s = 0; s < 6; s++)
7611
for (unsigned int t = 0; t < 6; t++)
7613
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
7614
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
7615
}// end loop over 't'
7616
}// end loop over 's'
7618
// Using contravariant Piola transform to map values back to the physical element.
7619
const double tmp_ref0 = derivatives[r];
7620
const double tmp_ref1 = derivatives[num_derivatives_t + r];
7621
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
7622
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
7623
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
7624
}// end loop over 'r'
7626
// Transform derivatives back to physical element
7627
for (unsigned int r = 0; r < num_derivatives_g; r++)
7629
for (unsigned int s = 0; s < num_derivatives_t; s++)
7631
values[r] += transform[r][s]*derivatives_p[s];
7632
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
7633
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
7634
}// end loop over 's'
7635
}// end loop over 'r'
7637
// Delete pointer to array of derivatives on FIAT element
7638
delete [] derivatives;
7640
// Delete pointer to array of reference derivatives on physical element.
7641
delete [] derivatives_p;
7643
// Delete pointer to array of combinations of derivatives and transform
7644
for (unsigned int r = 0; r < num_derivatives_t; r++)
7646
delete [] combinations_t[r];
7647
}// end loop over 'r'
7648
delete [] combinations_t;
7649
for (unsigned int r = 0; r < num_derivatives_g; r++)
7651
delete [] combinations_g[r];
7652
}// end loop over 'r'
7653
delete [] combinations_g;
7654
for (unsigned int r = 0; r < num_derivatives_g; r++)
7656
delete [] transform[r];
7657
}// end loop over 'r'
7658
delete [] transform;
7664
// Array of basisvalues
7665
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
7667
// Declare helper variables
7668
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7669
double tmp1 = (1.0 - Y)/2.0;
7670
double tmp2 = tmp1*tmp1;
7672
// Compute basisvalues
7673
basisvalues[0] = 1.0;
7674
basisvalues[1] = tmp0;
7675
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
7676
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
7677
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
7678
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
7679
basisvalues[0] *= std::sqrt(0.5);
7680
basisvalues[2] *= std::sqrt(1.0);
7681
basisvalues[5] *= std::sqrt(1.5);
7682
basisvalues[1] *= std::sqrt(3.0);
7683
basisvalues[4] *= std::sqrt(4.5);
7684
basisvalues[3] *= std::sqrt(7.5);
7686
// Table(s) of coefficients
7687
static const double coefficients0[6] = \
7688
{-0.11785113, -0.11547005, 0.26666667, 0.0, 0.14142136, -0.12247449};
7690
static const double coefficients1[6] = \
7691
{0.23570226, 0.0, 0.46666667, 0.0, 0.0, 0.24494897};
7693
// Tables of derivatives of the polynomial base (transpose).
7694
static const double dmats0[6][6] = \
7695
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7696
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
7697
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7698
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
7699
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
7700
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
7702
static const double dmats1[6][6] = \
7703
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7704
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
7705
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
7706
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
7707
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
7708
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
7710
// Compute reference derivatives.
7711
// Declare pointer to array of derivatives on FIAT element.
7712
double *derivatives = new double[2*num_derivatives_t];
7713
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
7715
derivatives[r] = 0.0;
7716
}// end loop over 'r'
7718
// Declare pointer to array of reference derivatives on physical element.
7719
double *derivatives_p = new double[3*num_derivatives_t];
7720
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
7722
derivatives_p[r] = 0.0;
7723
}// end loop over 'r'
7725
// Declare derivative matrix (of polynomial basis).
7726
double dmats[6][6] = \
7727
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7728
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
7729
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
7730
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
7731
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
7732
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
7734
// Declare (auxiliary) derivative matrix (of polynomial basis).
7735
double dmats_old[6][6] = \
7736
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7737
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
7738
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
7739
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
7740
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
7741
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
7743
// Loop possible derivatives.
7744
for (unsigned int r = 0; r < num_derivatives_t; r++)
7746
// Resetting dmats values to compute next derivative.
7747
for (unsigned int t = 0; t < 6; t++)
7749
for (unsigned int u = 0; u < 6; u++)
7757
}// end loop over 'u'
7758
}// end loop over 't'
7760
// Looping derivative order to generate dmats.
7761
for (unsigned int s = 0; s < n; s++)
7763
// Updating dmats_old with new values and resetting dmats.
7764
for (unsigned int t = 0; t < 6; t++)
7766
for (unsigned int u = 0; u < 6; u++)
7768
dmats_old[t][u] = dmats[t][u];
7770
}// end loop over 'u'
7771
}// end loop over 't'
7773
// Update dmats using an inner product.
7774
if (combinations_t[r][s] == 0)
7776
for (unsigned int t = 0; t < 6; t++)
7778
for (unsigned int u = 0; u < 6; u++)
7780
for (unsigned int tu = 0; tu < 6; tu++)
7782
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
7783
}// end loop over 'tu'
7784
}// end loop over 'u'
7785
}// end loop over 't'
7788
if (combinations_t[r][s] == 1)
7790
for (unsigned int t = 0; t < 6; t++)
7792
for (unsigned int u = 0; u < 6; u++)
7794
for (unsigned int tu = 0; tu < 6; tu++)
7796
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
7797
}// end loop over 'tu'
7798
}// end loop over 'u'
7799
}// end loop over 't'
7802
}// end loop over 's'
7803
for (unsigned int s = 0; s < 6; s++)
7805
for (unsigned int t = 0; t < 6; t++)
7807
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
7808
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
7809
}// end loop over 't'
7810
}// end loop over 's'
7812
// Using contravariant Piola transform to map values back to the physical element.
7813
const double tmp_ref0 = derivatives[r];
7814
const double tmp_ref1 = derivatives[num_derivatives_t + r];
7815
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
7816
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
7817
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
7818
}// end loop over 'r'
7820
// Transform derivatives back to physical element
7821
for (unsigned int r = 0; r < num_derivatives_g; r++)
7823
for (unsigned int s = 0; s < num_derivatives_t; s++)
7825
values[r] += transform[r][s]*derivatives_p[s];
7826
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
7827
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
7828
}// end loop over 's'
7829
}// end loop over 'r'
7831
// Delete pointer to array of derivatives on FIAT element
7832
delete [] derivatives;
7834
// Delete pointer to array of reference derivatives on physical element.
7835
delete [] derivatives_p;
7837
// Delete pointer to array of combinations of derivatives and transform
7838
for (unsigned int r = 0; r < num_derivatives_t; r++)
7840
delete [] combinations_t[r];
7841
}// end loop over 'r'
7842
delete [] combinations_t;
7843
for (unsigned int r = 0; r < num_derivatives_g; r++)
7845
delete [] combinations_g[r];
7846
}// end loop over 'r'
7847
delete [] combinations_g;
7848
for (unsigned int r = 0; r < num_derivatives_g; r++)
7850
delete [] transform[r];
7851
}// end loop over 'r'
7852
delete [] transform;
7858
// Array of basisvalues
7859
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
7861
// Declare helper variables
7862
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
7863
double tmp1 = (1.0 - Y)/2.0;
7864
double tmp2 = tmp1*tmp1;
7866
// Compute basisvalues
7867
basisvalues[0] = 1.0;
7868
basisvalues[1] = tmp0;
7869
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
7870
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
7871
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
7872
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
7873
basisvalues[0] *= std::sqrt(0.5);
7874
basisvalues[2] *= std::sqrt(1.0);
7875
basisvalues[5] *= std::sqrt(1.5);
7876
basisvalues[1] *= std::sqrt(3.0);
7877
basisvalues[4] *= std::sqrt(4.5);
7878
basisvalues[3] *= std::sqrt(7.5);
7880
// Table(s) of coefficients
7881
static const double coefficients0[6] = \
7882
{0.11785113, -0.57735027, -0.46666667, 0.18257419, 0.0, -0.040824829};
7884
static const double coefficients1[6] = \
7885
{0.11785113, 0.17320508, 0.23333333, 0.0, 0.14142136, 0.12247449};
7887
// Tables of derivatives of the polynomial base (transpose).
7888
static const double dmats0[6][6] = \
7889
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7890
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
7891
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7892
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
7893
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
7894
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
7896
static const double dmats1[6][6] = \
7897
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7898
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
7899
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
7900
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
7901
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
7902
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
7904
// Compute reference derivatives.
7905
// Declare pointer to array of derivatives on FIAT element.
7906
double *derivatives = new double[2*num_derivatives_t];
7907
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
7909
derivatives[r] = 0.0;
7910
}// end loop over 'r'
7912
// Declare pointer to array of reference derivatives on physical element.
7913
double *derivatives_p = new double[3*num_derivatives_t];
7914
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
7916
derivatives_p[r] = 0.0;
7917
}// end loop over 'r'
7919
// Declare derivative matrix (of polynomial basis).
7920
double dmats[6][6] = \
7921
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7922
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
7923
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
7924
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
7925
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
7926
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
7928
// Declare (auxiliary) derivative matrix (of polynomial basis).
7929
double dmats_old[6][6] = \
7930
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
7931
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
7932
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
7933
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
7934
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
7935
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
7937
// Loop possible derivatives.
7938
for (unsigned int r = 0; r < num_derivatives_t; r++)
7940
// Resetting dmats values to compute next derivative.
7941
for (unsigned int t = 0; t < 6; t++)
7943
for (unsigned int u = 0; u < 6; u++)
7951
}// end loop over 'u'
7952
}// end loop over 't'
7954
// Looping derivative order to generate dmats.
7955
for (unsigned int s = 0; s < n; s++)
7957
// Updating dmats_old with new values and resetting dmats.
7958
for (unsigned int t = 0; t < 6; t++)
7960
for (unsigned int u = 0; u < 6; u++)
7962
dmats_old[t][u] = dmats[t][u];
7964
}// end loop over 'u'
7965
}// end loop over 't'
7967
// Update dmats using an inner product.
7968
if (combinations_t[r][s] == 0)
7970
for (unsigned int t = 0; t < 6; t++)
7972
for (unsigned int u = 0; u < 6; u++)
7974
for (unsigned int tu = 0; tu < 6; tu++)
7976
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
7977
}// end loop over 'tu'
7978
}// end loop over 'u'
7979
}// end loop over 't'
7982
if (combinations_t[r][s] == 1)
7984
for (unsigned int t = 0; t < 6; t++)
7986
for (unsigned int u = 0; u < 6; u++)
7988
for (unsigned int tu = 0; tu < 6; tu++)
7990
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
7991
}// end loop over 'tu'
7992
}// end loop over 'u'
7993
}// end loop over 't'
7996
}// end loop over 's'
7997
for (unsigned int s = 0; s < 6; s++)
7999
for (unsigned int t = 0; t < 6; t++)
8001
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
8002
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
8003
}// end loop over 't'
8004
}// end loop over 's'
8006
// Using contravariant Piola transform to map values back to the physical element.
8007
const double tmp_ref0 = derivatives[r];
8008
const double tmp_ref1 = derivatives[num_derivatives_t + r];
8009
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
8010
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
8011
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
8012
}// end loop over 'r'
8014
// Transform derivatives back to physical element
8015
for (unsigned int r = 0; r < num_derivatives_g; r++)
8017
for (unsigned int s = 0; s < num_derivatives_t; s++)
8019
values[r] += transform[r][s]*derivatives_p[s];
8020
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
8021
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
8022
}// end loop over 's'
8023
}// end loop over 'r'
8025
// Delete pointer to array of derivatives on FIAT element
8026
delete [] derivatives;
8028
// Delete pointer to array of reference derivatives on physical element.
8029
delete [] derivatives_p;
8031
// Delete pointer to array of combinations of derivatives and transform
8032
for (unsigned int r = 0; r < num_derivatives_t; r++)
8034
delete [] combinations_t[r];
8035
}// end loop over 'r'
8036
delete [] combinations_t;
8037
for (unsigned int r = 0; r < num_derivatives_g; r++)
8039
delete [] combinations_g[r];
8040
}// end loop over 'r'
8041
delete [] combinations_g;
8042
for (unsigned int r = 0; r < num_derivatives_g; r++)
8044
delete [] transform[r];
8045
}// end loop over 'r'
8046
delete [] transform;
8052
// Array of basisvalues
8053
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
8055
// Declare helper variables
8056
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
8057
double tmp1 = (1.0 - Y)/2.0;
8058
double tmp2 = tmp1*tmp1;
8060
// Compute basisvalues
8061
basisvalues[0] = 1.0;
8062
basisvalues[1] = tmp0;
8063
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
8064
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
8065
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
8066
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
8067
basisvalues[0] *= std::sqrt(0.5);
8068
basisvalues[2] *= std::sqrt(1.0);
8069
basisvalues[5] *= std::sqrt(1.5);
8070
basisvalues[1] *= std::sqrt(3.0);
8071
basisvalues[4] *= std::sqrt(4.5);
8072
basisvalues[3] *= std::sqrt(7.5);
8074
// Table(s) of coefficients
8075
static const double coefficients0[6] = \
8076
{0.11785113, 0.11547005, 0.73333333, 0.0, -0.14142136, 0.12247449};
8078
static const double coefficients1[6] = \
8079
{-0.23570226, 0.0, -0.46666667, 0.0, 0.0, -0.24494897};
8081
// Tables of derivatives of the polynomial base (transpose).
8082
static const double dmats0[6][6] = \
8083
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8084
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
8085
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8086
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
8087
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
8088
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
8090
static const double dmats1[6][6] = \
8091
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8092
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
8093
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
8094
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
8095
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
8096
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
8098
// Compute reference derivatives.
8099
// Declare pointer to array of derivatives on FIAT element.
8100
double *derivatives = new double[2*num_derivatives_t];
8101
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
8103
derivatives[r] = 0.0;
8104
}// end loop over 'r'
8106
// Declare pointer to array of reference derivatives on physical element.
8107
double *derivatives_p = new double[3*num_derivatives_t];
8108
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
8110
derivatives_p[r] = 0.0;
8111
}// end loop over 'r'
8113
// Declare derivative matrix (of polynomial basis).
8114
double dmats[6][6] = \
8115
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8116
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
8117
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
8118
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
8119
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
8120
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
8122
// Declare (auxiliary) derivative matrix (of polynomial basis).
8123
double dmats_old[6][6] = \
8124
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8125
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
8126
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
8127
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
8128
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
8129
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
8131
// Loop possible derivatives.
8132
for (unsigned int r = 0; r < num_derivatives_t; r++)
8134
// Resetting dmats values to compute next derivative.
8135
for (unsigned int t = 0; t < 6; t++)
8137
for (unsigned int u = 0; u < 6; u++)
8145
}// end loop over 'u'
8146
}// end loop over 't'
8148
// Looping derivative order to generate dmats.
8149
for (unsigned int s = 0; s < n; s++)
8151
// Updating dmats_old with new values and resetting dmats.
8152
for (unsigned int t = 0; t < 6; t++)
8154
for (unsigned int u = 0; u < 6; u++)
8156
dmats_old[t][u] = dmats[t][u];
8158
}// end loop over 'u'
8159
}// end loop over 't'
8161
// Update dmats using an inner product.
8162
if (combinations_t[r][s] == 0)
8164
for (unsigned int t = 0; t < 6; t++)
8166
for (unsigned int u = 0; u < 6; u++)
8168
for (unsigned int tu = 0; tu < 6; tu++)
8170
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
8171
}// end loop over 'tu'
8172
}// end loop over 'u'
8173
}// end loop over 't'
8176
if (combinations_t[r][s] == 1)
8178
for (unsigned int t = 0; t < 6; t++)
8180
for (unsigned int u = 0; u < 6; u++)
8182
for (unsigned int tu = 0; tu < 6; tu++)
8184
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
8185
}// end loop over 'tu'
8186
}// end loop over 'u'
8187
}// end loop over 't'
8190
}// end loop over 's'
8191
for (unsigned int s = 0; s < 6; s++)
8193
for (unsigned int t = 0; t < 6; t++)
8195
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
8196
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
8197
}// end loop over 't'
8198
}// end loop over 's'
8200
// Using contravariant Piola transform to map values back to the physical element.
8201
const double tmp_ref0 = derivatives[r];
8202
const double tmp_ref1 = derivatives[num_derivatives_t + r];
8203
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
8204
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
8205
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
8206
}// end loop over 'r'
8208
// Transform derivatives back to physical element
8209
for (unsigned int r = 0; r < num_derivatives_g; r++)
8211
for (unsigned int s = 0; s < num_derivatives_t; s++)
8213
values[r] += transform[r][s]*derivatives_p[s];
8214
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
8215
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
8216
}// end loop over 's'
8217
}// end loop over 'r'
8219
// Delete pointer to array of derivatives on FIAT element
8220
delete [] derivatives;
8222
// Delete pointer to array of reference derivatives on physical element.
8223
delete [] derivatives_p;
8225
// Delete pointer to array of combinations of derivatives and transform
8226
for (unsigned int r = 0; r < num_derivatives_t; r++)
8228
delete [] combinations_t[r];
8229
}// end loop over 'r'
8230
delete [] combinations_t;
8231
for (unsigned int r = 0; r < num_derivatives_g; r++)
8233
delete [] combinations_g[r];
8234
}// end loop over 'r'
8235
delete [] combinations_g;
8236
for (unsigned int r = 0; r < num_derivatives_g; r++)
8238
delete [] transform[r];
8239
}// end loop over 'r'
8240
delete [] transform;
8246
// Array of basisvalues
8247
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
8249
// Declare helper variables
8250
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
8251
double tmp1 = (1.0 - Y)/2.0;
8252
double tmp2 = tmp1*tmp1;
8254
// Compute basisvalues
8255
basisvalues[0] = 1.0;
8256
basisvalues[1] = tmp0;
8257
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
8258
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
8259
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
8260
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
8261
basisvalues[0] *= std::sqrt(0.5);
8262
basisvalues[2] *= std::sqrt(1.0);
8263
basisvalues[5] *= std::sqrt(1.5);
8264
basisvalues[1] *= std::sqrt(3.0);
8265
basisvalues[4] *= std::sqrt(4.5);
8266
basisvalues[3] *= std::sqrt(7.5);
8268
// Table(s) of coefficients
8269
static const double coefficients0[6] = \
8270
{-0.11785113, -0.28867513, -0.033333333, -0.18257419, 0.0, 0.040824829};
8272
static const double coefficients1[6] = \
8273
{-0.11785113, 0.69282032, 0.26666667, 0.0, -0.14142136, -0.12247449};
8275
// Tables of derivatives of the polynomial base (transpose).
8276
static const double dmats0[6][6] = \
8277
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8278
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
8279
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8280
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
8281
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
8282
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
8284
static const double dmats1[6][6] = \
8285
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8286
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
8287
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
8288
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
8289
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
8290
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
8292
// Compute reference derivatives.
8293
// Declare pointer to array of derivatives on FIAT element.
8294
double *derivatives = new double[2*num_derivatives_t];
8295
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
8297
derivatives[r] = 0.0;
8298
}// end loop over 'r'
8300
// Declare pointer to array of reference derivatives on physical element.
8301
double *derivatives_p = new double[3*num_derivatives_t];
8302
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
8304
derivatives_p[r] = 0.0;
8305
}// end loop over 'r'
8307
// Declare derivative matrix (of polynomial basis).
8308
double dmats[6][6] = \
8309
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8310
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
8311
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
8312
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
8313
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
8314
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
8316
// Declare (auxiliary) derivative matrix (of polynomial basis).
8317
double dmats_old[6][6] = \
8318
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8319
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
8320
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
8321
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
8322
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
8323
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
8325
// Loop possible derivatives.
8326
for (unsigned int r = 0; r < num_derivatives_t; r++)
8328
// Resetting dmats values to compute next derivative.
8329
for (unsigned int t = 0; t < 6; t++)
8331
for (unsigned int u = 0; u < 6; u++)
8339
}// end loop over 'u'
8340
}// end loop over 't'
8342
// Looping derivative order to generate dmats.
8343
for (unsigned int s = 0; s < n; s++)
8345
// Updating dmats_old with new values and resetting dmats.
8346
for (unsigned int t = 0; t < 6; t++)
8348
for (unsigned int u = 0; u < 6; u++)
8350
dmats_old[t][u] = dmats[t][u];
8352
}// end loop over 'u'
8353
}// end loop over 't'
8355
// Update dmats using an inner product.
8356
if (combinations_t[r][s] == 0)
8358
for (unsigned int t = 0; t < 6; t++)
8360
for (unsigned int u = 0; u < 6; u++)
8362
for (unsigned int tu = 0; tu < 6; tu++)
8364
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
8365
}// end loop over 'tu'
8366
}// end loop over 'u'
8367
}// end loop over 't'
8370
if (combinations_t[r][s] == 1)
8372
for (unsigned int t = 0; t < 6; t++)
8374
for (unsigned int u = 0; u < 6; u++)
8376
for (unsigned int tu = 0; tu < 6; tu++)
8378
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
8379
}// end loop over 'tu'
8380
}// end loop over 'u'
8381
}// end loop over 't'
8384
}// end loop over 's'
8385
for (unsigned int s = 0; s < 6; s++)
8387
for (unsigned int t = 0; t < 6; t++)
8389
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
8390
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
8391
}// end loop over 't'
8392
}// end loop over 's'
8394
// Using contravariant Piola transform to map values back to the physical element.
8395
const double tmp_ref0 = derivatives[r];
8396
const double tmp_ref1 = derivatives[num_derivatives_t + r];
8397
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
8398
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
8399
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
8400
}// end loop over 'r'
8402
// Transform derivatives back to physical element
8403
for (unsigned int r = 0; r < num_derivatives_g; r++)
8405
for (unsigned int s = 0; s < num_derivatives_t; s++)
8407
values[r] += transform[r][s]*derivatives_p[s];
8408
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
8409
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
8410
}// end loop over 's'
8411
}// end loop over 'r'
8413
// Delete pointer to array of derivatives on FIAT element
8414
delete [] derivatives;
8416
// Delete pointer to array of reference derivatives on physical element.
8417
delete [] derivatives_p;
8419
// Delete pointer to array of combinations of derivatives and transform
8420
for (unsigned int r = 0; r < num_derivatives_t; r++)
8422
delete [] combinations_t[r];
8423
}// end loop over 'r'
8424
delete [] combinations_t;
8425
for (unsigned int r = 0; r < num_derivatives_g; r++)
8427
delete [] combinations_g[r];
8428
}// end loop over 'r'
8429
delete [] combinations_g;
8430
for (unsigned int r = 0; r < num_derivatives_g; r++)
8432
delete [] transform[r];
8433
}// end loop over 'r'
8434
delete [] transform;
8440
// Array of basisvalues
8441
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
8443
// Declare helper variables
8444
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
8445
double tmp1 = (1.0 - Y)/2.0;
8446
double tmp2 = tmp1*tmp1;
8448
// Compute basisvalues
8449
basisvalues[0] = 1.0;
8450
basisvalues[1] = tmp0;
8451
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
8452
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
8453
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
8454
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
8455
basisvalues[0] *= std::sqrt(0.5);
8456
basisvalues[2] *= std::sqrt(1.0);
8457
basisvalues[5] *= std::sqrt(1.5);
8458
basisvalues[1] *= std::sqrt(3.0);
8459
basisvalues[4] *= std::sqrt(4.5);
8460
basisvalues[3] *= std::sqrt(7.5);
8462
// Table(s) of coefficients
8463
static const double coefficients0[6] = \
8464
{0.23570226, 0.40414519, -0.23333333, 0.18257419, -0.14142136, 0.081649658};
8466
static const double coefficients1[6] = \
8467
{-0.11785113, -0.69282032, 0.26666667, 0.0, 0.14142136, -0.12247449};
8469
// Tables of derivatives of the polynomial base (transpose).
8470
static const double dmats0[6][6] = \
8471
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8472
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
8473
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8474
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
8475
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
8476
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
8478
static const double dmats1[6][6] = \
8479
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8480
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
8481
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
8482
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
8483
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
8484
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
8486
// Compute reference derivatives.
8487
// Declare pointer to array of derivatives on FIAT element.
8488
double *derivatives = new double[2*num_derivatives_t];
8489
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
8491
derivatives[r] = 0.0;
8492
}// end loop over 'r'
8494
// Declare pointer to array of reference derivatives on physical element.
8495
double *derivatives_p = new double[3*num_derivatives_t];
8496
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
8498
derivatives_p[r] = 0.0;
8499
}// end loop over 'r'
8501
// Declare derivative matrix (of polynomial basis).
8502
double dmats[6][6] = \
8503
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8504
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
8505
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
8506
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
8507
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
8508
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
8510
// Declare (auxiliary) derivative matrix (of polynomial basis).
8511
double dmats_old[6][6] = \
8512
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8513
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
8514
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
8515
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
8516
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
8517
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
8519
// Loop possible derivatives.
8520
for (unsigned int r = 0; r < num_derivatives_t; r++)
8522
// Resetting dmats values to compute next derivative.
8523
for (unsigned int t = 0; t < 6; t++)
8525
for (unsigned int u = 0; u < 6; u++)
8533
}// end loop over 'u'
8534
}// end loop over 't'
8536
// Looping derivative order to generate dmats.
8537
for (unsigned int s = 0; s < n; s++)
8539
// Updating dmats_old with new values and resetting dmats.
8540
for (unsigned int t = 0; t < 6; t++)
8542
for (unsigned int u = 0; u < 6; u++)
8544
dmats_old[t][u] = dmats[t][u];
8546
}// end loop over 'u'
8547
}// end loop over 't'
8549
// Update dmats using an inner product.
8550
if (combinations_t[r][s] == 0)
8552
for (unsigned int t = 0; t < 6; t++)
8554
for (unsigned int u = 0; u < 6; u++)
8556
for (unsigned int tu = 0; tu < 6; tu++)
8558
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
8559
}// end loop over 'tu'
8560
}// end loop over 'u'
8561
}// end loop over 't'
8564
if (combinations_t[r][s] == 1)
8566
for (unsigned int t = 0; t < 6; t++)
8568
for (unsigned int u = 0; u < 6; u++)
8570
for (unsigned int tu = 0; tu < 6; tu++)
8572
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
8573
}// end loop over 'tu'
8574
}// end loop over 'u'
8575
}// end loop over 't'
8578
}// end loop over 's'
8579
for (unsigned int s = 0; s < 6; s++)
8581
for (unsigned int t = 0; t < 6; t++)
8583
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
8584
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
8585
}// end loop over 't'
8586
}// end loop over 's'
8588
// Using contravariant Piola transform to map values back to the physical element.
8589
const double tmp_ref0 = derivatives[r];
8590
const double tmp_ref1 = derivatives[num_derivatives_t + r];
8591
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
8592
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
8593
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
8594
}// end loop over 'r'
8596
// Transform derivatives back to physical element
8597
for (unsigned int r = 0; r < num_derivatives_g; r++)
8599
for (unsigned int s = 0; s < num_derivatives_t; s++)
8601
values[r] += transform[r][s]*derivatives_p[s];
8602
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
8603
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
8604
}// end loop over 's'
8605
}// end loop over 'r'
8607
// Delete pointer to array of derivatives on FIAT element
8608
delete [] derivatives;
8610
// Delete pointer to array of reference derivatives on physical element.
8611
delete [] derivatives_p;
8613
// Delete pointer to array of combinations of derivatives and transform
8614
for (unsigned int r = 0; r < num_derivatives_t; r++)
8616
delete [] combinations_t[r];
8617
}// end loop over 'r'
8618
delete [] combinations_t;
8619
for (unsigned int r = 0; r < num_derivatives_g; r++)
8621
delete [] combinations_g[r];
8622
}// end loop over 'r'
8623
delete [] combinations_g;
8624
for (unsigned int r = 0; r < num_derivatives_g; r++)
8626
delete [] transform[r];
8627
}// end loop over 'r'
8628
delete [] transform;
8634
// Array of basisvalues
8635
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
8637
// Declare helper variables
8638
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
8639
double tmp1 = (1.0 - Y)/2.0;
8640
double tmp2 = tmp1*tmp1;
8642
// Compute basisvalues
8643
basisvalues[0] = 1.0;
8644
basisvalues[1] = tmp0;
8645
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
8646
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
8647
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
8648
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
8649
basisvalues[0] *= std::sqrt(0.5);
8650
basisvalues[2] *= std::sqrt(1.0);
8651
basisvalues[5] *= std::sqrt(1.5);
8652
basisvalues[1] *= std::sqrt(3.0);
8653
basisvalues[4] *= std::sqrt(4.5);
8654
basisvalues[3] *= std::sqrt(7.5);
8656
// Table(s) of coefficients
8657
static const double coefficients0[6] = \
8658
{1.0606602, 0.17320508, -0.3, -0.36514837, 0.14142136, -0.040824829};
8660
static const double coefficients1[6] = \
8661
{0.0, -0.34641016, 0.0, 0.0, -0.28284271, 0.0};
8663
// Tables of derivatives of the polynomial base (transpose).
8664
static const double dmats0[6][6] = \
8665
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8666
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
8667
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8668
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
8669
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
8670
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
8672
static const double dmats1[6][6] = \
8673
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8674
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
8675
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
8676
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
8677
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
8678
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
8680
// Compute reference derivatives.
8681
// Declare pointer to array of derivatives on FIAT element.
8682
double *derivatives = new double[2*num_derivatives_t];
8683
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
8685
derivatives[r] = 0.0;
8686
}// end loop over 'r'
8688
// Declare pointer to array of reference derivatives on physical element.
8689
double *derivatives_p = new double[3*num_derivatives_t];
8690
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
8692
derivatives_p[r] = 0.0;
8693
}// end loop over 'r'
8695
// Declare derivative matrix (of polynomial basis).
8696
double dmats[6][6] = \
8697
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8698
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
8699
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
8700
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
8701
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
8702
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
8704
// Declare (auxiliary) derivative matrix (of polynomial basis).
8705
double dmats_old[6][6] = \
8706
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8707
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
8708
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
8709
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
8710
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
8711
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
8713
// Loop possible derivatives.
8714
for (unsigned int r = 0; r < num_derivatives_t; r++)
8716
// Resetting dmats values to compute next derivative.
8717
for (unsigned int t = 0; t < 6; t++)
8719
for (unsigned int u = 0; u < 6; u++)
8727
}// end loop over 'u'
8728
}// end loop over 't'
8730
// Looping derivative order to generate dmats.
8731
for (unsigned int s = 0; s < n; s++)
8733
// Updating dmats_old with new values and resetting dmats.
8734
for (unsigned int t = 0; t < 6; t++)
8736
for (unsigned int u = 0; u < 6; u++)
8738
dmats_old[t][u] = dmats[t][u];
8740
}// end loop over 'u'
8741
}// end loop over 't'
8743
// Update dmats using an inner product.
8744
if (combinations_t[r][s] == 0)
8746
for (unsigned int t = 0; t < 6; t++)
8748
for (unsigned int u = 0; u < 6; u++)
8750
for (unsigned int tu = 0; tu < 6; tu++)
8752
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
8753
}// end loop over 'tu'
8754
}// end loop over 'u'
8755
}// end loop over 't'
8758
if (combinations_t[r][s] == 1)
8760
for (unsigned int t = 0; t < 6; t++)
8762
for (unsigned int u = 0; u < 6; u++)
8764
for (unsigned int tu = 0; tu < 6; tu++)
8766
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
8767
}// end loop over 'tu'
8768
}// end loop over 'u'
8769
}// end loop over 't'
8772
}// end loop over 's'
8773
for (unsigned int s = 0; s < 6; s++)
8775
for (unsigned int t = 0; t < 6; t++)
8777
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
8778
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
8779
}// end loop over 't'
8780
}// end loop over 's'
8782
// Using contravariant Piola transform to map values back to the physical element.
8783
const double tmp_ref0 = derivatives[r];
8784
const double tmp_ref1 = derivatives[num_derivatives_t + r];
8785
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
8786
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
8787
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
8788
}// end loop over 'r'
8790
// Transform derivatives back to physical element
8791
for (unsigned int r = 0; r < num_derivatives_g; r++)
8793
for (unsigned int s = 0; s < num_derivatives_t; s++)
8795
values[r] += transform[r][s]*derivatives_p[s];
8796
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
8797
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
8798
}// end loop over 's'
8799
}// end loop over 'r'
8801
// Delete pointer to array of derivatives on FIAT element
8802
delete [] derivatives;
8804
// Delete pointer to array of reference derivatives on physical element.
8805
delete [] derivatives_p;
8807
// Delete pointer to array of combinations of derivatives and transform
8808
for (unsigned int r = 0; r < num_derivatives_t; r++)
8810
delete [] combinations_t[r];
8811
}// end loop over 'r'
8812
delete [] combinations_t;
8813
for (unsigned int r = 0; r < num_derivatives_g; r++)
8815
delete [] combinations_g[r];
8816
}// end loop over 'r'
8817
delete [] combinations_g;
8818
for (unsigned int r = 0; r < num_derivatives_g; r++)
8820
delete [] transform[r];
8821
}// end loop over 'r'
8822
delete [] transform;
8828
// Array of basisvalues
8829
double basisvalues[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
8831
// Declare helper variables
8832
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
8833
double tmp1 = (1.0 - Y)/2.0;
8834
double tmp2 = tmp1*tmp1;
8836
// Compute basisvalues
8837
basisvalues[0] = 1.0;
8838
basisvalues[1] = tmp0;
8839
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
8840
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
8841
basisvalues[4] = basisvalues[1]*(1.5 + 2.5*Y);
8842
basisvalues[5] = basisvalues[2]*(0.11111111 + Y*1.6666667) - basisvalues[0]*0.55555556;
8843
basisvalues[0] *= std::sqrt(0.5);
8844
basisvalues[2] *= std::sqrt(1.0);
8845
basisvalues[5] *= std::sqrt(1.5);
8846
basisvalues[1] *= std::sqrt(3.0);
8847
basisvalues[4] *= std::sqrt(4.5);
8848
basisvalues[3] *= std::sqrt(7.5);
8850
// Table(s) of coefficients
8851
static const double coefficients0[6] = \
8852
{0.0, -0.17320508, -0.3, -0.18257419, -0.14142136, 0.16329932};
8854
static const double coefficients1[6] = \
8855
{1.0606602, -0.17320508, 0.3, 0.0, -0.14142136, -0.36742346};
8857
// Tables of derivatives of the polynomial base (transpose).
8858
static const double dmats0[6][6] = \
8859
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8860
{4.8989795, 0.0, 0.0, 0.0, 0.0, 0.0},
8861
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8862
{0.0, 9.486833, 0.0, 0.0, 0.0, 0.0},
8863
{4.0, 0.0, 7.0710678, 0.0, 0.0, 0.0},
8864
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0}};
8866
static const double dmats1[6][6] = \
8867
{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8868
{2.4494897, 0.0, 0.0, 0.0, 0.0, 0.0},
8869
{4.2426407, 0.0, 0.0, 0.0, 0.0, 0.0},
8870
{2.5819889, 4.7434165, -0.91287093, 0.0, 0.0, 0.0},
8871
{2.0, 6.1237244, 3.5355339, 0.0, 0.0, 0.0},
8872
{-2.3094011, 0.0, 8.1649658, 0.0, 0.0, 0.0}};
8874
// Compute reference derivatives.
8875
// Declare pointer to array of derivatives on FIAT element.
8876
double *derivatives = new double[2*num_derivatives_t];
8877
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
8879
derivatives[r] = 0.0;
8880
}// end loop over 'r'
8882
// Declare pointer to array of reference derivatives on physical element.
8883
double *derivatives_p = new double[3*num_derivatives_t];
8884
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
8886
derivatives_p[r] = 0.0;
8887
}// end loop over 'r'
8889
// Declare derivative matrix (of polynomial basis).
8890
double dmats[6][6] = \
8891
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8892
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
8893
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
8894
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
8895
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
8896
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
8898
// Declare (auxiliary) derivative matrix (of polynomial basis).
8899
double dmats_old[6][6] = \
8900
{{1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
8901
{0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
8902
{0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
8903
{0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
8904
{0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
8905
{0.0, 0.0, 0.0, 0.0, 0.0, 1.0}};
8907
// Loop possible derivatives.
8908
for (unsigned int r = 0; r < num_derivatives_t; r++)
8910
// Resetting dmats values to compute next derivative.
8911
for (unsigned int t = 0; t < 6; t++)
8913
for (unsigned int u = 0; u < 6; u++)
8921
}// end loop over 'u'
8922
}// end loop over 't'
8924
// Looping derivative order to generate dmats.
8925
for (unsigned int s = 0; s < n; s++)
8927
// Updating dmats_old with new values and resetting dmats.
8928
for (unsigned int t = 0; t < 6; t++)
8930
for (unsigned int u = 0; u < 6; u++)
8932
dmats_old[t][u] = dmats[t][u];
8934
}// end loop over 'u'
8935
}// end loop over 't'
8937
// Update dmats using an inner product.
8938
if (combinations_t[r][s] == 0)
8940
for (unsigned int t = 0; t < 6; t++)
8942
for (unsigned int u = 0; u < 6; u++)
8944
for (unsigned int tu = 0; tu < 6; tu++)
8946
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
8947
}// end loop over 'tu'
8948
}// end loop over 'u'
8949
}// end loop over 't'
8952
if (combinations_t[r][s] == 1)
8954
for (unsigned int t = 0; t < 6; t++)
8956
for (unsigned int u = 0; u < 6; u++)
8958
for (unsigned int tu = 0; tu < 6; tu++)
8960
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
8961
}// end loop over 'tu'
8962
}// end loop over 'u'
8963
}// end loop over 't'
8966
}// end loop over 's'
8967
for (unsigned int s = 0; s < 6; s++)
8969
for (unsigned int t = 0; t < 6; t++)
8971
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
8972
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
8973
}// end loop over 't'
8974
}// end loop over 's'
8976
// Using contravariant Piola transform to map values back to the physical element.
8977
const double tmp_ref0 = derivatives[r];
8978
const double tmp_ref1 = derivatives[num_derivatives_t + r];
8979
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
8980
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
8981
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
8982
}// end loop over 'r'
8984
// Transform derivatives back to physical element
8985
for (unsigned int r = 0; r < num_derivatives_g; r++)
8987
for (unsigned int s = 0; s < num_derivatives_t; s++)
8989
values[r] += transform[r][s]*derivatives_p[s];
8990
values[num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
8991
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
8992
}// end loop over 's'
8993
}// end loop over 'r'
8995
// Delete pointer to array of derivatives on FIAT element
8996
delete [] derivatives;
8998
// Delete pointer to array of reference derivatives on physical element.
8999
delete [] derivatives_p;
9001
// Delete pointer to array of combinations of derivatives and transform
9002
for (unsigned int r = 0; r < num_derivatives_t; r++)
9004
delete [] combinations_t[r];
9005
}// end loop over 'r'
9006
delete [] combinations_t;
9007
for (unsigned int r = 0; r < num_derivatives_g; r++)
9009
delete [] combinations_g[r];
9010
}// end loop over 'r'
9011
delete [] combinations_g;
9012
for (unsigned int r = 0; r < num_derivatives_g; r++)
9014
delete [] transform[r];
9015
}// end loop over 'r'
9016
delete [] transform;
9022
// Array of basisvalues
9023
double basisvalues[3] = {0.0, 0.0, 0.0};
9025
// Declare helper variables
9026
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9028
// Compute basisvalues
9029
basisvalues[0] = 1.0;
9030
basisvalues[1] = tmp0;
9031
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
9032
basisvalues[0] *= std::sqrt(0.5);
9033
basisvalues[2] *= std::sqrt(1.0);
9034
basisvalues[1] *= std::sqrt(3.0);
9036
// Table(s) of coefficients
9037
static const double coefficients0[3] = \
9038
{0.94280904, 0.57735027, -0.33333333};
9040
static const double coefficients1[3] = \
9041
{-0.47140452, 0.0, -0.33333333};
9043
// Tables of derivatives of the polynomial base (transpose).
9044
static const double dmats0[3][3] = \
9046
{4.8989795, 0.0, 0.0},
9049
static const double dmats1[3][3] = \
9051
{2.4494897, 0.0, 0.0},
9052
{4.2426407, 0.0, 0.0}};
9054
// Compute reference derivatives.
9055
// Declare pointer to array of derivatives on FIAT element.
9056
double *derivatives = new double[2*num_derivatives_t];
9057
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
9059
derivatives[r] = 0.0;
9060
}// end loop over 'r'
9062
// Declare pointer to array of reference derivatives on physical element.
9063
double *derivatives_p = new double[3*num_derivatives_t];
9064
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
9066
derivatives_p[r] = 0.0;
9067
}// end loop over 'r'
9069
// Declare derivative matrix (of polynomial basis).
9070
double dmats[3][3] = \
9075
// Declare (auxiliary) derivative matrix (of polynomial basis).
9076
double dmats_old[3][3] = \
9081
// Loop possible derivatives.
9082
for (unsigned int r = 0; r < num_derivatives_t; r++)
9084
// Resetting dmats values to compute next derivative.
9085
for (unsigned int t = 0; t < 3; t++)
9087
for (unsigned int u = 0; u < 3; u++)
9095
}// end loop over 'u'
9096
}// end loop over 't'
9098
// Looping derivative order to generate dmats.
9099
for (unsigned int s = 0; s < n; s++)
9101
// Updating dmats_old with new values and resetting dmats.
9102
for (unsigned int t = 0; t < 3; t++)
9104
for (unsigned int u = 0; u < 3; u++)
9106
dmats_old[t][u] = dmats[t][u];
9108
}// end loop over 'u'
9109
}// end loop over 't'
9111
// Update dmats using an inner product.
9112
if (combinations_t[r][s] == 0)
9114
for (unsigned int t = 0; t < 3; t++)
9116
for (unsigned int u = 0; u < 3; u++)
9118
for (unsigned int tu = 0; tu < 3; tu++)
9120
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
9121
}// end loop over 'tu'
9122
}// end loop over 'u'
9123
}// end loop over 't'
9126
if (combinations_t[r][s] == 1)
9128
for (unsigned int t = 0; t < 3; t++)
9130
for (unsigned int u = 0; u < 3; u++)
9132
for (unsigned int tu = 0; tu < 3; tu++)
9134
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
9135
}// end loop over 'tu'
9136
}// end loop over 'u'
9137
}// end loop over 't'
9140
}// end loop over 's'
9141
for (unsigned int s = 0; s < 3; s++)
9143
for (unsigned int t = 0; t < 3; t++)
9145
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
9146
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
9147
}// end loop over 't'
9148
}// end loop over 's'
9150
// Using contravariant Piola transform to map values back to the physical element.
9151
const double tmp_ref0 = derivatives[r];
9152
const double tmp_ref1 = derivatives[num_derivatives_t + r];
9153
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
9154
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9155
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
9156
}// end loop over 'r'
9158
// Transform derivatives back to physical element
9159
for (unsigned int r = 0; r < num_derivatives_g; r++)
9161
for (unsigned int s = 0; s < num_derivatives_t; s++)
9163
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[s];
9164
values[3*num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
9165
values[4*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
9166
}// end loop over 's'
9167
}// end loop over 'r'
9169
// Delete pointer to array of derivatives on FIAT element
9170
delete [] derivatives;
9172
// Delete pointer to array of reference derivatives on physical element.
9173
delete [] derivatives_p;
9175
// Delete pointer to array of combinations of derivatives and transform
9176
for (unsigned int r = 0; r < num_derivatives_t; r++)
9178
delete [] combinations_t[r];
9179
}// end loop over 'r'
9180
delete [] combinations_t;
9181
for (unsigned int r = 0; r < num_derivatives_g; r++)
9183
delete [] combinations_g[r];
9184
}// end loop over 'r'
9185
delete [] combinations_g;
9186
for (unsigned int r = 0; r < num_derivatives_g; r++)
9188
delete [] transform[r];
9189
}// end loop over 'r'
9190
delete [] transform;
9196
// Array of basisvalues
9197
double basisvalues[3] = {0.0, 0.0, 0.0};
9199
// Declare helper variables
9200
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9202
// Compute basisvalues
9203
basisvalues[0] = 1.0;
9204
basisvalues[1] = tmp0;
9205
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
9206
basisvalues[0] *= std::sqrt(0.5);
9207
basisvalues[2] *= std::sqrt(1.0);
9208
basisvalues[1] *= std::sqrt(3.0);
9210
// Table(s) of coefficients
9211
static const double coefficients0[3] = \
9212
{-0.47140452, -0.28867513, 0.16666667};
9214
static const double coefficients1[3] = \
9215
{0.94280904, 0.0, 0.66666667};
9217
// Tables of derivatives of the polynomial base (transpose).
9218
static const double dmats0[3][3] = \
9220
{4.8989795, 0.0, 0.0},
9223
static const double dmats1[3][3] = \
9225
{2.4494897, 0.0, 0.0},
9226
{4.2426407, 0.0, 0.0}};
9228
// Compute reference derivatives.
9229
// Declare pointer to array of derivatives on FIAT element.
9230
double *derivatives = new double[2*num_derivatives_t];
9231
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
9233
derivatives[r] = 0.0;
9234
}// end loop over 'r'
9236
// Declare pointer to array of reference derivatives on physical element.
9237
double *derivatives_p = new double[3*num_derivatives_t];
9238
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
9240
derivatives_p[r] = 0.0;
9241
}// end loop over 'r'
9243
// Declare derivative matrix (of polynomial basis).
9244
double dmats[3][3] = \
9249
// Declare (auxiliary) derivative matrix (of polynomial basis).
9250
double dmats_old[3][3] = \
9255
// Loop possible derivatives.
9256
for (unsigned int r = 0; r < num_derivatives_t; r++)
9258
// Resetting dmats values to compute next derivative.
9259
for (unsigned int t = 0; t < 3; t++)
9261
for (unsigned int u = 0; u < 3; u++)
9269
}// end loop over 'u'
9270
}// end loop over 't'
9272
// Looping derivative order to generate dmats.
9273
for (unsigned int s = 0; s < n; s++)
9275
// Updating dmats_old with new values and resetting dmats.
9276
for (unsigned int t = 0; t < 3; t++)
9278
for (unsigned int u = 0; u < 3; u++)
9280
dmats_old[t][u] = dmats[t][u];
9282
}// end loop over 'u'
9283
}// end loop over 't'
9285
// Update dmats using an inner product.
9286
if (combinations_t[r][s] == 0)
9288
for (unsigned int t = 0; t < 3; t++)
9290
for (unsigned int u = 0; u < 3; u++)
9292
for (unsigned int tu = 0; tu < 3; tu++)
9294
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
9295
}// end loop over 'tu'
9296
}// end loop over 'u'
9297
}// end loop over 't'
9300
if (combinations_t[r][s] == 1)
9302
for (unsigned int t = 0; t < 3; t++)
9304
for (unsigned int u = 0; u < 3; u++)
9306
for (unsigned int tu = 0; tu < 3; tu++)
9308
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
9309
}// end loop over 'tu'
9310
}// end loop over 'u'
9311
}// end loop over 't'
9314
}// end loop over 's'
9315
for (unsigned int s = 0; s < 3; s++)
9317
for (unsigned int t = 0; t < 3; t++)
9319
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
9320
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
9321
}// end loop over 't'
9322
}// end loop over 's'
9324
// Using contravariant Piola transform to map values back to the physical element.
9325
const double tmp_ref0 = derivatives[r];
9326
const double tmp_ref1 = derivatives[num_derivatives_t + r];
9327
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
9328
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9329
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
9330
}// end loop over 'r'
9332
// Transform derivatives back to physical element
9333
for (unsigned int r = 0; r < num_derivatives_g; r++)
9335
for (unsigned int s = 0; s < num_derivatives_t; s++)
9337
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[s];
9338
values[3*num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
9339
values[4*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
9340
}// end loop over 's'
9341
}// end loop over 'r'
9343
// Delete pointer to array of derivatives on FIAT element
9344
delete [] derivatives;
9346
// Delete pointer to array of reference derivatives on physical element.
9347
delete [] derivatives_p;
9349
// Delete pointer to array of combinations of derivatives and transform
9350
for (unsigned int r = 0; r < num_derivatives_t; r++)
9352
delete [] combinations_t[r];
9353
}// end loop over 'r'
9354
delete [] combinations_t;
9355
for (unsigned int r = 0; r < num_derivatives_g; r++)
9357
delete [] combinations_g[r];
9358
}// end loop over 'r'
9359
delete [] combinations_g;
9360
for (unsigned int r = 0; r < num_derivatives_g; r++)
9362
delete [] transform[r];
9363
}// end loop over 'r'
9364
delete [] transform;
9370
// Array of basisvalues
9371
double basisvalues[3] = {0.0, 0.0, 0.0};
9373
// Declare helper variables
9374
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9376
// Compute basisvalues
9377
basisvalues[0] = 1.0;
9378
basisvalues[1] = tmp0;
9379
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
9380
basisvalues[0] *= std::sqrt(0.5);
9381
basisvalues[2] *= std::sqrt(1.0);
9382
basisvalues[1] *= std::sqrt(3.0);
9384
// Table(s) of coefficients
9385
static const double coefficients0[3] = \
9386
{0.47140452, -0.57735027, -0.66666667};
9388
static const double coefficients1[3] = \
9389
{0.47140452, 0.0, 0.33333333};
9391
// Tables of derivatives of the polynomial base (transpose).
9392
static const double dmats0[3][3] = \
9394
{4.8989795, 0.0, 0.0},
9397
static const double dmats1[3][3] = \
9399
{2.4494897, 0.0, 0.0},
9400
{4.2426407, 0.0, 0.0}};
9402
// Compute reference derivatives.
9403
// Declare pointer to array of derivatives on FIAT element.
9404
double *derivatives = new double[2*num_derivatives_t];
9405
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
9407
derivatives[r] = 0.0;
9408
}// end loop over 'r'
9410
// Declare pointer to array of reference derivatives on physical element.
9411
double *derivatives_p = new double[3*num_derivatives_t];
9412
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
9414
derivatives_p[r] = 0.0;
9415
}// end loop over 'r'
9417
// Declare derivative matrix (of polynomial basis).
9418
double dmats[3][3] = \
9423
// Declare (auxiliary) derivative matrix (of polynomial basis).
9424
double dmats_old[3][3] = \
9429
// Loop possible derivatives.
9430
for (unsigned int r = 0; r < num_derivatives_t; r++)
9432
// Resetting dmats values to compute next derivative.
9433
for (unsigned int t = 0; t < 3; t++)
9435
for (unsigned int u = 0; u < 3; u++)
9443
}// end loop over 'u'
9444
}// end loop over 't'
9446
// Looping derivative order to generate dmats.
9447
for (unsigned int s = 0; s < n; s++)
9449
// Updating dmats_old with new values and resetting dmats.
9450
for (unsigned int t = 0; t < 3; t++)
9452
for (unsigned int u = 0; u < 3; u++)
9454
dmats_old[t][u] = dmats[t][u];
9456
}// end loop over 'u'
9457
}// end loop over 't'
9459
// Update dmats using an inner product.
9460
if (combinations_t[r][s] == 0)
9462
for (unsigned int t = 0; t < 3; t++)
9464
for (unsigned int u = 0; u < 3; u++)
9466
for (unsigned int tu = 0; tu < 3; tu++)
9468
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
9469
}// end loop over 'tu'
9470
}// end loop over 'u'
9471
}// end loop over 't'
9474
if (combinations_t[r][s] == 1)
9476
for (unsigned int t = 0; t < 3; t++)
9478
for (unsigned int u = 0; u < 3; u++)
9480
for (unsigned int tu = 0; tu < 3; tu++)
9482
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
9483
}// end loop over 'tu'
9484
}// end loop over 'u'
9485
}// end loop over 't'
9488
}// end loop over 's'
9489
for (unsigned int s = 0; s < 3; s++)
9491
for (unsigned int t = 0; t < 3; t++)
9493
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
9494
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
9495
}// end loop over 't'
9496
}// end loop over 's'
9498
// Using contravariant Piola transform to map values back to the physical element.
9499
const double tmp_ref0 = derivatives[r];
9500
const double tmp_ref1 = derivatives[num_derivatives_t + r];
9501
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
9502
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9503
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
9504
}// end loop over 'r'
9506
// Transform derivatives back to physical element
9507
for (unsigned int r = 0; r < num_derivatives_g; r++)
9509
for (unsigned int s = 0; s < num_derivatives_t; s++)
9511
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[s];
9512
values[3*num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
9513
values[4*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
9514
}// end loop over 's'
9515
}// end loop over 'r'
9517
// Delete pointer to array of derivatives on FIAT element
9518
delete [] derivatives;
9520
// Delete pointer to array of reference derivatives on physical element.
9521
delete [] derivatives_p;
9523
// Delete pointer to array of combinations of derivatives and transform
9524
for (unsigned int r = 0; r < num_derivatives_t; r++)
9526
delete [] combinations_t[r];
9527
}// end loop over 'r'
9528
delete [] combinations_t;
9529
for (unsigned int r = 0; r < num_derivatives_g; r++)
9531
delete [] combinations_g[r];
9532
}// end loop over 'r'
9533
delete [] combinations_g;
9534
for (unsigned int r = 0; r < num_derivatives_g; r++)
9536
delete [] transform[r];
9537
}// end loop over 'r'
9538
delete [] transform;
9544
// Array of basisvalues
9545
double basisvalues[3] = {0.0, 0.0, 0.0};
9547
// Declare helper variables
9548
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9550
// Compute basisvalues
9551
basisvalues[0] = 1.0;
9552
basisvalues[1] = tmp0;
9553
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
9554
basisvalues[0] *= std::sqrt(0.5);
9555
basisvalues[2] *= std::sqrt(1.0);
9556
basisvalues[1] *= std::sqrt(3.0);
9558
// Table(s) of coefficients
9559
static const double coefficients0[3] = \
9560
{0.47140452, 0.28867513, 0.83333333};
9562
static const double coefficients1[3] = \
9563
{-0.94280904, 0.0, -0.66666667};
9565
// Tables of derivatives of the polynomial base (transpose).
9566
static const double dmats0[3][3] = \
9568
{4.8989795, 0.0, 0.0},
9571
static const double dmats1[3][3] = \
9573
{2.4494897, 0.0, 0.0},
9574
{4.2426407, 0.0, 0.0}};
9576
// Compute reference derivatives.
9577
// Declare pointer to array of derivatives on FIAT element.
9578
double *derivatives = new double[2*num_derivatives_t];
9579
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
9581
derivatives[r] = 0.0;
9582
}// end loop over 'r'
9584
// Declare pointer to array of reference derivatives on physical element.
9585
double *derivatives_p = new double[3*num_derivatives_t];
9586
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
9588
derivatives_p[r] = 0.0;
9589
}// end loop over 'r'
9591
// Declare derivative matrix (of polynomial basis).
9592
double dmats[3][3] = \
9597
// Declare (auxiliary) derivative matrix (of polynomial basis).
9598
double dmats_old[3][3] = \
9603
// Loop possible derivatives.
9604
for (unsigned int r = 0; r < num_derivatives_t; r++)
9606
// Resetting dmats values to compute next derivative.
9607
for (unsigned int t = 0; t < 3; t++)
9609
for (unsigned int u = 0; u < 3; u++)
9617
}// end loop over 'u'
9618
}// end loop over 't'
9620
// Looping derivative order to generate dmats.
9621
for (unsigned int s = 0; s < n; s++)
9623
// Updating dmats_old with new values and resetting dmats.
9624
for (unsigned int t = 0; t < 3; t++)
9626
for (unsigned int u = 0; u < 3; u++)
9628
dmats_old[t][u] = dmats[t][u];
9630
}// end loop over 'u'
9631
}// end loop over 't'
9633
// Update dmats using an inner product.
9634
if (combinations_t[r][s] == 0)
9636
for (unsigned int t = 0; t < 3; t++)
9638
for (unsigned int u = 0; u < 3; u++)
9640
for (unsigned int tu = 0; tu < 3; tu++)
9642
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
9643
}// end loop over 'tu'
9644
}// end loop over 'u'
9645
}// end loop over 't'
9648
if (combinations_t[r][s] == 1)
9650
for (unsigned int t = 0; t < 3; t++)
9652
for (unsigned int u = 0; u < 3; u++)
9654
for (unsigned int tu = 0; tu < 3; tu++)
9656
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
9657
}// end loop over 'tu'
9658
}// end loop over 'u'
9659
}// end loop over 't'
9662
}// end loop over 's'
9663
for (unsigned int s = 0; s < 3; s++)
9665
for (unsigned int t = 0; t < 3; t++)
9667
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
9668
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
9669
}// end loop over 't'
9670
}// end loop over 's'
9672
// Using contravariant Piola transform to map values back to the physical element.
9673
const double tmp_ref0 = derivatives[r];
9674
const double tmp_ref1 = derivatives[num_derivatives_t + r];
9675
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
9676
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9677
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
9678
}// end loop over 'r'
9680
// Transform derivatives back to physical element
9681
for (unsigned int r = 0; r < num_derivatives_g; r++)
9683
for (unsigned int s = 0; s < num_derivatives_t; s++)
9685
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[s];
9686
values[3*num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
9687
values[4*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
9688
}// end loop over 's'
9689
}// end loop over 'r'
9691
// Delete pointer to array of derivatives on FIAT element
9692
delete [] derivatives;
9694
// Delete pointer to array of reference derivatives on physical element.
9695
delete [] derivatives_p;
9697
// Delete pointer to array of combinations of derivatives and transform
9698
for (unsigned int r = 0; r < num_derivatives_t; r++)
9700
delete [] combinations_t[r];
9701
}// end loop over 'r'
9702
delete [] combinations_t;
9703
for (unsigned int r = 0; r < num_derivatives_g; r++)
9705
delete [] combinations_g[r];
9706
}// end loop over 'r'
9707
delete [] combinations_g;
9708
for (unsigned int r = 0; r < num_derivatives_g; r++)
9710
delete [] transform[r];
9711
}// end loop over 'r'
9712
delete [] transform;
9718
// Array of basisvalues
9719
double basisvalues[3] = {0.0, 0.0, 0.0};
9721
// Declare helper variables
9722
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9724
// Compute basisvalues
9725
basisvalues[0] = 1.0;
9726
basisvalues[1] = tmp0;
9727
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
9728
basisvalues[0] *= std::sqrt(0.5);
9729
basisvalues[2] *= std::sqrt(1.0);
9730
basisvalues[1] *= std::sqrt(3.0);
9732
// Table(s) of coefficients
9733
static const double coefficients0[3] = \
9734
{-0.47140452, -0.28867513, 0.16666667};
9736
static const double coefficients1[3] = \
9737
{-0.47140452, 0.8660254, 0.16666667};
9739
// Tables of derivatives of the polynomial base (transpose).
9740
static const double dmats0[3][3] = \
9742
{4.8989795, 0.0, 0.0},
9745
static const double dmats1[3][3] = \
9747
{2.4494897, 0.0, 0.0},
9748
{4.2426407, 0.0, 0.0}};
9750
// Compute reference derivatives.
9751
// Declare pointer to array of derivatives on FIAT element.
9752
double *derivatives = new double[2*num_derivatives_t];
9753
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
9755
derivatives[r] = 0.0;
9756
}// end loop over 'r'
9758
// Declare pointer to array of reference derivatives on physical element.
9759
double *derivatives_p = new double[3*num_derivatives_t];
9760
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
9762
derivatives_p[r] = 0.0;
9763
}// end loop over 'r'
9765
// Declare derivative matrix (of polynomial basis).
9766
double dmats[3][3] = \
9771
// Declare (auxiliary) derivative matrix (of polynomial basis).
9772
double dmats_old[3][3] = \
9777
// Loop possible derivatives.
9778
for (unsigned int r = 0; r < num_derivatives_t; r++)
9780
// Resetting dmats values to compute next derivative.
9781
for (unsigned int t = 0; t < 3; t++)
9783
for (unsigned int u = 0; u < 3; u++)
9791
}// end loop over 'u'
9792
}// end loop over 't'
9794
// Looping derivative order to generate dmats.
9795
for (unsigned int s = 0; s < n; s++)
9797
// Updating dmats_old with new values and resetting dmats.
9798
for (unsigned int t = 0; t < 3; t++)
9800
for (unsigned int u = 0; u < 3; u++)
9802
dmats_old[t][u] = dmats[t][u];
9804
}// end loop over 'u'
9805
}// end loop over 't'
9807
// Update dmats using an inner product.
9808
if (combinations_t[r][s] == 0)
9810
for (unsigned int t = 0; t < 3; t++)
9812
for (unsigned int u = 0; u < 3; u++)
9814
for (unsigned int tu = 0; tu < 3; tu++)
9816
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
9817
}// end loop over 'tu'
9818
}// end loop over 'u'
9819
}// end loop over 't'
9822
if (combinations_t[r][s] == 1)
9824
for (unsigned int t = 0; t < 3; t++)
9826
for (unsigned int u = 0; u < 3; u++)
9828
for (unsigned int tu = 0; tu < 3; tu++)
9830
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
9831
}// end loop over 'tu'
9832
}// end loop over 'u'
9833
}// end loop over 't'
9836
}// end loop over 's'
9837
for (unsigned int s = 0; s < 3; s++)
9839
for (unsigned int t = 0; t < 3; t++)
9841
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
9842
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
9843
}// end loop over 't'
9844
}// end loop over 's'
9846
// Using contravariant Piola transform to map values back to the physical element.
9847
const double tmp_ref0 = derivatives[r];
9848
const double tmp_ref1 = derivatives[num_derivatives_t + r];
9849
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
9850
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
9851
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
9852
}// end loop over 'r'
9854
// Transform derivatives back to physical element
9855
for (unsigned int r = 0; r < num_derivatives_g; r++)
9857
for (unsigned int s = 0; s < num_derivatives_t; s++)
9859
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[s];
9860
values[3*num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
9861
values[4*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
9862
}// end loop over 's'
9863
}// end loop over 'r'
9865
// Delete pointer to array of derivatives on FIAT element
9866
delete [] derivatives;
9868
// Delete pointer to array of reference derivatives on physical element.
9869
delete [] derivatives_p;
9871
// Delete pointer to array of combinations of derivatives and transform
9872
for (unsigned int r = 0; r < num_derivatives_t; r++)
9874
delete [] combinations_t[r];
9875
}// end loop over 'r'
9876
delete [] combinations_t;
9877
for (unsigned int r = 0; r < num_derivatives_g; r++)
9879
delete [] combinations_g[r];
9880
}// end loop over 'r'
9881
delete [] combinations_g;
9882
for (unsigned int r = 0; r < num_derivatives_g; r++)
9884
delete [] transform[r];
9885
}// end loop over 'r'
9886
delete [] transform;
9892
// Array of basisvalues
9893
double basisvalues[3] = {0.0, 0.0, 0.0};
9895
// Declare helper variables
9896
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
9898
// Compute basisvalues
9899
basisvalues[0] = 1.0;
9900
basisvalues[1] = tmp0;
9901
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
9902
basisvalues[0] *= std::sqrt(0.5);
9903
basisvalues[2] *= std::sqrt(1.0);
9904
basisvalues[1] *= std::sqrt(3.0);
9906
// Table(s) of coefficients
9907
static const double coefficients0[3] = \
9908
{0.94280904, 0.57735027, -0.33333333};
9910
static const double coefficients1[3] = \
9911
{-0.47140452, -0.8660254, 0.16666667};
9913
// Tables of derivatives of the polynomial base (transpose).
9914
static const double dmats0[3][3] = \
9916
{4.8989795, 0.0, 0.0},
9919
static const double dmats1[3][3] = \
9921
{2.4494897, 0.0, 0.0},
9922
{4.2426407, 0.0, 0.0}};
9924
// Compute reference derivatives.
9925
// Declare pointer to array of derivatives on FIAT element.
9926
double *derivatives = new double[2*num_derivatives_t];
9927
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
9929
derivatives[r] = 0.0;
9930
}// end loop over 'r'
9932
// Declare pointer to array of reference derivatives on physical element.
9933
double *derivatives_p = new double[3*num_derivatives_t];
9934
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
9936
derivatives_p[r] = 0.0;
9937
}// end loop over 'r'
9939
// Declare derivative matrix (of polynomial basis).
9940
double dmats[3][3] = \
9945
// Declare (auxiliary) derivative matrix (of polynomial basis).
9946
double dmats_old[3][3] = \
9951
// Loop possible derivatives.
9952
for (unsigned int r = 0; r < num_derivatives_t; r++)
9954
// Resetting dmats values to compute next derivative.
9955
for (unsigned int t = 0; t < 3; t++)
9957
for (unsigned int u = 0; u < 3; u++)
9965
}// end loop over 'u'
9966
}// end loop over 't'
9968
// Looping derivative order to generate dmats.
9969
for (unsigned int s = 0; s < n; s++)
9971
// Updating dmats_old with new values and resetting dmats.
9972
for (unsigned int t = 0; t < 3; t++)
9974
for (unsigned int u = 0; u < 3; u++)
9976
dmats_old[t][u] = dmats[t][u];
9978
}// end loop over 'u'
9979
}// end loop over 't'
9981
// Update dmats using an inner product.
9982
if (combinations_t[r][s] == 0)
9984
for (unsigned int t = 0; t < 3; t++)
9986
for (unsigned int u = 0; u < 3; u++)
9988
for (unsigned int tu = 0; tu < 3; tu++)
9990
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
9991
}// end loop over 'tu'
9992
}// end loop over 'u'
9993
}// end loop over 't'
9996
if (combinations_t[r][s] == 1)
9998
for (unsigned int t = 0; t < 3; t++)
10000
for (unsigned int u = 0; u < 3; u++)
10002
for (unsigned int tu = 0; tu < 3; tu++)
10004
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
10005
}// end loop over 'tu'
10006
}// end loop over 'u'
10007
}// end loop over 't'
10010
}// end loop over 's'
10011
for (unsigned int s = 0; s < 3; s++)
10013
for (unsigned int t = 0; t < 3; t++)
10015
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
10016
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
10017
}// end loop over 't'
10018
}// end loop over 's'
10020
// Using contravariant Piola transform to map values back to the physical element.
10021
const double tmp_ref0 = derivatives[r];
10022
const double tmp_ref1 = derivatives[num_derivatives_t + r];
10023
derivatives_p[r] = (1.0/detJ)*(J[0]*tmp_ref0 + J[1]*tmp_ref1);
10024
derivatives_p[num_derivatives_t + r] = (1.0/detJ)*(J[2]*tmp_ref0 + J[3]*tmp_ref1);
10025
derivatives_p[2*num_derivatives_t + r] = (1.0/detJ)*(J[4]*tmp_ref0 + J[5]*tmp_ref1);
10026
}// end loop over 'r'
10028
// Transform derivatives back to physical element
10029
for (unsigned int r = 0; r < num_derivatives_g; r++)
10031
for (unsigned int s = 0; s < num_derivatives_t; s++)
10033
values[2*num_derivatives_g + r] += transform[r][s]*derivatives_p[s];
10034
values[3*num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
10035
values[4*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
10036
}// end loop over 's'
10037
}// end loop over 'r'
10039
// Delete pointer to array of derivatives on FIAT element
10040
delete [] derivatives;
10042
// Delete pointer to array of reference derivatives on physical element.
10043
delete [] derivatives_p;
10045
// Delete pointer to array of combinations of derivatives and transform
10046
for (unsigned int r = 0; r < num_derivatives_t; r++)
10048
delete [] combinations_t[r];
10049
}// end loop over 'r'
10050
delete [] combinations_t;
10051
for (unsigned int r = 0; r < num_derivatives_g; r++)
10053
delete [] combinations_g[r];
10054
}// end loop over 'r'
10055
delete [] combinations_g;
10056
for (unsigned int r = 0; r < num_derivatives_g; r++)
10058
delete [] transform[r];
10059
}// end loop over 'r'
10060
delete [] transform;
10066
// Array of basisvalues
10067
double basisvalues[3] = {0.0, 0.0, 0.0};
10069
// Declare helper variables
10070
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10072
// Compute basisvalues
10073
basisvalues[0] = 1.0;
10074
basisvalues[1] = tmp0;
10075
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
10076
basisvalues[0] *= std::sqrt(0.5);
10077
basisvalues[2] *= std::sqrt(1.0);
10078
basisvalues[1] *= std::sqrt(3.0);
10080
// Table(s) of coefficients
10081
static const double coefficients0[3] = \
10082
{-0.47140452, 0.0, -0.33333333};
10084
static const double coefficients1[3] = \
10085
{0.47140452, 0.28867513, -0.16666667};
10087
// Tables of derivatives of the polynomial base (transpose).
10088
static const double dmats0[3][3] = \
10090
{4.8989795, 0.0, 0.0},
10093
static const double dmats1[3][3] = \
10095
{2.4494897, 0.0, 0.0},
10096
{4.2426407, 0.0, 0.0}};
10098
// Compute reference derivatives.
10099
// Declare pointer to array of derivatives on FIAT element.
10100
double *derivatives = new double[2*num_derivatives_t];
10101
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
10103
derivatives[r] = 0.0;
10104
}// end loop over 'r'
10106
// Declare pointer to array of reference derivatives on physical element.
10107
double *derivatives_p = new double[3*num_derivatives_t];
10108
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
10110
derivatives_p[r] = 0.0;
10111
}// end loop over 'r'
10113
// Declare derivative matrix (of polynomial basis).
10114
double dmats[3][3] = \
10119
// Declare (auxiliary) derivative matrix (of polynomial basis).
10120
double dmats_old[3][3] = \
10125
// Loop possible derivatives.
10126
for (unsigned int r = 0; r < num_derivatives_t; r++)
10128
// Resetting dmats values to compute next derivative.
10129
for (unsigned int t = 0; t < 3; t++)
10131
for (unsigned int u = 0; u < 3; u++)
10139
}// end loop over 'u'
10140
}// end loop over 't'
10142
// Looping derivative order to generate dmats.
10143
for (unsigned int s = 0; s < n; s++)
10145
// Updating dmats_old with new values and resetting dmats.
10146
for (unsigned int t = 0; t < 3; t++)
10148
for (unsigned int u = 0; u < 3; u++)
10150
dmats_old[t][u] = dmats[t][u];
10152
}// end loop over 'u'
10153
}// end loop over 't'
10155
// Update dmats using an inner product.
10156
if (combinations_t[r][s] == 0)
10158
for (unsigned int t = 0; t < 3; t++)
10160
for (unsigned int u = 0; u < 3; u++)
10162
for (unsigned int tu = 0; tu < 3; tu++)
10164
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
10165
}// end loop over 'tu'
10166
}// end loop over 'u'
10167
}// end loop over 't'
10170
if (combinations_t[r][s] == 1)
10172
for (unsigned int t = 0; t < 3; t++)
10174
for (unsigned int u = 0; u < 3; u++)
10176
for (unsigned int tu = 0; tu < 3; tu++)
10178
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
10179
}// end loop over 'tu'
10180
}// end loop over 'u'
10181
}// end loop over 't'
10184
}// end loop over 's'
10185
for (unsigned int s = 0; s < 3; s++)
10187
for (unsigned int t = 0; t < 3; t++)
10189
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
10190
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
10191
}// end loop over 't'
10192
}// end loop over 's'
10194
// Using covariant Piola transform to map values back to the physical element
10195
const double tmp_ref0 = derivatives[r];
10196
const double tmp_ref1 = derivatives[num_derivatives_t + r];
10197
derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1);
10198
derivatives_p[num_derivatives_t + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1);
10199
derivatives_p[2*num_derivatives_t + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1);
10200
}// end loop over 'r'
10202
// Transform derivatives back to physical element
10203
for (unsigned int r = 0; r < num_derivatives_g; r++)
10205
for (unsigned int s = 0; s < num_derivatives_t; s++)
10207
values[4*num_derivatives_g + r] += transform[r][s]*derivatives_p[s];
10208
values[5*num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
10209
values[6*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
10210
}// end loop over 's'
10211
}// end loop over 'r'
10213
// Delete pointer to array of derivatives on FIAT element
10214
delete [] derivatives;
10216
// Delete pointer to array of reference derivatives on physical element.
10217
delete [] derivatives_p;
10219
// Delete pointer to array of combinations of derivatives and transform
10220
for (unsigned int r = 0; r < num_derivatives_t; r++)
10222
delete [] combinations_t[r];
10223
}// end loop over 'r'
10224
delete [] combinations_t;
10225
for (unsigned int r = 0; r < num_derivatives_g; r++)
10227
delete [] combinations_g[r];
10228
}// end loop over 'r'
10229
delete [] combinations_g;
10230
for (unsigned int r = 0; r < num_derivatives_g; r++)
10232
delete [] transform[r];
10233
}// end loop over 'r'
10234
delete [] transform;
10240
// Array of basisvalues
10241
double basisvalues[3] = {0.0, 0.0, 0.0};
10243
// Declare helper variables
10244
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10246
// Compute basisvalues
10247
basisvalues[0] = 1.0;
10248
basisvalues[1] = tmp0;
10249
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
10250
basisvalues[0] *= std::sqrt(0.5);
10251
basisvalues[2] *= std::sqrt(1.0);
10252
basisvalues[1] *= std::sqrt(3.0);
10254
// Table(s) of coefficients
10255
static const double coefficients0[3] = \
10256
{0.47140452, 0.0, 0.33333333};
10258
static const double coefficients1[3] = \
10259
{0.94280904, -0.28867513, 0.16666667};
10261
// Tables of derivatives of the polynomial base (transpose).
10262
static const double dmats0[3][3] = \
10264
{4.8989795, 0.0, 0.0},
10267
static const double dmats1[3][3] = \
10269
{2.4494897, 0.0, 0.0},
10270
{4.2426407, 0.0, 0.0}};
10272
// Compute reference derivatives.
10273
// Declare pointer to array of derivatives on FIAT element.
10274
double *derivatives = new double[2*num_derivatives_t];
10275
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
10277
derivatives[r] = 0.0;
10278
}// end loop over 'r'
10280
// Declare pointer to array of reference derivatives on physical element.
10281
double *derivatives_p = new double[3*num_derivatives_t];
10282
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
10284
derivatives_p[r] = 0.0;
10285
}// end loop over 'r'
10287
// Declare derivative matrix (of polynomial basis).
10288
double dmats[3][3] = \
10293
// Declare (auxiliary) derivative matrix (of polynomial basis).
10294
double dmats_old[3][3] = \
10299
// Loop possible derivatives.
10300
for (unsigned int r = 0; r < num_derivatives_t; r++)
10302
// Resetting dmats values to compute next derivative.
10303
for (unsigned int t = 0; t < 3; t++)
10305
for (unsigned int u = 0; u < 3; u++)
10313
}// end loop over 'u'
10314
}// end loop over 't'
10316
// Looping derivative order to generate dmats.
10317
for (unsigned int s = 0; s < n; s++)
10319
// Updating dmats_old with new values and resetting dmats.
10320
for (unsigned int t = 0; t < 3; t++)
10322
for (unsigned int u = 0; u < 3; u++)
10324
dmats_old[t][u] = dmats[t][u];
10326
}// end loop over 'u'
10327
}// end loop over 't'
10329
// Update dmats using an inner product.
10330
if (combinations_t[r][s] == 0)
10332
for (unsigned int t = 0; t < 3; t++)
10334
for (unsigned int u = 0; u < 3; u++)
10336
for (unsigned int tu = 0; tu < 3; tu++)
10338
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
10339
}// end loop over 'tu'
10340
}// end loop over 'u'
10341
}// end loop over 't'
10344
if (combinations_t[r][s] == 1)
10346
for (unsigned int t = 0; t < 3; t++)
10348
for (unsigned int u = 0; u < 3; u++)
10350
for (unsigned int tu = 0; tu < 3; tu++)
10352
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
10353
}// end loop over 'tu'
10354
}// end loop over 'u'
10355
}// end loop over 't'
10358
}// end loop over 's'
10359
for (unsigned int s = 0; s < 3; s++)
10361
for (unsigned int t = 0; t < 3; t++)
10363
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
10364
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
10365
}// end loop over 't'
10366
}// end loop over 's'
10368
// Using covariant Piola transform to map values back to the physical element
10369
const double tmp_ref0 = derivatives[r];
10370
const double tmp_ref1 = derivatives[num_derivatives_t + r];
10371
derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1);
10372
derivatives_p[num_derivatives_t + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1);
10373
derivatives_p[2*num_derivatives_t + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1);
10374
}// end loop over 'r'
10376
// Transform derivatives back to physical element
10377
for (unsigned int r = 0; r < num_derivatives_g; r++)
10379
for (unsigned int s = 0; s < num_derivatives_t; s++)
10381
values[4*num_derivatives_g + r] += transform[r][s]*derivatives_p[s];
10382
values[5*num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
10383
values[6*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
10384
}// end loop over 's'
10385
}// end loop over 'r'
10387
// Delete pointer to array of derivatives on FIAT element
10388
delete [] derivatives;
10390
// Delete pointer to array of reference derivatives on physical element.
10391
delete [] derivatives_p;
10393
// Delete pointer to array of combinations of derivatives and transform
10394
for (unsigned int r = 0; r < num_derivatives_t; r++)
10396
delete [] combinations_t[r];
10397
}// end loop over 'r'
10398
delete [] combinations_t;
10399
for (unsigned int r = 0; r < num_derivatives_g; r++)
10401
delete [] combinations_g[r];
10402
}// end loop over 'r'
10403
delete [] combinations_g;
10404
for (unsigned int r = 0; r < num_derivatives_g; r++)
10406
delete [] transform[r];
10407
}// end loop over 'r'
10408
delete [] transform;
10414
// Array of basisvalues
10415
double basisvalues[3] = {0.0, 0.0, 0.0};
10417
// Declare helper variables
10418
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10420
// Compute basisvalues
10421
basisvalues[0] = 1.0;
10422
basisvalues[1] = tmp0;
10423
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
10424
basisvalues[0] *= std::sqrt(0.5);
10425
basisvalues[2] *= std::sqrt(1.0);
10426
basisvalues[1] *= std::sqrt(3.0);
10428
// Table(s) of coefficients
10429
static const double coefficients0[3] = \
10430
{0.94280904, 0.0, -0.33333333};
10432
static const double coefficients1[3] = \
10433
{0.47140452, 0.28867513, -0.16666667};
10435
// Tables of derivatives of the polynomial base (transpose).
10436
static const double dmats0[3][3] = \
10438
{4.8989795, 0.0, 0.0},
10441
static const double dmats1[3][3] = \
10443
{2.4494897, 0.0, 0.0},
10444
{4.2426407, 0.0, 0.0}};
10446
// Compute reference derivatives.
10447
// Declare pointer to array of derivatives on FIAT element.
10448
double *derivatives = new double[2*num_derivatives_t];
10449
for (unsigned int r = 0; r < 2*num_derivatives_t; r++)
10451
derivatives[r] = 0.0;
10452
}// end loop over 'r'
10454
// Declare pointer to array of reference derivatives on physical element.
10455
double *derivatives_p = new double[3*num_derivatives_t];
10456
for (unsigned int r = 0; r < 3*num_derivatives_t; r++)
10458
derivatives_p[r] = 0.0;
10459
}// end loop over 'r'
10461
// Declare derivative matrix (of polynomial basis).
10462
double dmats[3][3] = \
10467
// Declare (auxiliary) derivative matrix (of polynomial basis).
10468
double dmats_old[3][3] = \
10473
// Loop possible derivatives.
10474
for (unsigned int r = 0; r < num_derivatives_t; r++)
10476
// Resetting dmats values to compute next derivative.
10477
for (unsigned int t = 0; t < 3; t++)
10479
for (unsigned int u = 0; u < 3; u++)
10487
}// end loop over 'u'
10488
}// end loop over 't'
10490
// Looping derivative order to generate dmats.
10491
for (unsigned int s = 0; s < n; s++)
10493
// Updating dmats_old with new values and resetting dmats.
10494
for (unsigned int t = 0; t < 3; t++)
10496
for (unsigned int u = 0; u < 3; u++)
10498
dmats_old[t][u] = dmats[t][u];
10500
}// end loop over 'u'
10501
}// end loop over 't'
10503
// Update dmats using an inner product.
10504
if (combinations_t[r][s] == 0)
10506
for (unsigned int t = 0; t < 3; t++)
10508
for (unsigned int u = 0; u < 3; u++)
10510
for (unsigned int tu = 0; tu < 3; tu++)
10512
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
10513
}// end loop over 'tu'
10514
}// end loop over 'u'
10515
}// end loop over 't'
10518
if (combinations_t[r][s] == 1)
10520
for (unsigned int t = 0; t < 3; t++)
10522
for (unsigned int u = 0; u < 3; u++)
10524
for (unsigned int tu = 0; tu < 3; tu++)
10526
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
10527
}// end loop over 'tu'
10528
}// end loop over 'u'
10529
}// end loop over 't'
10532
}// end loop over 's'
10533
for (unsigned int s = 0; s < 3; s++)
10535
for (unsigned int t = 0; t < 3; t++)
10537
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
10538
derivatives[num_derivatives_t + r] += coefficients1[s]*dmats[s][t]*basisvalues[t];
10539
}// end loop over 't'
10540
}// end loop over 's'
10542
// Using covariant Piola transform to map values back to the physical element
10543
const double tmp_ref0 = derivatives[r];
10544
const double tmp_ref1 = derivatives[num_derivatives_t + r];
10545
derivatives_p[r] = (K[0]*tmp_ref0 + K[3]*tmp_ref1);
10546
derivatives_p[num_derivatives_t + r] = (K[1]*tmp_ref0 + K[4]*tmp_ref1);
10547
derivatives_p[2*num_derivatives_t + r] = (K[2]*tmp_ref0 + K[5]*tmp_ref1);
10548
}// end loop over 'r'
10550
// Transform derivatives back to physical element
10551
for (unsigned int r = 0; r < num_derivatives_g; r++)
10553
for (unsigned int s = 0; s < num_derivatives_t; s++)
10555
values[4*num_derivatives_g + r] += transform[r][s]*derivatives_p[s];
10556
values[5*num_derivatives_g + r] += transform[r][s]*derivatives_p[num_derivatives_t + s];
10557
values[6*num_derivatives_g + r] += transform[r][s]*derivatives_p[2*num_derivatives_t + s];
10558
}// end loop over 's'
10559
}// end loop over 'r'
10561
// Delete pointer to array of derivatives on FIAT element
10562
delete [] derivatives;
10564
// Delete pointer to array of reference derivatives on physical element.
10565
delete [] derivatives_p;
10567
// Delete pointer to array of combinations of derivatives and transform
10568
for (unsigned int r = 0; r < num_derivatives_t; r++)
10570
delete [] combinations_t[r];
10571
}// end loop over 'r'
10572
delete [] combinations_t;
10573
for (unsigned int r = 0; r < num_derivatives_g; r++)
10575
delete [] combinations_g[r];
10576
}// end loop over 'r'
10577
delete [] combinations_g;
10578
for (unsigned int r = 0; r < num_derivatives_g; r++)
10580
delete [] transform[r];
10581
}// end loop over 'r'
10582
delete [] transform;
10588
// Array of basisvalues
10589
double basisvalues[3] = {0.0, 0.0, 0.0};
10591
// Declare helper variables
10592
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10594
// Compute basisvalues
10595
basisvalues[0] = 1.0;
10596
basisvalues[1] = tmp0;
10597
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
10598
basisvalues[0] *= std::sqrt(0.5);
10599
basisvalues[2] *= std::sqrt(1.0);
10600
basisvalues[1] *= std::sqrt(3.0);
10602
// Table(s) of coefficients
10603
static const double coefficients0[3] = \
10604
{0.47140452, -0.28867513, -0.16666667};
10606
// Tables of derivatives of the polynomial base (transpose).
10607
static const double dmats0[3][3] = \
10609
{4.8989795, 0.0, 0.0},
10612
static const double dmats1[3][3] = \
10614
{2.4494897, 0.0, 0.0},
10615
{4.2426407, 0.0, 0.0}};
10617
// Compute reference derivatives.
10618
// Declare pointer to array of derivatives on FIAT element.
10619
double *derivatives = new double[num_derivatives_t];
10620
for (unsigned int r = 0; r < num_derivatives_t; r++)
10622
derivatives[r] = 0.0;
10623
}// end loop over 'r'
10625
// Declare derivative matrix (of polynomial basis).
10626
double dmats[3][3] = \
10631
// Declare (auxiliary) derivative matrix (of polynomial basis).
10632
double dmats_old[3][3] = \
10637
// Loop possible derivatives.
10638
for (unsigned int r = 0; r < num_derivatives_t; r++)
10640
// Resetting dmats values to compute next derivative.
10641
for (unsigned int t = 0; t < 3; t++)
10643
for (unsigned int u = 0; u < 3; u++)
10651
}// end loop over 'u'
10652
}// end loop over 't'
10654
// Looping derivative order to generate dmats.
10655
for (unsigned int s = 0; s < n; s++)
10657
// Updating dmats_old with new values and resetting dmats.
10658
for (unsigned int t = 0; t < 3; t++)
10660
for (unsigned int u = 0; u < 3; u++)
10662
dmats_old[t][u] = dmats[t][u];
10664
}// end loop over 'u'
10665
}// end loop over 't'
10667
// Update dmats using an inner product.
10668
if (combinations_t[r][s] == 0)
10670
for (unsigned int t = 0; t < 3; t++)
10672
for (unsigned int u = 0; u < 3; u++)
10674
for (unsigned int tu = 0; tu < 3; tu++)
10676
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
10677
}// end loop over 'tu'
10678
}// end loop over 'u'
10679
}// end loop over 't'
10682
if (combinations_t[r][s] == 1)
10684
for (unsigned int t = 0; t < 3; t++)
10686
for (unsigned int u = 0; u < 3; u++)
10688
for (unsigned int tu = 0; tu < 3; tu++)
10690
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
10691
}// end loop over 'tu'
10692
}// end loop over 'u'
10693
}// end loop over 't'
10696
}// end loop over 's'
10697
for (unsigned int s = 0; s < 3; s++)
10699
for (unsigned int t = 0; t < 3; t++)
10701
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
10702
}// end loop over 't'
10703
}// end loop over 's'
10704
}// end loop over 'r'
10706
// Transform derivatives back to physical element
10707
for (unsigned int r = 0; r < num_derivatives_g; r++)
10709
for (unsigned int s = 0; s < num_derivatives_t; s++)
10711
values[6*num_derivatives_g + r] += transform[r][s]*derivatives[s];
10712
}// end loop over 's'
10713
}// end loop over 'r'
10715
// Delete pointer to array of derivatives on FIAT element
10716
delete [] derivatives;
10718
// Delete pointer to array of combinations of derivatives and transform
10719
for (unsigned int r = 0; r < num_derivatives_t; r++)
10721
delete [] combinations_t[r];
10722
}// end loop over 'r'
10723
delete [] combinations_t;
10724
for (unsigned int r = 0; r < num_derivatives_g; r++)
10726
delete [] combinations_g[r];
10727
}// end loop over 'r'
10728
delete [] combinations_g;
10729
for (unsigned int r = 0; r < num_derivatives_g; r++)
10731
delete [] transform[r];
10732
}// end loop over 'r'
10733
delete [] transform;
10739
// Array of basisvalues
10740
double basisvalues[3] = {0.0, 0.0, 0.0};
10742
// Declare helper variables
10743
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10745
// Compute basisvalues
10746
basisvalues[0] = 1.0;
10747
basisvalues[1] = tmp0;
10748
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
10749
basisvalues[0] *= std::sqrt(0.5);
10750
basisvalues[2] *= std::sqrt(1.0);
10751
basisvalues[1] *= std::sqrt(3.0);
10753
// Table(s) of coefficients
10754
static const double coefficients0[3] = \
10755
{0.47140452, 0.28867513, -0.16666667};
10757
// Tables of derivatives of the polynomial base (transpose).
10758
static const double dmats0[3][3] = \
10760
{4.8989795, 0.0, 0.0},
10763
static const double dmats1[3][3] = \
10765
{2.4494897, 0.0, 0.0},
10766
{4.2426407, 0.0, 0.0}};
10768
// Compute reference derivatives.
10769
// Declare pointer to array of derivatives on FIAT element.
10770
double *derivatives = new double[num_derivatives_t];
10771
for (unsigned int r = 0; r < num_derivatives_t; r++)
10773
derivatives[r] = 0.0;
10774
}// end loop over 'r'
10776
// Declare derivative matrix (of polynomial basis).
10777
double dmats[3][3] = \
10782
// Declare (auxiliary) derivative matrix (of polynomial basis).
10783
double dmats_old[3][3] = \
10788
// Loop possible derivatives.
10789
for (unsigned int r = 0; r < num_derivatives_t; r++)
10791
// Resetting dmats values to compute next derivative.
10792
for (unsigned int t = 0; t < 3; t++)
10794
for (unsigned int u = 0; u < 3; u++)
10802
}// end loop over 'u'
10803
}// end loop over 't'
10805
// Looping derivative order to generate dmats.
10806
for (unsigned int s = 0; s < n; s++)
10808
// Updating dmats_old with new values and resetting dmats.
10809
for (unsigned int t = 0; t < 3; t++)
10811
for (unsigned int u = 0; u < 3; u++)
10813
dmats_old[t][u] = dmats[t][u];
10815
}// end loop over 'u'
10816
}// end loop over 't'
10818
// Update dmats using an inner product.
10819
if (combinations_t[r][s] == 0)
10821
for (unsigned int t = 0; t < 3; t++)
10823
for (unsigned int u = 0; u < 3; u++)
10825
for (unsigned int tu = 0; tu < 3; tu++)
10827
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
10828
}// end loop over 'tu'
10829
}// end loop over 'u'
10830
}// end loop over 't'
10833
if (combinations_t[r][s] == 1)
10835
for (unsigned int t = 0; t < 3; t++)
10837
for (unsigned int u = 0; u < 3; u++)
10839
for (unsigned int tu = 0; tu < 3; tu++)
10841
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
10842
}// end loop over 'tu'
10843
}// end loop over 'u'
10844
}// end loop over 't'
10847
}// end loop over 's'
10848
for (unsigned int s = 0; s < 3; s++)
10850
for (unsigned int t = 0; t < 3; t++)
10852
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
10853
}// end loop over 't'
10854
}// end loop over 's'
10855
}// end loop over 'r'
10857
// Transform derivatives back to physical element
10858
for (unsigned int r = 0; r < num_derivatives_g; r++)
10860
for (unsigned int s = 0; s < num_derivatives_t; s++)
10862
values[6*num_derivatives_g + r] += transform[r][s]*derivatives[s];
10863
}// end loop over 's'
10864
}// end loop over 'r'
10866
// Delete pointer to array of derivatives on FIAT element
10867
delete [] derivatives;
10869
// Delete pointer to array of combinations of derivatives and transform
10870
for (unsigned int r = 0; r < num_derivatives_t; r++)
10872
delete [] combinations_t[r];
10873
}// end loop over 'r'
10874
delete [] combinations_t;
10875
for (unsigned int r = 0; r < num_derivatives_g; r++)
10877
delete [] combinations_g[r];
10878
}// end loop over 'r'
10879
delete [] combinations_g;
10880
for (unsigned int r = 0; r < num_derivatives_g; r++)
10882
delete [] transform[r];
10883
}// end loop over 'r'
10884
delete [] transform;
10890
// Array of basisvalues
10891
double basisvalues[3] = {0.0, 0.0, 0.0};
10893
// Declare helper variables
10894
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
10896
// Compute basisvalues
10897
basisvalues[0] = 1.0;
10898
basisvalues[1] = tmp0;
10899
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
10900
basisvalues[0] *= std::sqrt(0.5);
10901
basisvalues[2] *= std::sqrt(1.0);
10902
basisvalues[1] *= std::sqrt(3.0);
10904
// Table(s) of coefficients
10905
static const double coefficients0[3] = \
10906
{0.47140452, 0.0, 0.33333333};
10908
// Tables of derivatives of the polynomial base (transpose).
10909
static const double dmats0[3][3] = \
10911
{4.8989795, 0.0, 0.0},
10914
static const double dmats1[3][3] = \
10916
{2.4494897, 0.0, 0.0},
10917
{4.2426407, 0.0, 0.0}};
10919
// Compute reference derivatives.
10920
// Declare pointer to array of derivatives on FIAT element.
10921
double *derivatives = new double[num_derivatives_t];
10922
for (unsigned int r = 0; r < num_derivatives_t; r++)
10924
derivatives[r] = 0.0;
10925
}// end loop over 'r'
10927
// Declare derivative matrix (of polynomial basis).
10928
double dmats[3][3] = \
10933
// Declare (auxiliary) derivative matrix (of polynomial basis).
10934
double dmats_old[3][3] = \
10939
// Loop possible derivatives.
10940
for (unsigned int r = 0; r < num_derivatives_t; r++)
10942
// Resetting dmats values to compute next derivative.
10943
for (unsigned int t = 0; t < 3; t++)
10945
for (unsigned int u = 0; u < 3; u++)
10953
}// end loop over 'u'
10954
}// end loop over 't'
10956
// Looping derivative order to generate dmats.
10957
for (unsigned int s = 0; s < n; s++)
10959
// Updating dmats_old with new values and resetting dmats.
10960
for (unsigned int t = 0; t < 3; t++)
10962
for (unsigned int u = 0; u < 3; u++)
10964
dmats_old[t][u] = dmats[t][u];
10966
}// end loop over 'u'
10967
}// end loop over 't'
10969
// Update dmats using an inner product.
10970
if (combinations_t[r][s] == 0)
10972
for (unsigned int t = 0; t < 3; t++)
10974
for (unsigned int u = 0; u < 3; u++)
10976
for (unsigned int tu = 0; tu < 3; tu++)
10978
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
10979
}// end loop over 'tu'
10980
}// end loop over 'u'
10981
}// end loop over 't'
10984
if (combinations_t[r][s] == 1)
10986
for (unsigned int t = 0; t < 3; t++)
10988
for (unsigned int u = 0; u < 3; u++)
10990
for (unsigned int tu = 0; tu < 3; tu++)
10992
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
10993
}// end loop over 'tu'
10994
}// end loop over 'u'
10995
}// end loop over 't'
10998
}// end loop over 's'
10999
for (unsigned int s = 0; s < 3; s++)
11001
for (unsigned int t = 0; t < 3; t++)
11003
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
11004
}// end loop over 't'
11005
}// end loop over 's'
11006
}// end loop over 'r'
11008
// Transform derivatives back to physical element
11009
for (unsigned int r = 0; r < num_derivatives_g; r++)
11011
for (unsigned int s = 0; s < num_derivatives_t; s++)
11013
values[6*num_derivatives_g + r] += transform[r][s]*derivatives[s];
11014
}// end loop over 's'
11015
}// end loop over 'r'
11017
// Delete pointer to array of derivatives on FIAT element
11018
delete [] derivatives;
11020
// Delete pointer to array of combinations of derivatives and transform
11021
for (unsigned int r = 0; r < num_derivatives_t; r++)
11023
delete [] combinations_t[r];
11024
}// end loop over 'r'
11025
delete [] combinations_t;
11026
for (unsigned int r = 0; r < num_derivatives_g; r++)
11028
delete [] combinations_g[r];
11029
}// end loop over 'r'
11030
delete [] combinations_g;
11031
for (unsigned int r = 0; r < num_derivatives_g; r++)
11033
delete [] transform[r];
11034
}// end loop over 'r'
11035
delete [] transform;
11042
/// Evaluate order n derivatives of all basis functions at given point x in cell
11043
virtual void evaluate_basis_derivatives_all(std::size_t n,
11046
const double* vertex_coordinates,
11047
int cell_orientation) const
11049
// Compute number of derivatives.
11050
unsigned int num_derivatives_g = 1;
11051
for (unsigned int r = 0; r < n; r++)
11053
num_derivatives_g *= 3;
11054
}// end loop over 'r'
11056
// Helper variable to hold values of a single dof.
11057
double *dof_values = new double[10*num_derivatives_g];
11058
for (unsigned int r = 0; r < 10*num_derivatives_g; r++)
11060
dof_values[r] = 0.0;
11061
}// end loop over 'r'
11063
// Loop dofs and call evaluate_basis_derivatives.
11064
for (unsigned int r = 0; r < 20; r++)
11066
evaluate_basis_derivatives(r, n, dof_values, x, vertex_coordinates, cell_orientation);
11067
for (unsigned int s = 0; s < 10*num_derivatives_g; s++)
11069
values[r*10*num_derivatives_g + s] = dof_values[s];
11070
}// end loop over 's'
11071
}// end loop over 'r'
11074
delete [] dof_values;
11077
/// Evaluate linear functional for dof i on the function f
11078
virtual double evaluate_dof(std::size_t i,
11079
const ufc::function& f,
11080
const double* vertex_coordinates,
11081
int cell_orientation,
11082
const ufc::cell& c) const
11084
// Declare variables for result of evaluation
11087
// Declare variable for physical coordinates
11091
// Compute Jacobian
11093
compute_jacobian_triangle_3d(J, vertex_coordinates);
11096
// Compute Jacobian inverse and determinant
11099
compute_jacobian_inverse_triangle_3d(K, detJ, J);
11103
// Check orientation
11104
if (cell_orientation == -1)
11105
throw std::runtime_error("cell orientation must be defined (not -1)");
11106
// (If cell_orientation == 1 = down, multiply det(J) by -1)
11107
else if (cell_orientation == 1)
11113
y[0] = 0.66666667*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
11114
y[1] = 0.66666667*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
11115
y[2] = 0.66666667*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
11116
f.evaluate(vals, y, c);
11117
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2])) + (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
11123
y[0] = 0.33333333*vertex_coordinates[3] + 0.66666667*vertex_coordinates[6];
11124
y[1] = 0.33333333*vertex_coordinates[4] + 0.66666667*vertex_coordinates[7];
11125
y[2] = 0.33333333*vertex_coordinates[5] + 0.66666667*vertex_coordinates[8];
11126
f.evaluate(vals, y, c);
11127
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2])) + (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
11133
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[6];
11134
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[7];
11135
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[8];
11136
f.evaluate(vals, y, c);
11137
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
11143
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[6];
11144
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[7];
11145
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[8];
11146
f.evaluate(vals, y, c);
11147
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
11153
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3];
11154
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4];
11155
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5];
11156
f.evaluate(vals, y, c);
11157
result = (-1.0)*(detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
11163
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[3];
11164
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[4];
11165
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[5];
11166
f.evaluate(vals, y, c);
11167
result = (-1.0)*(detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
11173
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
11174
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
11175
y[2] = 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
11176
f.evaluate(vals, y, c);
11177
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
11183
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
11184
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
11185
y[2] = 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
11186
f.evaluate(vals, y, c);
11187
result = (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
11193
y[0] = 0.66666667*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
11194
y[1] = 0.66666667*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
11195
y[2] = 0.66666667*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
11196
f.evaluate(vals, y, c);
11197
result = (detJ*(K[0]*vals[3] + K[1]*vals[4] + K[2]*vals[5])) + (detJ*(K[3]*vals[3] + K[4]*vals[4] + K[5]*vals[5]));
11203
y[0] = 0.33333333*vertex_coordinates[3] + 0.66666667*vertex_coordinates[6];
11204
y[1] = 0.33333333*vertex_coordinates[4] + 0.66666667*vertex_coordinates[7];
11205
y[2] = 0.33333333*vertex_coordinates[5] + 0.66666667*vertex_coordinates[8];
11206
f.evaluate(vals, y, c);
11207
result = (detJ*(K[0]*vals[3] + K[1]*vals[4] + K[2]*vals[5])) + (detJ*(K[3]*vals[3] + K[4]*vals[4] + K[5]*vals[5]));
11213
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[6];
11214
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[7];
11215
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[8];
11216
f.evaluate(vals, y, c);
11217
result = (detJ*(K[0]*vals[3] + K[1]*vals[4] + K[2]*vals[5]));
11223
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[6];
11224
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[7];
11225
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[8];
11226
f.evaluate(vals, y, c);
11227
result = (detJ*(K[0]*vals[3] + K[1]*vals[4] + K[2]*vals[5]));
11233
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3];
11234
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4];
11235
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5];
11236
f.evaluate(vals, y, c);
11237
result = (-1.0)*(detJ*(K[3]*vals[3] + K[4]*vals[4] + K[5]*vals[5]));
11243
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[3];
11244
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[4];
11245
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[5];
11246
f.evaluate(vals, y, c);
11247
result = (-1.0)*(detJ*(K[3]*vals[3] + K[4]*vals[4] + K[5]*vals[5]));
11253
y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
11254
y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
11255
y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
11256
f.evaluate(vals, y, c);
11257
result = (-1.0)*(J[0]*vals[6] + J[2]*vals[7] + J[4]*vals[8]) + (J[1]*vals[6] + J[3]*vals[7] + J[5]*vals[8]);
11263
y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
11264
y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
11265
y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
11266
f.evaluate(vals, y, c);
11267
result = (J[1]*vals[6] + J[3]*vals[7] + J[5]*vals[8]);
11273
y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
11274
y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
11275
y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
11276
f.evaluate(vals, y, c);
11277
result = (J[0]*vals[6] + J[2]*vals[7] + J[4]*vals[8]);
11283
y[0] = vertex_coordinates[0];
11284
y[1] = vertex_coordinates[1];
11285
y[2] = vertex_coordinates[2];
11286
f.evaluate(vals, y, c);
11292
y[0] = vertex_coordinates[3];
11293
y[1] = vertex_coordinates[4];
11294
y[2] = vertex_coordinates[5];
11295
f.evaluate(vals, y, c);
11301
y[0] = vertex_coordinates[6];
11302
y[1] = vertex_coordinates[7];
11303
y[2] = vertex_coordinates[8];
11304
f.evaluate(vals, y, c);
11313
/// Evaluate linear functionals for all dofs on the function f
11314
virtual void evaluate_dofs(double* values,
11315
const ufc::function& f,
11316
const double* vertex_coordinates,
11317
int cell_orientation,
11318
const ufc::cell& c) const
11320
// Declare variables for result of evaluation
11323
// Declare variable for physical coordinates
11327
// Compute Jacobian
11329
compute_jacobian_triangle_3d(J, vertex_coordinates);
11332
// Compute Jacobian inverse and determinant
11335
compute_jacobian_inverse_triangle_3d(K, detJ, J);
11339
// Check orientation
11340
if (cell_orientation == -1)
11341
throw std::runtime_error("cell orientation must be defined (not -1)");
11342
// (If cell_orientation == 1 = down, multiply det(J) by -1)
11343
else if (cell_orientation == 1)
11345
y[0] = 0.66666667*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
11346
y[1] = 0.66666667*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
11347
y[2] = 0.66666667*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
11348
f.evaluate(vals, y, c);
11349
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2])) + (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
11350
values[0] = result;
11351
y[0] = 0.33333333*vertex_coordinates[3] + 0.66666667*vertex_coordinates[6];
11352
y[1] = 0.33333333*vertex_coordinates[4] + 0.66666667*vertex_coordinates[7];
11353
y[2] = 0.33333333*vertex_coordinates[5] + 0.66666667*vertex_coordinates[8];
11354
f.evaluate(vals, y, c);
11355
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2])) + (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
11356
values[1] = result;
11357
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[6];
11358
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[7];
11359
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[8];
11360
f.evaluate(vals, y, c);
11361
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
11362
values[2] = result;
11363
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[6];
11364
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[7];
11365
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[8];
11366
f.evaluate(vals, y, c);
11367
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
11368
values[3] = result;
11369
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3];
11370
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4];
11371
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5];
11372
f.evaluate(vals, y, c);
11373
result = (-1.0)*(detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
11374
values[4] = result;
11375
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[3];
11376
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[4];
11377
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[5];
11378
f.evaluate(vals, y, c);
11379
result = (-1.0)*(detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
11380
values[5] = result;
11381
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
11382
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
11383
y[2] = 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
11384
f.evaluate(vals, y, c);
11385
result = (detJ*(K[0]*vals[0] + K[1]*vals[1] + K[2]*vals[2]));
11386
values[6] = result;
11387
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
11388
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
11389
y[2] = 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
11390
f.evaluate(vals, y, c);
11391
result = (detJ*(K[3]*vals[0] + K[4]*vals[1] + K[5]*vals[2]));
11392
values[7] = result;
11393
y[0] = 0.66666667*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
11394
y[1] = 0.66666667*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
11395
y[2] = 0.66666667*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
11396
f.evaluate(vals, y, c);
11397
result = (detJ*(K[0]*vals[3] + K[1]*vals[4] + K[2]*vals[5])) + (detJ*(K[3]*vals[3] + K[4]*vals[4] + K[5]*vals[5]));
11398
values[8] = result;
11399
y[0] = 0.33333333*vertex_coordinates[3] + 0.66666667*vertex_coordinates[6];
11400
y[1] = 0.33333333*vertex_coordinates[4] + 0.66666667*vertex_coordinates[7];
11401
y[2] = 0.33333333*vertex_coordinates[5] + 0.66666667*vertex_coordinates[8];
11402
f.evaluate(vals, y, c);
11403
result = (detJ*(K[0]*vals[3] + K[1]*vals[4] + K[2]*vals[5])) + (detJ*(K[3]*vals[3] + K[4]*vals[4] + K[5]*vals[5]));
11404
values[9] = result;
11405
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[6];
11406
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[7];
11407
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[8];
11408
f.evaluate(vals, y, c);
11409
result = (detJ*(K[0]*vals[3] + K[1]*vals[4] + K[2]*vals[5]));
11410
values[10] = result;
11411
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[6];
11412
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[7];
11413
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[8];
11414
f.evaluate(vals, y, c);
11415
result = (detJ*(K[0]*vals[3] + K[1]*vals[4] + K[2]*vals[5]));
11416
values[11] = result;
11417
y[0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3];
11418
y[1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4];
11419
y[2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5];
11420
f.evaluate(vals, y, c);
11421
result = (-1.0)*(detJ*(K[3]*vals[3] + K[4]*vals[4] + K[5]*vals[5]));
11422
values[12] = result;
11423
y[0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[3];
11424
y[1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[4];
11425
y[2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[5];
11426
f.evaluate(vals, y, c);
11427
result = (-1.0)*(detJ*(K[3]*vals[3] + K[4]*vals[4] + K[5]*vals[5]));
11428
values[13] = result;
11429
y[0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
11430
y[1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
11431
y[2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
11432
f.evaluate(vals, y, c);
11433
result = (-1.0)*(J[0]*vals[6] + J[2]*vals[7] + J[4]*vals[8]) + (J[1]*vals[6] + J[3]*vals[7] + J[5]*vals[8]);
11434
values[14] = result;
11435
y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
11436
y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
11437
y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
11438
f.evaluate(vals, y, c);
11439
result = (J[1]*vals[6] + J[3]*vals[7] + J[5]*vals[8]);
11440
values[15] = result;
11441
y[0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
11442
y[1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
11443
y[2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
11444
f.evaluate(vals, y, c);
11445
result = (J[0]*vals[6] + J[2]*vals[7] + J[4]*vals[8]);
11446
values[16] = result;
11447
y[0] = vertex_coordinates[0];
11448
y[1] = vertex_coordinates[1];
11449
y[2] = vertex_coordinates[2];
11450
f.evaluate(vals, y, c);
11451
values[17] = vals[9];
11452
y[0] = vertex_coordinates[3];
11453
y[1] = vertex_coordinates[4];
11454
y[2] = vertex_coordinates[5];
11455
f.evaluate(vals, y, c);
11456
values[18] = vals[9];
11457
y[0] = vertex_coordinates[6];
11458
y[1] = vertex_coordinates[7];
11459
y[2] = vertex_coordinates[8];
11460
f.evaluate(vals, y, c);
11461
values[19] = vals[9];
11464
/// Interpolate vertex values from dof values
11465
virtual void interpolate_vertex_values(double* vertex_values,
11466
const double* dof_values,
11467
const double* vertex_coordinates,
11468
int cell_orientation,
11469
const ufc::cell& c) const
11471
// Compute Jacobian
11473
compute_jacobian_triangle_3d(J, vertex_coordinates);
11476
// Compute Jacobian inverse and determinant
11479
compute_jacobian_inverse_triangle_3d(K, detJ, J);
11483
// Check orientation
11484
if (cell_orientation == -1)
11485
throw std::runtime_error("cell orientation must be defined (not -1)");
11486
// (If cell_orientation == 1 = down, multiply det(J) by -1)
11487
else if (cell_orientation == 1)
11490
// Evaluate function and change variables
11491
vertex_values[0] = dof_values[2]*(1.0/detJ)*J[0]*2.0 + dof_values[3]*((1.0/detJ)*(J[0]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[1]*(-2.0))) + dof_values[5]*(1.0/detJ)*J[1];
11492
vertex_values[7] = dof_values[0]*(1.0/detJ)*J[0]*2.0 + dof_values[1]*((1.0/detJ)*(J[0]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[0]*(-1.0) + J[1])) + dof_values[5]*((1.0/detJ)*(J[0]*2.0 + J[1]*(-2.0)));
11493
vertex_values[14] = dof_values[0]*((1.0/detJ)*(J[1]*(-1.0))) + dof_values[1]*(1.0/detJ)*J[1]*2.0 + dof_values[2]*((1.0/detJ)*(J[0]*(-1.0) + J[1])) + dof_values[3]*((1.0/detJ)*(J[0]*2.0 + J[1]*(-2.0)));
11494
vertex_values[1] = dof_values[2]*(1.0/detJ)*J[2]*2.0 + dof_values[3]*((1.0/detJ)*(J[2]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[3]*(-2.0))) + dof_values[5]*(1.0/detJ)*J[3];
11495
vertex_values[8] = dof_values[0]*(1.0/detJ)*J[2]*2.0 + dof_values[1]*((1.0/detJ)*(J[2]*(-1.0))) + dof_values[4]*((1.0/detJ)*(J[2]*(-1.0) + J[3])) + dof_values[5]*((1.0/detJ)*(J[2]*2.0 + J[3]*(-2.0)));
11496
vertex_values[15] = dof_values[0]*((1.0/detJ)*(J[3]*(-1.0))) + dof_values[1]*(1.0/detJ)*J[3]*2.0 + dof_values[2]*((1.0/detJ)*(J[2]*(-1.0) + J[3])) + dof_values[3]*((1.0/detJ)*(J[2]*2.0 + J[3]*(-2.0)));
11497
// Evaluate function and change variables
11498
vertex_values[2] = dof_values[10]*(1.0/detJ)*J[0]*2.0 + dof_values[11]*((1.0/detJ)*(J[0]*(-1.0))) + dof_values[12]*((1.0/detJ)*(J[1]*(-2.0))) + dof_values[13]*(1.0/detJ)*J[1];
11499
vertex_values[9] = dof_values[8]*(1.0/detJ)*J[0]*2.0 + dof_values[9]*((1.0/detJ)*(J[0]*(-1.0))) + dof_values[12]*((1.0/detJ)*(J[0]*(-1.0) + J[1])) + dof_values[13]*((1.0/detJ)*(J[0]*2.0 + J[1]*(-2.0)));
11500
vertex_values[16] = dof_values[8]*((1.0/detJ)*(J[1]*(-1.0))) + dof_values[9]*(1.0/detJ)*J[1]*2.0 + dof_values[10]*((1.0/detJ)*(J[0]*(-1.0) + J[1])) + dof_values[11]*((1.0/detJ)*(J[0]*2.0 + J[1]*(-2.0)));
11501
vertex_values[3] = dof_values[10]*(1.0/detJ)*J[2]*2.0 + dof_values[11]*((1.0/detJ)*(J[2]*(-1.0))) + dof_values[12]*((1.0/detJ)*(J[3]*(-2.0))) + dof_values[13]*(1.0/detJ)*J[3];
11502
vertex_values[10] = dof_values[8]*(1.0/detJ)*J[2]*2.0 + dof_values[9]*((1.0/detJ)*(J[2]*(-1.0))) + dof_values[12]*((1.0/detJ)*(J[2]*(-1.0) + J[3])) + dof_values[13]*((1.0/detJ)*(J[2]*2.0 + J[3]*(-2.0)));
11503
vertex_values[17] = dof_values[8]*((1.0/detJ)*(J[3]*(-1.0))) + dof_values[9]*(1.0/detJ)*J[3]*2.0 + dof_values[10]*((1.0/detJ)*(J[2]*(-1.0) + J[3])) + dof_values[11]*((1.0/detJ)*(J[2]*2.0 + J[3]*(-2.0)));
11504
// Evaluate function and change variables
11505
vertex_values[4] = dof_values[15]*K[3] + dof_values[16]*K[0];
11506
vertex_values[11] = dof_values[14]*K[3] + dof_values[16]*(K[0] + K[3]);
11507
vertex_values[18] = dof_values[14]*(K[0]*(-1.0)) + dof_values[15]*(K[0] + K[3]);
11508
vertex_values[5] = dof_values[15]*K[4] + dof_values[16]*K[1];
11509
vertex_values[12] = dof_values[14]*K[4] + dof_values[16]*(K[1] + K[4]);
11510
vertex_values[19] = dof_values[14]*(K[1]*(-1.0)) + dof_values[15]*(K[1] + K[4]);
11511
// Evaluate function and change variables
11512
vertex_values[6] = dof_values[17];
11513
vertex_values[13] = dof_values[18];
11514
vertex_values[20] = dof_values[19];
11517
/// Map coordinate xhat from reference cell to coordinate x in cell
11518
virtual void map_from_reference_cell(double* x,
11519
const double* xhat,
11520
const ufc::cell& c) const
11522
std::cerr << "*** FFC warning: " << "map_from_reference_cell not yet implemented." << std::endl;
11525
/// Map from coordinate x in cell to coordinate xhat in reference cell
11526
virtual void map_to_reference_cell(double* xhat,
11528
const ufc::cell& c) const
11530
std::cerr << "*** FFC warning: " << "map_to_reference_cell not yet implemented." << std::endl;
11533
/// Return the number of sub elements (for a mixed element)
11534
virtual std::size_t num_sub_elements() const
11539
/// Create a new finite element for sub element i (for a mixed element)
11540
virtual ufc::finite_element* create_sub_element(std::size_t i) const
11546
return new x_element9_finite_element_0();
11551
return new x_element9_finite_element_1();
11556
return new x_element9_finite_element_2();
11561
return new x_element9_finite_element_3();
11569
/// Create a new class instance
11570
virtual ufc::finite_element* create() const
11572
return new x_element9_finite_element_4();
11577
/// This class defines the interface for a local-to-global mapping of
11578
/// degrees of freedom (dofs).
11580
class x_element9_dofmap_0: public ufc::dofmap
11585
x_element9_dofmap_0() : ufc::dofmap()
11591
virtual ~x_element9_dofmap_0()
11596
/// Return a string identifying the dofmap
11597
virtual const char* signature() const
11599
return "FFC dofmap for FiniteElement('Raviart-Thomas', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 2, None)";
11602
/// Return true iff mesh entities of topological dimension d are needed
11603
virtual bool needs_mesh_entities(std::size_t d) const
11627
/// Return the topological dimension of the associated cell shape
11628
virtual std::size_t topological_dimension() const
11633
/// Return the geometric dimension of the associated cell shape
11634
virtual std::size_t geometric_dimension() const
11639
/// Return the dimension of the global finite element function space
11640
virtual std::size_t global_dimension(const std::vector<std::size_t>&
11641
num_global_entities) const
11643
return 2*num_global_entities[1] + 2*num_global_entities[2];
11646
/// Return the dimension of the local finite element function space for a cell
11647
virtual std::size_t local_dimension(const ufc::cell& c) const
11652
/// Return the maximum dimension of the local finite element function space
11653
virtual std::size_t max_local_dimension() const
11658
/// Return the number of dofs on each cell facet
11659
virtual std::size_t num_facet_dofs() const
11664
/// Return the number of dofs associated with each cell entity of dimension d
11665
virtual std::size_t num_entity_dofs(std::size_t d) const
11689
/// Tabulate the local-to-global mapping of dofs on a cell
11690
virtual void tabulate_dofs(std::size_t* dofs,
11691
const std::vector<std::size_t>& num_global_entities,
11692
const ufc::cell& c) const
11694
unsigned int offset = 0;
11695
dofs[0] = offset + 2*c.entity_indices[1][0];
11696
dofs[1] = offset + 2*c.entity_indices[1][0] + 1;
11697
dofs[2] = offset + 2*c.entity_indices[1][1];
11698
dofs[3] = offset + 2*c.entity_indices[1][1] + 1;
11699
dofs[4] = offset + 2*c.entity_indices[1][2];
11700
dofs[5] = offset + 2*c.entity_indices[1][2] + 1;
11701
offset += 2*num_global_entities[1];
11702
dofs[6] = offset + 2*c.entity_indices[2][0];
11703
dofs[7] = offset + 2*c.entity_indices[2][0] + 1;
11704
offset += 2*num_global_entities[2];
11707
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
11708
virtual void tabulate_facet_dofs(std::size_t* dofs,
11709
std::size_t facet) const
11735
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
11736
virtual void tabulate_entity_dofs(std::size_t* dofs,
11737
std::size_t d, std::size_t i) const
11741
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
11755
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
11786
std::cerr << "*** FFC warning: " << "i is larger than number of entities (0)" << std::endl;
11797
/// Tabulate the coordinates of all dofs on a cell
11798
virtual void tabulate_coordinates(double** dof_coordinates,
11799
const double* vertex_coordinates) const
11801
dof_coordinates[0][0] = 0.66666667*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
11802
dof_coordinates[0][1] = 0.66666667*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
11803
dof_coordinates[0][2] = 0.66666667*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
11804
dof_coordinates[1][0] = 0.33333333*vertex_coordinates[3] + 0.66666667*vertex_coordinates[6];
11805
dof_coordinates[1][1] = 0.33333333*vertex_coordinates[4] + 0.66666667*vertex_coordinates[7];
11806
dof_coordinates[1][2] = 0.33333333*vertex_coordinates[5] + 0.66666667*vertex_coordinates[8];
11807
dof_coordinates[2][0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[6];
11808
dof_coordinates[2][1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[7];
11809
dof_coordinates[2][2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[8];
11810
dof_coordinates[3][0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[6];
11811
dof_coordinates[3][1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[7];
11812
dof_coordinates[3][2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[8];
11813
dof_coordinates[4][0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3];
11814
dof_coordinates[4][1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4];
11815
dof_coordinates[4][2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5];
11816
dof_coordinates[5][0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[3];
11817
dof_coordinates[5][1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[4];
11818
dof_coordinates[5][2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[5];
11819
dof_coordinates[6][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
11820
dof_coordinates[6][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
11821
dof_coordinates[6][2] = 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
11822
dof_coordinates[7][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
11823
dof_coordinates[7][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
11824
dof_coordinates[7][2] = 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
11827
/// Return the number of sub dofmaps (for a mixed element)
11828
virtual std::size_t num_sub_dofmaps() const
11833
/// Create a new dofmap for sub dofmap i (for a mixed element)
11834
virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
11839
/// Create a new class instance
11840
virtual ufc::dofmap* create() const
11842
return new x_element9_dofmap_0();
11847
/// This class defines the interface for a local-to-global mapping of
11848
/// degrees of freedom (dofs).
11850
class x_element9_dofmap_1: public ufc::dofmap
11855
x_element9_dofmap_1() : ufc::dofmap()
11861
virtual ~x_element9_dofmap_1()
11866
/// Return a string identifying the dofmap
11867
virtual const char* signature() const
11869
return "FFC dofmap for FiniteElement('Brezzi-Douglas-Marini', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 1, None)";
11872
/// Return true iff mesh entities of topological dimension d are needed
11873
virtual bool needs_mesh_entities(std::size_t d) const
11897
/// Return the topological dimension of the associated cell shape
11898
virtual std::size_t topological_dimension() const
11903
/// Return the geometric dimension of the associated cell shape
11904
virtual std::size_t geometric_dimension() const
11909
/// Return the dimension of the global finite element function space
11910
virtual std::size_t global_dimension(const std::vector<std::size_t>&
11911
num_global_entities) const
11913
return 2*num_global_entities[1];
11916
/// Return the dimension of the local finite element function space for a cell
11917
virtual std::size_t local_dimension(const ufc::cell& c) const
11922
/// Return the maximum dimension of the local finite element function space
11923
virtual std::size_t max_local_dimension() const
11928
/// Return the number of dofs on each cell facet
11929
virtual std::size_t num_facet_dofs() const
11934
/// Return the number of dofs associated with each cell entity of dimension d
11935
virtual std::size_t num_entity_dofs(std::size_t d) const
11959
/// Tabulate the local-to-global mapping of dofs on a cell
11960
virtual void tabulate_dofs(std::size_t* dofs,
11961
const std::vector<std::size_t>& num_global_entities,
11962
const ufc::cell& c) const
11964
dofs[0] = 2*c.entity_indices[1][0];
11965
dofs[1] = 2*c.entity_indices[1][0] + 1;
11966
dofs[2] = 2*c.entity_indices[1][1];
11967
dofs[3] = 2*c.entity_indices[1][1] + 1;
11968
dofs[4] = 2*c.entity_indices[1][2];
11969
dofs[5] = 2*c.entity_indices[1][2] + 1;
11972
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
11973
virtual void tabulate_facet_dofs(std::size_t* dofs,
11974
std::size_t facet) const
12000
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
12001
virtual void tabulate_entity_dofs(std::size_t* dofs,
12002
std::size_t d, std::size_t i) const
12006
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
12020
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
12056
/// Tabulate the coordinates of all dofs on a cell
12057
virtual void tabulate_coordinates(double** dof_coordinates,
12058
const double* vertex_coordinates) const
12060
dof_coordinates[0][0] = 0.66666667*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
12061
dof_coordinates[0][1] = 0.66666667*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
12062
dof_coordinates[0][2] = 0.66666667*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
12063
dof_coordinates[1][0] = 0.33333333*vertex_coordinates[3] + 0.66666667*vertex_coordinates[6];
12064
dof_coordinates[1][1] = 0.33333333*vertex_coordinates[4] + 0.66666667*vertex_coordinates[7];
12065
dof_coordinates[1][2] = 0.33333333*vertex_coordinates[5] + 0.66666667*vertex_coordinates[8];
12066
dof_coordinates[2][0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[6];
12067
dof_coordinates[2][1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[7];
12068
dof_coordinates[2][2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[8];
12069
dof_coordinates[3][0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[6];
12070
dof_coordinates[3][1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[7];
12071
dof_coordinates[3][2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[8];
12072
dof_coordinates[4][0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3];
12073
dof_coordinates[4][1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4];
12074
dof_coordinates[4][2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5];
12075
dof_coordinates[5][0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[3];
12076
dof_coordinates[5][1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[4];
12077
dof_coordinates[5][2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[5];
12080
/// Return the number of sub dofmaps (for a mixed element)
12081
virtual std::size_t num_sub_dofmaps() const
12086
/// Create a new dofmap for sub dofmap i (for a mixed element)
12087
virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
12092
/// Create a new class instance
12093
virtual ufc::dofmap* create() const
12095
return new x_element9_dofmap_1();
12100
/// This class defines the interface for a local-to-global mapping of
12101
/// degrees of freedom (dofs).
12103
class x_element9_dofmap_2: public ufc::dofmap
12108
x_element9_dofmap_2() : ufc::dofmap()
12114
virtual ~x_element9_dofmap_2()
12119
/// Return a string identifying the dofmap
12120
virtual const char* signature() const
12122
return "FFC dofmap for FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 1, None)";
12125
/// Return true iff mesh entities of topological dimension d are needed
12126
virtual bool needs_mesh_entities(std::size_t d) const
12150
/// Return the topological dimension of the associated cell shape
12151
virtual std::size_t topological_dimension() const
12156
/// Return the geometric dimension of the associated cell shape
12157
virtual std::size_t geometric_dimension() const
12162
/// Return the dimension of the global finite element function space
12163
virtual std::size_t global_dimension(const std::vector<std::size_t>&
12164
num_global_entities) const
12166
return num_global_entities[1];
12169
/// Return the dimension of the local finite element function space for a cell
12170
virtual std::size_t local_dimension(const ufc::cell& c) const
12175
/// Return the maximum dimension of the local finite element function space
12176
virtual std::size_t max_local_dimension() const
12181
/// Return the number of dofs on each cell facet
12182
virtual std::size_t num_facet_dofs() const
12187
/// Return the number of dofs associated with each cell entity of dimension d
12188
virtual std::size_t num_entity_dofs(std::size_t d) const
12212
/// Tabulate the local-to-global mapping of dofs on a cell
12213
virtual void tabulate_dofs(std::size_t* dofs,
12214
const std::vector<std::size_t>& num_global_entities,
12215
const ufc::cell& c) const
12217
dofs[0] = c.entity_indices[1][0];
12218
dofs[1] = c.entity_indices[1][1];
12219
dofs[2] = c.entity_indices[1][2];
12222
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
12223
virtual void tabulate_facet_dofs(std::size_t* dofs,
12224
std::size_t facet) const
12247
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
12248
virtual void tabulate_entity_dofs(std::size_t* dofs,
12249
std::size_t d, std::size_t i) const
12253
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
12267
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
12300
/// Tabulate the coordinates of all dofs on a cell
12301
virtual void tabulate_coordinates(double** dof_coordinates,
12302
const double* vertex_coordinates) const
12304
dof_coordinates[0][0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
12305
dof_coordinates[0][1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
12306
dof_coordinates[0][2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
12307
dof_coordinates[1][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
12308
dof_coordinates[1][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
12309
dof_coordinates[1][2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
12310
dof_coordinates[2][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
12311
dof_coordinates[2][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
12312
dof_coordinates[2][2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
12315
/// Return the number of sub dofmaps (for a mixed element)
12316
virtual std::size_t num_sub_dofmaps() const
12321
/// Create a new dofmap for sub dofmap i (for a mixed element)
12322
virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
12327
/// Create a new class instance
12328
virtual ufc::dofmap* create() const
12330
return new x_element9_dofmap_2();
12335
/// This class defines the interface for a local-to-global mapping of
12336
/// degrees of freedom (dofs).
12338
class x_element9_dofmap_3: public ufc::dofmap
12343
x_element9_dofmap_3() : ufc::dofmap()
12349
virtual ~x_element9_dofmap_3()
12354
/// Return a string identifying the dofmap
12355
virtual const char* signature() const
12357
return "FFC dofmap for FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 1, None)";
12360
/// Return true iff mesh entities of topological dimension d are needed
12361
virtual bool needs_mesh_entities(std::size_t d) const
12385
/// Return the topological dimension of the associated cell shape
12386
virtual std::size_t topological_dimension() const
12391
/// Return the geometric dimension of the associated cell shape
12392
virtual std::size_t geometric_dimension() const
12397
/// Return the dimension of the global finite element function space
12398
virtual std::size_t global_dimension(const std::vector<std::size_t>&
12399
num_global_entities) const
12401
return 3*num_global_entities[2];
12404
/// Return the dimension of the local finite element function space for a cell
12405
virtual std::size_t local_dimension(const ufc::cell& c) const
12410
/// Return the maximum dimension of the local finite element function space
12411
virtual std::size_t max_local_dimension() const
12416
/// Return the number of dofs on each cell facet
12417
virtual std::size_t num_facet_dofs() const
12422
/// Return the number of dofs associated with each cell entity of dimension d
12423
virtual std::size_t num_entity_dofs(std::size_t d) const
12447
/// Tabulate the local-to-global mapping of dofs on a cell
12448
virtual void tabulate_dofs(std::size_t* dofs,
12449
const std::vector<std::size_t>& num_global_entities,
12450
const ufc::cell& c) const
12452
dofs[0] = 3*c.entity_indices[2][0];
12453
dofs[1] = 3*c.entity_indices[2][0] + 1;
12454
dofs[2] = 3*c.entity_indices[2][0] + 2;
12457
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
12458
virtual void tabulate_facet_dofs(std::size_t* dofs,
12459
std::size_t facet) const
12482
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
12483
virtual void tabulate_entity_dofs(std::size_t* dofs,
12484
std::size_t d, std::size_t i) const
12488
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
12507
std::cerr << "*** FFC warning: " << "i is larger than number of entities (0)" << std::endl;
12519
/// Tabulate the coordinates of all dofs on a cell
12520
virtual void tabulate_coordinates(double** dof_coordinates,
12521
const double* vertex_coordinates) const
12523
dof_coordinates[0][0] = vertex_coordinates[0];
12524
dof_coordinates[0][1] = vertex_coordinates[1];
12525
dof_coordinates[0][2] = vertex_coordinates[2];
12526
dof_coordinates[1][0] = vertex_coordinates[3];
12527
dof_coordinates[1][1] = vertex_coordinates[4];
12528
dof_coordinates[1][2] = vertex_coordinates[5];
12529
dof_coordinates[2][0] = vertex_coordinates[6];
12530
dof_coordinates[2][1] = vertex_coordinates[7];
12531
dof_coordinates[2][2] = vertex_coordinates[8];
12534
/// Return the number of sub dofmaps (for a mixed element)
12535
virtual std::size_t num_sub_dofmaps() const
12540
/// Create a new dofmap for sub dofmap i (for a mixed element)
12541
virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
12546
/// Create a new class instance
12547
virtual ufc::dofmap* create() const
12549
return new x_element9_dofmap_3();
12554
/// This class defines the interface for a local-to-global mapping of
12555
/// degrees of freedom (dofs).
12557
class x_element9_dofmap_4: public ufc::dofmap
12562
x_element9_dofmap_4() : ufc::dofmap()
12568
virtual ~x_element9_dofmap_4()
12573
/// Return a string identifying the dofmap
12574
virtual const char* signature() const
12576
return "FFC dofmap for MixedElement(*[FiniteElement('Raviart-Thomas', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 2, None), FiniteElement('Brezzi-Douglas-Marini', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 1, None), FiniteElement('Nedelec 1st kind H(curl)', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 1, None), FiniteElement('Discontinuous Lagrange', Domain(Cell('triangle', 3), 'triangle_multiverse', 3, 2), 1, None)], **{'value_shape': (10,) })";
12579
/// Return true iff mesh entities of topological dimension d are needed
12580
virtual bool needs_mesh_entities(std::size_t d) const
12604
/// Return the topological dimension of the associated cell shape
12605
virtual std::size_t topological_dimension() const
12610
/// Return the geometric dimension of the associated cell shape
12611
virtual std::size_t geometric_dimension() const
12616
/// Return the dimension of the global finite element function space
12617
virtual std::size_t global_dimension(const std::vector<std::size_t>&
12618
num_global_entities) const
12620
return 5*num_global_entities[1] + 5*num_global_entities[2];
12623
/// Return the dimension of the local finite element function space for a cell
12624
virtual std::size_t local_dimension(const ufc::cell& c) const
12629
/// Return the maximum dimension of the local finite element function space
12630
virtual std::size_t max_local_dimension() const
12635
/// Return the number of dofs on each cell facet
12636
virtual std::size_t num_facet_dofs() const
12641
/// Return the number of dofs associated with each cell entity of dimension d
12642
virtual std::size_t num_entity_dofs(std::size_t d) const
12666
/// Tabulate the local-to-global mapping of dofs on a cell
12667
virtual void tabulate_dofs(std::size_t* dofs,
12668
const std::vector<std::size_t>& num_global_entities,
12669
const ufc::cell& c) const
12671
unsigned int offset = 0;
12672
dofs[0] = offset + 2*c.entity_indices[1][0];
12673
dofs[1] = offset + 2*c.entity_indices[1][0] + 1;
12674
dofs[2] = offset + 2*c.entity_indices[1][1];
12675
dofs[3] = offset + 2*c.entity_indices[1][1] + 1;
12676
dofs[4] = offset + 2*c.entity_indices[1][2];
12677
dofs[5] = offset + 2*c.entity_indices[1][2] + 1;
12678
offset += 2*num_global_entities[1];
12679
dofs[6] = offset + 2*c.entity_indices[2][0];
12680
dofs[7] = offset + 2*c.entity_indices[2][0] + 1;
12681
offset += 2*num_global_entities[2];
12682
dofs[8] = offset + 2*c.entity_indices[1][0];
12683
dofs[9] = offset + 2*c.entity_indices[1][0] + 1;
12684
dofs[10] = offset + 2*c.entity_indices[1][1];
12685
dofs[11] = offset + 2*c.entity_indices[1][1] + 1;
12686
dofs[12] = offset + 2*c.entity_indices[1][2];
12687
dofs[13] = offset + 2*c.entity_indices[1][2] + 1;
12688
offset += 2*num_global_entities[1];
12689
dofs[14] = offset + c.entity_indices[1][0];
12690
dofs[15] = offset + c.entity_indices[1][1];
12691
dofs[16] = offset + c.entity_indices[1][2];
12692
offset += num_global_entities[1];
12693
dofs[17] = offset + 3*c.entity_indices[2][0];
12694
dofs[18] = offset + 3*c.entity_indices[2][0] + 1;
12695
dofs[19] = offset + 3*c.entity_indices[2][0] + 2;
12696
offset += 3*num_global_entities[2];
12699
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
12700
virtual void tabulate_facet_dofs(std::size_t* dofs,
12701
std::size_t facet) const
12736
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
12737
virtual void tabulate_entity_dofs(std::size_t* dofs,
12738
std::size_t d, std::size_t i) const
12742
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
12756
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
12796
std::cerr << "*** FFC warning: " << "i is larger than number of entities (0)" << std::endl;
12810
/// Tabulate the coordinates of all dofs on a cell
12811
virtual void tabulate_coordinates(double** dof_coordinates,
12812
const double* vertex_coordinates) const
12814
dof_coordinates[0][0] = 0.66666667*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
12815
dof_coordinates[0][1] = 0.66666667*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
12816
dof_coordinates[0][2] = 0.66666667*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
12817
dof_coordinates[1][0] = 0.33333333*vertex_coordinates[3] + 0.66666667*vertex_coordinates[6];
12818
dof_coordinates[1][1] = 0.33333333*vertex_coordinates[4] + 0.66666667*vertex_coordinates[7];
12819
dof_coordinates[1][2] = 0.33333333*vertex_coordinates[5] + 0.66666667*vertex_coordinates[8];
12820
dof_coordinates[2][0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[6];
12821
dof_coordinates[2][1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[7];
12822
dof_coordinates[2][2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[8];
12823
dof_coordinates[3][0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[6];
12824
dof_coordinates[3][1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[7];
12825
dof_coordinates[3][2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[8];
12826
dof_coordinates[4][0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3];
12827
dof_coordinates[4][1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4];
12828
dof_coordinates[4][2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5];
12829
dof_coordinates[5][0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[3];
12830
dof_coordinates[5][1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[4];
12831
dof_coordinates[5][2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[5];
12832
dof_coordinates[6][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
12833
dof_coordinates[6][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
12834
dof_coordinates[6][2] = 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
12835
dof_coordinates[7][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
12836
dof_coordinates[7][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
12837
dof_coordinates[7][2] = 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
12838
dof_coordinates[8][0] = 0.66666667*vertex_coordinates[3] + 0.33333333*vertex_coordinates[6];
12839
dof_coordinates[8][1] = 0.66666667*vertex_coordinates[4] + 0.33333333*vertex_coordinates[7];
12840
dof_coordinates[8][2] = 0.66666667*vertex_coordinates[5] + 0.33333333*vertex_coordinates[8];
12841
dof_coordinates[9][0] = 0.33333333*vertex_coordinates[3] + 0.66666667*vertex_coordinates[6];
12842
dof_coordinates[9][1] = 0.33333333*vertex_coordinates[4] + 0.66666667*vertex_coordinates[7];
12843
dof_coordinates[9][2] = 0.33333333*vertex_coordinates[5] + 0.66666667*vertex_coordinates[8];
12844
dof_coordinates[10][0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[6];
12845
dof_coordinates[10][1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[7];
12846
dof_coordinates[10][2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[8];
12847
dof_coordinates[11][0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[6];
12848
dof_coordinates[11][1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[7];
12849
dof_coordinates[11][2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[8];
12850
dof_coordinates[12][0] = 0.66666667*vertex_coordinates[0] + 0.33333333*vertex_coordinates[3];
12851
dof_coordinates[12][1] = 0.66666667*vertex_coordinates[1] + 0.33333333*vertex_coordinates[4];
12852
dof_coordinates[12][2] = 0.66666667*vertex_coordinates[2] + 0.33333333*vertex_coordinates[5];
12853
dof_coordinates[13][0] = 0.33333333*vertex_coordinates[0] + 0.66666667*vertex_coordinates[3];
12854
dof_coordinates[13][1] = 0.33333333*vertex_coordinates[1] + 0.66666667*vertex_coordinates[4];
12855
dof_coordinates[13][2] = 0.33333333*vertex_coordinates[2] + 0.66666667*vertex_coordinates[5];
12856
dof_coordinates[14][0] = 0.5*vertex_coordinates[3] + 0.5*vertex_coordinates[6];
12857
dof_coordinates[14][1] = 0.5*vertex_coordinates[4] + 0.5*vertex_coordinates[7];
12858
dof_coordinates[14][2] = 0.5*vertex_coordinates[5] + 0.5*vertex_coordinates[8];
12859
dof_coordinates[15][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[6];
12860
dof_coordinates[15][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[7];
12861
dof_coordinates[15][2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[8];
12862
dof_coordinates[16][0] = 0.5*vertex_coordinates[0] + 0.5*vertex_coordinates[3];
12863
dof_coordinates[16][1] = 0.5*vertex_coordinates[1] + 0.5*vertex_coordinates[4];
12864
dof_coordinates[16][2] = 0.5*vertex_coordinates[2] + 0.5*vertex_coordinates[5];
12865
dof_coordinates[17][0] = vertex_coordinates[0];
12866
dof_coordinates[17][1] = vertex_coordinates[1];
12867
dof_coordinates[17][2] = vertex_coordinates[2];
12868
dof_coordinates[18][0] = vertex_coordinates[3];
12869
dof_coordinates[18][1] = vertex_coordinates[4];
12870
dof_coordinates[18][2] = vertex_coordinates[5];
12871
dof_coordinates[19][0] = vertex_coordinates[6];
12872
dof_coordinates[19][1] = vertex_coordinates[7];
12873
dof_coordinates[19][2] = vertex_coordinates[8];
12876
/// Return the number of sub dofmaps (for a mixed element)
12877
virtual std::size_t num_sub_dofmaps() const
12882
/// Create a new dofmap for sub dofmap i (for a mixed element)
12883
virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
12889
return new x_element9_dofmap_0();
12894
return new x_element9_dofmap_1();
12899
return new x_element9_dofmap_2();
12904
return new x_element9_dofmap_3();
12912
/// Create a new class instance
12913
virtual ufc::dofmap* create() const
12915
return new x_element9_dofmap_4();