64
64
/// Return the topological dimension of the cell shape
65
virtual unsigned int topological_dimension() const
65
virtual std::size_t topological_dimension() const
70
70
/// Return the geometric dimension of the cell shape
71
virtual unsigned int geometric_dimension() const
71
virtual std::size_t geometric_dimension() const
76
76
/// Return the dimension of the finite element function space
77
virtual unsigned int space_dimension() const
77
virtual std::size_t space_dimension() const
82
82
/// Return the rank of the value space
83
virtual unsigned int value_rank() const
83
virtual std::size_t value_rank() const
88
88
/// Return the dimension of the value space for axis i
89
virtual unsigned int value_dimension(unsigned int i) const
89
virtual std::size_t value_dimension(std::size_t i) const
94
/// Evaluate basis function i at given point in cell
95
virtual void evaluate_basis(unsigned int i,
94
/// Evaluate basis function i at given point x in cell
95
virtual void evaluate_basis(std::size_t i,
97
const double* coordinates,
98
const ufc::cell& c) const
98
const double* vertex_coordinates,
99
int cell_orientation) const
100
// Extract vertex coordinates
102
// Compute Jacobian of affine map from reference cell
104
// Compute determinant of Jacobian
106
// Compute inverse of Jacobian
103
compute_jacobian_triangle_2d(J, vertex_coordinates);
105
// Compute Jacobian inverse and determinant
108
compute_jacobian_inverse_triangle_2d(K, detJ, J);
108
111
// Compute constants
110
113
// Get coordinates and map to the reference (FIAT) element
115
// Array of basisvalues.
118
// Array of basisvalues
116
119
double basisvalues[1] = {0.0};
118
// Declare helper variables.
121
// Declare helper variables
120
// Compute basisvalues.
123
// Compute basisvalues
121
124
basisvalues[0] = 1.0;
123
// Table(s) of coefficients.
126
// Table(s) of coefficients
124
127
static const double coefficients0[1] = \
128
131
for (unsigned int r = 0; r < 1; r++)
130
133
*values += coefficients0[r]*basisvalues[r];
131
134
}// end loop over 'r'
134
/// Evaluate all basis functions at given point in cell
137
/// Evaluate all basis functions at given point x in cell
135
138
virtual void evaluate_basis_all(double* values,
136
const double* coordinates,
137
const ufc::cell& c) const
140
const double* vertex_coordinates,
141
int cell_orientation) const
139
143
// Element is constant, calling evaluate_basis.
140
evaluate_basis(0, values, coordinates, c);
144
evaluate_basis(0, values, x, vertex_coordinates, cell_orientation);
143
/// Evaluate order n derivatives of basis function i at given point in cell
144
virtual void evaluate_basis_derivatives(unsigned int i,
147
/// Evaluate order n derivatives of basis function i at given point x in cell
148
virtual void evaluate_basis_derivatives(std::size_t i,
147
const double* coordinates,
148
const ufc::cell& c) const
152
const double* vertex_coordinates,
153
int cell_orientation) const
150
// Extract vertex coordinates
151
const double * const * x = c.coordinates;
153
// Compute Jacobian of affine map from reference cell
154
const double J_00 = x[1][0] - x[0][0];
155
const double J_01 = x[2][0] - x[0][0];
156
const double J_10 = x[1][1] - x[0][1];
157
const double J_11 = x[2][1] - x[0][1];
159
// Compute determinant of Jacobian
160
double detJ = J_00*J_11 - J_01*J_10;
162
// Compute inverse of Jacobian
163
const double K_00 = J_11 / detJ;
164
const double K_01 = -J_01 / detJ;
165
const double K_10 = -J_10 / detJ;
166
const double K_11 = J_00 / detJ;
157
compute_jacobian_triangle_2d(J, vertex_coordinates);
159
// Compute Jacobian inverse and determinant
162
compute_jacobian_inverse_triangle_2d(K, detJ, J);
168
165
// Compute constants
363
360
delete [] transform;
366
/// Evaluate order n derivatives of all basis functions at given point in cell
367
virtual void evaluate_basis_derivatives_all(unsigned int n,
363
/// Evaluate order n derivatives of all basis functions at given point x in cell
364
virtual void evaluate_basis_derivatives_all(std::size_t n,
369
const double* coordinates,
370
const ufc::cell& c) const
367
const double* vertex_coordinates,
368
int cell_orientation) const
372
370
// Element is constant, calling evaluate_basis_derivatives.
373
evaluate_basis_derivatives(0, n, values, coordinates, c);
371
evaluate_basis_derivatives(0, n, values, x, vertex_coordinates, cell_orientation);
376
374
/// Evaluate linear functional for dof i on the function f
377
virtual double evaluate_dof(unsigned int i,
375
virtual double evaluate_dof(std::size_t i,
378
376
const ufc::function& f,
377
const double* vertex_coordinates,
378
int cell_orientation,
379
379
const ufc::cell& c) const
381
// Declare variables for result of evaluation.
381
// Declare variables for result of evaluation
384
// Declare variable for physical coordinates.
384
// Declare variable for physical coordinates
386
const double * const * x = c.coordinates;
391
y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
392
y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
390
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
391
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
393
392
f.evaluate(vals, y, c);
402
401
/// Evaluate linear functionals for all dofs on the function f
403
402
virtual void evaluate_dofs(double* values,
404
403
const ufc::function& f,
404
const double* vertex_coordinates,
405
int cell_orientation,
405
406
const ufc::cell& c) const
407
// Declare variables for result of evaluation.
408
// Declare variables for result of evaluation
410
// Declare variable for physical coordinates.
411
// Declare variable for physical coordinates
412
const double * const * x = c.coordinates;
413
y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
414
y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
413
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
414
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
415
415
f.evaluate(vals, y, c);
416
416
values[0] = vals[0];
496
498
/// Return the topological dimension of the cell shape
497
virtual unsigned int topological_dimension() const
499
virtual std::size_t topological_dimension() const
502
504
/// Return the geometric dimension of the cell shape
503
virtual unsigned int geometric_dimension() const
505
virtual std::size_t geometric_dimension() const
508
510
/// Return the dimension of the finite element function space
509
virtual unsigned int space_dimension() const
511
virtual std::size_t space_dimension() const
514
516
/// Return the rank of the value space
515
virtual unsigned int value_rank() const
517
virtual std::size_t value_rank() const
520
522
/// Return the dimension of the value space for axis i
521
virtual unsigned int value_dimension(unsigned int i) const
523
virtual std::size_t value_dimension(std::size_t i) const
535
/// Evaluate basis function i at given point in cell
536
virtual void evaluate_basis(unsigned int i,
537
/// Evaluate basis function i at given point x in cell
538
virtual void evaluate_basis(std::size_t i,
538
const double* coordinates,
539
const ufc::cell& c) const
541
const double* vertex_coordinates,
542
int cell_orientation) const
541
// Extract vertex coordinates
543
// Compute Jacobian of affine map from reference cell
545
// Compute determinant of Jacobian
547
// Compute inverse of Jacobian
546
compute_jacobian_triangle_2d(J, vertex_coordinates);
548
// Compute Jacobian inverse and determinant
551
compute_jacobian_inverse_triangle_2d(K, detJ, J);
549
554
// Compute constants
551
556
// Get coordinates and map to the reference (FIAT) element
629
/// Evaluate all basis functions at given point in cell
634
/// Evaluate all basis functions at given point x in cell
630
635
virtual void evaluate_basis_all(double* values,
631
const double* coordinates,
632
const ufc::cell& c) const
637
const double* vertex_coordinates,
638
int cell_orientation) const
634
640
// Helper variable to hold values of a single dof.
635
641
double dof_values[3] = {0.0, 0.0, 0.0};
637
// Loop dofs and call evaluate_basis.
643
// Loop dofs and call evaluate_basis
638
644
for (unsigned int r = 0; r < 3; r++)
640
evaluate_basis(r, dof_values, coordinates, c);
646
evaluate_basis(r, dof_values, x, vertex_coordinates, cell_orientation);
641
647
for (unsigned int s = 0; s < 3; s++)
643
649
values[r*3 + s] = dof_values[s];
645
651
}// end loop over 'r'
648
/// Evaluate order n derivatives of basis function i at given point in cell
649
virtual void evaluate_basis_derivatives(unsigned int i,
654
/// Evaluate order n derivatives of basis function i at given point x in cell
655
virtual void evaluate_basis_derivatives(std::size_t i,
652
const double* coordinates,
653
const ufc::cell& c) const
659
const double* vertex_coordinates,
660
int cell_orientation) const
655
// Extract vertex coordinates
656
const double * const * x = c.coordinates;
658
// Compute Jacobian of affine map from reference cell
659
const double J_00 = x[1][0] - x[0][0];
660
const double J_01 = x[2][0] - x[0][0];
661
const double J_10 = x[1][1] - x[0][1];
662
const double J_11 = x[2][1] - x[0][1];
664
// Compute determinant of Jacobian
665
double detJ = J_00*J_11 - J_01*J_10;
667
// Compute inverse of Jacobian
668
const double K_00 = J_11 / detJ;
669
const double K_01 = -J_01 / detJ;
670
const double K_10 = -J_10 / detJ;
671
const double K_11 = J_00 / detJ;
664
compute_jacobian_triangle_2d(J, vertex_coordinates);
666
// Compute Jacobian inverse and determinant
669
compute_jacobian_inverse_triangle_2d(K, detJ, J);
673
672
// Compute constants
1177
1177
/// Evaluate linear functional for dof i on the function f
1178
virtual double evaluate_dof(unsigned int i,
1178
virtual double evaluate_dof(std::size_t i,
1179
1179
const ufc::function& f,
1180
const double* vertex_coordinates,
1181
int cell_orientation,
1180
1182
const ufc::cell& c) const
1182
// Declare variables for result of evaluation.
1184
// Declare variables for result of evaluation
1183
1185
double vals[3];
1185
// Declare variable for physical coordinates.
1187
// Declare variable for physical coordinates
1187
const double * const * x = c.coordinates;
1192
y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1193
y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1193
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
1194
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1194
1195
f.evaluate(vals, y, c);
1195
1196
return vals[0];
1200
y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1201
y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1201
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
1202
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1202
1203
f.evaluate(vals, y, c);
1203
1204
return vals[1];
1208
y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1209
y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1209
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
1210
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1210
1211
f.evaluate(vals, y, c);
1211
1212
return vals[2];
1219
1220
/// Evaluate linear functionals for all dofs on the function f
1220
1221
virtual void evaluate_dofs(double* values,
1221
1222
const ufc::function& f,
1223
const double* vertex_coordinates,
1224
int cell_orientation,
1222
1225
const ufc::cell& c) const
1224
// Declare variables for result of evaluation.
1227
// Declare variables for result of evaluation
1225
1228
double vals[3];
1227
// Declare variable for physical coordinates.
1230
// Declare variable for physical coordinates
1229
const double * const * x = c.coordinates;
1230
y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1231
y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1232
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
1233
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1232
1234
f.evaluate(vals, y, c);
1233
1235
values[0] = vals[0];
1234
y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1235
y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1236
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
1237
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1236
1238
f.evaluate(vals, y, c);
1237
1239
values[1] = vals[1];
1238
y[0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1239
y[1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1240
y[0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
1241
y[1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1240
1242
f.evaluate(vals, y, c);
1241
1243
values[2] = vals[2];
1371
/// Initialize dofmap for mesh (return true iff init_cell() is needed)
1372
virtual bool init_mesh(const ufc::mesh& m)
1374
_global_dimension = 1;
1378
/// Initialize dofmap for given cell
1379
virtual void init_cell(const ufc::mesh& m,
1385
/// Finish initialization of dofmap for cells
1386
virtual void init_cell_finalize()
1391
1372
/// Return the topological dimension of the associated cell shape
1392
virtual unsigned int topological_dimension() const
1373
virtual std::size_t topological_dimension() const
1397
1378
/// Return the geometric dimension of the associated cell shape
1398
virtual unsigned int geometric_dimension() const
1379
virtual std::size_t geometric_dimension() const
1403
1384
/// Return the dimension of the global finite element function space
1404
virtual unsigned int global_dimension() const
1385
virtual std::size_t global_dimension(const std::vector<std::size_t>&
1386
num_global_entities) const
1406
return _global_dimension;
1409
1391
/// Return the dimension of the local finite element function space for a cell
1410
virtual unsigned int local_dimension(const ufc::cell& c) const
1392
virtual std::size_t local_dimension(const ufc::cell& c) const
1415
1397
/// Return the maximum dimension of the local finite element function space
1416
virtual unsigned int max_local_dimension() const
1398
virtual std::size_t max_local_dimension() const
1421
1403
/// Return the number of dofs on each cell facet
1422
virtual unsigned int num_facet_dofs() const
1404
virtual std::size_t num_facet_dofs() const
1427
1409
/// Return the number of dofs associated with each cell entity of dimension d
1428
virtual unsigned int num_entity_dofs(unsigned int d) const
1410
virtual std::size_t num_entity_dofs(std::size_t d) const
1520
1502
/// Tabulate the coordinates of all dofs on a cell
1521
virtual void tabulate_coordinates(double** coordinates,
1522
const ufc::cell& c) const
1503
virtual void tabulate_coordinates(double** dof_coordinates,
1504
const double* vertex_coordinates) const
1524
const double * const * x = c.coordinates;
1526
coordinates[0][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1527
coordinates[0][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1506
dof_coordinates[0][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
1507
dof_coordinates[0][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1530
1510
/// Return the number of sub dofmaps (for a mixed element)
1531
virtual unsigned int num_sub_dofmaps() const
1511
virtual std::size_t num_sub_dofmaps() const
1536
1516
/// Create a new dofmap for sub dofmap i (for a mixed element)
1537
virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
1517
virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const
1603
/// Initialize dofmap for mesh (return true iff init_cell() is needed)
1604
virtual bool init_mesh(const ufc::mesh& m)
1606
_global_dimension = 3;
1610
/// Initialize dofmap for given cell
1611
virtual void init_cell(const ufc::mesh& m,
1617
/// Finish initialization of dofmap for cells
1618
virtual void init_cell_finalize()
1623
1580
/// Return the topological dimension of the associated cell shape
1624
virtual unsigned int topological_dimension() const
1581
virtual std::size_t topological_dimension() const
1629
1586
/// Return the geometric dimension of the associated cell shape
1630
virtual unsigned int geometric_dimension() const
1587
virtual std::size_t geometric_dimension() const
1635
1592
/// Return the dimension of the global finite element function space
1636
virtual unsigned int global_dimension() const
1593
virtual std::size_t global_dimension(const std::vector<std::size_t>&
1594
num_global_entities) const
1638
return _global_dimension;
1641
1599
/// Return the dimension of the local finite element function space for a cell
1642
virtual unsigned int local_dimension(const ufc::cell& c) const
1600
virtual std::size_t local_dimension(const ufc::cell& c) const
1647
1605
/// Return the maximum dimension of the local finite element function space
1648
virtual unsigned int max_local_dimension() const
1606
virtual std::size_t max_local_dimension() const
1653
1611
/// Return the number of dofs on each cell facet
1654
virtual unsigned int num_facet_dofs() const
1612
virtual std::size_t num_facet_dofs() const
1659
1617
/// Return the number of dofs associated with each cell entity of dimension d
1660
virtual unsigned int num_entity_dofs(unsigned int d) const
1618
virtual std::size_t num_entity_dofs(std::size_t d) const
1760
1718
/// Tabulate the coordinates of all dofs on a cell
1761
virtual void tabulate_coordinates(double** coordinates,
1762
const ufc::cell& c) const
1719
virtual void tabulate_coordinates(double** dof_coordinates,
1720
const double* vertex_coordinates) const
1764
const double * const * x = c.coordinates;
1766
coordinates[0][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1767
coordinates[0][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1768
coordinates[1][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1769
coordinates[1][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1770
coordinates[2][0] = 0.33333333*x[0][0] + 0.33333333*x[1][0] + 0.33333333*x[2][0];
1771
coordinates[2][1] = 0.33333333*x[0][1] + 0.33333333*x[1][1] + 0.33333333*x[2][1];
1722
dof_coordinates[0][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
1723
dof_coordinates[0][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1724
dof_coordinates[1][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
1725
dof_coordinates[1][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1726
dof_coordinates[2][0] = 0.33333333*vertex_coordinates[0] + 0.33333333*vertex_coordinates[2] + 0.33333333*vertex_coordinates[4];
1727
dof_coordinates[2][1] = 0.33333333*vertex_coordinates[1] + 0.33333333*vertex_coordinates[3] + 0.33333333*vertex_coordinates[5];
1774
1730
/// Return the number of sub dofmaps (for a mixed element)
1775
virtual unsigned int num_sub_dofmaps() const
1731
virtual std::size_t num_sub_dofmaps() const
1780
1736
/// Create a new dofmap for sub dofmap i (for a mixed element)
1781
virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
1737
virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const