1
// This code conforms with the UFC specification version 1.4.1
2
// and was automatically generated by FFC version 0.9.3.
4
// This code was generated with the following parameters:
7
// convert_exceptions_to_warnings: True
17
// quadrature_degree: 'auto'
18
// quadrature_rule: 'auto'
19
// representation: 'auto'
22
#ifndef __SPATIALCOORDINATES_H
23
#define __SPATIALCOORDINATES_H
30
/// This class defines the interface for a finite element.
32
class spatialcoordinates_finite_element_0: public ufc::finite_element
37
spatialcoordinates_finite_element_0() : ufc::finite_element()
43
virtual ~spatialcoordinates_finite_element_0()
48
/// Return a string identifying the finite element
49
virtual const char* signature() const
51
return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
54
/// Return the cell shape
55
virtual ufc::shape cell_shape() const
60
/// Return the dimension of the finite element function space
61
virtual unsigned int space_dimension() const
66
/// Return the rank of the value space
67
virtual unsigned int value_rank() const
72
/// Return the dimension of the value space for axis i
73
virtual unsigned int value_dimension(unsigned int i) const
78
/// Evaluate basis function i at given point in cell
79
virtual void evaluate_basis(unsigned int i,
81
const double* coordinates,
82
const ufc::cell& c) const
84
// Extract vertex coordinates
85
const double * const * x = c.coordinates;
87
// Compute Jacobian of affine map from reference cell
88
const double J_00 = x[1][0] - x[0][0];
89
const double J_01 = x[2][0] - x[0][0];
90
const double J_10 = x[1][1] - x[0][1];
91
const double J_11 = x[2][1] - x[0][1];
93
// Compute determinant of Jacobian
94
double detJ = J_00*J_11 - J_01*J_10;
96
// Compute inverse of Jacobian
99
const double C0 = x[1][0] + x[2][0];
100
const double C1 = x[1][1] + x[2][1];
102
// Get coordinates and map to the reference (FIAT) element
103
double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
104
double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
107
*values = 0.00000000;
113
// Array of basisvalues.
114
double basisvalues[6] = {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000};
116
// Declare helper variables.
120
double tmp5 = 0.00000000;
121
double tmp6 = 0.00000000;
122
double tmp7 = 0.00000000;
123
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
124
double tmp1 = (1.00000000 - Y)/2.00000000;
125
double tmp2 = tmp1*tmp1;
127
// Compute basisvalues.
128
basisvalues[0] = 1.00000000;
129
basisvalues[1] = tmp0;
130
for (unsigned int r = 1; r < 2; r++)
132
rr = (r + 1)*((r + 1) + 1)/2;
134
tt = (r - 1)*((r - 1) + 1)/2;
135
tmp5 = (1.00000000 + 2.00000000*r)/(1.00000000 + r);
136
basisvalues[rr] = (basisvalues[ss]*tmp0*tmp5 - basisvalues[tt]*tmp2*r/(1.00000000 + r));
137
}// end loop over 'r'
138
for (unsigned int r = 0; r < 2; r++)
140
rr = (r + 1)*(r + 1 + 1)/2 + 1;
142
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
143
}// end loop over 'r'
144
for (unsigned int r = 0; r < 1; r++)
146
for (unsigned int s = 1; s < 2 - r; s++)
148
rr = (r + s + 1)*(r + s + 1 + 1)/2 + s + 1;
149
ss = (r + s)*(r + s + 1)/2 + s;
150
tt = (r + s - 1)*(r + s - 1 + 1)/2 + s - 1;
151
tmp5 = (2.00000000 + 2.00000000*r + 2.00000000*s)*(3.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
152
tmp6 = (1.00000000 + 4.00000000*r*r + 4.00000000*r)*(2.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
153
tmp7 = (1.00000000 + s + 2.00000000*r)*(3.00000000 + 2.00000000*r + 2.00000000*s)*s/((1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
154
basisvalues[rr] = (basisvalues[ss]*(tmp6 + Y*tmp5) - basisvalues[tt]*tmp7);
155
}// end loop over 's'
156
}// end loop over 'r'
157
for (unsigned int r = 0; r < 3; r++)
159
for (unsigned int s = 0; s < 3 - r; s++)
161
rr = (r + s)*(r + s + 1)/2 + s;
162
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
163
}// end loop over 's'
164
}// end loop over 'r'
166
// Table(s) of coefficients.
167
static const double coefficients0[6] = \
168
{0.00000000, -0.17320508, -0.10000000, 0.12171612, 0.09428090, 0.05443311};
171
for (unsigned int r = 0; r < 6; r++)
173
*values += coefficients0[r]*basisvalues[r];
174
}// end loop over 'r'
180
// Array of basisvalues.
181
double basisvalues[6] = {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000};
183
// Declare helper variables.
187
double tmp5 = 0.00000000;
188
double tmp6 = 0.00000000;
189
double tmp7 = 0.00000000;
190
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
191
double tmp1 = (1.00000000 - Y)/2.00000000;
192
double tmp2 = tmp1*tmp1;
194
// Compute basisvalues.
195
basisvalues[0] = 1.00000000;
196
basisvalues[1] = tmp0;
197
for (unsigned int r = 1; r < 2; r++)
199
rr = (r + 1)*((r + 1) + 1)/2;
201
tt = (r - 1)*((r - 1) + 1)/2;
202
tmp5 = (1.00000000 + 2.00000000*r)/(1.00000000 + r);
203
basisvalues[rr] = (basisvalues[ss]*tmp0*tmp5 - basisvalues[tt]*tmp2*r/(1.00000000 + r));
204
}// end loop over 'r'
205
for (unsigned int r = 0; r < 2; r++)
207
rr = (r + 1)*(r + 1 + 1)/2 + 1;
209
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
210
}// end loop over 'r'
211
for (unsigned int r = 0; r < 1; r++)
213
for (unsigned int s = 1; s < 2 - r; s++)
215
rr = (r + s + 1)*(r + s + 1 + 1)/2 + s + 1;
216
ss = (r + s)*(r + s + 1)/2 + s;
217
tt = (r + s - 1)*(r + s - 1 + 1)/2 + s - 1;
218
tmp5 = (2.00000000 + 2.00000000*r + 2.00000000*s)*(3.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
219
tmp6 = (1.00000000 + 4.00000000*r*r + 4.00000000*r)*(2.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
220
tmp7 = (1.00000000 + s + 2.00000000*r)*(3.00000000 + 2.00000000*r + 2.00000000*s)*s/((1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
221
basisvalues[rr] = (basisvalues[ss]*(tmp6 + Y*tmp5) - basisvalues[tt]*tmp7);
222
}// end loop over 's'
223
}// end loop over 'r'
224
for (unsigned int r = 0; r < 3; r++)
226
for (unsigned int s = 0; s < 3 - r; s++)
228
rr = (r + s)*(r + s + 1)/2 + s;
229
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
230
}// end loop over 's'
231
}// end loop over 'r'
233
// Table(s) of coefficients.
234
static const double coefficients0[6] = \
235
{0.00000000, 0.17320508, -0.10000000, 0.12171612, -0.09428090, 0.05443311};
238
for (unsigned int r = 0; r < 6; r++)
240
*values += coefficients0[r]*basisvalues[r];
241
}// end loop over 'r'
247
// Array of basisvalues.
248
double basisvalues[6] = {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000};
250
// Declare helper variables.
254
double tmp5 = 0.00000000;
255
double tmp6 = 0.00000000;
256
double tmp7 = 0.00000000;
257
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
258
double tmp1 = (1.00000000 - Y)/2.00000000;
259
double tmp2 = tmp1*tmp1;
261
// Compute basisvalues.
262
basisvalues[0] = 1.00000000;
263
basisvalues[1] = tmp0;
264
for (unsigned int r = 1; r < 2; r++)
266
rr = (r + 1)*((r + 1) + 1)/2;
268
tt = (r - 1)*((r - 1) + 1)/2;
269
tmp5 = (1.00000000 + 2.00000000*r)/(1.00000000 + r);
270
basisvalues[rr] = (basisvalues[ss]*tmp0*tmp5 - basisvalues[tt]*tmp2*r/(1.00000000 + r));
271
}// end loop over 'r'
272
for (unsigned int r = 0; r < 2; r++)
274
rr = (r + 1)*(r + 1 + 1)/2 + 1;
276
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
277
}// end loop over 'r'
278
for (unsigned int r = 0; r < 1; r++)
280
for (unsigned int s = 1; s < 2 - r; s++)
282
rr = (r + s + 1)*(r + s + 1 + 1)/2 + s + 1;
283
ss = (r + s)*(r + s + 1)/2 + s;
284
tt = (r + s - 1)*(r + s - 1 + 1)/2 + s - 1;
285
tmp5 = (2.00000000 + 2.00000000*r + 2.00000000*s)*(3.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
286
tmp6 = (1.00000000 + 4.00000000*r*r + 4.00000000*r)*(2.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
287
tmp7 = (1.00000000 + s + 2.00000000*r)*(3.00000000 + 2.00000000*r + 2.00000000*s)*s/((1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
288
basisvalues[rr] = (basisvalues[ss]*(tmp6 + Y*tmp5) - basisvalues[tt]*tmp7);
289
}// end loop over 's'
290
}// end loop over 'r'
291
for (unsigned int r = 0; r < 3; r++)
293
for (unsigned int s = 0; s < 3 - r; s++)
295
rr = (r + s)*(r + s + 1)/2 + s;
296
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
297
}// end loop over 's'
298
}// end loop over 'r'
300
// Table(s) of coefficients.
301
static const double coefficients0[6] = \
302
{0.00000000, 0.00000000, 0.20000000, 0.00000000, 0.00000000, 0.16329932};
305
for (unsigned int r = 0; r < 6; r++)
307
*values += coefficients0[r]*basisvalues[r];
308
}// end loop over 'r'
314
// Array of basisvalues.
315
double basisvalues[6] = {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000};
317
// Declare helper variables.
321
double tmp5 = 0.00000000;
322
double tmp6 = 0.00000000;
323
double tmp7 = 0.00000000;
324
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
325
double tmp1 = (1.00000000 - Y)/2.00000000;
326
double tmp2 = tmp1*tmp1;
328
// Compute basisvalues.
329
basisvalues[0] = 1.00000000;
330
basisvalues[1] = tmp0;
331
for (unsigned int r = 1; r < 2; r++)
333
rr = (r + 1)*((r + 1) + 1)/2;
335
tt = (r - 1)*((r - 1) + 1)/2;
336
tmp5 = (1.00000000 + 2.00000000*r)/(1.00000000 + r);
337
basisvalues[rr] = (basisvalues[ss]*tmp0*tmp5 - basisvalues[tt]*tmp2*r/(1.00000000 + r));
338
}// end loop over 'r'
339
for (unsigned int r = 0; r < 2; r++)
341
rr = (r + 1)*(r + 1 + 1)/2 + 1;
343
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
344
}// end loop over 'r'
345
for (unsigned int r = 0; r < 1; r++)
347
for (unsigned int s = 1; s < 2 - r; s++)
349
rr = (r + s + 1)*(r + s + 1 + 1)/2 + s + 1;
350
ss = (r + s)*(r + s + 1)/2 + s;
351
tt = (r + s - 1)*(r + s - 1 + 1)/2 + s - 1;
352
tmp5 = (2.00000000 + 2.00000000*r + 2.00000000*s)*(3.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
353
tmp6 = (1.00000000 + 4.00000000*r*r + 4.00000000*r)*(2.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
354
tmp7 = (1.00000000 + s + 2.00000000*r)*(3.00000000 + 2.00000000*r + 2.00000000*s)*s/((1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
355
basisvalues[rr] = (basisvalues[ss]*(tmp6 + Y*tmp5) - basisvalues[tt]*tmp7);
356
}// end loop over 's'
357
}// end loop over 'r'
358
for (unsigned int r = 0; r < 3; r++)
360
for (unsigned int s = 0; s < 3 - r; s++)
362
rr = (r + s)*(r + s + 1)/2 + s;
363
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
364
}// end loop over 's'
365
}// end loop over 'r'
367
// Table(s) of coefficients.
368
static const double coefficients0[6] = \
369
{0.47140452, 0.23094011, 0.13333333, 0.00000000, 0.18856181, -0.16329932};
372
for (unsigned int r = 0; r < 6; r++)
374
*values += coefficients0[r]*basisvalues[r];
375
}// end loop over 'r'
381
// Array of basisvalues.
382
double basisvalues[6] = {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000};
384
// Declare helper variables.
388
double tmp5 = 0.00000000;
389
double tmp6 = 0.00000000;
390
double tmp7 = 0.00000000;
391
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
392
double tmp1 = (1.00000000 - Y)/2.00000000;
393
double tmp2 = tmp1*tmp1;
395
// Compute basisvalues.
396
basisvalues[0] = 1.00000000;
397
basisvalues[1] = tmp0;
398
for (unsigned int r = 1; r < 2; r++)
400
rr = (r + 1)*((r + 1) + 1)/2;
402
tt = (r - 1)*((r - 1) + 1)/2;
403
tmp5 = (1.00000000 + 2.00000000*r)/(1.00000000 + r);
404
basisvalues[rr] = (basisvalues[ss]*tmp0*tmp5 - basisvalues[tt]*tmp2*r/(1.00000000 + r));
405
}// end loop over 'r'
406
for (unsigned int r = 0; r < 2; r++)
408
rr = (r + 1)*(r + 1 + 1)/2 + 1;
410
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
411
}// end loop over 'r'
412
for (unsigned int r = 0; r < 1; r++)
414
for (unsigned int s = 1; s < 2 - r; s++)
416
rr = (r + s + 1)*(r + s + 1 + 1)/2 + s + 1;
417
ss = (r + s)*(r + s + 1)/2 + s;
418
tt = (r + s - 1)*(r + s - 1 + 1)/2 + s - 1;
419
tmp5 = (2.00000000 + 2.00000000*r + 2.00000000*s)*(3.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
420
tmp6 = (1.00000000 + 4.00000000*r*r + 4.00000000*r)*(2.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
421
tmp7 = (1.00000000 + s + 2.00000000*r)*(3.00000000 + 2.00000000*r + 2.00000000*s)*s/((1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
422
basisvalues[rr] = (basisvalues[ss]*(tmp6 + Y*tmp5) - basisvalues[tt]*tmp7);
423
}// end loop over 's'
424
}// end loop over 'r'
425
for (unsigned int r = 0; r < 3; r++)
427
for (unsigned int s = 0; s < 3 - r; s++)
429
rr = (r + s)*(r + s + 1)/2 + s;
430
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
431
}// end loop over 's'
432
}// end loop over 'r'
434
// Table(s) of coefficients.
435
static const double coefficients0[6] = \
436
{0.47140452, -0.23094011, 0.13333333, 0.00000000, -0.18856181, -0.16329932};
439
for (unsigned int r = 0; r < 6; r++)
441
*values += coefficients0[r]*basisvalues[r];
442
}// end loop over 'r'
448
// Array of basisvalues.
449
double basisvalues[6] = {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000};
451
// Declare helper variables.
455
double tmp5 = 0.00000000;
456
double tmp6 = 0.00000000;
457
double tmp7 = 0.00000000;
458
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
459
double tmp1 = (1.00000000 - Y)/2.00000000;
460
double tmp2 = tmp1*tmp1;
462
// Compute basisvalues.
463
basisvalues[0] = 1.00000000;
464
basisvalues[1] = tmp0;
465
for (unsigned int r = 1; r < 2; r++)
467
rr = (r + 1)*((r + 1) + 1)/2;
469
tt = (r - 1)*((r - 1) + 1)/2;
470
tmp5 = (1.00000000 + 2.00000000*r)/(1.00000000 + r);
471
basisvalues[rr] = (basisvalues[ss]*tmp0*tmp5 - basisvalues[tt]*tmp2*r/(1.00000000 + r));
472
}// end loop over 'r'
473
for (unsigned int r = 0; r < 2; r++)
475
rr = (r + 1)*(r + 1 + 1)/2 + 1;
477
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
478
}// end loop over 'r'
479
for (unsigned int r = 0; r < 1; r++)
481
for (unsigned int s = 1; s < 2 - r; s++)
483
rr = (r + s + 1)*(r + s + 1 + 1)/2 + s + 1;
484
ss = (r + s)*(r + s + 1)/2 + s;
485
tt = (r + s - 1)*(r + s - 1 + 1)/2 + s - 1;
486
tmp5 = (2.00000000 + 2.00000000*r + 2.00000000*s)*(3.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
487
tmp6 = (1.00000000 + 4.00000000*r*r + 4.00000000*r)*(2.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
488
tmp7 = (1.00000000 + s + 2.00000000*r)*(3.00000000 + 2.00000000*r + 2.00000000*s)*s/((1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
489
basisvalues[rr] = (basisvalues[ss]*(tmp6 + Y*tmp5) - basisvalues[tt]*tmp7);
490
}// end loop over 's'
491
}// end loop over 'r'
492
for (unsigned int r = 0; r < 3; r++)
494
for (unsigned int s = 0; s < 3 - r; s++)
496
rr = (r + s)*(r + s + 1)/2 + s;
497
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
498
}// end loop over 's'
499
}// end loop over 'r'
501
// Table(s) of coefficients.
502
static const double coefficients0[6] = \
503
{0.47140452, 0.00000000, -0.26666667, -0.24343225, 0.00000000, 0.05443311};
506
for (unsigned int r = 0; r < 6; r++)
508
*values += coefficients0[r]*basisvalues[r];
509
}// end loop over 'r'
516
/// Evaluate all basis functions at given point in cell
517
virtual void evaluate_basis_all(double* values,
518
const double* coordinates,
519
const ufc::cell& c) const
521
// Helper variable to hold values of a single dof.
522
double dof_values = 0.00000000;
524
// Loop dofs and call evaluate_basis.
525
for (unsigned int r = 0; r < 6; r++)
527
evaluate_basis(r, &dof_values, coordinates, c);
528
values[r] = dof_values;
529
}// end loop over 'r'
532
/// Evaluate order n derivatives of basis function i at given point in cell
533
virtual void evaluate_basis_derivatives(unsigned int i,
536
const double* coordinates,
537
const ufc::cell& c) const
539
// Extract vertex coordinates
540
const double * const * x = c.coordinates;
542
// Compute Jacobian of affine map from reference cell
543
const double J_00 = x[1][0] - x[0][0];
544
const double J_01 = x[2][0] - x[0][0];
545
const double J_10 = x[1][1] - x[0][1];
546
const double J_11 = x[2][1] - x[0][1];
548
// Compute determinant of Jacobian
549
double detJ = J_00*J_11 - J_01*J_10;
551
// Compute inverse of Jacobian
552
const double K_00 = J_11 / detJ;
553
const double K_01 = -J_01 / detJ;
554
const double K_10 = -J_10 / detJ;
555
const double K_11 = J_00 / detJ;
558
const double C0 = x[1][0] + x[2][0];
559
const double C1 = x[1][1] + x[2][1];
561
// Get coordinates and map to the reference (FIAT) element
562
double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
563
double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
565
// Compute number of derivatives.
566
unsigned int num_derivatives = 1;
567
for (unsigned int r = 0; r < n; r++)
569
num_derivatives *= 2;
570
}// end loop over 'r'
572
// Declare pointer to two dimensional array that holds combinations of derivatives and initialise
573
unsigned int **combinations = new unsigned int *[num_derivatives];
574
for (unsigned int row = 0; row < num_derivatives; row++)
576
combinations[row] = new unsigned int [n];
577
for (unsigned int col = 0; col < n; col++)
578
combinations[row][col] = 0;
581
// Generate combinations of derivatives
582
for (unsigned int row = 1; row < num_derivatives; row++)
584
for (unsigned int num = 0; num < row; num++)
586
for (unsigned int col = n-1; col+1 > 0; col--)
588
if (combinations[row][col] + 1 > 1)
589
combinations[row][col] = 0;
592
combinations[row][col] += 1;
599
// Compute inverse of Jacobian
600
const double Jinv[2][2] = {{K_00, K_01}, {K_10, K_11}};
602
// Declare transformation matrix
603
// Declare pointer to two dimensional array and initialise
604
double **transform = new double *[num_derivatives];
606
for (unsigned int j = 0; j < num_derivatives; j++)
608
transform[j] = new double [num_derivatives];
609
for (unsigned int k = 0; k < num_derivatives; k++)
613
// Construct transformation matrix
614
for (unsigned int row = 0; row < num_derivatives; row++)
616
for (unsigned int col = 0; col < num_derivatives; col++)
618
for (unsigned int k = 0; k < n; k++)
619
transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
623
// Reset values. Assuming that values is always an array.
624
for (unsigned int r = 0; r < num_derivatives; r++)
626
values[r] = 0.00000000;
627
}// end loop over 'r'
634
// Array of basisvalues.
635
double basisvalues[6] = {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000};
637
// Declare helper variables.
641
double tmp5 = 0.00000000;
642
double tmp6 = 0.00000000;
643
double tmp7 = 0.00000000;
644
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
645
double tmp1 = (1.00000000 - Y)/2.00000000;
646
double tmp2 = tmp1*tmp1;
648
// Compute basisvalues.
649
basisvalues[0] = 1.00000000;
650
basisvalues[1] = tmp0;
651
for (unsigned int r = 1; r < 2; r++)
653
rr = (r + 1)*((r + 1) + 1)/2;
655
tt = (r - 1)*((r - 1) + 1)/2;
656
tmp5 = (1.00000000 + 2.00000000*r)/(1.00000000 + r);
657
basisvalues[rr] = (basisvalues[ss]*tmp0*tmp5 - basisvalues[tt]*tmp2*r/(1.00000000 + r));
658
}// end loop over 'r'
659
for (unsigned int r = 0; r < 2; r++)
661
rr = (r + 1)*(r + 1 + 1)/2 + 1;
663
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
664
}// end loop over 'r'
665
for (unsigned int r = 0; r < 1; r++)
667
for (unsigned int s = 1; s < 2 - r; s++)
669
rr = (r + s + 1)*(r + s + 1 + 1)/2 + s + 1;
670
ss = (r + s)*(r + s + 1)/2 + s;
671
tt = (r + s - 1)*(r + s - 1 + 1)/2 + s - 1;
672
tmp5 = (2.00000000 + 2.00000000*r + 2.00000000*s)*(3.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
673
tmp6 = (1.00000000 + 4.00000000*r*r + 4.00000000*r)*(2.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
674
tmp7 = (1.00000000 + s + 2.00000000*r)*(3.00000000 + 2.00000000*r + 2.00000000*s)*s/((1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
675
basisvalues[rr] = (basisvalues[ss]*(tmp6 + Y*tmp5) - basisvalues[tt]*tmp7);
676
}// end loop over 's'
677
}// end loop over 'r'
678
for (unsigned int r = 0; r < 3; r++)
680
for (unsigned int s = 0; s < 3 - r; s++)
682
rr = (r + s)*(r + s + 1)/2 + s;
683
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
684
}// end loop over 's'
685
}// end loop over 'r'
687
// Table(s) of coefficients.
688
static const double coefficients0[6] = \
689
{0.00000000, -0.17320508, -0.10000000, 0.12171612, 0.09428090, 0.05443311};
691
// Tables of derivatives of the polynomial base (transpose).
692
static const double dmats0[6][6] = \
693
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
694
{4.89897949, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
695
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
696
{0.00000000, 9.48683298, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
697
{4.00000000, 0.00000000, 7.07106781, 0.00000000, 0.00000000, 0.00000000},
698
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000}};
700
static const double dmats1[6][6] = \
701
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
702
{2.44948974, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
703
{4.24264069, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
704
{2.58198890, 4.74341649, -0.91287093, 0.00000000, 0.00000000, 0.00000000},
705
{2.00000000, 6.12372436, 3.53553391, 0.00000000, 0.00000000, 0.00000000},
706
{-2.30940108, 0.00000000, 8.16496581, 0.00000000, 0.00000000, 0.00000000}};
708
// Compute reference derivatives.
709
// Declare pointer to array of derivatives on FIAT element.
710
double *derivatives = new double[num_derivatives];
711
for (unsigned int r = 0; r < num_derivatives; r++)
713
derivatives[r] = 0.00000000;
714
}// end loop over 'r'
716
// Declare derivative matrix (of polynomial basis).
717
double dmats[6][6] = \
718
{{1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
719
{0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
720
{0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
721
{0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000},
722
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000},
723
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000}};
725
// Declare (auxiliary) derivative matrix (of polynomial basis).
726
double dmats_old[6][6] = \
727
{{1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
728
{0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
729
{0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
730
{0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000},
731
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000},
732
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000}};
734
// Loop possible derivatives.
735
for (unsigned int r = 0; r < num_derivatives; r++)
737
// Resetting dmats values to compute next derivative.
738
for (unsigned int t = 0; t < 6; t++)
740
for (unsigned int u = 0; u < 6; u++)
742
dmats[t][u] = 0.00000000;
745
dmats[t][u] = 1.00000000;
748
}// end loop over 'u'
749
}// end loop over 't'
751
// Looping derivative order to generate dmats.
752
for (unsigned int s = 0; s < n; s++)
754
// Updating dmats_old with new values and resetting dmats.
755
for (unsigned int t = 0; t < 6; t++)
757
for (unsigned int u = 0; u < 6; u++)
759
dmats_old[t][u] = dmats[t][u];
760
dmats[t][u] = 0.00000000;
761
}// end loop over 'u'
762
}// end loop over 't'
764
// Update dmats using an inner product.
765
if (combinations[r][s] == 0)
767
for (unsigned int t = 0; t < 6; t++)
769
for (unsigned int u = 0; u < 6; u++)
771
for (unsigned int tu = 0; tu < 6; tu++)
773
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
774
}// end loop over 'tu'
775
}// end loop over 'u'
776
}// end loop over 't'
779
if (combinations[r][s] == 1)
781
for (unsigned int t = 0; t < 6; t++)
783
for (unsigned int u = 0; u < 6; u++)
785
for (unsigned int tu = 0; tu < 6; tu++)
787
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
788
}// end loop over 'tu'
789
}// end loop over 'u'
790
}// end loop over 't'
793
}// end loop over 's'
794
for (unsigned int s = 0; s < 6; s++)
796
for (unsigned int t = 0; t < 6; t++)
798
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
799
}// end loop over 't'
800
}// end loop over 's'
801
}// end loop over 'r'
803
// Transform derivatives back to physical element
804
for (unsigned int r = 0; r < num_derivatives; r++)
806
for (unsigned int s = 0; s < num_derivatives; s++)
808
values[r] += transform[r][s]*derivatives[s];
809
}// end loop over 's'
810
}// end loop over 'r'
812
// Delete pointer to array of derivatives on FIAT element
813
delete [] derivatives;
815
// Delete pointer to array of combinations of derivatives and transform
816
for (unsigned int r = 0; r < num_derivatives; r++)
818
delete [] combinations[r];
819
}// end loop over 'r'
820
delete [] combinations;
821
for (unsigned int r = 0; r < num_derivatives; r++)
823
delete [] transform[r];
824
}// end loop over 'r'
831
// Array of basisvalues.
832
double basisvalues[6] = {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000};
834
// Declare helper variables.
838
double tmp5 = 0.00000000;
839
double tmp6 = 0.00000000;
840
double tmp7 = 0.00000000;
841
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
842
double tmp1 = (1.00000000 - Y)/2.00000000;
843
double tmp2 = tmp1*tmp1;
845
// Compute basisvalues.
846
basisvalues[0] = 1.00000000;
847
basisvalues[1] = tmp0;
848
for (unsigned int r = 1; r < 2; r++)
850
rr = (r + 1)*((r + 1) + 1)/2;
852
tt = (r - 1)*((r - 1) + 1)/2;
853
tmp5 = (1.00000000 + 2.00000000*r)/(1.00000000 + r);
854
basisvalues[rr] = (basisvalues[ss]*tmp0*tmp5 - basisvalues[tt]*tmp2*r/(1.00000000 + r));
855
}// end loop over 'r'
856
for (unsigned int r = 0; r < 2; r++)
858
rr = (r + 1)*(r + 1 + 1)/2 + 1;
860
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
861
}// end loop over 'r'
862
for (unsigned int r = 0; r < 1; r++)
864
for (unsigned int s = 1; s < 2 - r; s++)
866
rr = (r + s + 1)*(r + s + 1 + 1)/2 + s + 1;
867
ss = (r + s)*(r + s + 1)/2 + s;
868
tt = (r + s - 1)*(r + s - 1 + 1)/2 + s - 1;
869
tmp5 = (2.00000000 + 2.00000000*r + 2.00000000*s)*(3.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
870
tmp6 = (1.00000000 + 4.00000000*r*r + 4.00000000*r)*(2.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
871
tmp7 = (1.00000000 + s + 2.00000000*r)*(3.00000000 + 2.00000000*r + 2.00000000*s)*s/((1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
872
basisvalues[rr] = (basisvalues[ss]*(tmp6 + Y*tmp5) - basisvalues[tt]*tmp7);
873
}// end loop over 's'
874
}// end loop over 'r'
875
for (unsigned int r = 0; r < 3; r++)
877
for (unsigned int s = 0; s < 3 - r; s++)
879
rr = (r + s)*(r + s + 1)/2 + s;
880
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
881
}// end loop over 's'
882
}// end loop over 'r'
884
// Table(s) of coefficients.
885
static const double coefficients0[6] = \
886
{0.00000000, 0.17320508, -0.10000000, 0.12171612, -0.09428090, 0.05443311};
888
// Tables of derivatives of the polynomial base (transpose).
889
static const double dmats0[6][6] = \
890
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
891
{4.89897949, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
892
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
893
{0.00000000, 9.48683298, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
894
{4.00000000, 0.00000000, 7.07106781, 0.00000000, 0.00000000, 0.00000000},
895
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000}};
897
static const double dmats1[6][6] = \
898
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
899
{2.44948974, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
900
{4.24264069, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
901
{2.58198890, 4.74341649, -0.91287093, 0.00000000, 0.00000000, 0.00000000},
902
{2.00000000, 6.12372436, 3.53553391, 0.00000000, 0.00000000, 0.00000000},
903
{-2.30940108, 0.00000000, 8.16496581, 0.00000000, 0.00000000, 0.00000000}};
905
// Compute reference derivatives.
906
// Declare pointer to array of derivatives on FIAT element.
907
double *derivatives = new double[num_derivatives];
908
for (unsigned int r = 0; r < num_derivatives; r++)
910
derivatives[r] = 0.00000000;
911
}// end loop over 'r'
913
// Declare derivative matrix (of polynomial basis).
914
double dmats[6][6] = \
915
{{1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
916
{0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
917
{0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
918
{0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000},
919
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000},
920
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000}};
922
// Declare (auxiliary) derivative matrix (of polynomial basis).
923
double dmats_old[6][6] = \
924
{{1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
925
{0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
926
{0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
927
{0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000},
928
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000},
929
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000}};
931
// Loop possible derivatives.
932
for (unsigned int r = 0; r < num_derivatives; r++)
934
// Resetting dmats values to compute next derivative.
935
for (unsigned int t = 0; t < 6; t++)
937
for (unsigned int u = 0; u < 6; u++)
939
dmats[t][u] = 0.00000000;
942
dmats[t][u] = 1.00000000;
945
}// end loop over 'u'
946
}// end loop over 't'
948
// Looping derivative order to generate dmats.
949
for (unsigned int s = 0; s < n; s++)
951
// Updating dmats_old with new values and resetting dmats.
952
for (unsigned int t = 0; t < 6; t++)
954
for (unsigned int u = 0; u < 6; u++)
956
dmats_old[t][u] = dmats[t][u];
957
dmats[t][u] = 0.00000000;
958
}// end loop over 'u'
959
}// end loop over 't'
961
// Update dmats using an inner product.
962
if (combinations[r][s] == 0)
964
for (unsigned int t = 0; t < 6; t++)
966
for (unsigned int u = 0; u < 6; u++)
968
for (unsigned int tu = 0; tu < 6; tu++)
970
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
971
}// end loop over 'tu'
972
}// end loop over 'u'
973
}// end loop over 't'
976
if (combinations[r][s] == 1)
978
for (unsigned int t = 0; t < 6; t++)
980
for (unsigned int u = 0; u < 6; u++)
982
for (unsigned int tu = 0; tu < 6; tu++)
984
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
985
}// end loop over 'tu'
986
}// end loop over 'u'
987
}// end loop over 't'
990
}// end loop over 's'
991
for (unsigned int s = 0; s < 6; s++)
993
for (unsigned int t = 0; t < 6; t++)
995
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
996
}// end loop over 't'
997
}// end loop over 's'
998
}// end loop over 'r'
1000
// Transform derivatives back to physical element
1001
for (unsigned int r = 0; r < num_derivatives; r++)
1003
for (unsigned int s = 0; s < num_derivatives; s++)
1005
values[r] += transform[r][s]*derivatives[s];
1006
}// end loop over 's'
1007
}// end loop over 'r'
1009
// Delete pointer to array of derivatives on FIAT element
1010
delete [] derivatives;
1012
// Delete pointer to array of combinations of derivatives and transform
1013
for (unsigned int r = 0; r < num_derivatives; r++)
1015
delete [] combinations[r];
1016
}// end loop over 'r'
1017
delete [] combinations;
1018
for (unsigned int r = 0; r < num_derivatives; r++)
1020
delete [] transform[r];
1021
}// end loop over 'r'
1022
delete [] transform;
1028
// Array of basisvalues.
1029
double basisvalues[6] = {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000};
1031
// Declare helper variables.
1032
unsigned int rr = 0;
1033
unsigned int ss = 0;
1034
unsigned int tt = 0;
1035
double tmp5 = 0.00000000;
1036
double tmp6 = 0.00000000;
1037
double tmp7 = 0.00000000;
1038
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
1039
double tmp1 = (1.00000000 - Y)/2.00000000;
1040
double tmp2 = tmp1*tmp1;
1042
// Compute basisvalues.
1043
basisvalues[0] = 1.00000000;
1044
basisvalues[1] = tmp0;
1045
for (unsigned int r = 1; r < 2; r++)
1047
rr = (r + 1)*((r + 1) + 1)/2;
1049
tt = (r - 1)*((r - 1) + 1)/2;
1050
tmp5 = (1.00000000 + 2.00000000*r)/(1.00000000 + r);
1051
basisvalues[rr] = (basisvalues[ss]*tmp0*tmp5 - basisvalues[tt]*tmp2*r/(1.00000000 + r));
1052
}// end loop over 'r'
1053
for (unsigned int r = 0; r < 2; r++)
1055
rr = (r + 1)*(r + 1 + 1)/2 + 1;
1057
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
1058
}// end loop over 'r'
1059
for (unsigned int r = 0; r < 1; r++)
1061
for (unsigned int s = 1; s < 2 - r; s++)
1063
rr = (r + s + 1)*(r + s + 1 + 1)/2 + s + 1;
1064
ss = (r + s)*(r + s + 1)/2 + s;
1065
tt = (r + s - 1)*(r + s - 1 + 1)/2 + s - 1;
1066
tmp5 = (2.00000000 + 2.00000000*r + 2.00000000*s)*(3.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
1067
tmp6 = (1.00000000 + 4.00000000*r*r + 4.00000000*r)*(2.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
1068
tmp7 = (1.00000000 + s + 2.00000000*r)*(3.00000000 + 2.00000000*r + 2.00000000*s)*s/((1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
1069
basisvalues[rr] = (basisvalues[ss]*(tmp6 + Y*tmp5) - basisvalues[tt]*tmp7);
1070
}// end loop over 's'
1071
}// end loop over 'r'
1072
for (unsigned int r = 0; r < 3; r++)
1074
for (unsigned int s = 0; s < 3 - r; s++)
1076
rr = (r + s)*(r + s + 1)/2 + s;
1077
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
1078
}// end loop over 's'
1079
}// end loop over 'r'
1081
// Table(s) of coefficients.
1082
static const double coefficients0[6] = \
1083
{0.00000000, 0.00000000, 0.20000000, 0.00000000, 0.00000000, 0.16329932};
1085
// Tables of derivatives of the polynomial base (transpose).
1086
static const double dmats0[6][6] = \
1087
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1088
{4.89897949, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1089
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1090
{0.00000000, 9.48683298, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1091
{4.00000000, 0.00000000, 7.07106781, 0.00000000, 0.00000000, 0.00000000},
1092
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000}};
1094
static const double dmats1[6][6] = \
1095
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1096
{2.44948974, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1097
{4.24264069, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1098
{2.58198890, 4.74341649, -0.91287093, 0.00000000, 0.00000000, 0.00000000},
1099
{2.00000000, 6.12372436, 3.53553391, 0.00000000, 0.00000000, 0.00000000},
1100
{-2.30940108, 0.00000000, 8.16496581, 0.00000000, 0.00000000, 0.00000000}};
1102
// Compute reference derivatives.
1103
// Declare pointer to array of derivatives on FIAT element.
1104
double *derivatives = new double[num_derivatives];
1105
for (unsigned int r = 0; r < num_derivatives; r++)
1107
derivatives[r] = 0.00000000;
1108
}// end loop over 'r'
1110
// Declare derivative matrix (of polynomial basis).
1111
double dmats[6][6] = \
1112
{{1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1113
{0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1114
{0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
1115
{0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000},
1116
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000},
1117
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000}};
1119
// Declare (auxiliary) derivative matrix (of polynomial basis).
1120
double dmats_old[6][6] = \
1121
{{1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1122
{0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1123
{0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
1124
{0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000},
1125
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000},
1126
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000}};
1128
// Loop possible derivatives.
1129
for (unsigned int r = 0; r < num_derivatives; r++)
1131
// Resetting dmats values to compute next derivative.
1132
for (unsigned int t = 0; t < 6; t++)
1134
for (unsigned int u = 0; u < 6; u++)
1136
dmats[t][u] = 0.00000000;
1139
dmats[t][u] = 1.00000000;
1142
}// end loop over 'u'
1143
}// end loop over 't'
1145
// Looping derivative order to generate dmats.
1146
for (unsigned int s = 0; s < n; s++)
1148
// Updating dmats_old with new values and resetting dmats.
1149
for (unsigned int t = 0; t < 6; t++)
1151
for (unsigned int u = 0; u < 6; u++)
1153
dmats_old[t][u] = dmats[t][u];
1154
dmats[t][u] = 0.00000000;
1155
}// end loop over 'u'
1156
}// end loop over 't'
1158
// Update dmats using an inner product.
1159
if (combinations[r][s] == 0)
1161
for (unsigned int t = 0; t < 6; t++)
1163
for (unsigned int u = 0; u < 6; u++)
1165
for (unsigned int tu = 0; tu < 6; tu++)
1167
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1168
}// end loop over 'tu'
1169
}// end loop over 'u'
1170
}// end loop over 't'
1173
if (combinations[r][s] == 1)
1175
for (unsigned int t = 0; t < 6; t++)
1177
for (unsigned int u = 0; u < 6; u++)
1179
for (unsigned int tu = 0; tu < 6; tu++)
1181
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1182
}// end loop over 'tu'
1183
}// end loop over 'u'
1184
}// end loop over 't'
1187
}// end loop over 's'
1188
for (unsigned int s = 0; s < 6; s++)
1190
for (unsigned int t = 0; t < 6; t++)
1192
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1193
}// end loop over 't'
1194
}// end loop over 's'
1195
}// end loop over 'r'
1197
// Transform derivatives back to physical element
1198
for (unsigned int r = 0; r < num_derivatives; r++)
1200
for (unsigned int s = 0; s < num_derivatives; s++)
1202
values[r] += transform[r][s]*derivatives[s];
1203
}// end loop over 's'
1204
}// end loop over 'r'
1206
// Delete pointer to array of derivatives on FIAT element
1207
delete [] derivatives;
1209
// Delete pointer to array of combinations of derivatives and transform
1210
for (unsigned int r = 0; r < num_derivatives; r++)
1212
delete [] combinations[r];
1213
}// end loop over 'r'
1214
delete [] combinations;
1215
for (unsigned int r = 0; r < num_derivatives; r++)
1217
delete [] transform[r];
1218
}// end loop over 'r'
1219
delete [] transform;
1225
// Array of basisvalues.
1226
double basisvalues[6] = {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000};
1228
// Declare helper variables.
1229
unsigned int rr = 0;
1230
unsigned int ss = 0;
1231
unsigned int tt = 0;
1232
double tmp5 = 0.00000000;
1233
double tmp6 = 0.00000000;
1234
double tmp7 = 0.00000000;
1235
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
1236
double tmp1 = (1.00000000 - Y)/2.00000000;
1237
double tmp2 = tmp1*tmp1;
1239
// Compute basisvalues.
1240
basisvalues[0] = 1.00000000;
1241
basisvalues[1] = tmp0;
1242
for (unsigned int r = 1; r < 2; r++)
1244
rr = (r + 1)*((r + 1) + 1)/2;
1246
tt = (r - 1)*((r - 1) + 1)/2;
1247
tmp5 = (1.00000000 + 2.00000000*r)/(1.00000000 + r);
1248
basisvalues[rr] = (basisvalues[ss]*tmp0*tmp5 - basisvalues[tt]*tmp2*r/(1.00000000 + r));
1249
}// end loop over 'r'
1250
for (unsigned int r = 0; r < 2; r++)
1252
rr = (r + 1)*(r + 1 + 1)/2 + 1;
1254
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
1255
}// end loop over 'r'
1256
for (unsigned int r = 0; r < 1; r++)
1258
for (unsigned int s = 1; s < 2 - r; s++)
1260
rr = (r + s + 1)*(r + s + 1 + 1)/2 + s + 1;
1261
ss = (r + s)*(r + s + 1)/2 + s;
1262
tt = (r + s - 1)*(r + s - 1 + 1)/2 + s - 1;
1263
tmp5 = (2.00000000 + 2.00000000*r + 2.00000000*s)*(3.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
1264
tmp6 = (1.00000000 + 4.00000000*r*r + 4.00000000*r)*(2.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
1265
tmp7 = (1.00000000 + s + 2.00000000*r)*(3.00000000 + 2.00000000*r + 2.00000000*s)*s/((1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
1266
basisvalues[rr] = (basisvalues[ss]*(tmp6 + Y*tmp5) - basisvalues[tt]*tmp7);
1267
}// end loop over 's'
1268
}// end loop over 'r'
1269
for (unsigned int r = 0; r < 3; r++)
1271
for (unsigned int s = 0; s < 3 - r; s++)
1273
rr = (r + s)*(r + s + 1)/2 + s;
1274
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
1275
}// end loop over 's'
1276
}// end loop over 'r'
1278
// Table(s) of coefficients.
1279
static const double coefficients0[6] = \
1280
{0.47140452, 0.23094011, 0.13333333, 0.00000000, 0.18856181, -0.16329932};
1282
// Tables of derivatives of the polynomial base (transpose).
1283
static const double dmats0[6][6] = \
1284
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1285
{4.89897949, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1286
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1287
{0.00000000, 9.48683298, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1288
{4.00000000, 0.00000000, 7.07106781, 0.00000000, 0.00000000, 0.00000000},
1289
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000}};
1291
static const double dmats1[6][6] = \
1292
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1293
{2.44948974, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1294
{4.24264069, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1295
{2.58198890, 4.74341649, -0.91287093, 0.00000000, 0.00000000, 0.00000000},
1296
{2.00000000, 6.12372436, 3.53553391, 0.00000000, 0.00000000, 0.00000000},
1297
{-2.30940108, 0.00000000, 8.16496581, 0.00000000, 0.00000000, 0.00000000}};
1299
// Compute reference derivatives.
1300
// Declare pointer to array of derivatives on FIAT element.
1301
double *derivatives = new double[num_derivatives];
1302
for (unsigned int r = 0; r < num_derivatives; r++)
1304
derivatives[r] = 0.00000000;
1305
}// end loop over 'r'
1307
// Declare derivative matrix (of polynomial basis).
1308
double dmats[6][6] = \
1309
{{1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1310
{0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1311
{0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
1312
{0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000},
1313
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000},
1314
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000}};
1316
// Declare (auxiliary) derivative matrix (of polynomial basis).
1317
double dmats_old[6][6] = \
1318
{{1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1319
{0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1320
{0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
1321
{0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000},
1322
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000},
1323
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000}};
1325
// Loop possible derivatives.
1326
for (unsigned int r = 0; r < num_derivatives; r++)
1328
// Resetting dmats values to compute next derivative.
1329
for (unsigned int t = 0; t < 6; t++)
1331
for (unsigned int u = 0; u < 6; u++)
1333
dmats[t][u] = 0.00000000;
1336
dmats[t][u] = 1.00000000;
1339
}// end loop over 'u'
1340
}// end loop over 't'
1342
// Looping derivative order to generate dmats.
1343
for (unsigned int s = 0; s < n; s++)
1345
// Updating dmats_old with new values and resetting dmats.
1346
for (unsigned int t = 0; t < 6; t++)
1348
for (unsigned int u = 0; u < 6; u++)
1350
dmats_old[t][u] = dmats[t][u];
1351
dmats[t][u] = 0.00000000;
1352
}// end loop over 'u'
1353
}// end loop over 't'
1355
// Update dmats using an inner product.
1356
if (combinations[r][s] == 0)
1358
for (unsigned int t = 0; t < 6; t++)
1360
for (unsigned int u = 0; u < 6; u++)
1362
for (unsigned int tu = 0; tu < 6; tu++)
1364
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1365
}// end loop over 'tu'
1366
}// end loop over 'u'
1367
}// end loop over 't'
1370
if (combinations[r][s] == 1)
1372
for (unsigned int t = 0; t < 6; t++)
1374
for (unsigned int u = 0; u < 6; u++)
1376
for (unsigned int tu = 0; tu < 6; tu++)
1378
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1379
}// end loop over 'tu'
1380
}// end loop over 'u'
1381
}// end loop over 't'
1384
}// end loop over 's'
1385
for (unsigned int s = 0; s < 6; s++)
1387
for (unsigned int t = 0; t < 6; t++)
1389
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1390
}// end loop over 't'
1391
}// end loop over 's'
1392
}// end loop over 'r'
1394
// Transform derivatives back to physical element
1395
for (unsigned int r = 0; r < num_derivatives; r++)
1397
for (unsigned int s = 0; s < num_derivatives; s++)
1399
values[r] += transform[r][s]*derivatives[s];
1400
}// end loop over 's'
1401
}// end loop over 'r'
1403
// Delete pointer to array of derivatives on FIAT element
1404
delete [] derivatives;
1406
// Delete pointer to array of combinations of derivatives and transform
1407
for (unsigned int r = 0; r < num_derivatives; r++)
1409
delete [] combinations[r];
1410
}// end loop over 'r'
1411
delete [] combinations;
1412
for (unsigned int r = 0; r < num_derivatives; r++)
1414
delete [] transform[r];
1415
}// end loop over 'r'
1416
delete [] transform;
1422
// Array of basisvalues.
1423
double basisvalues[6] = {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000};
1425
// Declare helper variables.
1426
unsigned int rr = 0;
1427
unsigned int ss = 0;
1428
unsigned int tt = 0;
1429
double tmp5 = 0.00000000;
1430
double tmp6 = 0.00000000;
1431
double tmp7 = 0.00000000;
1432
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
1433
double tmp1 = (1.00000000 - Y)/2.00000000;
1434
double tmp2 = tmp1*tmp1;
1436
// Compute basisvalues.
1437
basisvalues[0] = 1.00000000;
1438
basisvalues[1] = tmp0;
1439
for (unsigned int r = 1; r < 2; r++)
1441
rr = (r + 1)*((r + 1) + 1)/2;
1443
tt = (r - 1)*((r - 1) + 1)/2;
1444
tmp5 = (1.00000000 + 2.00000000*r)/(1.00000000 + r);
1445
basisvalues[rr] = (basisvalues[ss]*tmp0*tmp5 - basisvalues[tt]*tmp2*r/(1.00000000 + r));
1446
}// end loop over 'r'
1447
for (unsigned int r = 0; r < 2; r++)
1449
rr = (r + 1)*(r + 1 + 1)/2 + 1;
1451
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
1452
}// end loop over 'r'
1453
for (unsigned int r = 0; r < 1; r++)
1455
for (unsigned int s = 1; s < 2 - r; s++)
1457
rr = (r + s + 1)*(r + s + 1 + 1)/2 + s + 1;
1458
ss = (r + s)*(r + s + 1)/2 + s;
1459
tt = (r + s - 1)*(r + s - 1 + 1)/2 + s - 1;
1460
tmp5 = (2.00000000 + 2.00000000*r + 2.00000000*s)*(3.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
1461
tmp6 = (1.00000000 + 4.00000000*r*r + 4.00000000*r)*(2.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
1462
tmp7 = (1.00000000 + s + 2.00000000*r)*(3.00000000 + 2.00000000*r + 2.00000000*s)*s/((1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
1463
basisvalues[rr] = (basisvalues[ss]*(tmp6 + Y*tmp5) - basisvalues[tt]*tmp7);
1464
}// end loop over 's'
1465
}// end loop over 'r'
1466
for (unsigned int r = 0; r < 3; r++)
1468
for (unsigned int s = 0; s < 3 - r; s++)
1470
rr = (r + s)*(r + s + 1)/2 + s;
1471
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
1472
}// end loop over 's'
1473
}// end loop over 'r'
1475
// Table(s) of coefficients.
1476
static const double coefficients0[6] = \
1477
{0.47140452, -0.23094011, 0.13333333, 0.00000000, -0.18856181, -0.16329932};
1479
// Tables of derivatives of the polynomial base (transpose).
1480
static const double dmats0[6][6] = \
1481
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1482
{4.89897949, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1483
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1484
{0.00000000, 9.48683298, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1485
{4.00000000, 0.00000000, 7.07106781, 0.00000000, 0.00000000, 0.00000000},
1486
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000}};
1488
static const double dmats1[6][6] = \
1489
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1490
{2.44948974, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1491
{4.24264069, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1492
{2.58198890, 4.74341649, -0.91287093, 0.00000000, 0.00000000, 0.00000000},
1493
{2.00000000, 6.12372436, 3.53553391, 0.00000000, 0.00000000, 0.00000000},
1494
{-2.30940108, 0.00000000, 8.16496581, 0.00000000, 0.00000000, 0.00000000}};
1496
// Compute reference derivatives.
1497
// Declare pointer to array of derivatives on FIAT element.
1498
double *derivatives = new double[num_derivatives];
1499
for (unsigned int r = 0; r < num_derivatives; r++)
1501
derivatives[r] = 0.00000000;
1502
}// end loop over 'r'
1504
// Declare derivative matrix (of polynomial basis).
1505
double dmats[6][6] = \
1506
{{1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1507
{0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1508
{0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
1509
{0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000},
1510
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000},
1511
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000}};
1513
// Declare (auxiliary) derivative matrix (of polynomial basis).
1514
double dmats_old[6][6] = \
1515
{{1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1516
{0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1517
{0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
1518
{0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000},
1519
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000},
1520
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000}};
1522
// Loop possible derivatives.
1523
for (unsigned int r = 0; r < num_derivatives; r++)
1525
// Resetting dmats values to compute next derivative.
1526
for (unsigned int t = 0; t < 6; t++)
1528
for (unsigned int u = 0; u < 6; u++)
1530
dmats[t][u] = 0.00000000;
1533
dmats[t][u] = 1.00000000;
1536
}// end loop over 'u'
1537
}// end loop over 't'
1539
// Looping derivative order to generate dmats.
1540
for (unsigned int s = 0; s < n; s++)
1542
// Updating dmats_old with new values and resetting dmats.
1543
for (unsigned int t = 0; t < 6; t++)
1545
for (unsigned int u = 0; u < 6; u++)
1547
dmats_old[t][u] = dmats[t][u];
1548
dmats[t][u] = 0.00000000;
1549
}// end loop over 'u'
1550
}// end loop over 't'
1552
// Update dmats using an inner product.
1553
if (combinations[r][s] == 0)
1555
for (unsigned int t = 0; t < 6; t++)
1557
for (unsigned int u = 0; u < 6; u++)
1559
for (unsigned int tu = 0; tu < 6; tu++)
1561
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1562
}// end loop over 'tu'
1563
}// end loop over 'u'
1564
}// end loop over 't'
1567
if (combinations[r][s] == 1)
1569
for (unsigned int t = 0; t < 6; t++)
1571
for (unsigned int u = 0; u < 6; u++)
1573
for (unsigned int tu = 0; tu < 6; tu++)
1575
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1576
}// end loop over 'tu'
1577
}// end loop over 'u'
1578
}// end loop over 't'
1581
}// end loop over 's'
1582
for (unsigned int s = 0; s < 6; s++)
1584
for (unsigned int t = 0; t < 6; t++)
1586
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1587
}// end loop over 't'
1588
}// end loop over 's'
1589
}// end loop over 'r'
1591
// Transform derivatives back to physical element
1592
for (unsigned int r = 0; r < num_derivatives; r++)
1594
for (unsigned int s = 0; s < num_derivatives; s++)
1596
values[r] += transform[r][s]*derivatives[s];
1597
}// end loop over 's'
1598
}// end loop over 'r'
1600
// Delete pointer to array of derivatives on FIAT element
1601
delete [] derivatives;
1603
// Delete pointer to array of combinations of derivatives and transform
1604
for (unsigned int r = 0; r < num_derivatives; r++)
1606
delete [] combinations[r];
1607
}// end loop over 'r'
1608
delete [] combinations;
1609
for (unsigned int r = 0; r < num_derivatives; r++)
1611
delete [] transform[r];
1612
}// end loop over 'r'
1613
delete [] transform;
1619
// Array of basisvalues.
1620
double basisvalues[6] = {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000};
1622
// Declare helper variables.
1623
unsigned int rr = 0;
1624
unsigned int ss = 0;
1625
unsigned int tt = 0;
1626
double tmp5 = 0.00000000;
1627
double tmp6 = 0.00000000;
1628
double tmp7 = 0.00000000;
1629
double tmp0 = (1.00000000 + Y + 2.00000000*X)/2.00000000;
1630
double tmp1 = (1.00000000 - Y)/2.00000000;
1631
double tmp2 = tmp1*tmp1;
1633
// Compute basisvalues.
1634
basisvalues[0] = 1.00000000;
1635
basisvalues[1] = tmp0;
1636
for (unsigned int r = 1; r < 2; r++)
1638
rr = (r + 1)*((r + 1) + 1)/2;
1640
tt = (r - 1)*((r - 1) + 1)/2;
1641
tmp5 = (1.00000000 + 2.00000000*r)/(1.00000000 + r);
1642
basisvalues[rr] = (basisvalues[ss]*tmp0*tmp5 - basisvalues[tt]*tmp2*r/(1.00000000 + r));
1643
}// end loop over 'r'
1644
for (unsigned int r = 0; r < 2; r++)
1646
rr = (r + 1)*(r + 1 + 1)/2 + 1;
1648
basisvalues[rr] = basisvalues[ss]*(0.50000000 + r + Y*(1.50000000 + r));
1649
}// end loop over 'r'
1650
for (unsigned int r = 0; r < 1; r++)
1652
for (unsigned int s = 1; s < 2 - r; s++)
1654
rr = (r + s + 1)*(r + s + 1 + 1)/2 + s + 1;
1655
ss = (r + s)*(r + s + 1)/2 + s;
1656
tt = (r + s - 1)*(r + s - 1 + 1)/2 + s - 1;
1657
tmp5 = (2.00000000 + 2.00000000*r + 2.00000000*s)*(3.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
1658
tmp6 = (1.00000000 + 4.00000000*r*r + 4.00000000*r)*(2.00000000 + 2.00000000*r + 2.00000000*s)/(2.00000000*(1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
1659
tmp7 = (1.00000000 + s + 2.00000000*r)*(3.00000000 + 2.00000000*r + 2.00000000*s)*s/((1.00000000 + 2.00000000*r + 2.00000000*s)*(1.00000000 + s)*(2.00000000 + s + 2.00000000*r));
1660
basisvalues[rr] = (basisvalues[ss]*(tmp6 + Y*tmp5) - basisvalues[tt]*tmp7);
1661
}// end loop over 's'
1662
}// end loop over 'r'
1663
for (unsigned int r = 0; r < 3; r++)
1665
for (unsigned int s = 0; s < 3 - r; s++)
1667
rr = (r + s)*(r + s + 1)/2 + s;
1668
basisvalues[rr] *= std::sqrt((0.50000000 + r)*(1.00000000 + r + s));
1669
}// end loop over 's'
1670
}// end loop over 'r'
1672
// Table(s) of coefficients.
1673
static const double coefficients0[6] = \
1674
{0.47140452, 0.00000000, -0.26666667, -0.24343225, 0.00000000, 0.05443311};
1676
// Tables of derivatives of the polynomial base (transpose).
1677
static const double dmats0[6][6] = \
1678
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1679
{4.89897949, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1680
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1681
{0.00000000, 9.48683298, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1682
{4.00000000, 0.00000000, 7.07106781, 0.00000000, 0.00000000, 0.00000000},
1683
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000}};
1685
static const double dmats1[6][6] = \
1686
{{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1687
{2.44948974, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1688
{4.24264069, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1689
{2.58198890, 4.74341649, -0.91287093, 0.00000000, 0.00000000, 0.00000000},
1690
{2.00000000, 6.12372436, 3.53553391, 0.00000000, 0.00000000, 0.00000000},
1691
{-2.30940108, 0.00000000, 8.16496581, 0.00000000, 0.00000000, 0.00000000}};
1693
// Compute reference derivatives.
1694
// Declare pointer to array of derivatives on FIAT element.
1695
double *derivatives = new double[num_derivatives];
1696
for (unsigned int r = 0; r < num_derivatives; r++)
1698
derivatives[r] = 0.00000000;
1699
}// end loop over 'r'
1701
// Declare derivative matrix (of polynomial basis).
1702
double dmats[6][6] = \
1703
{{1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1704
{0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1705
{0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
1706
{0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000},
1707
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000},
1708
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000}};
1710
// Declare (auxiliary) derivative matrix (of polynomial basis).
1711
double dmats_old[6][6] = \
1712
{{1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1713
{0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000},
1714
{0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000, 0.00000000},
1715
{0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000, 0.00000000},
1716
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000, 0.00000000},
1717
{0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 1.00000000}};
1719
// Loop possible derivatives.
1720
for (unsigned int r = 0; r < num_derivatives; r++)
1722
// Resetting dmats values to compute next derivative.
1723
for (unsigned int t = 0; t < 6; t++)
1725
for (unsigned int u = 0; u < 6; u++)
1727
dmats[t][u] = 0.00000000;
1730
dmats[t][u] = 1.00000000;
1733
}// end loop over 'u'
1734
}// end loop over 't'
1736
// Looping derivative order to generate dmats.
1737
for (unsigned int s = 0; s < n; s++)
1739
// Updating dmats_old with new values and resetting dmats.
1740
for (unsigned int t = 0; t < 6; t++)
1742
for (unsigned int u = 0; u < 6; u++)
1744
dmats_old[t][u] = dmats[t][u];
1745
dmats[t][u] = 0.00000000;
1746
}// end loop over 'u'
1747
}// end loop over 't'
1749
// Update dmats using an inner product.
1750
if (combinations[r][s] == 0)
1752
for (unsigned int t = 0; t < 6; t++)
1754
for (unsigned int u = 0; u < 6; u++)
1756
for (unsigned int tu = 0; tu < 6; tu++)
1758
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
1759
}// end loop over 'tu'
1760
}// end loop over 'u'
1761
}// end loop over 't'
1764
if (combinations[r][s] == 1)
1766
for (unsigned int t = 0; t < 6; t++)
1768
for (unsigned int u = 0; u < 6; u++)
1770
for (unsigned int tu = 0; tu < 6; tu++)
1772
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
1773
}// end loop over 'tu'
1774
}// end loop over 'u'
1775
}// end loop over 't'
1778
}// end loop over 's'
1779
for (unsigned int s = 0; s < 6; s++)
1781
for (unsigned int t = 0; t < 6; t++)
1783
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
1784
}// end loop over 't'
1785
}// end loop over 's'
1786
}// end loop over 'r'
1788
// Transform derivatives back to physical element
1789
for (unsigned int r = 0; r < num_derivatives; r++)
1791
for (unsigned int s = 0; s < num_derivatives; s++)
1793
values[r] += transform[r][s]*derivatives[s];
1794
}// end loop over 's'
1795
}// end loop over 'r'
1797
// Delete pointer to array of derivatives on FIAT element
1798
delete [] derivatives;
1800
// Delete pointer to array of combinations of derivatives and transform
1801
for (unsigned int r = 0; r < num_derivatives; r++)
1803
delete [] combinations[r];
1804
}// end loop over 'r'
1805
delete [] combinations;
1806
for (unsigned int r = 0; r < num_derivatives; r++)
1808
delete [] transform[r];
1809
}// end loop over 'r'
1810
delete [] transform;
1817
/// Evaluate order n derivatives of all basis functions at given point in cell
1818
virtual void evaluate_basis_derivatives_all(unsigned int n,
1820
const double* coordinates,
1821
const ufc::cell& c) const
1823
// Compute number of derivatives.
1824
unsigned int num_derivatives = 1;
1825
for (unsigned int r = 0; r < n; r++)
1827
num_derivatives *= 2;
1828
}// end loop over 'r'
1830
// Helper variable to hold values of a single dof.
1831
double *dof_values = new double[num_derivatives];
1832
for (unsigned int r = 0; r < num_derivatives; r++)
1834
dof_values[r] = 0.00000000;
1835
}// end loop over 'r'
1837
// Loop dofs and call evaluate_basis_derivatives.
1838
for (unsigned int r = 0; r < 6; r++)
1840
evaluate_basis_derivatives(r, n, dof_values, coordinates, c);
1841
for (unsigned int s = 0; s < num_derivatives; s++)
1843
values[r*num_derivatives + s] = dof_values[s];
1844
}// end loop over 's'
1845
}// end loop over 'r'
1848
delete [] dof_values;
1851
/// Evaluate linear functional for dof i on the function f
1852
virtual double evaluate_dof(unsigned int i,
1853
const ufc::function& f,
1854
const ufc::cell& c) const
1856
// Declare variables for result of evaluation.
1859
// Declare variable for physical coordinates.
1861
const double * const * x = c.coordinates;
1868
f.evaluate(vals, y, c);
1876
f.evaluate(vals, y, c);
1884
f.evaluate(vals, y, c);
1890
y[0] = 0.50000000*x[1][0] + 0.50000000*x[2][0];
1891
y[1] = 0.50000000*x[1][1] + 0.50000000*x[2][1];
1892
f.evaluate(vals, y, c);
1898
y[0] = 0.50000000*x[0][0] + 0.50000000*x[2][0];
1899
y[1] = 0.50000000*x[0][1] + 0.50000000*x[2][1];
1900
f.evaluate(vals, y, c);
1906
y[0] = 0.50000000*x[0][0] + 0.50000000*x[1][0];
1907
y[1] = 0.50000000*x[0][1] + 0.50000000*x[1][1];
1908
f.evaluate(vals, y, c);
1917
/// Evaluate linear functionals for all dofs on the function f
1918
virtual void evaluate_dofs(double* values,
1919
const ufc::function& f,
1920
const ufc::cell& c) const
1922
// Declare variables for result of evaluation.
1925
// Declare variable for physical coordinates.
1927
const double * const * x = c.coordinates;
1930
f.evaluate(vals, y, c);
1931
values[0] = vals[0];
1934
f.evaluate(vals, y, c);
1935
values[1] = vals[0];
1938
f.evaluate(vals, y, c);
1939
values[2] = vals[0];
1940
y[0] = 0.50000000*x[1][0] + 0.50000000*x[2][0];
1941
y[1] = 0.50000000*x[1][1] + 0.50000000*x[2][1];
1942
f.evaluate(vals, y, c);
1943
values[3] = vals[0];
1944
y[0] = 0.50000000*x[0][0] + 0.50000000*x[2][0];
1945
y[1] = 0.50000000*x[0][1] + 0.50000000*x[2][1];
1946
f.evaluate(vals, y, c);
1947
values[4] = vals[0];
1948
y[0] = 0.50000000*x[0][0] + 0.50000000*x[1][0];
1949
y[1] = 0.50000000*x[0][1] + 0.50000000*x[1][1];
1950
f.evaluate(vals, y, c);
1951
values[5] = vals[0];
1954
/// Interpolate vertex values from dof values
1955
virtual void interpolate_vertex_values(double* vertex_values,
1956
const double* dof_values,
1957
const ufc::cell& c) const
1959
// Evaluate function and change variables
1960
vertex_values[0] = dof_values[0];
1961
vertex_values[1] = dof_values[1];
1962
vertex_values[2] = dof_values[2];
1965
/// Return the number of sub elements (for a mixed element)
1966
virtual unsigned int num_sub_elements() const
1971
/// Create a new finite element for sub element i (for a mixed element)
1972
virtual ufc::finite_element* create_sub_element(unsigned int i) const
1979
/// This class defines the interface for a local-to-global mapping of
1980
/// degrees of freedom (dofs).
1982
class spatialcoordinates_dof_map_0: public ufc::dof_map
1986
unsigned int _global_dimension;
1990
spatialcoordinates_dof_map_0() : ufc::dof_map()
1992
_global_dimension = 0;
1996
virtual ~spatialcoordinates_dof_map_0()
2001
/// Return a string identifying the dof map
2002
virtual const char* signature() const
2004
return "FFC dofmap for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
2007
/// Return true iff mesh entities of topological dimension d are needed
2008
virtual bool needs_mesh_entities(unsigned int d) const
2032
/// Initialize dof map for mesh (return true iff init_cell() is needed)
2033
virtual bool init_mesh(const ufc::mesh& m)
2035
_global_dimension = m.num_entities[0] + m.num_entities[1];
2039
/// Initialize dof map for given cell
2040
virtual void init_cell(const ufc::mesh& m,
2046
/// Finish initialization of dof map for cells
2047
virtual void init_cell_finalize()
2052
/// Return the dimension of the global finite element function space
2053
virtual unsigned int global_dimension() const
2055
return _global_dimension;
2058
/// Return the dimension of the local finite element function space for a cell
2059
virtual unsigned int local_dimension(const ufc::cell& c) const
2064
/// Return the maximum dimension of the local finite element function space
2065
virtual unsigned int max_local_dimension() const
2070
// Return the geometric dimension of the coordinates this dof map provides
2071
virtual unsigned int geometric_dimension() const
2076
/// Return the number of dofs on each cell facet
2077
virtual unsigned int num_facet_dofs() const
2082
/// Return the number of dofs associated with each cell entity of dimension d
2083
virtual unsigned int num_entity_dofs(unsigned int d) const
2107
/// Tabulate the local-to-global mapping of dofs on a cell
2108
virtual void tabulate_dofs(unsigned int* dofs,
2110
const ufc::cell& c) const
2112
unsigned int offset = 0;
2113
dofs[0] = offset + c.entity_indices[0][0];
2114
dofs[1] = offset + c.entity_indices[0][1];
2115
dofs[2] = offset + c.entity_indices[0][2];
2116
offset += m.num_entities[0];
2117
dofs[3] = offset + c.entity_indices[1][0];
2118
dofs[4] = offset + c.entity_indices[1][1];
2119
dofs[5] = offset + c.entity_indices[1][2];
2120
offset += m.num_entities[1];
2123
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
2124
virtual void tabulate_facet_dofs(unsigned int* dofs,
2125
unsigned int facet) const
2154
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
2155
virtual void tabulate_entity_dofs(unsigned int* dofs,
2156
unsigned int d, unsigned int i) const
2160
std::cerr << "*** FFC warning: " << "d is larger than dimension (2)" << std::endl;
2169
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
2197
std::cerr << "*** FFC warning: " << "i is larger than number of entities (2)" << std::endl;
2230
/// Tabulate the coordinates of all dofs on a cell
2231
virtual void tabulate_coordinates(double** coordinates,
2232
const ufc::cell& c) const
2234
const double * const * x = c.coordinates;
2236
coordinates[0][0] = x[0][0];
2237
coordinates[0][1] = x[0][1];
2238
coordinates[1][0] = x[1][0];
2239
coordinates[1][1] = x[1][1];
2240
coordinates[2][0] = x[2][0];
2241
coordinates[2][1] = x[2][1];
2242
coordinates[3][0] = 0.50000000*x[1][0] + 0.50000000*x[2][0];
2243
coordinates[3][1] = 0.50000000*x[1][1] + 0.50000000*x[2][1];
2244
coordinates[4][0] = 0.50000000*x[0][0] + 0.50000000*x[2][0];
2245
coordinates[4][1] = 0.50000000*x[0][1] + 0.50000000*x[2][1];
2246
coordinates[5][0] = 0.50000000*x[0][0] + 0.50000000*x[1][0];
2247
coordinates[5][1] = 0.50000000*x[0][1] + 0.50000000*x[1][1];
2250
/// Return the number of sub dof maps (for a mixed element)
2251
virtual unsigned int num_sub_dof_maps() const
2256
/// Create a new dof_map for sub dof map i (for a mixed element)
2257
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
2264
/// This class defines the interface for the tabulation of the cell
2265
/// tensor corresponding to the local contribution to a form from
2266
/// the integral over a cell.
2268
class spatialcoordinates_cell_integral_0_0: public ufc::cell_integral
2273
spatialcoordinates_cell_integral_0_0() : ufc::cell_integral()
2279
virtual ~spatialcoordinates_cell_integral_0_0()
2284
/// Tabulate the tensor for the contribution from a local cell
2285
virtual void tabulate_tensor(double* A,
2286
const double * const * w,
2287
const ufc::cell& c) const
2289
// Number of operations (multiply-add pairs) for Jacobian data: 11
2290
// Number of operations (multiply-add pairs) for geometry tensor: 8
2291
// Number of operations (multiply-add pairs) for tensor contraction: 49
2292
// Total number of operations (multiply-add pairs): 68
2294
// Extract vertex coordinates
2295
const double * const * x = c.coordinates;
2297
// Compute Jacobian of affine map from reference cell
2298
const double J_00 = x[1][0] - x[0][0];
2299
const double J_01 = x[2][0] - x[0][0];
2300
const double J_10 = x[1][1] - x[0][1];
2301
const double J_11 = x[2][1] - x[0][1];
2303
// Compute determinant of Jacobian
2304
double detJ = J_00*J_11 - J_01*J_10;
2306
// Compute inverse of Jacobian
2307
const double K_00 = J_11 / detJ;
2308
const double K_01 = -J_01 / detJ;
2309
const double K_10 = -J_10 / detJ;
2310
const double K_11 = J_00 / detJ;
2313
const double det = std::abs(detJ);
2315
// Compute geometry tensor
2316
const double G0_0_0 = det*(K_00*K_00 + K_01*K_01);
2317
const double G0_0_1 = det*(K_00*K_10 + K_01*K_11);
2318
const double G0_1_0 = det*(K_10*K_00 + K_11*K_01);
2319
const double G0_1_1 = det*(K_10*K_10 + K_11*K_11);
2321
// Compute element tensor
2322
A[0] = 0.50000000*G0_0_0 + 0.50000000*G0_0_1 + 0.50000000*G0_1_0 + 0.50000000*G0_1_1;
2323
A[1] = 0.16666667*G0_0_0 + 0.16666667*G0_1_0;
2324
A[2] = 0.16666667*G0_0_1 + 0.16666667*G0_1_1;
2326
A[4] = -0.66666667*G0_0_1 - 0.66666667*G0_1_1;
2327
A[5] = -0.66666667*G0_0_0 - 0.66666667*G0_1_0;
2328
A[6] = 0.16666667*G0_0_0 + 0.16666667*G0_0_1;
2329
A[7] = 0.50000000*G0_0_0;
2330
A[8] = -0.16666667*G0_0_1;
2331
A[9] = 0.66666667*G0_0_1;
2333
A[11] = -0.66666667*G0_0_0 - 0.66666667*G0_0_1;
2334
A[12] = 0.16666667*G0_1_0 + 0.16666667*G0_1_1;
2335
A[13] = -0.16666667*G0_1_0;
2336
A[14] = 0.50000000*G0_1_1;
2337
A[15] = 0.66666667*G0_1_0;
2338
A[16] = -0.66666667*G0_1_0 - 0.66666667*G0_1_1;
2341
A[19] = 0.66666667*G0_1_0;
2342
A[20] = 0.66666667*G0_0_1;
2343
A[21] = 1.33333333*G0_0_0 + 0.66666667*G0_0_1 + 0.66666667*G0_1_0 + 1.33333333*G0_1_1;
2344
A[22] = -1.33333333*G0_0_0 - 0.66666667*G0_0_1 - 0.66666667*G0_1_0;
2345
A[23] = -0.66666667*G0_0_1 - 0.66666667*G0_1_0 - 1.33333333*G0_1_1;
2346
A[24] = -0.66666667*G0_1_0 - 0.66666667*G0_1_1;
2348
A[26] = -0.66666667*G0_0_1 - 0.66666667*G0_1_1;
2349
A[27] = -1.33333333*G0_0_0 - 0.66666667*G0_0_1 - 0.66666667*G0_1_0;
2350
A[28] = 1.33333333*G0_0_0 + 0.66666667*G0_0_1 + 0.66666667*G0_1_0 + 1.33333333*G0_1_1;
2351
A[29] = 0.66666667*G0_0_1 + 0.66666667*G0_1_0;
2352
A[30] = -0.66666667*G0_0_0 - 0.66666667*G0_0_1;
2353
A[31] = -0.66666667*G0_0_0 - 0.66666667*G0_1_0;
2355
A[33] = -0.66666667*G0_0_1 - 0.66666667*G0_1_0 - 1.33333333*G0_1_1;
2356
A[34] = 0.66666667*G0_0_1 + 0.66666667*G0_1_0;
2357
A[35] = 1.33333333*G0_0_0 + 0.66666667*G0_0_1 + 0.66666667*G0_1_0 + 1.33333333*G0_1_1;
2362
/// This class defines the interface for the tabulation of the cell
2363
/// tensor corresponding to the local contribution to a form from
2364
/// the integral over a cell.
2366
class spatialcoordinates_cell_integral_1_0: public ufc::cell_integral
2371
spatialcoordinates_cell_integral_1_0() : ufc::cell_integral()
2377
virtual ~spatialcoordinates_cell_integral_1_0()
2382
/// Tabulate the tensor for the contribution from a local cell
2383
virtual void tabulate_tensor(double* A,
2384
const double * const * w,
2385
const ufc::cell& c) const
2387
// Extract vertex coordinates
2388
const double * const * x = c.coordinates;
2390
// Compute Jacobian of affine map from reference cell
2391
const double J_00 = x[1][0] - x[0][0];
2392
const double J_01 = x[2][0] - x[0][0];
2393
const double J_10 = x[1][1] - x[0][1];
2394
const double J_11 = x[2][1] - x[0][1];
2396
// Compute determinant of Jacobian
2397
double detJ = J_00*J_11 - J_01*J_10;
2399
// Compute inverse of Jacobian
2402
const double det = std::abs(detJ);
2404
// Array of quadrature weights.
2405
static const double W4[4] = {0.15902069, 0.09097931, 0.15902069, 0.09097931};
2406
// Quadrature points on the UFC reference element: (0.17855873, 0.15505103), (0.07503111, 0.64494897), (0.66639025, 0.15505103), (0.28001992, 0.64494897)
2408
// Value of basis functions at quadrature points.
2409
static const double FE0[4][6] = \
2410
{{0.22176167, -0.11479229, -0.10696938, 0.11074286, 0.41329796, 0.47595918},
2411
{-0.12319761, -0.06377178, 0.18696938, 0.19356495, 0.72239423, 0.08404082},
2412
{-0.11479229, 0.22176167, -0.10696938, 0.41329796, 0.11074286, 0.47595918},
2413
{-0.06377178, -0.12319761, 0.18696938, 0.72239423, 0.19356495, 0.08404082}};
2415
static const double FEA4_f0[4][3] = \
2416
{{0.66639025, 0.17855873, 0.15505103},
2417
{0.28001992, 0.07503111, 0.64494897},
2418
{0.17855873, 0.66639025, 0.15505103},
2419
{0.07503111, 0.28001992, 0.64494897}};
2421
// Reset values in the element tensor.
2422
for (unsigned int r = 0; r < 6; r++)
2425
}// end loop over 'r'
2427
// Compute element tensor using UFL quadrature representation
2428
// Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
2430
// Loop quadrature points for integral.
2432
// Declare array to hold physical coordinate of quadrature point.
2434
// Number of operations to compute element tensor for following IP loop = 352
2435
for (unsigned int ip = 0; ip < 4; ip++)
2438
// Compute physical coordinate of quadrature point, operations: 10.
2439
X4[0] = FEA4_f0[ip][0]*x[0][0] + FEA4_f0[ip][1]*x[1][0] + FEA4_f0[ip][2]*x[2][0];
2440
X4[1] = FEA4_f0[ip][0]*x[0][1] + FEA4_f0[ip][1]*x[1][1] + FEA4_f0[ip][2]*x[2][1];
2442
// Number of operations for primary indices: 78
2443
for (unsigned int j = 0; j < 6; j++)
2445
// Number of operations to compute entry: 13
2446
A[j] += FE0[ip][j]*(10.00000000*(std::exp((-1.00000000)*((((X4[0] + -0.50000000))*((X4[0] + -0.50000000)) + ((X4[1] + -0.50000000))*((X4[1] + -0.50000000))))/(0.02000000))))*W4[ip]*det;
2447
}// end loop over 'j'
2448
}// end loop over 'ip'
2453
/// This class defines the interface for the tabulation of the
2454
/// exterior facet tensor corresponding to the local contribution to
2455
/// a form from the integral over an exterior facet.
2457
class spatialcoordinates_exterior_facet_integral_1_0: public ufc::exterior_facet_integral
2462
spatialcoordinates_exterior_facet_integral_1_0() : ufc::exterior_facet_integral()
2468
virtual ~spatialcoordinates_exterior_facet_integral_1_0()
2473
/// Tabulate the tensor for the contribution from a local exterior facet
2474
virtual void tabulate_tensor(double* A,
2475
const double * const * w,
2477
unsigned int facet) const
2479
// Extract vertex coordinates
2480
const double * const * x = c.coordinates;
2482
// Compute Jacobian of affine map from reference cell
2484
// Compute determinant of Jacobian
2486
// Compute inverse of Jacobian
2488
// Get vertices on edge
2489
static unsigned int edge_vertices[3][2] = {{1, 2}, {0, 2}, {0, 1}};
2490
const unsigned int v0 = edge_vertices[facet][0];
2491
const unsigned int v1 = edge_vertices[facet][1];
2493
// Compute scale factor (length of edge scaled by length of reference interval)
2494
const double dx0 = x[v1][0] - x[v0][0];
2495
const double dx1 = x[v1][1] - x[v0][1];
2496
const double det = std::sqrt(dx0*dx0 + dx1*dx1);
2499
// Array of quadrature weights.
2500
static const double W2[2] = {0.50000000, 0.50000000};
2501
// Quadrature points on the UFC reference element: (0.21132487), (0.78867513)
2503
// Value of basis functions at quadrature points.
2504
static const double FE0_f0[2][6] = \
2505
{{0.00000000, 0.45534180, -0.12200847, 0.66666667, 0.00000000, 0.00000000},
2506
{0.00000000, -0.12200847, 0.45534180, 0.66666667, 0.00000000, 0.00000000}};
2508
static const double FE0_f1[2][6] = \
2509
{{0.45534180, 0.00000000, -0.12200847, 0.00000000, 0.66666667, 0.00000000},
2510
{-0.12200847, 0.00000000, 0.45534180, 0.00000000, 0.66666667, 0.00000000}};
2512
static const double FE0_f2[2][6] = \
2513
{{0.45534180, -0.12200847, 0.00000000, 0.00000000, 0.00000000, 0.66666667},
2514
{-0.12200847, 0.45534180, 0.00000000, 0.00000000, 0.00000000, 0.66666667}};
2516
static const double FEA2_f0[2][3] = \
2517
{{0.00000000, 0.78867513, 0.21132487},
2518
{0.00000000, 0.21132487, 0.78867513}};
2520
static const double FEA2_f1[2][3] = \
2521
{{0.78867513, 0.00000000, 0.21132487},
2522
{0.21132487, 0.00000000, 0.78867513}};
2524
static const double FEA2_f2[2][3] = \
2525
{{0.78867513, 0.21132487, 0.00000000},
2526
{0.21132487, 0.78867513, 0.00000000}};
2528
// Reset values in the element tensor.
2529
for (unsigned int r = 0; r < 6; r++)
2532
}// end loop over 'r'
2534
// Compute element tensor using UFL quadrature representation
2535
// Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
2540
// Total number of operations to compute element tensor (from this point): 80
2542
// Loop quadrature points for integral.
2544
// Declare array to hold physical coordinate of quadrature point.
2546
// Number of operations to compute element tensor for following IP loop = 80
2547
for (unsigned int ip = 0; ip < 2; ip++)
2550
// Compute physical coordinate of quadrature point, operations: 10.
2551
X2[0] = FEA2_f0[ip][0]*x[0][0] + FEA2_f0[ip][1]*x[1][0] + FEA2_f0[ip][2]*x[2][0];
2552
X2[1] = FEA2_f0[ip][0]*x[0][1] + FEA2_f0[ip][1]*x[1][1] + FEA2_f0[ip][2]*x[2][1];
2554
// Number of operations for primary indices: 30
2555
for (unsigned int j = 0; j < 6; j++)
2557
// Number of operations to compute entry: 5
2558
A[j] += FE0_f0[ip][j]*std::sin(5.00000000*X2[0])*W2[ip]*det;
2559
}// end loop over 'j'
2560
}// end loop over 'ip'
2565
// Total number of operations to compute element tensor (from this point): 80
2567
// Loop quadrature points for integral.
2569
// Declare array to hold physical coordinate of quadrature point.
2571
// Number of operations to compute element tensor for following IP loop = 80
2572
for (unsigned int ip = 0; ip < 2; ip++)
2575
// Compute physical coordinate of quadrature point, operations: 10.
2576
X2[0] = FEA2_f1[ip][0]*x[0][0] + FEA2_f1[ip][1]*x[1][0] + FEA2_f1[ip][2]*x[2][0];
2577
X2[1] = FEA2_f1[ip][0]*x[0][1] + FEA2_f1[ip][1]*x[1][1] + FEA2_f1[ip][2]*x[2][1];
2579
// Number of operations for primary indices: 30
2580
for (unsigned int j = 0; j < 6; j++)
2582
// Number of operations to compute entry: 5
2583
A[j] += FE0_f1[ip][j]*std::sin(5.00000000*X2[0])*W2[ip]*det;
2584
}// end loop over 'j'
2585
}// end loop over 'ip'
2590
// Total number of operations to compute element tensor (from this point): 80
2592
// Loop quadrature points for integral.
2594
// Declare array to hold physical coordinate of quadrature point.
2596
// Number of operations to compute element tensor for following IP loop = 80
2597
for (unsigned int ip = 0; ip < 2; ip++)
2600
// Compute physical coordinate of quadrature point, operations: 10.
2601
X2[0] = FEA2_f2[ip][0]*x[0][0] + FEA2_f2[ip][1]*x[1][0] + FEA2_f2[ip][2]*x[2][0];
2602
X2[1] = FEA2_f2[ip][0]*x[0][1] + FEA2_f2[ip][1]*x[1][1] + FEA2_f2[ip][2]*x[2][1];
2604
// Number of operations for primary indices: 30
2605
for (unsigned int j = 0; j < 6; j++)
2607
// Number of operations to compute entry: 5
2608
A[j] += FE0_f2[ip][j]*std::sin(5.00000000*X2[0])*W2[ip]*det;
2609
}// end loop over 'j'
2610
}// end loop over 'ip'
2619
/// This class defines the interface for the assembly of the global
2620
/// tensor corresponding to a form with r + n arguments, that is, a
2623
/// a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
2625
/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
2626
/// global tensor A is defined by
2628
/// A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
2630
/// where each argument Vj represents the application to the
2631
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
2632
/// fixed functions (coefficients).
2634
class spatialcoordinates_form_0: public ufc::form
2639
spatialcoordinates_form_0() : ufc::form()
2645
virtual ~spatialcoordinates_form_0()
2650
/// Return a string identifying the form
2651
virtual const char* signature() const
2653
return "Form([Integral(IndexSum(Product(Indexed(ComponentTensor(SpatialDerivative(Argument(FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2), 0), MultiIndex((Index(0),), {Index(0): 2})), MultiIndex((Index(0),), {Index(0): 2})), MultiIndex((Index(1),), {Index(1): 2})), Indexed(ComponentTensor(SpatialDerivative(Argument(FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2), 1), MultiIndex((Index(2),), {Index(2): 2})), MultiIndex((Index(2),), {Index(2): 2})), MultiIndex((Index(1),), {Index(1): 2}))), MultiIndex((Index(1),), {Index(1): 2})), Measure('cell', 0, None))])";
2656
/// Return the rank of the global tensor (r)
2657
virtual unsigned int rank() const
2662
/// Return the number of coefficients (n)
2663
virtual unsigned int num_coefficients() const
2668
/// Return the number of cell integrals
2669
virtual unsigned int num_cell_integrals() const
2674
/// Return the number of exterior facet integrals
2675
virtual unsigned int num_exterior_facet_integrals() const
2680
/// Return the number of interior facet integrals
2681
virtual unsigned int num_interior_facet_integrals() const
2686
/// Create a new finite element for argument function i
2687
virtual ufc::finite_element* create_finite_element(unsigned int i) const
2693
return new spatialcoordinates_finite_element_0();
2698
return new spatialcoordinates_finite_element_0();
2706
/// Create a new dof map for argument function i
2707
virtual ufc::dof_map* create_dof_map(unsigned int i) const
2713
return new spatialcoordinates_dof_map_0();
2718
return new spatialcoordinates_dof_map_0();
2726
/// Create a new cell integral on sub domain i
2727
virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
2733
return new spatialcoordinates_cell_integral_0_0();
2741
/// Create a new exterior facet integral on sub domain i
2742
virtual ufc::exterior_facet_integral* create_exterior_facet_integral(unsigned int i) const
2747
/// Create a new interior facet integral on sub domain i
2748
virtual ufc::interior_facet_integral* create_interior_facet_integral(unsigned int i) const
2755
/// This class defines the interface for the assembly of the global
2756
/// tensor corresponding to a form with r + n arguments, that is, a
2759
/// a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
2761
/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
2762
/// global tensor A is defined by
2764
/// A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
2766
/// where each argument Vj represents the application to the
2767
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
2768
/// fixed functions (coefficients).
2770
class spatialcoordinates_form_1: public ufc::form
2775
spatialcoordinates_form_1() : ufc::form()
2781
virtual ~spatialcoordinates_form_1()
2786
/// Return a string identifying the form
2787
virtual const char* signature() const
2789
return "Form([Integral(Product(Argument(FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2), 0), Product(FloatValue(10.0, (), (), {}), exp(Division(Product(IntValue(-1, (), (), {}), Sum(Power(Sum(FloatValue(-0.5, (), (), {}), Indexed(SpatialCoordinate(Cell('triangle', 1, Space(2))), MultiIndex((FixedIndex(0),), {FixedIndex(0): 2}))), IntValue(2, (), (), {})), Power(Sum(FloatValue(-0.5, (), (), {}), Indexed(SpatialCoordinate(Cell('triangle', 1, Space(2))), MultiIndex((FixedIndex(1),), {FixedIndex(1): 2}))), IntValue(2, (), (), {})))), FloatValue(0.02, (), (), {}))))), Measure('cell', 0, None)), Integral(Product(Argument(FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2), 0), sin(Product(FloatValue(5.0, (), (), {}), Indexed(SpatialCoordinate(Cell('triangle', 1, Space(2))), MultiIndex((FixedIndex(0),), {FixedIndex(0): 2}))))), Measure('exterior_facet', 0, None))])";
2792
/// Return the rank of the global tensor (r)
2793
virtual unsigned int rank() const
2798
/// Return the number of coefficients (n)
2799
virtual unsigned int num_coefficients() const
2804
/// Return the number of cell integrals
2805
virtual unsigned int num_cell_integrals() const
2810
/// Return the number of exterior facet integrals
2811
virtual unsigned int num_exterior_facet_integrals() const
2816
/// Return the number of interior facet integrals
2817
virtual unsigned int num_interior_facet_integrals() const
2822
/// Create a new finite element for argument function i
2823
virtual ufc::finite_element* create_finite_element(unsigned int i) const
2829
return new spatialcoordinates_finite_element_0();
2837
/// Create a new dof map for argument function i
2838
virtual ufc::dof_map* create_dof_map(unsigned int i) const
2844
return new spatialcoordinates_dof_map_0();
2852
/// Create a new cell integral on sub domain i
2853
virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
2859
return new spatialcoordinates_cell_integral_1_0();
2867
/// Create a new exterior facet integral on sub domain i
2868
virtual ufc::exterior_facet_integral* create_exterior_facet_integral(unsigned int i) const
2874
return new spatialcoordinates_exterior_facet_integral_1_0();
2882
/// Create a new interior facet integral on sub domain i
2883
virtual ufc::interior_facet_integral* create_interior_facet_integral(unsigned int i) const