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
101
const double * const * x = c.coordinates;
103
// Compute Jacobian of affine map from reference cell
104
const double J_00 = x[1][0] - x[0][0];
105
const double J_01 = x[2][0] - x[0][0];
106
const double J_10 = x[1][1] - x[0][1];
107
const double J_11 = x[2][1] - x[0][1];
109
// Compute determinant of Jacobian
110
double detJ = J_00*J_11 - J_01*J_10;
112
// 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);
114
111
// Compute constants
115
const double C0 = x[1][0] + x[2][0];
116
const double C1 = x[1][1] + x[2][1];
112
const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
113
const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
118
115
// Get coordinates and map to the reference (FIAT) element
119
double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
120
double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
116
double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
117
double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
129
// Array of basisvalues.
126
// Array of basisvalues
130
127
double basisvalues[21] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
132
// Declare helper variables.
129
// Declare helper variables
133
130
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
134
131
double tmp1 = (1.0 - Y)/2.0;
135
132
double tmp2 = tmp1*tmp1;
137
// Compute basisvalues.
134
// Compute basisvalues
138
135
basisvalues[0] = 1.0;
139
136
basisvalues[1] = tmp0;
140
137
basisvalues[3] = basisvalues[1]*1.5*tmp0 - basisvalues[0]*0.5*tmp2;
1516
/// Evaluate all basis functions at given point in cell
1513
/// Evaluate all basis functions at given point x in cell
1517
1514
virtual void evaluate_basis_all(double* values,
1518
const double* coordinates,
1519
const ufc::cell& c) const
1516
const double* vertex_coordinates,
1517
int cell_orientation) const
1521
1519
// Helper variable to hold values of a single dof.
1522
1520
double dof_values = 0.0;
1524
// Loop dofs and call evaluate_basis.
1522
// Loop dofs and call evaluate_basis
1525
1523
for (unsigned int r = 0; r < 21; r++)
1527
evaluate_basis(r, &dof_values, coordinates, c);
1525
evaluate_basis(r, &dof_values, x, vertex_coordinates, cell_orientation);
1528
1526
values[r] = dof_values;
1529
1527
}// end loop over 'r'
1532
/// Evaluate order n derivatives of basis function i at given point in cell
1533
virtual void evaluate_basis_derivatives(unsigned int i,
1530
/// Evaluate order n derivatives of basis function i at given point x in cell
1531
virtual void evaluate_basis_derivatives(std::size_t i,
1535
1533
double* values,
1536
const double* coordinates,
1537
const ufc::cell& c) const
1535
const double* vertex_coordinates,
1536
int cell_orientation) const
1539
// Extract vertex coordinates
1540
const double * const * x = c.coordinates;
1542
// Compute Jacobian of affine map from reference cell
1543
const double J_00 = x[1][0] - x[0][0];
1544
const double J_01 = x[2][0] - x[0][0];
1545
const double J_10 = x[1][1] - x[0][1];
1546
const double J_11 = x[2][1] - x[0][1];
1548
// Compute determinant of Jacobian
1549
double detJ = J_00*J_11 - J_01*J_10;
1551
// Compute inverse of Jacobian
1552
const double K_00 = J_11 / detJ;
1553
const double K_01 = -J_01 / detJ;
1554
const double K_10 = -J_10 / detJ;
1555
const double K_11 = J_00 / detJ;
1540
compute_jacobian_triangle_2d(J, vertex_coordinates);
1542
// Compute Jacobian inverse and determinant
1545
compute_jacobian_inverse_triangle_2d(K, detJ, J);
1557
1548
// Compute constants
1558
const double C0 = x[1][0] + x[2][0];
1559
const double C1 = x[1][1] + x[2][1];
1549
const double C0 = vertex_coordinates[2] + vertex_coordinates[4];
1550
const double C1 = vertex_coordinates[3] + vertex_coordinates[5];
1561
1552
// Get coordinates and map to the reference (FIAT) element
1562
double X = (J_01*(C1 - 2.0*coordinates[1]) + J_11*(2.0*coordinates[0] - C0)) / detJ;
1563
double Y = (J_00*(2.0*coordinates[1] - C1) + J_10*(C0 - 2.0*coordinates[0])) / detJ;
1553
double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
1554
double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
1565
1556
// Compute number of derivatives.
1566
1557
unsigned int num_derivatives = 1;
7045
7037
/// Evaluate linear functional for dof i on the function f
7046
virtual double evaluate_dof(unsigned int i,
7038
virtual double evaluate_dof(std::size_t i,
7047
7039
const ufc::function& f,
7040
const double* vertex_coordinates,
7041
int cell_orientation,
7048
7042
const ufc::cell& c) const
7050
// Declare variables for result of evaluation.
7044
// Declare variables for result of evaluation
7051
7045
double vals[1];
7053
// Declare variable for physical coordinates.
7047
// Declare variable for physical coordinates
7055
const double * const * x = c.coordinates;
7053
y[0] = vertex_coordinates[0];
7054
y[1] = vertex_coordinates[1];
7062
7055
f.evaluate(vals, y, c);
7063
7056
return vals[0];
7061
y[0] = vertex_coordinates[2];
7062
y[1] = vertex_coordinates[3];
7070
7063
f.evaluate(vals, y, c);
7071
7064
return vals[0];
7069
y[0] = vertex_coordinates[4];
7070
y[1] = vertex_coordinates[5];
7078
7071
f.evaluate(vals, y, c);
7079
7072
return vals[0];
7084
y[0] = 0.8*x[1][0] + 0.2*x[2][0];
7085
y[1] = 0.8*x[1][1] + 0.2*x[2][1];
7077
y[0] = 0.8*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
7078
y[1] = 0.8*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
7086
7079
f.evaluate(vals, y, c);
7087
7080
return vals[0];
7092
y[0] = 0.6*x[1][0] + 0.4*x[2][0];
7093
y[1] = 0.6*x[1][1] + 0.4*x[2][1];
7085
y[0] = 0.6*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
7086
y[1] = 0.6*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
7094
7087
f.evaluate(vals, y, c);
7095
7088
return vals[0];
7100
y[0] = 0.4*x[1][0] + 0.6*x[2][0];
7101
y[1] = 0.4*x[1][1] + 0.6*x[2][1];
7093
y[0] = 0.4*vertex_coordinates[2] + 0.6*vertex_coordinates[4];
7094
y[1] = 0.4*vertex_coordinates[3] + 0.6*vertex_coordinates[5];
7102
7095
f.evaluate(vals, y, c);
7103
7096
return vals[0];
7108
y[0] = 0.2*x[1][0] + 0.8*x[2][0];
7109
y[1] = 0.2*x[1][1] + 0.8*x[2][1];
7101
y[0] = 0.2*vertex_coordinates[2] + 0.8*vertex_coordinates[4];
7102
y[1] = 0.2*vertex_coordinates[3] + 0.8*vertex_coordinates[5];
7110
7103
f.evaluate(vals, y, c);
7111
7104
return vals[0];
7116
y[0] = 0.8*x[0][0] + 0.2*x[2][0];
7117
y[1] = 0.8*x[0][1] + 0.2*x[2][1];
7109
y[0] = 0.8*vertex_coordinates[0] + 0.2*vertex_coordinates[4];
7110
y[1] = 0.8*vertex_coordinates[1] + 0.2*vertex_coordinates[5];
7118
7111
f.evaluate(vals, y, c);
7119
7112
return vals[0];
7124
y[0] = 0.6*x[0][0] + 0.4*x[2][0];
7125
y[1] = 0.6*x[0][1] + 0.4*x[2][1];
7117
y[0] = 0.6*vertex_coordinates[0] + 0.4*vertex_coordinates[4];
7118
y[1] = 0.6*vertex_coordinates[1] + 0.4*vertex_coordinates[5];
7126
7119
f.evaluate(vals, y, c);
7127
7120
return vals[0];
7132
y[0] = 0.4*x[0][0] + 0.6*x[2][0];
7133
y[1] = 0.4*x[0][1] + 0.6*x[2][1];
7125
y[0] = 0.4*vertex_coordinates[0] + 0.6*vertex_coordinates[4];
7126
y[1] = 0.4*vertex_coordinates[1] + 0.6*vertex_coordinates[5];
7134
7127
f.evaluate(vals, y, c);
7135
7128
return vals[0];
7140
y[0] = 0.2*x[0][0] + 0.8*x[2][0];
7141
y[1] = 0.2*x[0][1] + 0.8*x[2][1];
7133
y[0] = 0.2*vertex_coordinates[0] + 0.8*vertex_coordinates[4];
7134
y[1] = 0.2*vertex_coordinates[1] + 0.8*vertex_coordinates[5];
7142
7135
f.evaluate(vals, y, c);
7143
7136
return vals[0];
7148
y[0] = 0.8*x[0][0] + 0.2*x[1][0];
7149
y[1] = 0.8*x[0][1] + 0.2*x[1][1];
7141
y[0] = 0.8*vertex_coordinates[0] + 0.2*vertex_coordinates[2];
7142
y[1] = 0.8*vertex_coordinates[1] + 0.2*vertex_coordinates[3];
7150
7143
f.evaluate(vals, y, c);
7151
7144
return vals[0];
7156
y[0] = 0.6*x[0][0] + 0.4*x[1][0];
7157
y[1] = 0.6*x[0][1] + 0.4*x[1][1];
7149
y[0] = 0.6*vertex_coordinates[0] + 0.4*vertex_coordinates[2];
7150
y[1] = 0.6*vertex_coordinates[1] + 0.4*vertex_coordinates[3];
7158
7151
f.evaluate(vals, y, c);
7159
7152
return vals[0];
7164
y[0] = 0.4*x[0][0] + 0.6*x[1][0];
7165
y[1] = 0.4*x[0][1] + 0.6*x[1][1];
7157
y[0] = 0.4*vertex_coordinates[0] + 0.6*vertex_coordinates[2];
7158
y[1] = 0.4*vertex_coordinates[1] + 0.6*vertex_coordinates[3];
7166
7159
f.evaluate(vals, y, c);
7167
7160
return vals[0];
7172
y[0] = 0.2*x[0][0] + 0.8*x[1][0];
7173
y[1] = 0.2*x[0][1] + 0.8*x[1][1];
7165
y[0] = 0.2*vertex_coordinates[0] + 0.8*vertex_coordinates[2];
7166
y[1] = 0.2*vertex_coordinates[1] + 0.8*vertex_coordinates[3];
7174
7167
f.evaluate(vals, y, c);
7175
7168
return vals[0];
7180
y[0] = 0.6*x[0][0] + 0.2*x[1][0] + 0.2*x[2][0];
7181
y[1] = 0.6*x[0][1] + 0.2*x[1][1] + 0.2*x[2][1];
7173
y[0] = 0.6*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
7174
y[1] = 0.6*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
7182
7175
f.evaluate(vals, y, c);
7183
7176
return vals[0];
7188
y[0] = 0.4*x[0][0] + 0.4*x[1][0] + 0.2*x[2][0];
7189
y[1] = 0.4*x[0][1] + 0.4*x[1][1] + 0.2*x[2][1];
7181
y[0] = 0.4*vertex_coordinates[0] + 0.4*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
7182
y[1] = 0.4*vertex_coordinates[1] + 0.4*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
7190
7183
f.evaluate(vals, y, c);
7191
7184
return vals[0];
7196
y[0] = 0.2*x[0][0] + 0.6*x[1][0] + 0.2*x[2][0];
7197
y[1] = 0.2*x[0][1] + 0.6*x[1][1] + 0.2*x[2][1];
7189
y[0] = 0.2*vertex_coordinates[0] + 0.6*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
7190
y[1] = 0.2*vertex_coordinates[1] + 0.6*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
7198
7191
f.evaluate(vals, y, c);
7199
7192
return vals[0];
7204
y[0] = 0.4*x[0][0] + 0.2*x[1][0] + 0.4*x[2][0];
7205
y[1] = 0.4*x[0][1] + 0.2*x[1][1] + 0.4*x[2][1];
7197
y[0] = 0.4*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
7198
y[1] = 0.4*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
7206
7199
f.evaluate(vals, y, c);
7207
7200
return vals[0];
7212
y[0] = 0.2*x[0][0] + 0.4*x[1][0] + 0.4*x[2][0];
7213
y[1] = 0.2*x[0][1] + 0.4*x[1][1] + 0.4*x[2][1];
7205
y[0] = 0.2*vertex_coordinates[0] + 0.4*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
7206
y[1] = 0.2*vertex_coordinates[1] + 0.4*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
7214
7207
f.evaluate(vals, y, c);
7215
7208
return vals[0];
7220
y[0] = 0.2*x[0][0] + 0.2*x[1][0] + 0.6*x[2][0];
7221
y[1] = 0.2*x[0][1] + 0.2*x[1][1] + 0.6*x[2][1];
7213
y[0] = 0.2*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.6*vertex_coordinates[4];
7214
y[1] = 0.2*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.6*vertex_coordinates[5];
7222
7215
f.evaluate(vals, y, c);
7223
7216
return vals[0];
7231
7224
/// Evaluate linear functionals for all dofs on the function f
7232
7225
virtual void evaluate_dofs(double* values,
7233
7226
const ufc::function& f,
7227
const double* vertex_coordinates,
7228
int cell_orientation,
7234
7229
const ufc::cell& c) const
7236
// Declare variables for result of evaluation.
7231
// Declare variables for result of evaluation
7237
7232
double vals[1];
7239
// Declare variable for physical coordinates.
7234
// Declare variable for physical coordinates
7241
const double * const * x = c.coordinates;
7236
y[0] = vertex_coordinates[0];
7237
y[1] = vertex_coordinates[1];
7244
7238
f.evaluate(vals, y, c);
7245
7239
values[0] = vals[0];
7240
y[0] = vertex_coordinates[2];
7241
y[1] = vertex_coordinates[3];
7248
7242
f.evaluate(vals, y, c);
7249
7243
values[1] = vals[0];
7244
y[0] = vertex_coordinates[4];
7245
y[1] = vertex_coordinates[5];
7252
7246
f.evaluate(vals, y, c);
7253
7247
values[2] = vals[0];
7254
y[0] = 0.8*x[1][0] + 0.2*x[2][0];
7255
y[1] = 0.8*x[1][1] + 0.2*x[2][1];
7248
y[0] = 0.8*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
7249
y[1] = 0.8*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
7256
7250
f.evaluate(vals, y, c);
7257
7251
values[3] = vals[0];
7258
y[0] = 0.6*x[1][0] + 0.4*x[2][0];
7259
y[1] = 0.6*x[1][1] + 0.4*x[2][1];
7252
y[0] = 0.6*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
7253
y[1] = 0.6*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
7260
7254
f.evaluate(vals, y, c);
7261
7255
values[4] = vals[0];
7262
y[0] = 0.4*x[1][0] + 0.6*x[2][0];
7263
y[1] = 0.4*x[1][1] + 0.6*x[2][1];
7256
y[0] = 0.4*vertex_coordinates[2] + 0.6*vertex_coordinates[4];
7257
y[1] = 0.4*vertex_coordinates[3] + 0.6*vertex_coordinates[5];
7264
7258
f.evaluate(vals, y, c);
7265
7259
values[5] = vals[0];
7266
y[0] = 0.2*x[1][0] + 0.8*x[2][0];
7267
y[1] = 0.2*x[1][1] + 0.8*x[2][1];
7260
y[0] = 0.2*vertex_coordinates[2] + 0.8*vertex_coordinates[4];
7261
y[1] = 0.2*vertex_coordinates[3] + 0.8*vertex_coordinates[5];
7268
7262
f.evaluate(vals, y, c);
7269
7263
values[6] = vals[0];
7270
y[0] = 0.8*x[0][0] + 0.2*x[2][0];
7271
y[1] = 0.8*x[0][1] + 0.2*x[2][1];
7264
y[0] = 0.8*vertex_coordinates[0] + 0.2*vertex_coordinates[4];
7265
y[1] = 0.8*vertex_coordinates[1] + 0.2*vertex_coordinates[5];
7272
7266
f.evaluate(vals, y, c);
7273
7267
values[7] = vals[0];
7274
y[0] = 0.6*x[0][0] + 0.4*x[2][0];
7275
y[1] = 0.6*x[0][1] + 0.4*x[2][1];
7268
y[0] = 0.6*vertex_coordinates[0] + 0.4*vertex_coordinates[4];
7269
y[1] = 0.6*vertex_coordinates[1] + 0.4*vertex_coordinates[5];
7276
7270
f.evaluate(vals, y, c);
7277
7271
values[8] = vals[0];
7278
y[0] = 0.4*x[0][0] + 0.6*x[2][0];
7279
y[1] = 0.4*x[0][1] + 0.6*x[2][1];
7272
y[0] = 0.4*vertex_coordinates[0] + 0.6*vertex_coordinates[4];
7273
y[1] = 0.4*vertex_coordinates[1] + 0.6*vertex_coordinates[5];
7280
7274
f.evaluate(vals, y, c);
7281
7275
values[9] = vals[0];
7282
y[0] = 0.2*x[0][0] + 0.8*x[2][0];
7283
y[1] = 0.2*x[0][1] + 0.8*x[2][1];
7276
y[0] = 0.2*vertex_coordinates[0] + 0.8*vertex_coordinates[4];
7277
y[1] = 0.2*vertex_coordinates[1] + 0.8*vertex_coordinates[5];
7284
7278
f.evaluate(vals, y, c);
7285
7279
values[10] = vals[0];
7286
y[0] = 0.8*x[0][0] + 0.2*x[1][0];
7287
y[1] = 0.8*x[0][1] + 0.2*x[1][1];
7280
y[0] = 0.8*vertex_coordinates[0] + 0.2*vertex_coordinates[2];
7281
y[1] = 0.8*vertex_coordinates[1] + 0.2*vertex_coordinates[3];
7288
7282
f.evaluate(vals, y, c);
7289
7283
values[11] = vals[0];
7290
y[0] = 0.6*x[0][0] + 0.4*x[1][0];
7291
y[1] = 0.6*x[0][1] + 0.4*x[1][1];
7284
y[0] = 0.6*vertex_coordinates[0] + 0.4*vertex_coordinates[2];
7285
y[1] = 0.6*vertex_coordinates[1] + 0.4*vertex_coordinates[3];
7292
7286
f.evaluate(vals, y, c);
7293
7287
values[12] = vals[0];
7294
y[0] = 0.4*x[0][0] + 0.6*x[1][0];
7295
y[1] = 0.4*x[0][1] + 0.6*x[1][1];
7288
y[0] = 0.4*vertex_coordinates[0] + 0.6*vertex_coordinates[2];
7289
y[1] = 0.4*vertex_coordinates[1] + 0.6*vertex_coordinates[3];
7296
7290
f.evaluate(vals, y, c);
7297
7291
values[13] = vals[0];
7298
y[0] = 0.2*x[0][0] + 0.8*x[1][0];
7299
y[1] = 0.2*x[0][1] + 0.8*x[1][1];
7292
y[0] = 0.2*vertex_coordinates[0] + 0.8*vertex_coordinates[2];
7293
y[1] = 0.2*vertex_coordinates[1] + 0.8*vertex_coordinates[3];
7300
7294
f.evaluate(vals, y, c);
7301
7295
values[14] = vals[0];
7302
y[0] = 0.6*x[0][0] + 0.2*x[1][0] + 0.2*x[2][0];
7303
y[1] = 0.6*x[0][1] + 0.2*x[1][1] + 0.2*x[2][1];
7296
y[0] = 0.6*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
7297
y[1] = 0.6*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
7304
7298
f.evaluate(vals, y, c);
7305
7299
values[15] = vals[0];
7306
y[0] = 0.4*x[0][0] + 0.4*x[1][0] + 0.2*x[2][0];
7307
y[1] = 0.4*x[0][1] + 0.4*x[1][1] + 0.2*x[2][1];
7300
y[0] = 0.4*vertex_coordinates[0] + 0.4*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
7301
y[1] = 0.4*vertex_coordinates[1] + 0.4*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
7308
7302
f.evaluate(vals, y, c);
7309
7303
values[16] = vals[0];
7310
y[0] = 0.2*x[0][0] + 0.6*x[1][0] + 0.2*x[2][0];
7311
y[1] = 0.2*x[0][1] + 0.6*x[1][1] + 0.2*x[2][1];
7304
y[0] = 0.2*vertex_coordinates[0] + 0.6*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
7305
y[1] = 0.2*vertex_coordinates[1] + 0.6*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
7312
7306
f.evaluate(vals, y, c);
7313
7307
values[17] = vals[0];
7314
y[0] = 0.4*x[0][0] + 0.2*x[1][0] + 0.4*x[2][0];
7315
y[1] = 0.4*x[0][1] + 0.2*x[1][1] + 0.4*x[2][1];
7308
y[0] = 0.4*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
7309
y[1] = 0.4*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
7316
7310
f.evaluate(vals, y, c);
7317
7311
values[18] = vals[0];
7318
y[0] = 0.2*x[0][0] + 0.4*x[1][0] + 0.4*x[2][0];
7319
y[1] = 0.2*x[0][1] + 0.4*x[1][1] + 0.4*x[2][1];
7312
y[0] = 0.2*vertex_coordinates[0] + 0.4*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
7313
y[1] = 0.2*vertex_coordinates[1] + 0.4*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
7320
7314
f.evaluate(vals, y, c);
7321
7315
values[19] = vals[0];
7322
y[0] = 0.2*x[0][0] + 0.2*x[1][0] + 0.6*x[2][0];
7323
y[1] = 0.2*x[0][1] + 0.2*x[1][1] + 0.6*x[2][1];
7316
y[0] = 0.2*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.6*vertex_coordinates[4];
7317
y[1] = 0.2*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.6*vertex_coordinates[5];
7324
7318
f.evaluate(vals, y, c);
7325
7319
values[20] = vals[0];
7428
/// Initialize dofmap for mesh (return true iff init_cell() is needed)
7429
virtual bool init_mesh(const ufc::mesh& m)
7431
_global_dimension = m.num_entities[0] + 4*m.num_entities[1] + 6*m.num_entities[2];
7435
/// Initialize dofmap for given cell
7436
virtual void init_cell(const ufc::mesh& m,
7442
/// Finish initialization of dofmap for cells
7443
virtual void init_cell_finalize()
7448
7421
/// Return the topological dimension of the associated cell shape
7449
virtual unsigned int topological_dimension() const
7422
virtual std::size_t topological_dimension() const
7454
7427
/// Return the geometric dimension of the associated cell shape
7455
virtual unsigned int geometric_dimension() const
7428
virtual std::size_t geometric_dimension() const
7460
7433
/// Return the dimension of the global finite element function space
7461
virtual unsigned int global_dimension() const
7434
virtual std::size_t global_dimension(const std::vector<std::size_t>&
7435
num_global_entities) const
7463
return _global_dimension;
7437
return num_global_entities[0] + 4*num_global_entities[1] + 6*num_global_entities[2];
7466
7440
/// Return the dimension of the local finite element function space for a cell
7467
virtual unsigned int local_dimension(const ufc::cell& c) const
7441
virtual std::size_t local_dimension(const ufc::cell& c) const
7472
7446
/// Return the maximum dimension of the local finite element function space
7473
virtual unsigned int max_local_dimension() const
7447
virtual std::size_t max_local_dimension() const
7478
7452
/// Return the number of dofs on each cell facet
7479
virtual unsigned int num_facet_dofs() const
7453
virtual std::size_t num_facet_dofs() const
7484
7458
/// Return the number of dofs associated with each cell entity of dimension d
7485
virtual unsigned int num_entity_dofs(unsigned int d) const
7459
virtual std::size_t num_entity_dofs(std::size_t d) const
7528
7502
dofs[12] = offset + 4*c.entity_indices[1][2] + 1;
7529
7503
dofs[13] = offset + 4*c.entity_indices[1][2] + 2;
7530
7504
dofs[14] = offset + 4*c.entity_indices[1][2] + 3;
7531
offset += 4*m.num_entities[1];
7505
offset += 4*num_global_entities[1];
7532
7506
dofs[15] = offset + 6*c.entity_indices[2][0];
7533
7507
dofs[16] = offset + 6*c.entity_indices[2][0] + 1;
7534
7508
dofs[17] = offset + 6*c.entity_indices[2][0] + 2;
7535
7509
dofs[18] = offset + 6*c.entity_indices[2][0] + 3;
7536
7510
dofs[19] = offset + 6*c.entity_indices[2][0] + 4;
7537
7511
dofs[20] = offset + 6*c.entity_indices[2][0] + 5;
7538
offset += 6*m.num_entities[2];
7512
offset += 6*num_global_entities[2];
7541
7515
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
7542
virtual void tabulate_facet_dofs(unsigned int* dofs,
7543
unsigned int facet) const
7516
virtual void tabulate_facet_dofs(std::size_t* dofs,
7517
std::size_t facet) const
7676
7650
/// Tabulate the coordinates of all dofs on a cell
7677
virtual void tabulate_coordinates(double** coordinates,
7678
const ufc::cell& c) const
7651
virtual void tabulate_coordinates(double** dof_coordinates,
7652
const double* vertex_coordinates) const
7680
const double * const * x = c.coordinates;
7682
coordinates[0][0] = x[0][0];
7683
coordinates[0][1] = x[0][1];
7684
coordinates[1][0] = x[1][0];
7685
coordinates[1][1] = x[1][1];
7686
coordinates[2][0] = x[2][0];
7687
coordinates[2][1] = x[2][1];
7688
coordinates[3][0] = 0.8*x[1][0] + 0.2*x[2][0];
7689
coordinates[3][1] = 0.8*x[1][1] + 0.2*x[2][1];
7690
coordinates[4][0] = 0.6*x[1][0] + 0.4*x[2][0];
7691
coordinates[4][1] = 0.6*x[1][1] + 0.4*x[2][1];
7692
coordinates[5][0] = 0.4*x[1][0] + 0.6*x[2][0];
7693
coordinates[5][1] = 0.4*x[1][1] + 0.6*x[2][1];
7694
coordinates[6][0] = 0.2*x[1][0] + 0.8*x[2][0];
7695
coordinates[6][1] = 0.2*x[1][1] + 0.8*x[2][1];
7696
coordinates[7][0] = 0.8*x[0][0] + 0.2*x[2][0];
7697
coordinates[7][1] = 0.8*x[0][1] + 0.2*x[2][1];
7698
coordinates[8][0] = 0.6*x[0][0] + 0.4*x[2][0];
7699
coordinates[8][1] = 0.6*x[0][1] + 0.4*x[2][1];
7700
coordinates[9][0] = 0.4*x[0][0] + 0.6*x[2][0];
7701
coordinates[9][1] = 0.4*x[0][1] + 0.6*x[2][1];
7702
coordinates[10][0] = 0.2*x[0][0] + 0.8*x[2][0];
7703
coordinates[10][1] = 0.2*x[0][1] + 0.8*x[2][1];
7704
coordinates[11][0] = 0.8*x[0][0] + 0.2*x[1][0];
7705
coordinates[11][1] = 0.8*x[0][1] + 0.2*x[1][1];
7706
coordinates[12][0] = 0.6*x[0][0] + 0.4*x[1][0];
7707
coordinates[12][1] = 0.6*x[0][1] + 0.4*x[1][1];
7708
coordinates[13][0] = 0.4*x[0][0] + 0.6*x[1][0];
7709
coordinates[13][1] = 0.4*x[0][1] + 0.6*x[1][1];
7710
coordinates[14][0] = 0.2*x[0][0] + 0.8*x[1][0];
7711
coordinates[14][1] = 0.2*x[0][1] + 0.8*x[1][1];
7712
coordinates[15][0] = 0.6*x[0][0] + 0.2*x[1][0] + 0.2*x[2][0];
7713
coordinates[15][1] = 0.6*x[0][1] + 0.2*x[1][1] + 0.2*x[2][1];
7714
coordinates[16][0] = 0.4*x[0][0] + 0.4*x[1][0] + 0.2*x[2][0];
7715
coordinates[16][1] = 0.4*x[0][1] + 0.4*x[1][1] + 0.2*x[2][1];
7716
coordinates[17][0] = 0.2*x[0][0] + 0.6*x[1][0] + 0.2*x[2][0];
7717
coordinates[17][1] = 0.2*x[0][1] + 0.6*x[1][1] + 0.2*x[2][1];
7718
coordinates[18][0] = 0.4*x[0][0] + 0.2*x[1][0] + 0.4*x[2][0];
7719
coordinates[18][1] = 0.4*x[0][1] + 0.2*x[1][1] + 0.4*x[2][1];
7720
coordinates[19][0] = 0.2*x[0][0] + 0.4*x[1][0] + 0.4*x[2][0];
7721
coordinates[19][1] = 0.2*x[0][1] + 0.4*x[1][1] + 0.4*x[2][1];
7722
coordinates[20][0] = 0.2*x[0][0] + 0.2*x[1][0] + 0.6*x[2][0];
7723
coordinates[20][1] = 0.2*x[0][1] + 0.2*x[1][1] + 0.6*x[2][1];
7654
dof_coordinates[0][0] = vertex_coordinates[0];
7655
dof_coordinates[0][1] = vertex_coordinates[1];
7656
dof_coordinates[1][0] = vertex_coordinates[2];
7657
dof_coordinates[1][1] = vertex_coordinates[3];
7658
dof_coordinates[2][0] = vertex_coordinates[4];
7659
dof_coordinates[2][1] = vertex_coordinates[5];
7660
dof_coordinates[3][0] = 0.8*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
7661
dof_coordinates[3][1] = 0.8*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
7662
dof_coordinates[4][0] = 0.6*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
7663
dof_coordinates[4][1] = 0.6*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
7664
dof_coordinates[5][0] = 0.4*vertex_coordinates[2] + 0.6*vertex_coordinates[4];
7665
dof_coordinates[5][1] = 0.4*vertex_coordinates[3] + 0.6*vertex_coordinates[5];
7666
dof_coordinates[6][0] = 0.2*vertex_coordinates[2] + 0.8*vertex_coordinates[4];
7667
dof_coordinates[6][1] = 0.2*vertex_coordinates[3] + 0.8*vertex_coordinates[5];
7668
dof_coordinates[7][0] = 0.8*vertex_coordinates[0] + 0.2*vertex_coordinates[4];
7669
dof_coordinates[7][1] = 0.8*vertex_coordinates[1] + 0.2*vertex_coordinates[5];
7670
dof_coordinates[8][0] = 0.6*vertex_coordinates[0] + 0.4*vertex_coordinates[4];
7671
dof_coordinates[8][1] = 0.6*vertex_coordinates[1] + 0.4*vertex_coordinates[5];
7672
dof_coordinates[9][0] = 0.4*vertex_coordinates[0] + 0.6*vertex_coordinates[4];
7673
dof_coordinates[9][1] = 0.4*vertex_coordinates[1] + 0.6*vertex_coordinates[5];
7674
dof_coordinates[10][0] = 0.2*vertex_coordinates[0] + 0.8*vertex_coordinates[4];
7675
dof_coordinates[10][1] = 0.2*vertex_coordinates[1] + 0.8*vertex_coordinates[5];
7676
dof_coordinates[11][0] = 0.8*vertex_coordinates[0] + 0.2*vertex_coordinates[2];
7677
dof_coordinates[11][1] = 0.8*vertex_coordinates[1] + 0.2*vertex_coordinates[3];
7678
dof_coordinates[12][0] = 0.6*vertex_coordinates[0] + 0.4*vertex_coordinates[2];
7679
dof_coordinates[12][1] = 0.6*vertex_coordinates[1] + 0.4*vertex_coordinates[3];
7680
dof_coordinates[13][0] = 0.4*vertex_coordinates[0] + 0.6*vertex_coordinates[2];
7681
dof_coordinates[13][1] = 0.4*vertex_coordinates[1] + 0.6*vertex_coordinates[3];
7682
dof_coordinates[14][0] = 0.2*vertex_coordinates[0] + 0.8*vertex_coordinates[2];
7683
dof_coordinates[14][1] = 0.2*vertex_coordinates[1] + 0.8*vertex_coordinates[3];
7684
dof_coordinates[15][0] = 0.6*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
7685
dof_coordinates[15][1] = 0.6*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
7686
dof_coordinates[16][0] = 0.4*vertex_coordinates[0] + 0.4*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
7687
dof_coordinates[16][1] = 0.4*vertex_coordinates[1] + 0.4*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
7688
dof_coordinates[17][0] = 0.2*vertex_coordinates[0] + 0.6*vertex_coordinates[2] + 0.2*vertex_coordinates[4];
7689
dof_coordinates[17][1] = 0.2*vertex_coordinates[1] + 0.6*vertex_coordinates[3] + 0.2*vertex_coordinates[5];
7690
dof_coordinates[18][0] = 0.4*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
7691
dof_coordinates[18][1] = 0.4*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
7692
dof_coordinates[19][0] = 0.2*vertex_coordinates[0] + 0.4*vertex_coordinates[2] + 0.4*vertex_coordinates[4];
7693
dof_coordinates[19][1] = 0.2*vertex_coordinates[1] + 0.4*vertex_coordinates[3] + 0.4*vertex_coordinates[5];
7694
dof_coordinates[20][0] = 0.2*vertex_coordinates[0] + 0.2*vertex_coordinates[2] + 0.6*vertex_coordinates[4];
7695
dof_coordinates[20][1] = 0.2*vertex_coordinates[1] + 0.2*vertex_coordinates[3] + 0.6*vertex_coordinates[5];
7726
7698
/// Return the number of sub dofmaps (for a mixed element)
7727
virtual unsigned int num_sub_dofmaps() const
7699
virtual std::size_t num_sub_dofmaps() const
7732
7704
/// Create a new dofmap for sub dofmap i (for a mixed element)
7733
virtual ufc::dofmap* create_sub_dofmap(unsigned int i) const
7705
virtual ufc::dofmap* create_sub_dofmap(std::size_t i) const