~ubuntu-branches/ubuntu/maverick/dolfin/maverick

« back to all changes in this revision

Viewing changes to bench/fem/convergence/Poisson2D_4.h

  • Committer: Bazaar Package Importer
  • Author(s): Johannes Ring
  • Date: 2009-10-12 14:13:18 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20091012141318-hkbxl0sq555vqv7d
Tags: 0.9.4-1
* New upstream release. This version cleans up the design of the
  function class by adding a new abstraction for user-defined
  functions called Expression. A number of minor bugfixes and
  improvements have also been made.
* debian/watch: Update for new flat directory structure.
* Update debian/copyright.
* debian/rules: Use explicit paths to PETSc 3.0.0 and SLEPc 3.0.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// This code conforms with the UFC specification version 1.0
2
 
// and was automatically generated by FFC version 0.6.0.
 
2
// and was automatically generated by FFC version 0.7.0.
3
3
//
4
4
// Warning: This code was generated with the option '-l dolfin'
5
5
// and contains DOLFIN-specific wrappers that depend on DOLFIN.
11
11
#include <stdexcept>
12
12
#include <fstream>
13
13
#include <ufc.h>
14
 
 
15
 
/// This class defines the interface for a finite element.
16
 
 
17
 
class UFC_Poisson2D_4BilinearForm_finite_element_0: public ufc::finite_element
18
 
{
19
 
public:
20
 
 
21
 
  /// Constructor
22
 
  UFC_Poisson2D_4BilinearForm_finite_element_0() : ufc::finite_element()
23
 
  {
24
 
    // Do nothing
25
 
  }
26
 
 
27
 
  /// Destructor
28
 
  virtual ~UFC_Poisson2D_4BilinearForm_finite_element_0()
29
 
  {
30
 
    // Do nothing
31
 
  }
32
 
 
33
 
  /// Return a string identifying the finite element
34
 
  virtual const char* signature() const
35
 
  {
36
 
    return "FiniteElement('Lagrange', 'triangle', 4)";
37
 
  }
38
 
 
39
 
  /// Return the cell shape
40
 
  virtual ufc::shape cell_shape() const
41
 
  {
42
 
    return ufc::triangle;
43
 
  }
44
 
 
45
 
  /// Return the dimension of the finite element function space
46
 
  virtual unsigned int space_dimension() const
47
 
  {
48
 
    return 15;
49
 
  }
50
 
 
51
 
  /// Return the rank of the value space
52
 
  virtual unsigned int value_rank() const
53
 
  {
54
 
    return 0;
55
 
  }
56
 
 
57
 
  /// Return the dimension of the value space for axis i
58
 
  virtual unsigned int value_dimension(unsigned int i) const
59
 
  {
60
 
    return 1;
61
 
  }
62
 
 
63
 
  /// Evaluate basis function i at given point in cell
64
 
  virtual void evaluate_basis(unsigned int i,
65
 
                              double* values,
66
 
                              const double* coordinates,
67
 
                              const ufc::cell& c) const
68
 
  {
69
 
    // Extract vertex coordinates
70
 
    const double * const * element_coordinates = c.coordinates;
71
 
    
72
 
    // Compute Jacobian of affine map from reference cell
73
 
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
74
 
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
75
 
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
76
 
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
77
 
      
78
 
    // Compute determinant of Jacobian
79
 
    const double detJ = J_00*J_11 - J_01*J_10;
80
 
    
81
 
    // Compute inverse of Jacobian
82
 
    
83
 
    // Get coordinates and map to the reference (UFC) element
84
 
    double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
85
 
                element_coordinates[0][0]*element_coordinates[2][1] +\
86
 
                J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
87
 
    double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
88
 
                element_coordinates[1][0]*element_coordinates[0][1] -\
89
 
                J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
90
 
    
91
 
    // Map coordinates to the reference square
92
 
    if (std::abs(y - 1.0) < 1e-14)
93
 
      x = -1.0;
94
 
    else
95
 
      x = 2.0 *x/(1.0 - y) - 1.0;
96
 
    y = 2.0*y - 1.0;
97
 
    
98
 
    // Reset values
99
 
    *values = 0;
100
 
    
101
 
    // Map degree of freedom to element degree of freedom
102
 
    const unsigned int dof = i;
103
 
    
104
 
    // Generate scalings
105
 
    const double scalings_y_0 = 1;
106
 
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
107
 
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
108
 
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
109
 
    const double scalings_y_4 = scalings_y_3*(0.5 - 0.5*y);
110
 
    
111
 
    // Compute psitilde_a
112
 
    const double psitilde_a_0 = 1;
113
 
    const double psitilde_a_1 = x;
114
 
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
115
 
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
116
 
    const double psitilde_a_4 = 1.75*x*psitilde_a_3 - 0.75*psitilde_a_2;
117
 
    
118
 
    // Compute psitilde_bs
119
 
    const double psitilde_bs_0_0 = 1;
120
 
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
121
 
    const double psitilde_bs_0_2 = 0.111111111111111*psitilde_bs_0_1 + 1.66666666666667*y*psitilde_bs_0_1 - 0.555555555555556*psitilde_bs_0_0;
122
 
    const double psitilde_bs_0_3 = 0.05*psitilde_bs_0_2 + 1.75*y*psitilde_bs_0_2 - 0.7*psitilde_bs_0_1;
123
 
    const double psitilde_bs_0_4 = 0.0285714285714286*psitilde_bs_0_3 + 1.8*y*psitilde_bs_0_3 - 0.771428571428571*psitilde_bs_0_2;
124
 
    const double psitilde_bs_1_0 = 1;
125
 
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
126
 
    const double psitilde_bs_1_2 = 0.54*psitilde_bs_1_1 + 2.1*y*psitilde_bs_1_1 - 0.56*psitilde_bs_1_0;
127
 
    const double psitilde_bs_1_3 = 0.285714285714286*psitilde_bs_1_2 + 2*y*psitilde_bs_1_2 - 0.714285714285714*psitilde_bs_1_1;
128
 
    const double psitilde_bs_2_0 = 1;
129
 
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
130
 
    const double psitilde_bs_2_2 = 1.02040816326531*psitilde_bs_2_1 + 2.57142857142857*y*psitilde_bs_2_1 - 0.551020408163265*psitilde_bs_2_0;
131
 
    const double psitilde_bs_3_0 = 1;
132
 
    const double psitilde_bs_3_1 = 4.5*y + 3.5;
133
 
    const double psitilde_bs_4_0 = 1;
134
 
    
135
 
    // Compute basisvalues
136
 
    const double basisvalue0 = 0.707106781186548*psitilde_a_0*scalings_y_0*psitilde_bs_0_0;
137
 
    const double basisvalue1 = 1.73205080756888*psitilde_a_1*scalings_y_1*psitilde_bs_1_0;
138
 
    const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
139
 
    const double basisvalue3 = 2.73861278752583*psitilde_a_2*scalings_y_2*psitilde_bs_2_0;
140
 
    const double basisvalue4 = 2.12132034355964*psitilde_a_1*scalings_y_1*psitilde_bs_1_1;
141
 
    const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
142
 
    const double basisvalue6 = 3.74165738677394*psitilde_a_3*scalings_y_3*psitilde_bs_3_0;
143
 
    const double basisvalue7 = 3.16227766016838*psitilde_a_2*scalings_y_2*psitilde_bs_2_1;
144
 
    const double basisvalue8 = 2.44948974278318*psitilde_a_1*scalings_y_1*psitilde_bs_1_2;
145
 
    const double basisvalue9 = 1.4142135623731*psitilde_a_0*scalings_y_0*psitilde_bs_0_3;
146
 
    const double basisvalue10 = 4.74341649025257*psitilde_a_4*scalings_y_4*psitilde_bs_4_0;
147
 
    const double basisvalue11 = 4.18330013267038*psitilde_a_3*scalings_y_3*psitilde_bs_3_1;
148
 
    const double basisvalue12 = 3.53553390593274*psitilde_a_2*scalings_y_2*psitilde_bs_2_2;
149
 
    const double basisvalue13 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_3;
150
 
    const double basisvalue14 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_4;
151
 
    
152
 
    // Table(s) of coefficients
153
 
    const static double coefficients0[15][15] = \
154
 
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366312, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
155
 
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233825, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.023944356611608, -0.0185472188784818, 0.0107082418122104},
156
 
    {0, 0, 0.0476190476190476, 0, 0, 0.0388807895679869, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
157
 
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543895, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406279, 0.0834624849531681, -0.0535412090610519},
158
 
    {-0.0314269680527355, 0.0109971479845644, 0.00634920634920629, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
159
 
    {0.125707872210942, 0.0439885919382572, 0.126984126984127, 0, 0.0359165349174119, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
160
 
    {0.125707872210942, -0.131965775814772, -0.0253968253968255, 0.139104141588614, 0.0718330698348238, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.047888713223216, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
161
 
    {-0.0314269680527357, -0.0109971479845642, 0.00634920634920626, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
162
 
    {0.125707872210942, -0.0439885919382573, 0.126984126984127, 0, -0.035916534917412, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
163
 
    {0.125707872210942, -0.0879771838765143, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
164
 
    {-0.0314269680527355, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951818, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.0239443566116079, 0, 0.0107082418122103},
165
 
    {0.125707872210942, 0.0879771838765144, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277045, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
166
 
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406278, -0.0278208283177228, -0.0535412090610519},
167
 
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.026770604530526, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406279, 0.0278208283177227, -0.0535412090610519},
168
 
    {0.251415744421884, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
169
 
    
170
 
    // Extract relevant coefficients
171
 
    const double coeff0_0 = coefficients0[dof][0];
172
 
    const double coeff0_1 = coefficients0[dof][1];
173
 
    const double coeff0_2 = coefficients0[dof][2];
174
 
    const double coeff0_3 = coefficients0[dof][3];
175
 
    const double coeff0_4 = coefficients0[dof][4];
176
 
    const double coeff0_5 = coefficients0[dof][5];
177
 
    const double coeff0_6 = coefficients0[dof][6];
178
 
    const double coeff0_7 = coefficients0[dof][7];
179
 
    const double coeff0_8 = coefficients0[dof][8];
180
 
    const double coeff0_9 = coefficients0[dof][9];
181
 
    const double coeff0_10 = coefficients0[dof][10];
182
 
    const double coeff0_11 = coefficients0[dof][11];
183
 
    const double coeff0_12 = coefficients0[dof][12];
184
 
    const double coeff0_13 = coefficients0[dof][13];
185
 
    const double coeff0_14 = coefficients0[dof][14];
186
 
    
187
 
    // Compute value(s)
188
 
    *values = coeff0_0*basisvalue0 + coeff0_1*basisvalue1 + coeff0_2*basisvalue2 + coeff0_3*basisvalue3 + coeff0_4*basisvalue4 + coeff0_5*basisvalue5 + coeff0_6*basisvalue6 + coeff0_7*basisvalue7 + coeff0_8*basisvalue8 + coeff0_9*basisvalue9 + coeff0_10*basisvalue10 + coeff0_11*basisvalue11 + coeff0_12*basisvalue12 + coeff0_13*basisvalue13 + coeff0_14*basisvalue14;
189
 
  }
190
 
 
191
 
  /// Evaluate all basis functions at given point in cell
192
 
  virtual void evaluate_basis_all(double* values,
193
 
                                  const double* coordinates,
194
 
                                  const ufc::cell& c) const
195
 
  {
196
 
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
197
 
  }
198
 
 
199
 
  /// Evaluate order n derivatives of basis function i at given point in cell
200
 
  virtual void evaluate_basis_derivatives(unsigned int i,
201
 
                                          unsigned int n,
202
 
                                          double* values,
203
 
                                          const double* coordinates,
204
 
                                          const ufc::cell& c) const
205
 
  {
206
 
    // Extract vertex coordinates
207
 
    const double * const * element_coordinates = c.coordinates;
208
 
    
209
 
    // Compute Jacobian of affine map from reference cell
210
 
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
211
 
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
212
 
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
213
 
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
214
 
      
215
 
    // Compute determinant of Jacobian
216
 
    const double detJ = J_00*J_11 - J_01*J_10;
217
 
    
218
 
    // Compute inverse of Jacobian
219
 
    
220
 
    // Get coordinates and map to the reference (UFC) element
221
 
    double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
222
 
                element_coordinates[0][0]*element_coordinates[2][1] +\
223
 
                J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
224
 
    double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
225
 
                element_coordinates[1][0]*element_coordinates[0][1] -\
226
 
                J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
227
 
    
228
 
    // Map coordinates to the reference square
229
 
    if (std::abs(y - 1.0) < 1e-14)
230
 
      x = -1.0;
231
 
    else
232
 
      x = 2.0 *x/(1.0 - y) - 1.0;
233
 
    y = 2.0*y - 1.0;
234
 
    
235
 
    // Compute number of derivatives
236
 
    unsigned int num_derivatives = 1;
237
 
    
238
 
    for (unsigned int j = 0; j < n; j++)
239
 
      num_derivatives *= 2;
240
 
    
241
 
    
242
 
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
243
 
    unsigned int **combinations = new unsigned int *[num_derivatives];
244
 
        
245
 
    for (unsigned int j = 0; j < num_derivatives; j++)
246
 
    {
247
 
      combinations[j] = new unsigned int [n];
248
 
      for (unsigned int k = 0; k < n; k++)
249
 
        combinations[j][k] = 0;
250
 
    }
251
 
        
252
 
    // Generate combinations of derivatives
253
 
    for (unsigned int row = 1; row < num_derivatives; row++)
254
 
    {
255
 
      for (unsigned int num = 0; num < row; num++)
256
 
      {
257
 
        for (unsigned int col = n-1; col+1 > 0; col--)
258
 
        {
259
 
          if (combinations[row][col] + 1 > 1)
260
 
            combinations[row][col] = 0;
261
 
          else
262
 
          {
263
 
            combinations[row][col] += 1;
264
 
            break;
265
 
          }
266
 
        }
267
 
      }
268
 
    }
269
 
    
270
 
    // Compute inverse of Jacobian
271
 
    const double Jinv[2][2] =  {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
272
 
    
273
 
    // Declare transformation matrix
274
 
    // Declare pointer to two dimensional array and initialise
275
 
    double **transform = new double *[num_derivatives];
276
 
        
277
 
    for (unsigned int j = 0; j < num_derivatives; j++)
278
 
    {
279
 
      transform[j] = new double [num_derivatives];
280
 
      for (unsigned int k = 0; k < num_derivatives; k++)
281
 
        transform[j][k] = 1;
282
 
    }
283
 
    
284
 
    // Construct transformation matrix
285
 
    for (unsigned int row = 0; row < num_derivatives; row++)
286
 
    {
287
 
      for (unsigned int col = 0; col < num_derivatives; col++)
288
 
      {
289
 
        for (unsigned int k = 0; k < n; k++)
290
 
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
291
 
      }
292
 
    }
293
 
    
294
 
    // Reset values
295
 
    for (unsigned int j = 0; j < 1*num_derivatives; j++)
296
 
      values[j] = 0;
297
 
    
298
 
    // Map degree of freedom to element degree of freedom
299
 
    const unsigned int dof = i;
300
 
    
301
 
    // Generate scalings
302
 
    const double scalings_y_0 = 1;
303
 
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
304
 
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
305
 
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
306
 
    const double scalings_y_4 = scalings_y_3*(0.5 - 0.5*y);
307
 
    
308
 
    // Compute psitilde_a
309
 
    const double psitilde_a_0 = 1;
310
 
    const double psitilde_a_1 = x;
311
 
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
312
 
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
313
 
    const double psitilde_a_4 = 1.75*x*psitilde_a_3 - 0.75*psitilde_a_2;
314
 
    
315
 
    // Compute psitilde_bs
316
 
    const double psitilde_bs_0_0 = 1;
317
 
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
318
 
    const double psitilde_bs_0_2 = 0.111111111111111*psitilde_bs_0_1 + 1.66666666666667*y*psitilde_bs_0_1 - 0.555555555555556*psitilde_bs_0_0;
319
 
    const double psitilde_bs_0_3 = 0.05*psitilde_bs_0_2 + 1.75*y*psitilde_bs_0_2 - 0.7*psitilde_bs_0_1;
320
 
    const double psitilde_bs_0_4 = 0.0285714285714286*psitilde_bs_0_3 + 1.8*y*psitilde_bs_0_3 - 0.771428571428571*psitilde_bs_0_2;
321
 
    const double psitilde_bs_1_0 = 1;
322
 
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
323
 
    const double psitilde_bs_1_2 = 0.54*psitilde_bs_1_1 + 2.1*y*psitilde_bs_1_1 - 0.56*psitilde_bs_1_0;
324
 
    const double psitilde_bs_1_3 = 0.285714285714286*psitilde_bs_1_2 + 2*y*psitilde_bs_1_2 - 0.714285714285714*psitilde_bs_1_1;
325
 
    const double psitilde_bs_2_0 = 1;
326
 
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
327
 
    const double psitilde_bs_2_2 = 1.02040816326531*psitilde_bs_2_1 + 2.57142857142857*y*psitilde_bs_2_1 - 0.551020408163265*psitilde_bs_2_0;
328
 
    const double psitilde_bs_3_0 = 1;
329
 
    const double psitilde_bs_3_1 = 4.5*y + 3.5;
330
 
    const double psitilde_bs_4_0 = 1;
331
 
    
332
 
    // Compute basisvalues
333
 
    const double basisvalue0 = 0.707106781186548*psitilde_a_0*scalings_y_0*psitilde_bs_0_0;
334
 
    const double basisvalue1 = 1.73205080756888*psitilde_a_1*scalings_y_1*psitilde_bs_1_0;
335
 
    const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
336
 
    const double basisvalue3 = 2.73861278752583*psitilde_a_2*scalings_y_2*psitilde_bs_2_0;
337
 
    const double basisvalue4 = 2.12132034355964*psitilde_a_1*scalings_y_1*psitilde_bs_1_1;
338
 
    const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
339
 
    const double basisvalue6 = 3.74165738677394*psitilde_a_3*scalings_y_3*psitilde_bs_3_0;
340
 
    const double basisvalue7 = 3.16227766016838*psitilde_a_2*scalings_y_2*psitilde_bs_2_1;
341
 
    const double basisvalue8 = 2.44948974278318*psitilde_a_1*scalings_y_1*psitilde_bs_1_2;
342
 
    const double basisvalue9 = 1.4142135623731*psitilde_a_0*scalings_y_0*psitilde_bs_0_3;
343
 
    const double basisvalue10 = 4.74341649025257*psitilde_a_4*scalings_y_4*psitilde_bs_4_0;
344
 
    const double basisvalue11 = 4.18330013267038*psitilde_a_3*scalings_y_3*psitilde_bs_3_1;
345
 
    const double basisvalue12 = 3.53553390593274*psitilde_a_2*scalings_y_2*psitilde_bs_2_2;
346
 
    const double basisvalue13 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_3;
347
 
    const double basisvalue14 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_4;
348
 
    
349
 
    // Table(s) of coefficients
350
 
    const static double coefficients0[15][15] = \
351
 
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366312, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
352
 
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233825, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.023944356611608, -0.0185472188784818, 0.0107082418122104},
353
 
    {0, 0, 0.0476190476190476, 0, 0, 0.0388807895679869, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
354
 
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543895, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406279, 0.0834624849531681, -0.0535412090610519},
355
 
    {-0.0314269680527355, 0.0109971479845644, 0.00634920634920629, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
356
 
    {0.125707872210942, 0.0439885919382572, 0.126984126984127, 0, 0.0359165349174119, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
357
 
    {0.125707872210942, -0.131965775814772, -0.0253968253968255, 0.139104141588614, 0.0718330698348238, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.047888713223216, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
358
 
    {-0.0314269680527357, -0.0109971479845642, 0.00634920634920626, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
359
 
    {0.125707872210942, -0.0439885919382573, 0.126984126984127, 0, -0.035916534917412, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
360
 
    {0.125707872210942, -0.0879771838765143, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
361
 
    {-0.0314269680527355, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951818, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.0239443566116079, 0, 0.0107082418122103},
362
 
    {0.125707872210942, 0.0879771838765144, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277045, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
363
 
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406278, -0.0278208283177228, -0.0535412090610519},
364
 
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.026770604530526, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406279, 0.0278208283177227, -0.0535412090610519},
365
 
    {0.251415744421884, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
366
 
    
367
 
    // Interesting (new) part
368
 
    // Tables of derivatives of the polynomial base (transpose)
369
 
    const static double dmats0[15][15] = \
370
 
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
371
 
    {4.89897948556635, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
372
 
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
373
 
    {0, 9.48683298050513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
374
 
    {4, 0, 7.07106781186548, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
375
 
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
376
 
    {5.29150262212917, 0, -2.99332590941916, 13.6626010212795, 0, 0.611010092660778, 0, 0, 0, 0, 0, 0, 0, 0, 0},
377
 
    {0, 4.38178046004132, 0, 0, 12.5219806739988, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
378
 
    {3.46410161513776, 0, 7.83836717690617, 0, 0, 8.40000000000001, 0, 0, 0, 0, 0, 0, 0, 0, 0},
379
 
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
380
 
    {0, 10.9544511501033, 0, 0, -3.83325938999965, 0, 17.7482393492988, 0, 0.553283335172492, 0, 0, 0, 0, 0, 0},
381
 
    {4.73286382647968, 0, 3.3466401061363, 4.36435780471985, 0, -5.07468037933239, 0, 17.0084012854152, 0, 1.52127765851133, 0, 0, 0, 0, 0},
382
 
    {0, 2.44948974278317, 0, 0, 9.14285714285714, 0, 0, 0, 14.8461497791618, 0, 0, 0, 0, 0, 0},
383
 
    {3.09838667696594, 0, 7.66811580507233, 0, 0, 10.733126291999, 0, 0, 0, 9.2951600308978, 0, 0, 0, 0, 0},
384
 
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
385
 
    
386
 
    const static double dmats1[15][15] = \
387
 
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
388
 
    {2.44948974278317, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
389
 
    {4.24264068711928, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
390
 
    {2.58198889747161, 4.74341649025257, -0.912870929175277, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
391
 
    {2, 6.12372435695794, 3.53553390593274, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
392
 
    {-2.30940107675849, 0, 8.16496580927726, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
393
 
    {2.64575131106458, 5.18459255872628, -1.49666295470958, 6.83130051063973, -1.05830052442584, 0.305505046330385, 0, 0, 0, 0, 0, 0, 0, 0, 0},
394
 
    {2.23606797749978, 2.19089023002066, 2.5298221281347, 8.08290376865476, 6.26099033699942, -1.80739222823014, 0, 0, 0, 0, 0, 0, 0, 0, 0},
395
 
    {1.73205080756888, -5.09116882454314, 3.91918358845309, 0, 9.69948452238572, 4.2, 0, 0, 0, 0, 0, 0, 0, 0, 0},
396
 
    {5, 0, -2.8284271247462, 0, 0, 12.1243556529821, 0, 0, 0, 0, 0, 0, 0, 0, 0},
397
 
    {2.68328157299974, 5.47722557505166, -1.89736659610103, 7.4230748895809, -1.91662969499982, 0.663940002206987, 8.87411967464942, -1.07142857142857, 0.276641667586245, -0.095831484749991, 0, 0, 0, 0, 0},
398
 
    {2.36643191323984, 2.89827534923788, 1.67332005306815, 2.18217890235993, 5.74704893215391, -2.53734018966619, 10.0623058987491, 8.50420064270761, -2.1957751641342, 0.760638829255663, 0, 0, 0, 0, 0},
399
 
    {2, 1.22474487139159, 3.53553390593274, -7.37711113563317, 4.57142857142857, 1.64957219768464, 0, 11.4997781699989, 7.4230748895809, -2.57142857142858, 0, 0, 0, 0, 0},
400
 
    {1.54919333848296, 6.6407830863536, 3.83405790253616, 0, -6.19677335393188, 5.3665631459995, 0, 0, 13.4164078649987, 4.6475800154489, 0, 0, 0, 0, 0},
401
 
    {-3.57770876399967, 0, 8.85437744847147, 0, 0, -3.09838667696593, 0, 0, 0, 16.0996894379985, 0, 0, 0, 0, 0}};
402
 
    
403
 
    // Compute reference derivatives
404
 
    // Declare pointer to array of derivatives on FIAT element
405
 
    double *derivatives = new double [num_derivatives];
406
 
    
407
 
    // Declare coefficients
408
 
    double coeff0_0 = 0;
409
 
    double coeff0_1 = 0;
410
 
    double coeff0_2 = 0;
411
 
    double coeff0_3 = 0;
412
 
    double coeff0_4 = 0;
413
 
    double coeff0_5 = 0;
414
 
    double coeff0_6 = 0;
415
 
    double coeff0_7 = 0;
416
 
    double coeff0_8 = 0;
417
 
    double coeff0_9 = 0;
418
 
    double coeff0_10 = 0;
419
 
    double coeff0_11 = 0;
420
 
    double coeff0_12 = 0;
421
 
    double coeff0_13 = 0;
422
 
    double coeff0_14 = 0;
423
 
    
424
 
    // Declare new coefficients
425
 
    double new_coeff0_0 = 0;
426
 
    double new_coeff0_1 = 0;
427
 
    double new_coeff0_2 = 0;
428
 
    double new_coeff0_3 = 0;
429
 
    double new_coeff0_4 = 0;
430
 
    double new_coeff0_5 = 0;
431
 
    double new_coeff0_6 = 0;
432
 
    double new_coeff0_7 = 0;
433
 
    double new_coeff0_8 = 0;
434
 
    double new_coeff0_9 = 0;
435
 
    double new_coeff0_10 = 0;
436
 
    double new_coeff0_11 = 0;
437
 
    double new_coeff0_12 = 0;
438
 
    double new_coeff0_13 = 0;
439
 
    double new_coeff0_14 = 0;
440
 
    
441
 
    // Loop possible derivatives
442
 
    for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
443
 
    {
444
 
      // Get values from coefficients array
445
 
      new_coeff0_0 = coefficients0[dof][0];
446
 
      new_coeff0_1 = coefficients0[dof][1];
447
 
      new_coeff0_2 = coefficients0[dof][2];
448
 
      new_coeff0_3 = coefficients0[dof][3];
449
 
      new_coeff0_4 = coefficients0[dof][4];
450
 
      new_coeff0_5 = coefficients0[dof][5];
451
 
      new_coeff0_6 = coefficients0[dof][6];
452
 
      new_coeff0_7 = coefficients0[dof][7];
453
 
      new_coeff0_8 = coefficients0[dof][8];
454
 
      new_coeff0_9 = coefficients0[dof][9];
455
 
      new_coeff0_10 = coefficients0[dof][10];
456
 
      new_coeff0_11 = coefficients0[dof][11];
457
 
      new_coeff0_12 = coefficients0[dof][12];
458
 
      new_coeff0_13 = coefficients0[dof][13];
459
 
      new_coeff0_14 = coefficients0[dof][14];
460
 
    
461
 
      // Loop derivative order
462
 
      for (unsigned int j = 0; j < n; j++)
463
 
      {
464
 
        // Update old coefficients
465
 
        coeff0_0 = new_coeff0_0;
466
 
        coeff0_1 = new_coeff0_1;
467
 
        coeff0_2 = new_coeff0_2;
468
 
        coeff0_3 = new_coeff0_3;
469
 
        coeff0_4 = new_coeff0_4;
470
 
        coeff0_5 = new_coeff0_5;
471
 
        coeff0_6 = new_coeff0_6;
472
 
        coeff0_7 = new_coeff0_7;
473
 
        coeff0_8 = new_coeff0_8;
474
 
        coeff0_9 = new_coeff0_9;
475
 
        coeff0_10 = new_coeff0_10;
476
 
        coeff0_11 = new_coeff0_11;
477
 
        coeff0_12 = new_coeff0_12;
478
 
        coeff0_13 = new_coeff0_13;
479
 
        coeff0_14 = new_coeff0_14;
480
 
    
481
 
        if(combinations[deriv_num][j] == 0)
482
 
        {
483
 
          new_coeff0_0 = coeff0_0*dmats0[0][0] + coeff0_1*dmats0[1][0] + coeff0_2*dmats0[2][0] + coeff0_3*dmats0[3][0] + coeff0_4*dmats0[4][0] + coeff0_5*dmats0[5][0] + coeff0_6*dmats0[6][0] + coeff0_7*dmats0[7][0] + coeff0_8*dmats0[8][0] + coeff0_9*dmats0[9][0] + coeff0_10*dmats0[10][0] + coeff0_11*dmats0[11][0] + coeff0_12*dmats0[12][0] + coeff0_13*dmats0[13][0] + coeff0_14*dmats0[14][0];
484
 
          new_coeff0_1 = coeff0_0*dmats0[0][1] + coeff0_1*dmats0[1][1] + coeff0_2*dmats0[2][1] + coeff0_3*dmats0[3][1] + coeff0_4*dmats0[4][1] + coeff0_5*dmats0[5][1] + coeff0_6*dmats0[6][1] + coeff0_7*dmats0[7][1] + coeff0_8*dmats0[8][1] + coeff0_9*dmats0[9][1] + coeff0_10*dmats0[10][1] + coeff0_11*dmats0[11][1] + coeff0_12*dmats0[12][1] + coeff0_13*dmats0[13][1] + coeff0_14*dmats0[14][1];
485
 
          new_coeff0_2 = coeff0_0*dmats0[0][2] + coeff0_1*dmats0[1][2] + coeff0_2*dmats0[2][2] + coeff0_3*dmats0[3][2] + coeff0_4*dmats0[4][2] + coeff0_5*dmats0[5][2] + coeff0_6*dmats0[6][2] + coeff0_7*dmats0[7][2] + coeff0_8*dmats0[8][2] + coeff0_9*dmats0[9][2] + coeff0_10*dmats0[10][2] + coeff0_11*dmats0[11][2] + coeff0_12*dmats0[12][2] + coeff0_13*dmats0[13][2] + coeff0_14*dmats0[14][2];
486
 
          new_coeff0_3 = coeff0_0*dmats0[0][3] + coeff0_1*dmats0[1][3] + coeff0_2*dmats0[2][3] + coeff0_3*dmats0[3][3] + coeff0_4*dmats0[4][3] + coeff0_5*dmats0[5][3] + coeff0_6*dmats0[6][3] + coeff0_7*dmats0[7][3] + coeff0_8*dmats0[8][3] + coeff0_9*dmats0[9][3] + coeff0_10*dmats0[10][3] + coeff0_11*dmats0[11][3] + coeff0_12*dmats0[12][3] + coeff0_13*dmats0[13][3] + coeff0_14*dmats0[14][3];
487
 
          new_coeff0_4 = coeff0_0*dmats0[0][4] + coeff0_1*dmats0[1][4] + coeff0_2*dmats0[2][4] + coeff0_3*dmats0[3][4] + coeff0_4*dmats0[4][4] + coeff0_5*dmats0[5][4] + coeff0_6*dmats0[6][4] + coeff0_7*dmats0[7][4] + coeff0_8*dmats0[8][4] + coeff0_9*dmats0[9][4] + coeff0_10*dmats0[10][4] + coeff0_11*dmats0[11][4] + coeff0_12*dmats0[12][4] + coeff0_13*dmats0[13][4] + coeff0_14*dmats0[14][4];
488
 
          new_coeff0_5 = coeff0_0*dmats0[0][5] + coeff0_1*dmats0[1][5] + coeff0_2*dmats0[2][5] + coeff0_3*dmats0[3][5] + coeff0_4*dmats0[4][5] + coeff0_5*dmats0[5][5] + coeff0_6*dmats0[6][5] + coeff0_7*dmats0[7][5] + coeff0_8*dmats0[8][5] + coeff0_9*dmats0[9][5] + coeff0_10*dmats0[10][5] + coeff0_11*dmats0[11][5] + coeff0_12*dmats0[12][5] + coeff0_13*dmats0[13][5] + coeff0_14*dmats0[14][5];
489
 
          new_coeff0_6 = coeff0_0*dmats0[0][6] + coeff0_1*dmats0[1][6] + coeff0_2*dmats0[2][6] + coeff0_3*dmats0[3][6] + coeff0_4*dmats0[4][6] + coeff0_5*dmats0[5][6] + coeff0_6*dmats0[6][6] + coeff0_7*dmats0[7][6] + coeff0_8*dmats0[8][6] + coeff0_9*dmats0[9][6] + coeff0_10*dmats0[10][6] + coeff0_11*dmats0[11][6] + coeff0_12*dmats0[12][6] + coeff0_13*dmats0[13][6] + coeff0_14*dmats0[14][6];
490
 
          new_coeff0_7 = coeff0_0*dmats0[0][7] + coeff0_1*dmats0[1][7] + coeff0_2*dmats0[2][7] + coeff0_3*dmats0[3][7] + coeff0_4*dmats0[4][7] + coeff0_5*dmats0[5][7] + coeff0_6*dmats0[6][7] + coeff0_7*dmats0[7][7] + coeff0_8*dmats0[8][7] + coeff0_9*dmats0[9][7] + coeff0_10*dmats0[10][7] + coeff0_11*dmats0[11][7] + coeff0_12*dmats0[12][7] + coeff0_13*dmats0[13][7] + coeff0_14*dmats0[14][7];
491
 
          new_coeff0_8 = coeff0_0*dmats0[0][8] + coeff0_1*dmats0[1][8] + coeff0_2*dmats0[2][8] + coeff0_3*dmats0[3][8] + coeff0_4*dmats0[4][8] + coeff0_5*dmats0[5][8] + coeff0_6*dmats0[6][8] + coeff0_7*dmats0[7][8] + coeff0_8*dmats0[8][8] + coeff0_9*dmats0[9][8] + coeff0_10*dmats0[10][8] + coeff0_11*dmats0[11][8] + coeff0_12*dmats0[12][8] + coeff0_13*dmats0[13][8] + coeff0_14*dmats0[14][8];
492
 
          new_coeff0_9 = coeff0_0*dmats0[0][9] + coeff0_1*dmats0[1][9] + coeff0_2*dmats0[2][9] + coeff0_3*dmats0[3][9] + coeff0_4*dmats0[4][9] + coeff0_5*dmats0[5][9] + coeff0_6*dmats0[6][9] + coeff0_7*dmats0[7][9] + coeff0_8*dmats0[8][9] + coeff0_9*dmats0[9][9] + coeff0_10*dmats0[10][9] + coeff0_11*dmats0[11][9] + coeff0_12*dmats0[12][9] + coeff0_13*dmats0[13][9] + coeff0_14*dmats0[14][9];
493
 
          new_coeff0_10 = coeff0_0*dmats0[0][10] + coeff0_1*dmats0[1][10] + coeff0_2*dmats0[2][10] + coeff0_3*dmats0[3][10] + coeff0_4*dmats0[4][10] + coeff0_5*dmats0[5][10] + coeff0_6*dmats0[6][10] + coeff0_7*dmats0[7][10] + coeff0_8*dmats0[8][10] + coeff0_9*dmats0[9][10] + coeff0_10*dmats0[10][10] + coeff0_11*dmats0[11][10] + coeff0_12*dmats0[12][10] + coeff0_13*dmats0[13][10] + coeff0_14*dmats0[14][10];
494
 
          new_coeff0_11 = coeff0_0*dmats0[0][11] + coeff0_1*dmats0[1][11] + coeff0_2*dmats0[2][11] + coeff0_3*dmats0[3][11] + coeff0_4*dmats0[4][11] + coeff0_5*dmats0[5][11] + coeff0_6*dmats0[6][11] + coeff0_7*dmats0[7][11] + coeff0_8*dmats0[8][11] + coeff0_9*dmats0[9][11] + coeff0_10*dmats0[10][11] + coeff0_11*dmats0[11][11] + coeff0_12*dmats0[12][11] + coeff0_13*dmats0[13][11] + coeff0_14*dmats0[14][11];
495
 
          new_coeff0_12 = coeff0_0*dmats0[0][12] + coeff0_1*dmats0[1][12] + coeff0_2*dmats0[2][12] + coeff0_3*dmats0[3][12] + coeff0_4*dmats0[4][12] + coeff0_5*dmats0[5][12] + coeff0_6*dmats0[6][12] + coeff0_7*dmats0[7][12] + coeff0_8*dmats0[8][12] + coeff0_9*dmats0[9][12] + coeff0_10*dmats0[10][12] + coeff0_11*dmats0[11][12] + coeff0_12*dmats0[12][12] + coeff0_13*dmats0[13][12] + coeff0_14*dmats0[14][12];
496
 
          new_coeff0_13 = coeff0_0*dmats0[0][13] + coeff0_1*dmats0[1][13] + coeff0_2*dmats0[2][13] + coeff0_3*dmats0[3][13] + coeff0_4*dmats0[4][13] + coeff0_5*dmats0[5][13] + coeff0_6*dmats0[6][13] + coeff0_7*dmats0[7][13] + coeff0_8*dmats0[8][13] + coeff0_9*dmats0[9][13] + coeff0_10*dmats0[10][13] + coeff0_11*dmats0[11][13] + coeff0_12*dmats0[12][13] + coeff0_13*dmats0[13][13] + coeff0_14*dmats0[14][13];
497
 
          new_coeff0_14 = coeff0_0*dmats0[0][14] + coeff0_1*dmats0[1][14] + coeff0_2*dmats0[2][14] + coeff0_3*dmats0[3][14] + coeff0_4*dmats0[4][14] + coeff0_5*dmats0[5][14] + coeff0_6*dmats0[6][14] + coeff0_7*dmats0[7][14] + coeff0_8*dmats0[8][14] + coeff0_9*dmats0[9][14] + coeff0_10*dmats0[10][14] + coeff0_11*dmats0[11][14] + coeff0_12*dmats0[12][14] + coeff0_13*dmats0[13][14] + coeff0_14*dmats0[14][14];
498
 
        }
499
 
        if(combinations[deriv_num][j] == 1)
500
 
        {
501
 
          new_coeff0_0 = coeff0_0*dmats1[0][0] + coeff0_1*dmats1[1][0] + coeff0_2*dmats1[2][0] + coeff0_3*dmats1[3][0] + coeff0_4*dmats1[4][0] + coeff0_5*dmats1[5][0] + coeff0_6*dmats1[6][0] + coeff0_7*dmats1[7][0] + coeff0_8*dmats1[8][0] + coeff0_9*dmats1[9][0] + coeff0_10*dmats1[10][0] + coeff0_11*dmats1[11][0] + coeff0_12*dmats1[12][0] + coeff0_13*dmats1[13][0] + coeff0_14*dmats1[14][0];
502
 
          new_coeff0_1 = coeff0_0*dmats1[0][1] + coeff0_1*dmats1[1][1] + coeff0_2*dmats1[2][1] + coeff0_3*dmats1[3][1] + coeff0_4*dmats1[4][1] + coeff0_5*dmats1[5][1] + coeff0_6*dmats1[6][1] + coeff0_7*dmats1[7][1] + coeff0_8*dmats1[8][1] + coeff0_9*dmats1[9][1] + coeff0_10*dmats1[10][1] + coeff0_11*dmats1[11][1] + coeff0_12*dmats1[12][1] + coeff0_13*dmats1[13][1] + coeff0_14*dmats1[14][1];
503
 
          new_coeff0_2 = coeff0_0*dmats1[0][2] + coeff0_1*dmats1[1][2] + coeff0_2*dmats1[2][2] + coeff0_3*dmats1[3][2] + coeff0_4*dmats1[4][2] + coeff0_5*dmats1[5][2] + coeff0_6*dmats1[6][2] + coeff0_7*dmats1[7][2] + coeff0_8*dmats1[8][2] + coeff0_9*dmats1[9][2] + coeff0_10*dmats1[10][2] + coeff0_11*dmats1[11][2] + coeff0_12*dmats1[12][2] + coeff0_13*dmats1[13][2] + coeff0_14*dmats1[14][2];
504
 
          new_coeff0_3 = coeff0_0*dmats1[0][3] + coeff0_1*dmats1[1][3] + coeff0_2*dmats1[2][3] + coeff0_3*dmats1[3][3] + coeff0_4*dmats1[4][3] + coeff0_5*dmats1[5][3] + coeff0_6*dmats1[6][3] + coeff0_7*dmats1[7][3] + coeff0_8*dmats1[8][3] + coeff0_9*dmats1[9][3] + coeff0_10*dmats1[10][3] + coeff0_11*dmats1[11][3] + coeff0_12*dmats1[12][3] + coeff0_13*dmats1[13][3] + coeff0_14*dmats1[14][3];
505
 
          new_coeff0_4 = coeff0_0*dmats1[0][4] + coeff0_1*dmats1[1][4] + coeff0_2*dmats1[2][4] + coeff0_3*dmats1[3][4] + coeff0_4*dmats1[4][4] + coeff0_5*dmats1[5][4] + coeff0_6*dmats1[6][4] + coeff0_7*dmats1[7][4] + coeff0_8*dmats1[8][4] + coeff0_9*dmats1[9][4] + coeff0_10*dmats1[10][4] + coeff0_11*dmats1[11][4] + coeff0_12*dmats1[12][4] + coeff0_13*dmats1[13][4] + coeff0_14*dmats1[14][4];
506
 
          new_coeff0_5 = coeff0_0*dmats1[0][5] + coeff0_1*dmats1[1][5] + coeff0_2*dmats1[2][5] + coeff0_3*dmats1[3][5] + coeff0_4*dmats1[4][5] + coeff0_5*dmats1[5][5] + coeff0_6*dmats1[6][5] + coeff0_7*dmats1[7][5] + coeff0_8*dmats1[8][5] + coeff0_9*dmats1[9][5] + coeff0_10*dmats1[10][5] + coeff0_11*dmats1[11][5] + coeff0_12*dmats1[12][5] + coeff0_13*dmats1[13][5] + coeff0_14*dmats1[14][5];
507
 
          new_coeff0_6 = coeff0_0*dmats1[0][6] + coeff0_1*dmats1[1][6] + coeff0_2*dmats1[2][6] + coeff0_3*dmats1[3][6] + coeff0_4*dmats1[4][6] + coeff0_5*dmats1[5][6] + coeff0_6*dmats1[6][6] + coeff0_7*dmats1[7][6] + coeff0_8*dmats1[8][6] + coeff0_9*dmats1[9][6] + coeff0_10*dmats1[10][6] + coeff0_11*dmats1[11][6] + coeff0_12*dmats1[12][6] + coeff0_13*dmats1[13][6] + coeff0_14*dmats1[14][6];
508
 
          new_coeff0_7 = coeff0_0*dmats1[0][7] + coeff0_1*dmats1[1][7] + coeff0_2*dmats1[2][7] + coeff0_3*dmats1[3][7] + coeff0_4*dmats1[4][7] + coeff0_5*dmats1[5][7] + coeff0_6*dmats1[6][7] + coeff0_7*dmats1[7][7] + coeff0_8*dmats1[8][7] + coeff0_9*dmats1[9][7] + coeff0_10*dmats1[10][7] + coeff0_11*dmats1[11][7] + coeff0_12*dmats1[12][7] + coeff0_13*dmats1[13][7] + coeff0_14*dmats1[14][7];
509
 
          new_coeff0_8 = coeff0_0*dmats1[0][8] + coeff0_1*dmats1[1][8] + coeff0_2*dmats1[2][8] + coeff0_3*dmats1[3][8] + coeff0_4*dmats1[4][8] + coeff0_5*dmats1[5][8] + coeff0_6*dmats1[6][8] + coeff0_7*dmats1[7][8] + coeff0_8*dmats1[8][8] + coeff0_9*dmats1[9][8] + coeff0_10*dmats1[10][8] + coeff0_11*dmats1[11][8] + coeff0_12*dmats1[12][8] + coeff0_13*dmats1[13][8] + coeff0_14*dmats1[14][8];
510
 
          new_coeff0_9 = coeff0_0*dmats1[0][9] + coeff0_1*dmats1[1][9] + coeff0_2*dmats1[2][9] + coeff0_3*dmats1[3][9] + coeff0_4*dmats1[4][9] + coeff0_5*dmats1[5][9] + coeff0_6*dmats1[6][9] + coeff0_7*dmats1[7][9] + coeff0_8*dmats1[8][9] + coeff0_9*dmats1[9][9] + coeff0_10*dmats1[10][9] + coeff0_11*dmats1[11][9] + coeff0_12*dmats1[12][9] + coeff0_13*dmats1[13][9] + coeff0_14*dmats1[14][9];
511
 
          new_coeff0_10 = coeff0_0*dmats1[0][10] + coeff0_1*dmats1[1][10] + coeff0_2*dmats1[2][10] + coeff0_3*dmats1[3][10] + coeff0_4*dmats1[4][10] + coeff0_5*dmats1[5][10] + coeff0_6*dmats1[6][10] + coeff0_7*dmats1[7][10] + coeff0_8*dmats1[8][10] + coeff0_9*dmats1[9][10] + coeff0_10*dmats1[10][10] + coeff0_11*dmats1[11][10] + coeff0_12*dmats1[12][10] + coeff0_13*dmats1[13][10] + coeff0_14*dmats1[14][10];
512
 
          new_coeff0_11 = coeff0_0*dmats1[0][11] + coeff0_1*dmats1[1][11] + coeff0_2*dmats1[2][11] + coeff0_3*dmats1[3][11] + coeff0_4*dmats1[4][11] + coeff0_5*dmats1[5][11] + coeff0_6*dmats1[6][11] + coeff0_7*dmats1[7][11] + coeff0_8*dmats1[8][11] + coeff0_9*dmats1[9][11] + coeff0_10*dmats1[10][11] + coeff0_11*dmats1[11][11] + coeff0_12*dmats1[12][11] + coeff0_13*dmats1[13][11] + coeff0_14*dmats1[14][11];
513
 
          new_coeff0_12 = coeff0_0*dmats1[0][12] + coeff0_1*dmats1[1][12] + coeff0_2*dmats1[2][12] + coeff0_3*dmats1[3][12] + coeff0_4*dmats1[4][12] + coeff0_5*dmats1[5][12] + coeff0_6*dmats1[6][12] + coeff0_7*dmats1[7][12] + coeff0_8*dmats1[8][12] + coeff0_9*dmats1[9][12] + coeff0_10*dmats1[10][12] + coeff0_11*dmats1[11][12] + coeff0_12*dmats1[12][12] + coeff0_13*dmats1[13][12] + coeff0_14*dmats1[14][12];
514
 
          new_coeff0_13 = coeff0_0*dmats1[0][13] + coeff0_1*dmats1[1][13] + coeff0_2*dmats1[2][13] + coeff0_3*dmats1[3][13] + coeff0_4*dmats1[4][13] + coeff0_5*dmats1[5][13] + coeff0_6*dmats1[6][13] + coeff0_7*dmats1[7][13] + coeff0_8*dmats1[8][13] + coeff0_9*dmats1[9][13] + coeff0_10*dmats1[10][13] + coeff0_11*dmats1[11][13] + coeff0_12*dmats1[12][13] + coeff0_13*dmats1[13][13] + coeff0_14*dmats1[14][13];
515
 
          new_coeff0_14 = coeff0_0*dmats1[0][14] + coeff0_1*dmats1[1][14] + coeff0_2*dmats1[2][14] + coeff0_3*dmats1[3][14] + coeff0_4*dmats1[4][14] + coeff0_5*dmats1[5][14] + coeff0_6*dmats1[6][14] + coeff0_7*dmats1[7][14] + coeff0_8*dmats1[8][14] + coeff0_9*dmats1[9][14] + coeff0_10*dmats1[10][14] + coeff0_11*dmats1[11][14] + coeff0_12*dmats1[12][14] + coeff0_13*dmats1[13][14] + coeff0_14*dmats1[14][14];
516
 
        }
517
 
    
518
 
      }
519
 
      // Compute derivatives on reference element as dot product of coefficients and basisvalues
520
 
      derivatives[deriv_num] = new_coeff0_0*basisvalue0 + new_coeff0_1*basisvalue1 + new_coeff0_2*basisvalue2 + new_coeff0_3*basisvalue3 + new_coeff0_4*basisvalue4 + new_coeff0_5*basisvalue5 + new_coeff0_6*basisvalue6 + new_coeff0_7*basisvalue7 + new_coeff0_8*basisvalue8 + new_coeff0_9*basisvalue9 + new_coeff0_10*basisvalue10 + new_coeff0_11*basisvalue11 + new_coeff0_12*basisvalue12 + new_coeff0_13*basisvalue13 + new_coeff0_14*basisvalue14;
521
 
    }
522
 
    
523
 
    // Transform derivatives back to physical element
524
 
    for (unsigned int row = 0; row < num_derivatives; row++)
525
 
    {
526
 
      for (unsigned int col = 0; col < num_derivatives; col++)
527
 
      {
528
 
        values[row] += transform[row][col]*derivatives[col];
529
 
      }
530
 
    }
531
 
    // Delete pointer to array of derivatives on FIAT element
532
 
    delete [] derivatives;
533
 
    
534
 
    // Delete pointer to array of combinations of derivatives and transform
535
 
    for (unsigned int row = 0; row < num_derivatives; row++)
536
 
    {
537
 
      delete [] combinations[row];
538
 
      delete [] transform[row];
539
 
    }
540
 
    
541
 
    delete [] combinations;
542
 
    delete [] transform;
543
 
  }
544
 
 
545
 
  /// Evaluate order n derivatives of all basis functions at given point in cell
546
 
  virtual void evaluate_basis_derivatives_all(unsigned int n,
547
 
                                              double* values,
548
 
                                              const double* coordinates,
549
 
                                              const ufc::cell& c) const
550
 
  {
551
 
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
552
 
  }
553
 
 
554
 
  /// Evaluate linear functional for dof i on the function f
555
 
  virtual double evaluate_dof(unsigned int i,
556
 
                              const ufc::function& f,
557
 
                              const ufc::cell& c) const
558
 
  {
559
 
    // The reference points, direction and weights:
560
 
    const static double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.75, 0.25}}, {{0.5, 0.5}}, {{0.25, 0.75}}, {{0, 0.25}}, {{0, 0.5}}, {{0, 0.75}}, {{0.25, 0}}, {{0.5, 0}}, {{0.75, 0}}, {{0.25, 0.25}}, {{0.5, 0.25}}, {{0.25, 0.5}}};
561
 
    const static double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
562
 
    const static double D[15][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
563
 
    
564
 
    const double * const * x = c.coordinates;
565
 
    double result = 0.0;
566
 
    // Iterate over the points:
567
 
    // Evaluate basis functions for affine mapping
568
 
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1];
569
 
    const double w1 = X[i][0][0];
570
 
    const double w2 = X[i][0][1];
571
 
    
572
 
    // Compute affine mapping y = F(X)
573
 
    double y[2];
574
 
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0];
575
 
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1];
576
 
    
577
 
    // Evaluate function at physical points
578
 
    double values[1];
579
 
    f.evaluate(values, y, c);
580
 
    
581
 
    // Map function values using appropriate mapping
582
 
    // Affine map: Do nothing
583
 
    
584
 
    // Note that we do not map the weights (yet).
585
 
    
586
 
    // Take directional components
587
 
    for(int k = 0; k < 1; k++)
588
 
      result += values[k]*D[i][0][k];
589
 
    // Multiply by weights 
590
 
    result *= W[i][0];
591
 
    
592
 
    return result;
593
 
  }
594
 
 
595
 
  /// Evaluate linear functionals for all dofs on the function f
596
 
  virtual void evaluate_dofs(double* values,
597
 
                             const ufc::function& f,
598
 
                             const ufc::cell& c) const
599
 
  {
600
 
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
601
 
  }
602
 
 
603
 
  /// Interpolate vertex values from dof values
604
 
  virtual void interpolate_vertex_values(double* vertex_values,
605
 
                                         const double* dof_values,
606
 
                                         const ufc::cell& c) const
607
 
  {
608
 
    // Evaluate at vertices and use affine mapping
609
 
    vertex_values[0] = dof_values[0];
610
 
    vertex_values[1] = dof_values[1];
611
 
    vertex_values[2] = dof_values[2];
612
 
  }
613
 
 
614
 
  /// Return the number of sub elements (for a mixed element)
615
 
  virtual unsigned int num_sub_elements() const
616
 
  {
617
 
    return 1;
618
 
  }
619
 
 
620
 
  /// Create a new finite element for sub element i (for a mixed element)
621
 
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
622
 
  {
623
 
    return new UFC_Poisson2D_4BilinearForm_finite_element_0();
624
 
  }
625
 
 
626
 
};
627
 
 
628
 
/// This class defines the interface for a finite element.
629
 
 
630
 
class UFC_Poisson2D_4BilinearForm_finite_element_1: public ufc::finite_element
631
 
{
632
 
public:
633
 
 
634
 
  /// Constructor
635
 
  UFC_Poisson2D_4BilinearForm_finite_element_1() : ufc::finite_element()
636
 
  {
637
 
    // Do nothing
638
 
  }
639
 
 
640
 
  /// Destructor
641
 
  virtual ~UFC_Poisson2D_4BilinearForm_finite_element_1()
642
 
  {
643
 
    // Do nothing
644
 
  }
645
 
 
646
 
  /// Return a string identifying the finite element
647
 
  virtual const char* signature() const
648
 
  {
649
 
    return "FiniteElement('Lagrange', 'triangle', 4)";
650
 
  }
651
 
 
652
 
  /// Return the cell shape
653
 
  virtual ufc::shape cell_shape() const
654
 
  {
655
 
    return ufc::triangle;
656
 
  }
657
 
 
658
 
  /// Return the dimension of the finite element function space
659
 
  virtual unsigned int space_dimension() const
660
 
  {
661
 
    return 15;
662
 
  }
663
 
 
664
 
  /// Return the rank of the value space
665
 
  virtual unsigned int value_rank() const
666
 
  {
667
 
    return 0;
668
 
  }
669
 
 
670
 
  /// Return the dimension of the value space for axis i
671
 
  virtual unsigned int value_dimension(unsigned int i) const
672
 
  {
673
 
    return 1;
674
 
  }
675
 
 
676
 
  /// Evaluate basis function i at given point in cell
677
 
  virtual void evaluate_basis(unsigned int i,
678
 
                              double* values,
679
 
                              const double* coordinates,
680
 
                              const ufc::cell& c) const
681
 
  {
682
 
    // Extract vertex coordinates
683
 
    const double * const * element_coordinates = c.coordinates;
684
 
    
685
 
    // Compute Jacobian of affine map from reference cell
686
 
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
687
 
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
688
 
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
689
 
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
690
 
      
691
 
    // Compute determinant of Jacobian
692
 
    const double detJ = J_00*J_11 - J_01*J_10;
693
 
    
694
 
    // Compute inverse of Jacobian
695
 
    
696
 
    // Get coordinates and map to the reference (UFC) element
697
 
    double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
698
 
                element_coordinates[0][0]*element_coordinates[2][1] +\
699
 
                J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
700
 
    double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
701
 
                element_coordinates[1][0]*element_coordinates[0][1] -\
702
 
                J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
703
 
    
704
 
    // Map coordinates to the reference square
705
 
    if (std::abs(y - 1.0) < 1e-14)
706
 
      x = -1.0;
707
 
    else
708
 
      x = 2.0 *x/(1.0 - y) - 1.0;
709
 
    y = 2.0*y - 1.0;
710
 
    
711
 
    // Reset values
712
 
    *values = 0;
713
 
    
714
 
    // Map degree of freedom to element degree of freedom
715
 
    const unsigned int dof = i;
716
 
    
717
 
    // Generate scalings
718
 
    const double scalings_y_0 = 1;
719
 
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
720
 
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
721
 
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
722
 
    const double scalings_y_4 = scalings_y_3*(0.5 - 0.5*y);
723
 
    
724
 
    // Compute psitilde_a
725
 
    const double psitilde_a_0 = 1;
726
 
    const double psitilde_a_1 = x;
727
 
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
728
 
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
729
 
    const double psitilde_a_4 = 1.75*x*psitilde_a_3 - 0.75*psitilde_a_2;
730
 
    
731
 
    // Compute psitilde_bs
732
 
    const double psitilde_bs_0_0 = 1;
733
 
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
734
 
    const double psitilde_bs_0_2 = 0.111111111111111*psitilde_bs_0_1 + 1.66666666666667*y*psitilde_bs_0_1 - 0.555555555555556*psitilde_bs_0_0;
735
 
    const double psitilde_bs_0_3 = 0.05*psitilde_bs_0_2 + 1.75*y*psitilde_bs_0_2 - 0.7*psitilde_bs_0_1;
736
 
    const double psitilde_bs_0_4 = 0.0285714285714286*psitilde_bs_0_3 + 1.8*y*psitilde_bs_0_3 - 0.771428571428571*psitilde_bs_0_2;
737
 
    const double psitilde_bs_1_0 = 1;
738
 
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
739
 
    const double psitilde_bs_1_2 = 0.54*psitilde_bs_1_1 + 2.1*y*psitilde_bs_1_1 - 0.56*psitilde_bs_1_0;
740
 
    const double psitilde_bs_1_3 = 0.285714285714286*psitilde_bs_1_2 + 2*y*psitilde_bs_1_2 - 0.714285714285714*psitilde_bs_1_1;
741
 
    const double psitilde_bs_2_0 = 1;
742
 
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
743
 
    const double psitilde_bs_2_2 = 1.02040816326531*psitilde_bs_2_1 + 2.57142857142857*y*psitilde_bs_2_1 - 0.551020408163265*psitilde_bs_2_0;
744
 
    const double psitilde_bs_3_0 = 1;
745
 
    const double psitilde_bs_3_1 = 4.5*y + 3.5;
746
 
    const double psitilde_bs_4_0 = 1;
747
 
    
748
 
    // Compute basisvalues
749
 
    const double basisvalue0 = 0.707106781186548*psitilde_a_0*scalings_y_0*psitilde_bs_0_0;
750
 
    const double basisvalue1 = 1.73205080756888*psitilde_a_1*scalings_y_1*psitilde_bs_1_0;
751
 
    const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
752
 
    const double basisvalue3 = 2.73861278752583*psitilde_a_2*scalings_y_2*psitilde_bs_2_0;
753
 
    const double basisvalue4 = 2.12132034355964*psitilde_a_1*scalings_y_1*psitilde_bs_1_1;
754
 
    const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
755
 
    const double basisvalue6 = 3.74165738677394*psitilde_a_3*scalings_y_3*psitilde_bs_3_0;
756
 
    const double basisvalue7 = 3.16227766016838*psitilde_a_2*scalings_y_2*psitilde_bs_2_1;
757
 
    const double basisvalue8 = 2.44948974278318*psitilde_a_1*scalings_y_1*psitilde_bs_1_2;
758
 
    const double basisvalue9 = 1.4142135623731*psitilde_a_0*scalings_y_0*psitilde_bs_0_3;
759
 
    const double basisvalue10 = 4.74341649025257*psitilde_a_4*scalings_y_4*psitilde_bs_4_0;
760
 
    const double basisvalue11 = 4.18330013267038*psitilde_a_3*scalings_y_3*psitilde_bs_3_1;
761
 
    const double basisvalue12 = 3.53553390593274*psitilde_a_2*scalings_y_2*psitilde_bs_2_2;
762
 
    const double basisvalue13 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_3;
763
 
    const double basisvalue14 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_4;
764
 
    
765
 
    // Table(s) of coefficients
766
 
    const static double coefficients0[15][15] = \
767
 
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366312, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
768
 
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233825, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.023944356611608, -0.0185472188784818, 0.0107082418122104},
769
 
    {0, 0, 0.0476190476190476, 0, 0, 0.0388807895679869, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
770
 
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543895, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406279, 0.0834624849531681, -0.0535412090610519},
771
 
    {-0.0314269680527355, 0.0109971479845644, 0.00634920634920629, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
772
 
    {0.125707872210942, 0.0439885919382572, 0.126984126984127, 0, 0.0359165349174119, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
773
 
    {0.125707872210942, -0.131965775814772, -0.0253968253968255, 0.139104141588614, 0.0718330698348238, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.047888713223216, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
774
 
    {-0.0314269680527357, -0.0109971479845642, 0.00634920634920626, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
775
 
    {0.125707872210942, -0.0439885919382573, 0.126984126984127, 0, -0.035916534917412, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
776
 
    {0.125707872210942, -0.0879771838765143, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
777
 
    {-0.0314269680527355, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951818, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.0239443566116079, 0, 0.0107082418122103},
778
 
    {0.125707872210942, 0.0879771838765144, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277045, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
779
 
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406278, -0.0278208283177228, -0.0535412090610519},
780
 
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.026770604530526, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406279, 0.0278208283177227, -0.0535412090610519},
781
 
    {0.251415744421884, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
782
 
    
783
 
    // Extract relevant coefficients
784
 
    const double coeff0_0 = coefficients0[dof][0];
785
 
    const double coeff0_1 = coefficients0[dof][1];
786
 
    const double coeff0_2 = coefficients0[dof][2];
787
 
    const double coeff0_3 = coefficients0[dof][3];
788
 
    const double coeff0_4 = coefficients0[dof][4];
789
 
    const double coeff0_5 = coefficients0[dof][5];
790
 
    const double coeff0_6 = coefficients0[dof][6];
791
 
    const double coeff0_7 = coefficients0[dof][7];
792
 
    const double coeff0_8 = coefficients0[dof][8];
793
 
    const double coeff0_9 = coefficients0[dof][9];
794
 
    const double coeff0_10 = coefficients0[dof][10];
795
 
    const double coeff0_11 = coefficients0[dof][11];
796
 
    const double coeff0_12 = coefficients0[dof][12];
797
 
    const double coeff0_13 = coefficients0[dof][13];
798
 
    const double coeff0_14 = coefficients0[dof][14];
799
 
    
800
 
    // Compute value(s)
801
 
    *values = coeff0_0*basisvalue0 + coeff0_1*basisvalue1 + coeff0_2*basisvalue2 + coeff0_3*basisvalue3 + coeff0_4*basisvalue4 + coeff0_5*basisvalue5 + coeff0_6*basisvalue6 + coeff0_7*basisvalue7 + coeff0_8*basisvalue8 + coeff0_9*basisvalue9 + coeff0_10*basisvalue10 + coeff0_11*basisvalue11 + coeff0_12*basisvalue12 + coeff0_13*basisvalue13 + coeff0_14*basisvalue14;
802
 
  }
803
 
 
804
 
  /// Evaluate all basis functions at given point in cell
805
 
  virtual void evaluate_basis_all(double* values,
806
 
                                  const double* coordinates,
807
 
                                  const ufc::cell& c) const
808
 
  {
809
 
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
810
 
  }
811
 
 
812
 
  /// Evaluate order n derivatives of basis function i at given point in cell
813
 
  virtual void evaluate_basis_derivatives(unsigned int i,
814
 
                                          unsigned int n,
815
 
                                          double* values,
816
 
                                          const double* coordinates,
817
 
                                          const ufc::cell& c) const
818
 
  {
819
 
    // Extract vertex coordinates
820
 
    const double * const * element_coordinates = c.coordinates;
821
 
    
822
 
    // Compute Jacobian of affine map from reference cell
823
 
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
824
 
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
825
 
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
826
 
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
827
 
      
828
 
    // Compute determinant of Jacobian
829
 
    const double detJ = J_00*J_11 - J_01*J_10;
830
 
    
831
 
    // Compute inverse of Jacobian
832
 
    
833
 
    // Get coordinates and map to the reference (UFC) element
834
 
    double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
835
 
                element_coordinates[0][0]*element_coordinates[2][1] +\
836
 
                J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
837
 
    double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
838
 
                element_coordinates[1][0]*element_coordinates[0][1] -\
839
 
                J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
840
 
    
841
 
    // Map coordinates to the reference square
842
 
    if (std::abs(y - 1.0) < 1e-14)
843
 
      x = -1.0;
844
 
    else
845
 
      x = 2.0 *x/(1.0 - y) - 1.0;
846
 
    y = 2.0*y - 1.0;
847
 
    
848
 
    // Compute number of derivatives
849
 
    unsigned int num_derivatives = 1;
850
 
    
851
 
    for (unsigned int j = 0; j < n; j++)
852
 
      num_derivatives *= 2;
853
 
    
854
 
    
855
 
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
856
 
    unsigned int **combinations = new unsigned int *[num_derivatives];
857
 
        
858
 
    for (unsigned int j = 0; j < num_derivatives; j++)
859
 
    {
860
 
      combinations[j] = new unsigned int [n];
861
 
      for (unsigned int k = 0; k < n; k++)
862
 
        combinations[j][k] = 0;
863
 
    }
864
 
        
865
 
    // Generate combinations of derivatives
866
 
    for (unsigned int row = 1; row < num_derivatives; row++)
867
 
    {
868
 
      for (unsigned int num = 0; num < row; num++)
869
 
      {
870
 
        for (unsigned int col = n-1; col+1 > 0; col--)
871
 
        {
872
 
          if (combinations[row][col] + 1 > 1)
873
 
            combinations[row][col] = 0;
874
 
          else
875
 
          {
876
 
            combinations[row][col] += 1;
877
 
            break;
878
 
          }
879
 
        }
880
 
      }
881
 
    }
882
 
    
883
 
    // Compute inverse of Jacobian
884
 
    const double Jinv[2][2] =  {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
885
 
    
886
 
    // Declare transformation matrix
887
 
    // Declare pointer to two dimensional array and initialise
888
 
    double **transform = new double *[num_derivatives];
889
 
        
890
 
    for (unsigned int j = 0; j < num_derivatives; j++)
891
 
    {
892
 
      transform[j] = new double [num_derivatives];
893
 
      for (unsigned int k = 0; k < num_derivatives; k++)
894
 
        transform[j][k] = 1;
895
 
    }
896
 
    
897
 
    // Construct transformation matrix
898
 
    for (unsigned int row = 0; row < num_derivatives; row++)
899
 
    {
900
 
      for (unsigned int col = 0; col < num_derivatives; col++)
901
 
      {
902
 
        for (unsigned int k = 0; k < n; k++)
903
 
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
904
 
      }
905
 
    }
906
 
    
907
 
    // Reset values
908
 
    for (unsigned int j = 0; j < 1*num_derivatives; j++)
909
 
      values[j] = 0;
910
 
    
911
 
    // Map degree of freedom to element degree of freedom
912
 
    const unsigned int dof = i;
913
 
    
914
 
    // Generate scalings
915
 
    const double scalings_y_0 = 1;
916
 
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
917
 
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
918
 
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
919
 
    const double scalings_y_4 = scalings_y_3*(0.5 - 0.5*y);
920
 
    
921
 
    // Compute psitilde_a
922
 
    const double psitilde_a_0 = 1;
923
 
    const double psitilde_a_1 = x;
924
 
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
925
 
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
926
 
    const double psitilde_a_4 = 1.75*x*psitilde_a_3 - 0.75*psitilde_a_2;
927
 
    
928
 
    // Compute psitilde_bs
929
 
    const double psitilde_bs_0_0 = 1;
930
 
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
931
 
    const double psitilde_bs_0_2 = 0.111111111111111*psitilde_bs_0_1 + 1.66666666666667*y*psitilde_bs_0_1 - 0.555555555555556*psitilde_bs_0_0;
932
 
    const double psitilde_bs_0_3 = 0.05*psitilde_bs_0_2 + 1.75*y*psitilde_bs_0_2 - 0.7*psitilde_bs_0_1;
933
 
    const double psitilde_bs_0_4 = 0.0285714285714286*psitilde_bs_0_3 + 1.8*y*psitilde_bs_0_3 - 0.771428571428571*psitilde_bs_0_2;
934
 
    const double psitilde_bs_1_0 = 1;
935
 
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
936
 
    const double psitilde_bs_1_2 = 0.54*psitilde_bs_1_1 + 2.1*y*psitilde_bs_1_1 - 0.56*psitilde_bs_1_0;
937
 
    const double psitilde_bs_1_3 = 0.285714285714286*psitilde_bs_1_2 + 2*y*psitilde_bs_1_2 - 0.714285714285714*psitilde_bs_1_1;
938
 
    const double psitilde_bs_2_0 = 1;
939
 
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
940
 
    const double psitilde_bs_2_2 = 1.02040816326531*psitilde_bs_2_1 + 2.57142857142857*y*psitilde_bs_2_1 - 0.551020408163265*psitilde_bs_2_0;
941
 
    const double psitilde_bs_3_0 = 1;
942
 
    const double psitilde_bs_3_1 = 4.5*y + 3.5;
943
 
    const double psitilde_bs_4_0 = 1;
944
 
    
945
 
    // Compute basisvalues
946
 
    const double basisvalue0 = 0.707106781186548*psitilde_a_0*scalings_y_0*psitilde_bs_0_0;
947
 
    const double basisvalue1 = 1.73205080756888*psitilde_a_1*scalings_y_1*psitilde_bs_1_0;
948
 
    const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
949
 
    const double basisvalue3 = 2.73861278752583*psitilde_a_2*scalings_y_2*psitilde_bs_2_0;
950
 
    const double basisvalue4 = 2.12132034355964*psitilde_a_1*scalings_y_1*psitilde_bs_1_1;
951
 
    const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
952
 
    const double basisvalue6 = 3.74165738677394*psitilde_a_3*scalings_y_3*psitilde_bs_3_0;
953
 
    const double basisvalue7 = 3.16227766016838*psitilde_a_2*scalings_y_2*psitilde_bs_2_1;
954
 
    const double basisvalue8 = 2.44948974278318*psitilde_a_1*scalings_y_1*psitilde_bs_1_2;
955
 
    const double basisvalue9 = 1.4142135623731*psitilde_a_0*scalings_y_0*psitilde_bs_0_3;
956
 
    const double basisvalue10 = 4.74341649025257*psitilde_a_4*scalings_y_4*psitilde_bs_4_0;
957
 
    const double basisvalue11 = 4.18330013267038*psitilde_a_3*scalings_y_3*psitilde_bs_3_1;
958
 
    const double basisvalue12 = 3.53553390593274*psitilde_a_2*scalings_y_2*psitilde_bs_2_2;
959
 
    const double basisvalue13 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_3;
960
 
    const double basisvalue14 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_4;
961
 
    
962
 
    // Table(s) of coefficients
963
 
    const static double coefficients0[15][15] = \
964
 
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366312, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
965
 
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233825, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.023944356611608, -0.0185472188784818, 0.0107082418122104},
966
 
    {0, 0, 0.0476190476190476, 0, 0, 0.0388807895679869, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
967
 
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543895, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406279, 0.0834624849531681, -0.0535412090610519},
968
 
    {-0.0314269680527355, 0.0109971479845644, 0.00634920634920629, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
969
 
    {0.125707872210942, 0.0439885919382572, 0.126984126984127, 0, 0.0359165349174119, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
970
 
    {0.125707872210942, -0.131965775814772, -0.0253968253968255, 0.139104141588614, 0.0718330698348238, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.047888713223216, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
971
 
    {-0.0314269680527357, -0.0109971479845642, 0.00634920634920626, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
972
 
    {0.125707872210942, -0.0439885919382573, 0.126984126984127, 0, -0.035916534917412, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
973
 
    {0.125707872210942, -0.0879771838765143, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
974
 
    {-0.0314269680527355, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951818, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.0239443566116079, 0, 0.0107082418122103},
975
 
    {0.125707872210942, 0.0879771838765144, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277045, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
976
 
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406278, -0.0278208283177228, -0.0535412090610519},
977
 
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.026770604530526, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406279, 0.0278208283177227, -0.0535412090610519},
978
 
    {0.251415744421884, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
979
 
    
980
 
    // Interesting (new) part
981
 
    // Tables of derivatives of the polynomial base (transpose)
982
 
    const static double dmats0[15][15] = \
983
 
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
984
 
    {4.89897948556635, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
985
 
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
986
 
    {0, 9.48683298050513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
987
 
    {4, 0, 7.07106781186548, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
988
 
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
989
 
    {5.29150262212917, 0, -2.99332590941916, 13.6626010212795, 0, 0.611010092660778, 0, 0, 0, 0, 0, 0, 0, 0, 0},
990
 
    {0, 4.38178046004132, 0, 0, 12.5219806739988, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
991
 
    {3.46410161513776, 0, 7.83836717690617, 0, 0, 8.40000000000001, 0, 0, 0, 0, 0, 0, 0, 0, 0},
992
 
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
993
 
    {0, 10.9544511501033, 0, 0, -3.83325938999965, 0, 17.7482393492988, 0, 0.553283335172492, 0, 0, 0, 0, 0, 0},
994
 
    {4.73286382647968, 0, 3.3466401061363, 4.36435780471985, 0, -5.07468037933239, 0, 17.0084012854152, 0, 1.52127765851133, 0, 0, 0, 0, 0},
995
 
    {0, 2.44948974278317, 0, 0, 9.14285714285714, 0, 0, 0, 14.8461497791618, 0, 0, 0, 0, 0, 0},
996
 
    {3.09838667696594, 0, 7.66811580507233, 0, 0, 10.733126291999, 0, 0, 0, 9.2951600308978, 0, 0, 0, 0, 0},
997
 
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
998
 
    
999
 
    const static double dmats1[15][15] = \
1000
 
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1001
 
    {2.44948974278317, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1002
 
    {4.24264068711928, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1003
 
    {2.58198889747161, 4.74341649025257, -0.912870929175277, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1004
 
    {2, 6.12372435695794, 3.53553390593274, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1005
 
    {-2.30940107675849, 0, 8.16496580927726, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1006
 
    {2.64575131106458, 5.18459255872628, -1.49666295470958, 6.83130051063973, -1.05830052442584, 0.305505046330385, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1007
 
    {2.23606797749978, 2.19089023002066, 2.5298221281347, 8.08290376865476, 6.26099033699942, -1.80739222823014, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1008
 
    {1.73205080756888, -5.09116882454314, 3.91918358845309, 0, 9.69948452238572, 4.2, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1009
 
    {5, 0, -2.8284271247462, 0, 0, 12.1243556529821, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1010
 
    {2.68328157299974, 5.47722557505166, -1.89736659610103, 7.4230748895809, -1.91662969499982, 0.663940002206987, 8.87411967464942, -1.07142857142857, 0.276641667586245, -0.095831484749991, 0, 0, 0, 0, 0},
1011
 
    {2.36643191323984, 2.89827534923788, 1.67332005306815, 2.18217890235993, 5.74704893215391, -2.53734018966619, 10.0623058987491, 8.50420064270761, -2.1957751641342, 0.760638829255663, 0, 0, 0, 0, 0},
1012
 
    {2, 1.22474487139159, 3.53553390593274, -7.37711113563317, 4.57142857142857, 1.64957219768464, 0, 11.4997781699989, 7.4230748895809, -2.57142857142858, 0, 0, 0, 0, 0},
1013
 
    {1.54919333848296, 6.6407830863536, 3.83405790253616, 0, -6.19677335393188, 5.3665631459995, 0, 0, 13.4164078649987, 4.6475800154489, 0, 0, 0, 0, 0},
1014
 
    {-3.57770876399967, 0, 8.85437744847147, 0, 0, -3.09838667696593, 0, 0, 0, 16.0996894379985, 0, 0, 0, 0, 0}};
1015
 
    
1016
 
    // Compute reference derivatives
1017
 
    // Declare pointer to array of derivatives on FIAT element
1018
 
    double *derivatives = new double [num_derivatives];
1019
 
    
1020
 
    // Declare coefficients
1021
 
    double coeff0_0 = 0;
1022
 
    double coeff0_1 = 0;
1023
 
    double coeff0_2 = 0;
1024
 
    double coeff0_3 = 0;
1025
 
    double coeff0_4 = 0;
1026
 
    double coeff0_5 = 0;
1027
 
    double coeff0_6 = 0;
1028
 
    double coeff0_7 = 0;
1029
 
    double coeff0_8 = 0;
1030
 
    double coeff0_9 = 0;
1031
 
    double coeff0_10 = 0;
1032
 
    double coeff0_11 = 0;
1033
 
    double coeff0_12 = 0;
1034
 
    double coeff0_13 = 0;
1035
 
    double coeff0_14 = 0;
1036
 
    
1037
 
    // Declare new coefficients
1038
 
    double new_coeff0_0 = 0;
1039
 
    double new_coeff0_1 = 0;
1040
 
    double new_coeff0_2 = 0;
1041
 
    double new_coeff0_3 = 0;
1042
 
    double new_coeff0_4 = 0;
1043
 
    double new_coeff0_5 = 0;
1044
 
    double new_coeff0_6 = 0;
1045
 
    double new_coeff0_7 = 0;
1046
 
    double new_coeff0_8 = 0;
1047
 
    double new_coeff0_9 = 0;
1048
 
    double new_coeff0_10 = 0;
1049
 
    double new_coeff0_11 = 0;
1050
 
    double new_coeff0_12 = 0;
1051
 
    double new_coeff0_13 = 0;
1052
 
    double new_coeff0_14 = 0;
1053
 
    
1054
 
    // Loop possible derivatives
1055
 
    for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
1056
 
    {
1057
 
      // Get values from coefficients array
1058
 
      new_coeff0_0 = coefficients0[dof][0];
1059
 
      new_coeff0_1 = coefficients0[dof][1];
1060
 
      new_coeff0_2 = coefficients0[dof][2];
1061
 
      new_coeff0_3 = coefficients0[dof][3];
1062
 
      new_coeff0_4 = coefficients0[dof][4];
1063
 
      new_coeff0_5 = coefficients0[dof][5];
1064
 
      new_coeff0_6 = coefficients0[dof][6];
1065
 
      new_coeff0_7 = coefficients0[dof][7];
1066
 
      new_coeff0_8 = coefficients0[dof][8];
1067
 
      new_coeff0_9 = coefficients0[dof][9];
1068
 
      new_coeff0_10 = coefficients0[dof][10];
1069
 
      new_coeff0_11 = coefficients0[dof][11];
1070
 
      new_coeff0_12 = coefficients0[dof][12];
1071
 
      new_coeff0_13 = coefficients0[dof][13];
1072
 
      new_coeff0_14 = coefficients0[dof][14];
1073
 
    
1074
 
      // Loop derivative order
1075
 
      for (unsigned int j = 0; j < n; j++)
1076
 
      {
1077
 
        // Update old coefficients
1078
 
        coeff0_0 = new_coeff0_0;
1079
 
        coeff0_1 = new_coeff0_1;
1080
 
        coeff0_2 = new_coeff0_2;
1081
 
        coeff0_3 = new_coeff0_3;
1082
 
        coeff0_4 = new_coeff0_4;
1083
 
        coeff0_5 = new_coeff0_5;
1084
 
        coeff0_6 = new_coeff0_6;
1085
 
        coeff0_7 = new_coeff0_7;
1086
 
        coeff0_8 = new_coeff0_8;
1087
 
        coeff0_9 = new_coeff0_9;
1088
 
        coeff0_10 = new_coeff0_10;
1089
 
        coeff0_11 = new_coeff0_11;
1090
 
        coeff0_12 = new_coeff0_12;
1091
 
        coeff0_13 = new_coeff0_13;
1092
 
        coeff0_14 = new_coeff0_14;
1093
 
    
1094
 
        if(combinations[deriv_num][j] == 0)
1095
 
        {
1096
 
          new_coeff0_0 = coeff0_0*dmats0[0][0] + coeff0_1*dmats0[1][0] + coeff0_2*dmats0[2][0] + coeff0_3*dmats0[3][0] + coeff0_4*dmats0[4][0] + coeff0_5*dmats0[5][0] + coeff0_6*dmats0[6][0] + coeff0_7*dmats0[7][0] + coeff0_8*dmats0[8][0] + coeff0_9*dmats0[9][0] + coeff0_10*dmats0[10][0] + coeff0_11*dmats0[11][0] + coeff0_12*dmats0[12][0] + coeff0_13*dmats0[13][0] + coeff0_14*dmats0[14][0];
1097
 
          new_coeff0_1 = coeff0_0*dmats0[0][1] + coeff0_1*dmats0[1][1] + coeff0_2*dmats0[2][1] + coeff0_3*dmats0[3][1] + coeff0_4*dmats0[4][1] + coeff0_5*dmats0[5][1] + coeff0_6*dmats0[6][1] + coeff0_7*dmats0[7][1] + coeff0_8*dmats0[8][1] + coeff0_9*dmats0[9][1] + coeff0_10*dmats0[10][1] + coeff0_11*dmats0[11][1] + coeff0_12*dmats0[12][1] + coeff0_13*dmats0[13][1] + coeff0_14*dmats0[14][1];
1098
 
          new_coeff0_2 = coeff0_0*dmats0[0][2] + coeff0_1*dmats0[1][2] + coeff0_2*dmats0[2][2] + coeff0_3*dmats0[3][2] + coeff0_4*dmats0[4][2] + coeff0_5*dmats0[5][2] + coeff0_6*dmats0[6][2] + coeff0_7*dmats0[7][2] + coeff0_8*dmats0[8][2] + coeff0_9*dmats0[9][2] + coeff0_10*dmats0[10][2] + coeff0_11*dmats0[11][2] + coeff0_12*dmats0[12][2] + coeff0_13*dmats0[13][2] + coeff0_14*dmats0[14][2];
1099
 
          new_coeff0_3 = coeff0_0*dmats0[0][3] + coeff0_1*dmats0[1][3] + coeff0_2*dmats0[2][3] + coeff0_3*dmats0[3][3] + coeff0_4*dmats0[4][3] + coeff0_5*dmats0[5][3] + coeff0_6*dmats0[6][3] + coeff0_7*dmats0[7][3] + coeff0_8*dmats0[8][3] + coeff0_9*dmats0[9][3] + coeff0_10*dmats0[10][3] + coeff0_11*dmats0[11][3] + coeff0_12*dmats0[12][3] + coeff0_13*dmats0[13][3] + coeff0_14*dmats0[14][3];
1100
 
          new_coeff0_4 = coeff0_0*dmats0[0][4] + coeff0_1*dmats0[1][4] + coeff0_2*dmats0[2][4] + coeff0_3*dmats0[3][4] + coeff0_4*dmats0[4][4] + coeff0_5*dmats0[5][4] + coeff0_6*dmats0[6][4] + coeff0_7*dmats0[7][4] + coeff0_8*dmats0[8][4] + coeff0_9*dmats0[9][4] + coeff0_10*dmats0[10][4] + coeff0_11*dmats0[11][4] + coeff0_12*dmats0[12][4] + coeff0_13*dmats0[13][4] + coeff0_14*dmats0[14][4];
1101
 
          new_coeff0_5 = coeff0_0*dmats0[0][5] + coeff0_1*dmats0[1][5] + coeff0_2*dmats0[2][5] + coeff0_3*dmats0[3][5] + coeff0_4*dmats0[4][5] + coeff0_5*dmats0[5][5] + coeff0_6*dmats0[6][5] + coeff0_7*dmats0[7][5] + coeff0_8*dmats0[8][5] + coeff0_9*dmats0[9][5] + coeff0_10*dmats0[10][5] + coeff0_11*dmats0[11][5] + coeff0_12*dmats0[12][5] + coeff0_13*dmats0[13][5] + coeff0_14*dmats0[14][5];
1102
 
          new_coeff0_6 = coeff0_0*dmats0[0][6] + coeff0_1*dmats0[1][6] + coeff0_2*dmats0[2][6] + coeff0_3*dmats0[3][6] + coeff0_4*dmats0[4][6] + coeff0_5*dmats0[5][6] + coeff0_6*dmats0[6][6] + coeff0_7*dmats0[7][6] + coeff0_8*dmats0[8][6] + coeff0_9*dmats0[9][6] + coeff0_10*dmats0[10][6] + coeff0_11*dmats0[11][6] + coeff0_12*dmats0[12][6] + coeff0_13*dmats0[13][6] + coeff0_14*dmats0[14][6];
1103
 
          new_coeff0_7 = coeff0_0*dmats0[0][7] + coeff0_1*dmats0[1][7] + coeff0_2*dmats0[2][7] + coeff0_3*dmats0[3][7] + coeff0_4*dmats0[4][7] + coeff0_5*dmats0[5][7] + coeff0_6*dmats0[6][7] + coeff0_7*dmats0[7][7] + coeff0_8*dmats0[8][7] + coeff0_9*dmats0[9][7] + coeff0_10*dmats0[10][7] + coeff0_11*dmats0[11][7] + coeff0_12*dmats0[12][7] + coeff0_13*dmats0[13][7] + coeff0_14*dmats0[14][7];
1104
 
          new_coeff0_8 = coeff0_0*dmats0[0][8] + coeff0_1*dmats0[1][8] + coeff0_2*dmats0[2][8] + coeff0_3*dmats0[3][8] + coeff0_4*dmats0[4][8] + coeff0_5*dmats0[5][8] + coeff0_6*dmats0[6][8] + coeff0_7*dmats0[7][8] + coeff0_8*dmats0[8][8] + coeff0_9*dmats0[9][8] + coeff0_10*dmats0[10][8] + coeff0_11*dmats0[11][8] + coeff0_12*dmats0[12][8] + coeff0_13*dmats0[13][8] + coeff0_14*dmats0[14][8];
1105
 
          new_coeff0_9 = coeff0_0*dmats0[0][9] + coeff0_1*dmats0[1][9] + coeff0_2*dmats0[2][9] + coeff0_3*dmats0[3][9] + coeff0_4*dmats0[4][9] + coeff0_5*dmats0[5][9] + coeff0_6*dmats0[6][9] + coeff0_7*dmats0[7][9] + coeff0_8*dmats0[8][9] + coeff0_9*dmats0[9][9] + coeff0_10*dmats0[10][9] + coeff0_11*dmats0[11][9] + coeff0_12*dmats0[12][9] + coeff0_13*dmats0[13][9] + coeff0_14*dmats0[14][9];
1106
 
          new_coeff0_10 = coeff0_0*dmats0[0][10] + coeff0_1*dmats0[1][10] + coeff0_2*dmats0[2][10] + coeff0_3*dmats0[3][10] + coeff0_4*dmats0[4][10] + coeff0_5*dmats0[5][10] + coeff0_6*dmats0[6][10] + coeff0_7*dmats0[7][10] + coeff0_8*dmats0[8][10] + coeff0_9*dmats0[9][10] + coeff0_10*dmats0[10][10] + coeff0_11*dmats0[11][10] + coeff0_12*dmats0[12][10] + coeff0_13*dmats0[13][10] + coeff0_14*dmats0[14][10];
1107
 
          new_coeff0_11 = coeff0_0*dmats0[0][11] + coeff0_1*dmats0[1][11] + coeff0_2*dmats0[2][11] + coeff0_3*dmats0[3][11] + coeff0_4*dmats0[4][11] + coeff0_5*dmats0[5][11] + coeff0_6*dmats0[6][11] + coeff0_7*dmats0[7][11] + coeff0_8*dmats0[8][11] + coeff0_9*dmats0[9][11] + coeff0_10*dmats0[10][11] + coeff0_11*dmats0[11][11] + coeff0_12*dmats0[12][11] + coeff0_13*dmats0[13][11] + coeff0_14*dmats0[14][11];
1108
 
          new_coeff0_12 = coeff0_0*dmats0[0][12] + coeff0_1*dmats0[1][12] + coeff0_2*dmats0[2][12] + coeff0_3*dmats0[3][12] + coeff0_4*dmats0[4][12] + coeff0_5*dmats0[5][12] + coeff0_6*dmats0[6][12] + coeff0_7*dmats0[7][12] + coeff0_8*dmats0[8][12] + coeff0_9*dmats0[9][12] + coeff0_10*dmats0[10][12] + coeff0_11*dmats0[11][12] + coeff0_12*dmats0[12][12] + coeff0_13*dmats0[13][12] + coeff0_14*dmats0[14][12];
1109
 
          new_coeff0_13 = coeff0_0*dmats0[0][13] + coeff0_1*dmats0[1][13] + coeff0_2*dmats0[2][13] + coeff0_3*dmats0[3][13] + coeff0_4*dmats0[4][13] + coeff0_5*dmats0[5][13] + coeff0_6*dmats0[6][13] + coeff0_7*dmats0[7][13] + coeff0_8*dmats0[8][13] + coeff0_9*dmats0[9][13] + coeff0_10*dmats0[10][13] + coeff0_11*dmats0[11][13] + coeff0_12*dmats0[12][13] + coeff0_13*dmats0[13][13] + coeff0_14*dmats0[14][13];
1110
 
          new_coeff0_14 = coeff0_0*dmats0[0][14] + coeff0_1*dmats0[1][14] + coeff0_2*dmats0[2][14] + coeff0_3*dmats0[3][14] + coeff0_4*dmats0[4][14] + coeff0_5*dmats0[5][14] + coeff0_6*dmats0[6][14] + coeff0_7*dmats0[7][14] + coeff0_8*dmats0[8][14] + coeff0_9*dmats0[9][14] + coeff0_10*dmats0[10][14] + coeff0_11*dmats0[11][14] + coeff0_12*dmats0[12][14] + coeff0_13*dmats0[13][14] + coeff0_14*dmats0[14][14];
1111
 
        }
1112
 
        if(combinations[deriv_num][j] == 1)
1113
 
        {
1114
 
          new_coeff0_0 = coeff0_0*dmats1[0][0] + coeff0_1*dmats1[1][0] + coeff0_2*dmats1[2][0] + coeff0_3*dmats1[3][0] + coeff0_4*dmats1[4][0] + coeff0_5*dmats1[5][0] + coeff0_6*dmats1[6][0] + coeff0_7*dmats1[7][0] + coeff0_8*dmats1[8][0] + coeff0_9*dmats1[9][0] + coeff0_10*dmats1[10][0] + coeff0_11*dmats1[11][0] + coeff0_12*dmats1[12][0] + coeff0_13*dmats1[13][0] + coeff0_14*dmats1[14][0];
1115
 
          new_coeff0_1 = coeff0_0*dmats1[0][1] + coeff0_1*dmats1[1][1] + coeff0_2*dmats1[2][1] + coeff0_3*dmats1[3][1] + coeff0_4*dmats1[4][1] + coeff0_5*dmats1[5][1] + coeff0_6*dmats1[6][1] + coeff0_7*dmats1[7][1] + coeff0_8*dmats1[8][1] + coeff0_9*dmats1[9][1] + coeff0_10*dmats1[10][1] + coeff0_11*dmats1[11][1] + coeff0_12*dmats1[12][1] + coeff0_13*dmats1[13][1] + coeff0_14*dmats1[14][1];
1116
 
          new_coeff0_2 = coeff0_0*dmats1[0][2] + coeff0_1*dmats1[1][2] + coeff0_2*dmats1[2][2] + coeff0_3*dmats1[3][2] + coeff0_4*dmats1[4][2] + coeff0_5*dmats1[5][2] + coeff0_6*dmats1[6][2] + coeff0_7*dmats1[7][2] + coeff0_8*dmats1[8][2] + coeff0_9*dmats1[9][2] + coeff0_10*dmats1[10][2] + coeff0_11*dmats1[11][2] + coeff0_12*dmats1[12][2] + coeff0_13*dmats1[13][2] + coeff0_14*dmats1[14][2];
1117
 
          new_coeff0_3 = coeff0_0*dmats1[0][3] + coeff0_1*dmats1[1][3] + coeff0_2*dmats1[2][3] + coeff0_3*dmats1[3][3] + coeff0_4*dmats1[4][3] + coeff0_5*dmats1[5][3] + coeff0_6*dmats1[6][3] + coeff0_7*dmats1[7][3] + coeff0_8*dmats1[8][3] + coeff0_9*dmats1[9][3] + coeff0_10*dmats1[10][3] + coeff0_11*dmats1[11][3] + coeff0_12*dmats1[12][3] + coeff0_13*dmats1[13][3] + coeff0_14*dmats1[14][3];
1118
 
          new_coeff0_4 = coeff0_0*dmats1[0][4] + coeff0_1*dmats1[1][4] + coeff0_2*dmats1[2][4] + coeff0_3*dmats1[3][4] + coeff0_4*dmats1[4][4] + coeff0_5*dmats1[5][4] + coeff0_6*dmats1[6][4] + coeff0_7*dmats1[7][4] + coeff0_8*dmats1[8][4] + coeff0_9*dmats1[9][4] + coeff0_10*dmats1[10][4] + coeff0_11*dmats1[11][4] + coeff0_12*dmats1[12][4] + coeff0_13*dmats1[13][4] + coeff0_14*dmats1[14][4];
1119
 
          new_coeff0_5 = coeff0_0*dmats1[0][5] + coeff0_1*dmats1[1][5] + coeff0_2*dmats1[2][5] + coeff0_3*dmats1[3][5] + coeff0_4*dmats1[4][5] + coeff0_5*dmats1[5][5] + coeff0_6*dmats1[6][5] + coeff0_7*dmats1[7][5] + coeff0_8*dmats1[8][5] + coeff0_9*dmats1[9][5] + coeff0_10*dmats1[10][5] + coeff0_11*dmats1[11][5] + coeff0_12*dmats1[12][5] + coeff0_13*dmats1[13][5] + coeff0_14*dmats1[14][5];
1120
 
          new_coeff0_6 = coeff0_0*dmats1[0][6] + coeff0_1*dmats1[1][6] + coeff0_2*dmats1[2][6] + coeff0_3*dmats1[3][6] + coeff0_4*dmats1[4][6] + coeff0_5*dmats1[5][6] + coeff0_6*dmats1[6][6] + coeff0_7*dmats1[7][6] + coeff0_8*dmats1[8][6] + coeff0_9*dmats1[9][6] + coeff0_10*dmats1[10][6] + coeff0_11*dmats1[11][6] + coeff0_12*dmats1[12][6] + coeff0_13*dmats1[13][6] + coeff0_14*dmats1[14][6];
1121
 
          new_coeff0_7 = coeff0_0*dmats1[0][7] + coeff0_1*dmats1[1][7] + coeff0_2*dmats1[2][7] + coeff0_3*dmats1[3][7] + coeff0_4*dmats1[4][7] + coeff0_5*dmats1[5][7] + coeff0_6*dmats1[6][7] + coeff0_7*dmats1[7][7] + coeff0_8*dmats1[8][7] + coeff0_9*dmats1[9][7] + coeff0_10*dmats1[10][7] + coeff0_11*dmats1[11][7] + coeff0_12*dmats1[12][7] + coeff0_13*dmats1[13][7] + coeff0_14*dmats1[14][7];
1122
 
          new_coeff0_8 = coeff0_0*dmats1[0][8] + coeff0_1*dmats1[1][8] + coeff0_2*dmats1[2][8] + coeff0_3*dmats1[3][8] + coeff0_4*dmats1[4][8] + coeff0_5*dmats1[5][8] + coeff0_6*dmats1[6][8] + coeff0_7*dmats1[7][8] + coeff0_8*dmats1[8][8] + coeff0_9*dmats1[9][8] + coeff0_10*dmats1[10][8] + coeff0_11*dmats1[11][8] + coeff0_12*dmats1[12][8] + coeff0_13*dmats1[13][8] + coeff0_14*dmats1[14][8];
1123
 
          new_coeff0_9 = coeff0_0*dmats1[0][9] + coeff0_1*dmats1[1][9] + coeff0_2*dmats1[2][9] + coeff0_3*dmats1[3][9] + coeff0_4*dmats1[4][9] + coeff0_5*dmats1[5][9] + coeff0_6*dmats1[6][9] + coeff0_7*dmats1[7][9] + coeff0_8*dmats1[8][9] + coeff0_9*dmats1[9][9] + coeff0_10*dmats1[10][9] + coeff0_11*dmats1[11][9] + coeff0_12*dmats1[12][9] + coeff0_13*dmats1[13][9] + coeff0_14*dmats1[14][9];
1124
 
          new_coeff0_10 = coeff0_0*dmats1[0][10] + coeff0_1*dmats1[1][10] + coeff0_2*dmats1[2][10] + coeff0_3*dmats1[3][10] + coeff0_4*dmats1[4][10] + coeff0_5*dmats1[5][10] + coeff0_6*dmats1[6][10] + coeff0_7*dmats1[7][10] + coeff0_8*dmats1[8][10] + coeff0_9*dmats1[9][10] + coeff0_10*dmats1[10][10] + coeff0_11*dmats1[11][10] + coeff0_12*dmats1[12][10] + coeff0_13*dmats1[13][10] + coeff0_14*dmats1[14][10];
1125
 
          new_coeff0_11 = coeff0_0*dmats1[0][11] + coeff0_1*dmats1[1][11] + coeff0_2*dmats1[2][11] + coeff0_3*dmats1[3][11] + coeff0_4*dmats1[4][11] + coeff0_5*dmats1[5][11] + coeff0_6*dmats1[6][11] + coeff0_7*dmats1[7][11] + coeff0_8*dmats1[8][11] + coeff0_9*dmats1[9][11] + coeff0_10*dmats1[10][11] + coeff0_11*dmats1[11][11] + coeff0_12*dmats1[12][11] + coeff0_13*dmats1[13][11] + coeff0_14*dmats1[14][11];
1126
 
          new_coeff0_12 = coeff0_0*dmats1[0][12] + coeff0_1*dmats1[1][12] + coeff0_2*dmats1[2][12] + coeff0_3*dmats1[3][12] + coeff0_4*dmats1[4][12] + coeff0_5*dmats1[5][12] + coeff0_6*dmats1[6][12] + coeff0_7*dmats1[7][12] + coeff0_8*dmats1[8][12] + coeff0_9*dmats1[9][12] + coeff0_10*dmats1[10][12] + coeff0_11*dmats1[11][12] + coeff0_12*dmats1[12][12] + coeff0_13*dmats1[13][12] + coeff0_14*dmats1[14][12];
1127
 
          new_coeff0_13 = coeff0_0*dmats1[0][13] + coeff0_1*dmats1[1][13] + coeff0_2*dmats1[2][13] + coeff0_3*dmats1[3][13] + coeff0_4*dmats1[4][13] + coeff0_5*dmats1[5][13] + coeff0_6*dmats1[6][13] + coeff0_7*dmats1[7][13] + coeff0_8*dmats1[8][13] + coeff0_9*dmats1[9][13] + coeff0_10*dmats1[10][13] + coeff0_11*dmats1[11][13] + coeff0_12*dmats1[12][13] + coeff0_13*dmats1[13][13] + coeff0_14*dmats1[14][13];
1128
 
          new_coeff0_14 = coeff0_0*dmats1[0][14] + coeff0_1*dmats1[1][14] + coeff0_2*dmats1[2][14] + coeff0_3*dmats1[3][14] + coeff0_4*dmats1[4][14] + coeff0_5*dmats1[5][14] + coeff0_6*dmats1[6][14] + coeff0_7*dmats1[7][14] + coeff0_8*dmats1[8][14] + coeff0_9*dmats1[9][14] + coeff0_10*dmats1[10][14] + coeff0_11*dmats1[11][14] + coeff0_12*dmats1[12][14] + coeff0_13*dmats1[13][14] + coeff0_14*dmats1[14][14];
1129
 
        }
1130
 
    
1131
 
      }
1132
 
      // Compute derivatives on reference element as dot product of coefficients and basisvalues
1133
 
      derivatives[deriv_num] = new_coeff0_0*basisvalue0 + new_coeff0_1*basisvalue1 + new_coeff0_2*basisvalue2 + new_coeff0_3*basisvalue3 + new_coeff0_4*basisvalue4 + new_coeff0_5*basisvalue5 + new_coeff0_6*basisvalue6 + new_coeff0_7*basisvalue7 + new_coeff0_8*basisvalue8 + new_coeff0_9*basisvalue9 + new_coeff0_10*basisvalue10 + new_coeff0_11*basisvalue11 + new_coeff0_12*basisvalue12 + new_coeff0_13*basisvalue13 + new_coeff0_14*basisvalue14;
1134
 
    }
1135
 
    
1136
 
    // Transform derivatives back to physical element
1137
 
    for (unsigned int row = 0; row < num_derivatives; row++)
1138
 
    {
1139
 
      for (unsigned int col = 0; col < num_derivatives; col++)
1140
 
      {
1141
 
        values[row] += transform[row][col]*derivatives[col];
1142
 
      }
1143
 
    }
1144
 
    // Delete pointer to array of derivatives on FIAT element
1145
 
    delete [] derivatives;
1146
 
    
1147
 
    // Delete pointer to array of combinations of derivatives and transform
1148
 
    for (unsigned int row = 0; row < num_derivatives; row++)
1149
 
    {
1150
 
      delete [] combinations[row];
1151
 
      delete [] transform[row];
1152
 
    }
1153
 
    
1154
 
    delete [] combinations;
1155
 
    delete [] transform;
1156
 
  }
1157
 
 
1158
 
  /// Evaluate order n derivatives of all basis functions at given point in cell
1159
 
  virtual void evaluate_basis_derivatives_all(unsigned int n,
1160
 
                                              double* values,
1161
 
                                              const double* coordinates,
1162
 
                                              const ufc::cell& c) const
1163
 
  {
1164
 
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
1165
 
  }
1166
 
 
1167
 
  /// Evaluate linear functional for dof i on the function f
1168
 
  virtual double evaluate_dof(unsigned int i,
1169
 
                              const ufc::function& f,
1170
 
                              const ufc::cell& c) const
1171
 
  {
1172
 
    // The reference points, direction and weights:
1173
 
    const static double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.75, 0.25}}, {{0.5, 0.5}}, {{0.25, 0.75}}, {{0, 0.25}}, {{0, 0.5}}, {{0, 0.75}}, {{0.25, 0}}, {{0.5, 0}}, {{0.75, 0}}, {{0.25, 0.25}}, {{0.5, 0.25}}, {{0.25, 0.5}}};
1174
 
    const static double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
1175
 
    const static double D[15][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
1176
 
    
1177
 
    const double * const * x = c.coordinates;
1178
 
    double result = 0.0;
1179
 
    // Iterate over the points:
1180
 
    // Evaluate basis functions for affine mapping
1181
 
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1];
1182
 
    const double w1 = X[i][0][0];
1183
 
    const double w2 = X[i][0][1];
1184
 
    
1185
 
    // Compute affine mapping y = F(X)
1186
 
    double y[2];
1187
 
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0];
1188
 
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1];
1189
 
    
1190
 
    // Evaluate function at physical points
1191
 
    double values[1];
1192
 
    f.evaluate(values, y, c);
1193
 
    
1194
 
    // Map function values using appropriate mapping
1195
 
    // Affine map: Do nothing
1196
 
    
1197
 
    // Note that we do not map the weights (yet).
1198
 
    
1199
 
    // Take directional components
1200
 
    for(int k = 0; k < 1; k++)
1201
 
      result += values[k]*D[i][0][k];
1202
 
    // Multiply by weights 
1203
 
    result *= W[i][0];
1204
 
    
1205
 
    return result;
1206
 
  }
1207
 
 
1208
 
  /// Evaluate linear functionals for all dofs on the function f
1209
 
  virtual void evaluate_dofs(double* values,
1210
 
                             const ufc::function& f,
1211
 
                             const ufc::cell& c) const
1212
 
  {
1213
 
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
1214
 
  }
1215
 
 
1216
 
  /// Interpolate vertex values from dof values
1217
 
  virtual void interpolate_vertex_values(double* vertex_values,
1218
 
                                         const double* dof_values,
1219
 
                                         const ufc::cell& c) const
1220
 
  {
1221
 
    // Evaluate at vertices and use affine mapping
1222
 
    vertex_values[0] = dof_values[0];
1223
 
    vertex_values[1] = dof_values[1];
1224
 
    vertex_values[2] = dof_values[2];
1225
 
  }
1226
 
 
1227
 
  /// Return the number of sub elements (for a mixed element)
1228
 
  virtual unsigned int num_sub_elements() const
1229
 
  {
1230
 
    return 1;
1231
 
  }
1232
 
 
1233
 
  /// Create a new finite element for sub element i (for a mixed element)
1234
 
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
1235
 
  {
1236
 
    return new UFC_Poisson2D_4BilinearForm_finite_element_1();
1237
 
  }
1238
 
 
1239
 
};
1240
 
 
1241
 
/// This class defines the interface for a local-to-global mapping of
1242
 
/// degrees of freedom (dofs).
1243
 
 
1244
 
class UFC_Poisson2D_4BilinearForm_dof_map_0: public ufc::dof_map
1245
 
{
1246
 
private:
1247
 
 
1248
 
  unsigned int __global_dimension;
1249
 
 
1250
 
public:
1251
 
 
1252
 
  /// Constructor
1253
 
  UFC_Poisson2D_4BilinearForm_dof_map_0() : ufc::dof_map()
1254
 
  {
1255
 
    __global_dimension = 0;
1256
 
  }
1257
 
 
1258
 
  /// Destructor
1259
 
  virtual ~UFC_Poisson2D_4BilinearForm_dof_map_0()
1260
 
  {
1261
 
    // Do nothing
1262
 
  }
1263
 
 
1264
 
  /// Return a string identifying the dof map
1265
 
  virtual const char* signature() const
1266
 
  {
1267
 
    return "FFC dof map for FiniteElement('Lagrange', 'triangle', 4)";
1268
 
  }
1269
 
 
1270
 
  /// Return true iff mesh entities of topological dimension d are needed
1271
 
  virtual bool needs_mesh_entities(unsigned int d) const
1272
 
  {
1273
 
    switch ( d )
1274
 
    {
1275
 
    case 0:
1276
 
      return true;
1277
 
      break;
1278
 
    case 1:
1279
 
      return true;
1280
 
      break;
1281
 
    case 2:
1282
 
      return true;
1283
 
      break;
1284
 
    }
1285
 
    return false;
1286
 
  }
1287
 
 
1288
 
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
1289
 
  virtual bool init_mesh(const ufc::mesh& m)
1290
 
  {
1291
 
    __global_dimension = m.num_entities[0] + 3*m.num_entities[1] + 3*m.num_entities[2];
1292
 
    return false;
1293
 
  }
1294
 
 
1295
 
  /// Initialize dof map for given cell
1296
 
  virtual void init_cell(const ufc::mesh& m,
1297
 
                         const ufc::cell& c)
1298
 
  {
1299
 
    // Do nothing
1300
 
  }
1301
 
 
1302
 
  /// Finish initialization of dof map for cells
1303
 
  virtual void init_cell_finalize()
1304
 
  {
1305
 
    // Do nothing
1306
 
  }
1307
 
 
1308
 
  /// Return the dimension of the global finite element function space
1309
 
  virtual unsigned int global_dimension() const
1310
 
  {
1311
 
    return __global_dimension;
1312
 
  }
1313
 
 
1314
 
  /// Return the dimension of the local finite element function space
1315
 
  virtual unsigned int local_dimension() const
1316
 
  {
1317
 
    return 15;
1318
 
  }
1319
 
 
1320
 
  // Return the geometric dimension of the coordinates this dof map provides
1321
 
  virtual unsigned int geometric_dimension() const
1322
 
  {
1323
 
    return 2;
1324
 
  }
1325
 
 
1326
 
  /// Return the number of dofs on each cell facet
1327
 
  virtual unsigned int num_facet_dofs() const
1328
 
  {
1329
 
    return 5;
1330
 
  }
1331
 
 
1332
 
  /// Return the number of dofs associated with each cell entity of dimension d
1333
 
  virtual unsigned int num_entity_dofs(unsigned int d) const
1334
 
  {
1335
 
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
1336
 
  }
1337
 
 
1338
 
  /// Tabulate the local-to-global mapping of dofs on a cell
1339
 
  virtual void tabulate_dofs(unsigned int* dofs,
1340
 
                             const ufc::mesh& m,
1341
 
                             const ufc::cell& c) const
1342
 
  {
1343
 
    dofs[0] = c.entity_indices[0][0];
1344
 
    dofs[1] = c.entity_indices[0][1];
1345
 
    dofs[2] = c.entity_indices[0][2];
1346
 
    unsigned int offset = m.num_entities[0];
1347
 
    dofs[3] = offset + 3*c.entity_indices[1][0];
1348
 
    dofs[4] = offset + 3*c.entity_indices[1][0] + 1;
1349
 
    dofs[5] = offset + 3*c.entity_indices[1][0] + 2;
1350
 
    dofs[6] = offset + 3*c.entity_indices[1][1];
1351
 
    dofs[7] = offset + 3*c.entity_indices[1][1] + 1;
1352
 
    dofs[8] = offset + 3*c.entity_indices[1][1] + 2;
1353
 
    dofs[9] = offset + 3*c.entity_indices[1][2];
1354
 
    dofs[10] = offset + 3*c.entity_indices[1][2] + 1;
1355
 
    dofs[11] = offset + 3*c.entity_indices[1][2] + 2;
1356
 
    offset = offset + 3*m.num_entities[1];
1357
 
    dofs[12] = offset + 3*c.entity_indices[2][0];
1358
 
    dofs[13] = offset + 3*c.entity_indices[2][0] + 1;
1359
 
    dofs[14] = offset + 3*c.entity_indices[2][0] + 2;
1360
 
  }
1361
 
 
1362
 
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
1363
 
  virtual void tabulate_facet_dofs(unsigned int* dofs,
1364
 
                                   unsigned int facet) const
1365
 
  {
1366
 
    switch ( facet )
1367
 
    {
1368
 
    case 0:
1369
 
      dofs[0] = 1;
1370
 
      dofs[1] = 2;
1371
 
      dofs[2] = 3;
1372
 
      dofs[3] = 4;
1373
 
      dofs[4] = 5;
1374
 
      break;
1375
 
    case 1:
1376
 
      dofs[0] = 0;
1377
 
      dofs[1] = 2;
1378
 
      dofs[2] = 6;
1379
 
      dofs[3] = 7;
1380
 
      dofs[4] = 8;
1381
 
      break;
1382
 
    case 2:
1383
 
      dofs[0] = 0;
1384
 
      dofs[1] = 1;
1385
 
      dofs[2] = 9;
1386
 
      dofs[3] = 10;
1387
 
      dofs[4] = 11;
1388
 
      break;
1389
 
    }
1390
 
  }
1391
 
 
1392
 
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
1393
 
  virtual void tabulate_entity_dofs(unsigned int* dofs,
1394
 
                                    unsigned int d, unsigned int i) const
1395
 
  {
1396
 
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
1397
 
  }
1398
 
 
1399
 
  /// Tabulate the coordinates of all dofs on a cell
1400
 
  virtual void tabulate_coordinates(double** coordinates,
1401
 
                                    const ufc::cell& c) const
1402
 
  {
1403
 
    const double * const * x = c.coordinates;
1404
 
    coordinates[0][0] = x[0][0];
1405
 
    coordinates[0][1] = x[0][1];
1406
 
    coordinates[1][0] = x[1][0];
1407
 
    coordinates[1][1] = x[1][1];
1408
 
    coordinates[2][0] = x[2][0];
1409
 
    coordinates[2][1] = x[2][1];
1410
 
    coordinates[3][0] = 0.75*x[1][0] + 0.25*x[2][0];
1411
 
    coordinates[3][1] = 0.75*x[1][1] + 0.25*x[2][1];
1412
 
    coordinates[4][0] = 0.5*x[1][0] + 0.5*x[2][0];
1413
 
    coordinates[4][1] = 0.5*x[1][1] + 0.5*x[2][1];
1414
 
    coordinates[5][0] = 0.25*x[1][0] + 0.75*x[2][0];
1415
 
    coordinates[5][1] = 0.25*x[1][1] + 0.75*x[2][1];
1416
 
    coordinates[6][0] = 0.75*x[0][0] + 0.25*x[2][0];
1417
 
    coordinates[6][1] = 0.75*x[0][1] + 0.25*x[2][1];
1418
 
    coordinates[7][0] = 0.5*x[0][0] + 0.5*x[2][0];
1419
 
    coordinates[7][1] = 0.5*x[0][1] + 0.5*x[2][1];
1420
 
    coordinates[8][0] = 0.25*x[0][0] + 0.75*x[2][0];
1421
 
    coordinates[8][1] = 0.25*x[0][1] + 0.75*x[2][1];
1422
 
    coordinates[9][0] = 0.75*x[0][0] + 0.25*x[1][0];
1423
 
    coordinates[9][1] = 0.75*x[0][1] + 0.25*x[1][1];
1424
 
    coordinates[10][0] = 0.5*x[0][0] + 0.5*x[1][0];
1425
 
    coordinates[10][1] = 0.5*x[0][1] + 0.5*x[1][1];
1426
 
    coordinates[11][0] = 0.25*x[0][0] + 0.75*x[1][0];
1427
 
    coordinates[11][1] = 0.25*x[0][1] + 0.75*x[1][1];
1428
 
    coordinates[12][0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
1429
 
    coordinates[12][1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
1430
 
    coordinates[13][0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
1431
 
    coordinates[13][1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
1432
 
    coordinates[14][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
1433
 
    coordinates[14][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
1434
 
  }
1435
 
 
1436
 
  /// Return the number of sub dof maps (for a mixed element)
1437
 
  virtual unsigned int num_sub_dof_maps() const
1438
 
  {
1439
 
    return 1;
1440
 
  }
1441
 
 
1442
 
  /// Create a new dof_map for sub dof map i (for a mixed element)
1443
 
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
1444
 
  {
1445
 
    return new UFC_Poisson2D_4BilinearForm_dof_map_0();
1446
 
  }
1447
 
 
1448
 
};
1449
 
 
1450
 
/// This class defines the interface for a local-to-global mapping of
1451
 
/// degrees of freedom (dofs).
1452
 
 
1453
 
class UFC_Poisson2D_4BilinearForm_dof_map_1: public ufc::dof_map
1454
 
{
1455
 
private:
1456
 
 
1457
 
  unsigned int __global_dimension;
1458
 
 
1459
 
public:
1460
 
 
1461
 
  /// Constructor
1462
 
  UFC_Poisson2D_4BilinearForm_dof_map_1() : ufc::dof_map()
1463
 
  {
1464
 
    __global_dimension = 0;
1465
 
  }
1466
 
 
1467
 
  /// Destructor
1468
 
  virtual ~UFC_Poisson2D_4BilinearForm_dof_map_1()
1469
 
  {
1470
 
    // Do nothing
1471
 
  }
1472
 
 
1473
 
  /// Return a string identifying the dof map
1474
 
  virtual const char* signature() const
1475
 
  {
1476
 
    return "FFC dof map for FiniteElement('Lagrange', 'triangle', 4)";
1477
 
  }
1478
 
 
1479
 
  /// Return true iff mesh entities of topological dimension d are needed
1480
 
  virtual bool needs_mesh_entities(unsigned int d) const
1481
 
  {
1482
 
    switch ( d )
1483
 
    {
1484
 
    case 0:
1485
 
      return true;
1486
 
      break;
1487
 
    case 1:
1488
 
      return true;
1489
 
      break;
1490
 
    case 2:
1491
 
      return true;
1492
 
      break;
1493
 
    }
1494
 
    return false;
1495
 
  }
1496
 
 
1497
 
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
1498
 
  virtual bool init_mesh(const ufc::mesh& m)
1499
 
  {
1500
 
    __global_dimension = m.num_entities[0] + 3*m.num_entities[1] + 3*m.num_entities[2];
1501
 
    return false;
1502
 
  }
1503
 
 
1504
 
  /// Initialize dof map for given cell
1505
 
  virtual void init_cell(const ufc::mesh& m,
1506
 
                         const ufc::cell& c)
1507
 
  {
1508
 
    // Do nothing
1509
 
  }
1510
 
 
1511
 
  /// Finish initialization of dof map for cells
1512
 
  virtual void init_cell_finalize()
1513
 
  {
1514
 
    // Do nothing
1515
 
  }
1516
 
 
1517
 
  /// Return the dimension of the global finite element function space
1518
 
  virtual unsigned int global_dimension() const
1519
 
  {
1520
 
    return __global_dimension;
1521
 
  }
1522
 
 
1523
 
  /// Return the dimension of the local finite element function space
1524
 
  virtual unsigned int local_dimension() const
1525
 
  {
1526
 
    return 15;
1527
 
  }
1528
 
 
1529
 
  // Return the geometric dimension of the coordinates this dof map provides
1530
 
  virtual unsigned int geometric_dimension() const
1531
 
  {
1532
 
    return 2;
1533
 
  }
1534
 
 
1535
 
  /// Return the number of dofs on each cell facet
1536
 
  virtual unsigned int num_facet_dofs() const
1537
 
  {
1538
 
    return 5;
1539
 
  }
1540
 
 
1541
 
  /// Return the number of dofs associated with each cell entity of dimension d
1542
 
  virtual unsigned int num_entity_dofs(unsigned int d) const
1543
 
  {
1544
 
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
1545
 
  }
1546
 
 
1547
 
  /// Tabulate the local-to-global mapping of dofs on a cell
1548
 
  virtual void tabulate_dofs(unsigned int* dofs,
1549
 
                             const ufc::mesh& m,
1550
 
                             const ufc::cell& c) const
1551
 
  {
1552
 
    dofs[0] = c.entity_indices[0][0];
1553
 
    dofs[1] = c.entity_indices[0][1];
1554
 
    dofs[2] = c.entity_indices[0][2];
1555
 
    unsigned int offset = m.num_entities[0];
1556
 
    dofs[3] = offset + 3*c.entity_indices[1][0];
1557
 
    dofs[4] = offset + 3*c.entity_indices[1][0] + 1;
1558
 
    dofs[5] = offset + 3*c.entity_indices[1][0] + 2;
1559
 
    dofs[6] = offset + 3*c.entity_indices[1][1];
1560
 
    dofs[7] = offset + 3*c.entity_indices[1][1] + 1;
1561
 
    dofs[8] = offset + 3*c.entity_indices[1][1] + 2;
1562
 
    dofs[9] = offset + 3*c.entity_indices[1][2];
1563
 
    dofs[10] = offset + 3*c.entity_indices[1][2] + 1;
1564
 
    dofs[11] = offset + 3*c.entity_indices[1][2] + 2;
1565
 
    offset = offset + 3*m.num_entities[1];
1566
 
    dofs[12] = offset + 3*c.entity_indices[2][0];
1567
 
    dofs[13] = offset + 3*c.entity_indices[2][0] + 1;
1568
 
    dofs[14] = offset + 3*c.entity_indices[2][0] + 2;
1569
 
  }
1570
 
 
1571
 
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
1572
 
  virtual void tabulate_facet_dofs(unsigned int* dofs,
1573
 
                                   unsigned int facet) const
1574
 
  {
1575
 
    switch ( facet )
1576
 
    {
1577
 
    case 0:
1578
 
      dofs[0] = 1;
1579
 
      dofs[1] = 2;
1580
 
      dofs[2] = 3;
1581
 
      dofs[3] = 4;
1582
 
      dofs[4] = 5;
1583
 
      break;
1584
 
    case 1:
1585
 
      dofs[0] = 0;
1586
 
      dofs[1] = 2;
1587
 
      dofs[2] = 6;
1588
 
      dofs[3] = 7;
1589
 
      dofs[4] = 8;
1590
 
      break;
1591
 
    case 2:
1592
 
      dofs[0] = 0;
1593
 
      dofs[1] = 1;
1594
 
      dofs[2] = 9;
1595
 
      dofs[3] = 10;
1596
 
      dofs[4] = 11;
1597
 
      break;
1598
 
    }
1599
 
  }
1600
 
 
1601
 
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
1602
 
  virtual void tabulate_entity_dofs(unsigned int* dofs,
1603
 
                                    unsigned int d, unsigned int i) const
1604
 
  {
1605
 
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
1606
 
  }
1607
 
 
1608
 
  /// Tabulate the coordinates of all dofs on a cell
1609
 
  virtual void tabulate_coordinates(double** coordinates,
1610
 
                                    const ufc::cell& c) const
1611
 
  {
1612
 
    const double * const * x = c.coordinates;
1613
 
    coordinates[0][0] = x[0][0];
1614
 
    coordinates[0][1] = x[0][1];
1615
 
    coordinates[1][0] = x[1][0];
1616
 
    coordinates[1][1] = x[1][1];
1617
 
    coordinates[2][0] = x[2][0];
1618
 
    coordinates[2][1] = x[2][1];
1619
 
    coordinates[3][0] = 0.75*x[1][0] + 0.25*x[2][0];
1620
 
    coordinates[3][1] = 0.75*x[1][1] + 0.25*x[2][1];
1621
 
    coordinates[4][0] = 0.5*x[1][0] + 0.5*x[2][0];
1622
 
    coordinates[4][1] = 0.5*x[1][1] + 0.5*x[2][1];
1623
 
    coordinates[5][0] = 0.25*x[1][0] + 0.75*x[2][0];
1624
 
    coordinates[5][1] = 0.25*x[1][1] + 0.75*x[2][1];
1625
 
    coordinates[6][0] = 0.75*x[0][0] + 0.25*x[2][0];
1626
 
    coordinates[6][1] = 0.75*x[0][1] + 0.25*x[2][1];
1627
 
    coordinates[7][0] = 0.5*x[0][0] + 0.5*x[2][0];
1628
 
    coordinates[7][1] = 0.5*x[0][1] + 0.5*x[2][1];
1629
 
    coordinates[8][0] = 0.25*x[0][0] + 0.75*x[2][0];
1630
 
    coordinates[8][1] = 0.25*x[0][1] + 0.75*x[2][1];
1631
 
    coordinates[9][0] = 0.75*x[0][0] + 0.25*x[1][0];
1632
 
    coordinates[9][1] = 0.75*x[0][1] + 0.25*x[1][1];
1633
 
    coordinates[10][0] = 0.5*x[0][0] + 0.5*x[1][0];
1634
 
    coordinates[10][1] = 0.5*x[0][1] + 0.5*x[1][1];
1635
 
    coordinates[11][0] = 0.25*x[0][0] + 0.75*x[1][0];
1636
 
    coordinates[11][1] = 0.25*x[0][1] + 0.75*x[1][1];
1637
 
    coordinates[12][0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
1638
 
    coordinates[12][1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
1639
 
    coordinates[13][0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
1640
 
    coordinates[13][1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
1641
 
    coordinates[14][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
1642
 
    coordinates[14][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
1643
 
  }
1644
 
 
1645
 
  /// Return the number of sub dof maps (for a mixed element)
1646
 
  virtual unsigned int num_sub_dof_maps() const
1647
 
  {
1648
 
    return 1;
1649
 
  }
1650
 
 
1651
 
  /// Create a new dof_map for sub dof map i (for a mixed element)
1652
 
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
1653
 
  {
1654
 
    return new UFC_Poisson2D_4BilinearForm_dof_map_1();
 
14
    
 
15
/// This class defines the interface for a finite element.
 
16
 
 
17
class poisson2d_4_0_finite_element_0: public ufc::finite_element
 
18
{
 
19
public:
 
20
 
 
21
  /// Constructor
 
22
  poisson2d_4_0_finite_element_0() : ufc::finite_element()
 
23
  {
 
24
    // Do nothing
 
25
  }
 
26
 
 
27
  /// Destructor
 
28
  virtual ~poisson2d_4_0_finite_element_0()
 
29
  {
 
30
    // Do nothing
 
31
  }
 
32
 
 
33
  /// Return a string identifying the finite element
 
34
  virtual const char* signature() const
 
35
  {
 
36
    return "FiniteElement('Lagrange', 'triangle', 4)";
 
37
  }
 
38
 
 
39
  /// Return the cell shape
 
40
  virtual ufc::shape cell_shape() const
 
41
  {
 
42
    return ufc::triangle;
 
43
  }
 
44
 
 
45
  /// Return the dimension of the finite element function space
 
46
  virtual unsigned int space_dimension() const
 
47
  {
 
48
    return 15;
 
49
  }
 
50
 
 
51
  /// Return the rank of the value space
 
52
  virtual unsigned int value_rank() const
 
53
  {
 
54
    return 0;
 
55
  }
 
56
 
 
57
  /// Return the dimension of the value space for axis i
 
58
  virtual unsigned int value_dimension(unsigned int i) const
 
59
  {
 
60
    return 1;
 
61
  }
 
62
 
 
63
  /// Evaluate basis function i at given point in cell
 
64
  virtual void evaluate_basis(unsigned int i,
 
65
                              double* values,
 
66
                              const double* coordinates,
 
67
                              const ufc::cell& c) const
 
68
  {
 
69
    // Extract vertex coordinates
 
70
    const double * const * element_coordinates = c.coordinates;
 
71
    
 
72
    // Compute Jacobian of affine map from reference cell
 
73
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
74
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
75
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
76
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
77
    
 
78
    // Compute determinant of Jacobian
 
79
    const double detJ = J_00*J_11 - J_01*J_10;
 
80
    
 
81
    // Compute inverse of Jacobian
 
82
    
 
83
    // Get coordinates and map to the reference (UFC) element
 
84
    double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
 
85
                element_coordinates[0][0]*element_coordinates[2][1] +\
 
86
                J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
 
87
    double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
 
88
                element_coordinates[1][0]*element_coordinates[0][1] -\
 
89
                J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
 
90
    
 
91
    // Map coordinates to the reference square
 
92
    if (std::abs(y - 1.0) < 1e-14)
 
93
      x = -1.0;
 
94
    else
 
95
      x = 2.0 *x/(1.0 - y) - 1.0;
 
96
    y = 2.0*y - 1.0;
 
97
    
 
98
    // Reset values
 
99
    *values = 0;
 
100
    
 
101
    // Map degree of freedom to element degree of freedom
 
102
    const unsigned int dof = i;
 
103
    
 
104
    // Generate scalings
 
105
    const double scalings_y_0 = 1;
 
106
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
 
107
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
 
108
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
 
109
    const double scalings_y_4 = scalings_y_3*(0.5 - 0.5*y);
 
110
    
 
111
    // Compute psitilde_a
 
112
    const double psitilde_a_0 = 1;
 
113
    const double psitilde_a_1 = x;
 
114
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
 
115
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
 
116
    const double psitilde_a_4 = 1.75*x*psitilde_a_3 - 0.75*psitilde_a_2;
 
117
    
 
118
    // Compute psitilde_bs
 
119
    const double psitilde_bs_0_0 = 1;
 
120
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
 
121
    const double psitilde_bs_0_2 = 0.111111111111111*psitilde_bs_0_1 + 1.66666666666667*y*psitilde_bs_0_1 - 0.555555555555556*psitilde_bs_0_0;
 
122
    const double psitilde_bs_0_3 = 0.05*psitilde_bs_0_2 + 1.75*y*psitilde_bs_0_2 - 0.7*psitilde_bs_0_1;
 
123
    const double psitilde_bs_0_4 = 0.0285714285714286*psitilde_bs_0_3 + 1.8*y*psitilde_bs_0_3 - 0.771428571428571*psitilde_bs_0_2;
 
124
    const double psitilde_bs_1_0 = 1;
 
125
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
 
126
    const double psitilde_bs_1_2 = 0.54*psitilde_bs_1_1 + 2.1*y*psitilde_bs_1_1 - 0.56*psitilde_bs_1_0;
 
127
    const double psitilde_bs_1_3 = 0.285714285714286*psitilde_bs_1_2 + 2*y*psitilde_bs_1_2 - 0.714285714285714*psitilde_bs_1_1;
 
128
    const double psitilde_bs_2_0 = 1;
 
129
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
 
130
    const double psitilde_bs_2_2 = 1.02040816326531*psitilde_bs_2_1 + 2.57142857142857*y*psitilde_bs_2_1 - 0.551020408163265*psitilde_bs_2_0;
 
131
    const double psitilde_bs_3_0 = 1;
 
132
    const double psitilde_bs_3_1 = 4.5*y + 3.5;
 
133
    const double psitilde_bs_4_0 = 1;
 
134
    
 
135
    // Compute basisvalues
 
136
    const double basisvalue0 = 0.707106781186548*psitilde_a_0*scalings_y_0*psitilde_bs_0_0;
 
137
    const double basisvalue1 = 1.73205080756888*psitilde_a_1*scalings_y_1*psitilde_bs_1_0;
 
138
    const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
 
139
    const double basisvalue3 = 2.73861278752583*psitilde_a_2*scalings_y_2*psitilde_bs_2_0;
 
140
    const double basisvalue4 = 2.12132034355964*psitilde_a_1*scalings_y_1*psitilde_bs_1_1;
 
141
    const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
 
142
    const double basisvalue6 = 3.74165738677394*psitilde_a_3*scalings_y_3*psitilde_bs_3_0;
 
143
    const double basisvalue7 = 3.16227766016838*psitilde_a_2*scalings_y_2*psitilde_bs_2_1;
 
144
    const double basisvalue8 = 2.44948974278318*psitilde_a_1*scalings_y_1*psitilde_bs_1_2;
 
145
    const double basisvalue9 = 1.4142135623731*psitilde_a_0*scalings_y_0*psitilde_bs_0_3;
 
146
    const double basisvalue10 = 4.74341649025257*psitilde_a_4*scalings_y_4*psitilde_bs_4_0;
 
147
    const double basisvalue11 = 4.18330013267038*psitilde_a_3*scalings_y_3*psitilde_bs_3_1;
 
148
    const double basisvalue12 = 3.53553390593274*psitilde_a_2*scalings_y_2*psitilde_bs_2_2;
 
149
    const double basisvalue13 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_3;
 
150
    const double basisvalue14 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_4;
 
151
    
 
152
    // Table(s) of coefficients
 
153
    static const double coefficients0[15][15] = \
 
154
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366311, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
 
155
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233824, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.0239443566116079, -0.0185472188784818, 0.0107082418122104},
 
156
    {0, 0, 0.0476190476190476, 0, 0, 0.038880789567987, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
 
157
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543896, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406278, 0.0834624849531682, -0.0535412090610519},
 
158
    {-0.0314269680527354, 0.0109971479845642, 0.00634920634920638, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
 
159
    {0.125707872210942, 0.0439885919382573, 0.126984126984127, 0, 0.035916534917412, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
 
160
    {0.125707872210942, -0.131965775814772, -0.0253968253968254, 0.139104141588614, 0.0718330698348239, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.0478887132232159, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
 
161
    {-0.0314269680527354, -0.0109971479845643, 0.00634920634920633, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
 
162
    {0.125707872210942, -0.0439885919382572, 0.126984126984127, 0, -0.0359165349174119, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
 
163
    {0.125707872210942, -0.0879771838765144, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
 
164
    {-0.0314269680527354, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951817, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.023944356611608, 0, 0.0107082418122104},
 
165
    {0.125707872210942, 0.0879771838765145, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277046, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
 
166
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406279, -0.0278208283177228, -0.0535412090610519},
 
167
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.0267706045305259, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406278, 0.0278208283177228, -0.0535412090610519},
 
168
    {0.251415744421883, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
 
169
    
 
170
    // Extract relevant coefficients
 
171
    const double coeff0_0 = coefficients0[dof][0];
 
172
    const double coeff0_1 = coefficients0[dof][1];
 
173
    const double coeff0_2 = coefficients0[dof][2];
 
174
    const double coeff0_3 = coefficients0[dof][3];
 
175
    const double coeff0_4 = coefficients0[dof][4];
 
176
    const double coeff0_5 = coefficients0[dof][5];
 
177
    const double coeff0_6 = coefficients0[dof][6];
 
178
    const double coeff0_7 = coefficients0[dof][7];
 
179
    const double coeff0_8 = coefficients0[dof][8];
 
180
    const double coeff0_9 = coefficients0[dof][9];
 
181
    const double coeff0_10 = coefficients0[dof][10];
 
182
    const double coeff0_11 = coefficients0[dof][11];
 
183
    const double coeff0_12 = coefficients0[dof][12];
 
184
    const double coeff0_13 = coefficients0[dof][13];
 
185
    const double coeff0_14 = coefficients0[dof][14];
 
186
    
 
187
    // Compute value(s)
 
188
    *values = coeff0_0*basisvalue0 + coeff0_1*basisvalue1 + coeff0_2*basisvalue2 + coeff0_3*basisvalue3 + coeff0_4*basisvalue4 + coeff0_5*basisvalue5 + coeff0_6*basisvalue6 + coeff0_7*basisvalue7 + coeff0_8*basisvalue8 + coeff0_9*basisvalue9 + coeff0_10*basisvalue10 + coeff0_11*basisvalue11 + coeff0_12*basisvalue12 + coeff0_13*basisvalue13 + coeff0_14*basisvalue14;
 
189
  }
 
190
 
 
191
  /// Evaluate all basis functions at given point in cell
 
192
  virtual void evaluate_basis_all(double* values,
 
193
                                  const double* coordinates,
 
194
                                  const ufc::cell& c) const
 
195
  {
 
196
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
 
197
  }
 
198
 
 
199
  /// Evaluate order n derivatives of basis function i at given point in cell
 
200
  virtual void evaluate_basis_derivatives(unsigned int i,
 
201
                                          unsigned int n,
 
202
                                          double* values,
 
203
                                          const double* coordinates,
 
204
                                          const ufc::cell& c) const
 
205
  {
 
206
    // Extract vertex coordinates
 
207
    const double * const * element_coordinates = c.coordinates;
 
208
    
 
209
    // Compute Jacobian of affine map from reference cell
 
210
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
211
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
212
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
213
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
214
    
 
215
    // Compute determinant of Jacobian
 
216
    const double detJ = J_00*J_11 - J_01*J_10;
 
217
    
 
218
    // Compute inverse of Jacobian
 
219
    
 
220
    // Get coordinates and map to the reference (UFC) element
 
221
    double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
 
222
                element_coordinates[0][0]*element_coordinates[2][1] +\
 
223
                J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
 
224
    double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
 
225
                element_coordinates[1][0]*element_coordinates[0][1] -\
 
226
                J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
 
227
    
 
228
    // Map coordinates to the reference square
 
229
    if (std::abs(y - 1.0) < 1e-14)
 
230
      x = -1.0;
 
231
    else
 
232
      x = 2.0 *x/(1.0 - y) - 1.0;
 
233
    y = 2.0*y - 1.0;
 
234
    
 
235
    // Compute number of derivatives
 
236
    unsigned int num_derivatives = 1;
 
237
    
 
238
    for (unsigned int j = 0; j < n; j++)
 
239
      num_derivatives *= 2;
 
240
    
 
241
    
 
242
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
 
243
    unsigned int **combinations = new unsigned int *[num_derivatives];
 
244
    
 
245
    for (unsigned int j = 0; j < num_derivatives; j++)
 
246
    {
 
247
      combinations[j] = new unsigned int [n];
 
248
      for (unsigned int k = 0; k < n; k++)
 
249
        combinations[j][k] = 0;
 
250
    }
 
251
    
 
252
    // Generate combinations of derivatives
 
253
    for (unsigned int row = 1; row < num_derivatives; row++)
 
254
    {
 
255
      for (unsigned int num = 0; num < row; num++)
 
256
      {
 
257
        for (unsigned int col = n-1; col+1 > 0; col--)
 
258
        {
 
259
          if (combinations[row][col] + 1 > 1)
 
260
            combinations[row][col] = 0;
 
261
          else
 
262
          {
 
263
            combinations[row][col] += 1;
 
264
            break;
 
265
          }
 
266
        }
 
267
      }
 
268
    }
 
269
    
 
270
    // Compute inverse of Jacobian
 
271
    const double Jinv[2][2] =  {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
 
272
    
 
273
    // Declare transformation matrix
 
274
    // Declare pointer to two dimensional array and initialise
 
275
    double **transform = new double *[num_derivatives];
 
276
    
 
277
    for (unsigned int j = 0; j < num_derivatives; j++)
 
278
    {
 
279
      transform[j] = new double [num_derivatives];
 
280
      for (unsigned int k = 0; k < num_derivatives; k++)
 
281
        transform[j][k] = 1;
 
282
    }
 
283
    
 
284
    // Construct transformation matrix
 
285
    for (unsigned int row = 0; row < num_derivatives; row++)
 
286
    {
 
287
      for (unsigned int col = 0; col < num_derivatives; col++)
 
288
      {
 
289
        for (unsigned int k = 0; k < n; k++)
 
290
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
 
291
      }
 
292
    }
 
293
    
 
294
    // Reset values
 
295
    for (unsigned int j = 0; j < 1*num_derivatives; j++)
 
296
      values[j] = 0;
 
297
    
 
298
    // Map degree of freedom to element degree of freedom
 
299
    const unsigned int dof = i;
 
300
    
 
301
    // Generate scalings
 
302
    const double scalings_y_0 = 1;
 
303
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
 
304
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
 
305
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
 
306
    const double scalings_y_4 = scalings_y_3*(0.5 - 0.5*y);
 
307
    
 
308
    // Compute psitilde_a
 
309
    const double psitilde_a_0 = 1;
 
310
    const double psitilde_a_1 = x;
 
311
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
 
312
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
 
313
    const double psitilde_a_4 = 1.75*x*psitilde_a_3 - 0.75*psitilde_a_2;
 
314
    
 
315
    // Compute psitilde_bs
 
316
    const double psitilde_bs_0_0 = 1;
 
317
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
 
318
    const double psitilde_bs_0_2 = 0.111111111111111*psitilde_bs_0_1 + 1.66666666666667*y*psitilde_bs_0_1 - 0.555555555555556*psitilde_bs_0_0;
 
319
    const double psitilde_bs_0_3 = 0.05*psitilde_bs_0_2 + 1.75*y*psitilde_bs_0_2 - 0.7*psitilde_bs_0_1;
 
320
    const double psitilde_bs_0_4 = 0.0285714285714286*psitilde_bs_0_3 + 1.8*y*psitilde_bs_0_3 - 0.771428571428571*psitilde_bs_0_2;
 
321
    const double psitilde_bs_1_0 = 1;
 
322
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
 
323
    const double psitilde_bs_1_2 = 0.54*psitilde_bs_1_1 + 2.1*y*psitilde_bs_1_1 - 0.56*psitilde_bs_1_0;
 
324
    const double psitilde_bs_1_3 = 0.285714285714286*psitilde_bs_1_2 + 2*y*psitilde_bs_1_2 - 0.714285714285714*psitilde_bs_1_1;
 
325
    const double psitilde_bs_2_0 = 1;
 
326
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
 
327
    const double psitilde_bs_2_2 = 1.02040816326531*psitilde_bs_2_1 + 2.57142857142857*y*psitilde_bs_2_1 - 0.551020408163265*psitilde_bs_2_0;
 
328
    const double psitilde_bs_3_0 = 1;
 
329
    const double psitilde_bs_3_1 = 4.5*y + 3.5;
 
330
    const double psitilde_bs_4_0 = 1;
 
331
    
 
332
    // Compute basisvalues
 
333
    const double basisvalue0 = 0.707106781186548*psitilde_a_0*scalings_y_0*psitilde_bs_0_0;
 
334
    const double basisvalue1 = 1.73205080756888*psitilde_a_1*scalings_y_1*psitilde_bs_1_0;
 
335
    const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
 
336
    const double basisvalue3 = 2.73861278752583*psitilde_a_2*scalings_y_2*psitilde_bs_2_0;
 
337
    const double basisvalue4 = 2.12132034355964*psitilde_a_1*scalings_y_1*psitilde_bs_1_1;
 
338
    const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
 
339
    const double basisvalue6 = 3.74165738677394*psitilde_a_3*scalings_y_3*psitilde_bs_3_0;
 
340
    const double basisvalue7 = 3.16227766016838*psitilde_a_2*scalings_y_2*psitilde_bs_2_1;
 
341
    const double basisvalue8 = 2.44948974278318*psitilde_a_1*scalings_y_1*psitilde_bs_1_2;
 
342
    const double basisvalue9 = 1.4142135623731*psitilde_a_0*scalings_y_0*psitilde_bs_0_3;
 
343
    const double basisvalue10 = 4.74341649025257*psitilde_a_4*scalings_y_4*psitilde_bs_4_0;
 
344
    const double basisvalue11 = 4.18330013267038*psitilde_a_3*scalings_y_3*psitilde_bs_3_1;
 
345
    const double basisvalue12 = 3.53553390593274*psitilde_a_2*scalings_y_2*psitilde_bs_2_2;
 
346
    const double basisvalue13 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_3;
 
347
    const double basisvalue14 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_4;
 
348
    
 
349
    // Table(s) of coefficients
 
350
    static const double coefficients0[15][15] = \
 
351
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366311, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
 
352
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233824, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.0239443566116079, -0.0185472188784818, 0.0107082418122104},
 
353
    {0, 0, 0.0476190476190476, 0, 0, 0.038880789567987, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
 
354
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543896, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406278, 0.0834624849531682, -0.0535412090610519},
 
355
    {-0.0314269680527354, 0.0109971479845642, 0.00634920634920638, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
 
356
    {0.125707872210942, 0.0439885919382573, 0.126984126984127, 0, 0.035916534917412, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
 
357
    {0.125707872210942, -0.131965775814772, -0.0253968253968254, 0.139104141588614, 0.0718330698348239, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.0478887132232159, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
 
358
    {-0.0314269680527354, -0.0109971479845643, 0.00634920634920633, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
 
359
    {0.125707872210942, -0.0439885919382572, 0.126984126984127, 0, -0.0359165349174119, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
 
360
    {0.125707872210942, -0.0879771838765144, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
 
361
    {-0.0314269680527354, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951817, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.023944356611608, 0, 0.0107082418122104},
 
362
    {0.125707872210942, 0.0879771838765145, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277046, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
 
363
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406279, -0.0278208283177228, -0.0535412090610519},
 
364
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.0267706045305259, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406278, 0.0278208283177228, -0.0535412090610519},
 
365
    {0.251415744421883, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
 
366
    
 
367
    // Interesting (new) part
 
368
    // Tables of derivatives of the polynomial base (transpose)
 
369
    static const double dmats0[15][15] = \
 
370
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
371
    {4.89897948556635, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
372
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
373
    {0, 9.48683298050514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
374
    {4, 0, 7.07106781186548, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
375
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
376
    {5.29150262212918, 0, -2.99332590941916, 13.6626010212795, 0, 0.611010092660776, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
377
    {0, 4.38178046004133, 0, 0, 12.5219806739988, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
378
    {3.46410161513776, 0, 7.83836717690617, 0, 0, 8.40000000000001, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
379
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
380
    {0, 10.9544511501033, 0, 0, -3.83325938999965, 0, 17.7482393492988, 0, 0.55328333517249, 0, 0, 0, 0, 0, 0},
 
381
    {4.73286382647969, 0, 3.3466401061363, 4.36435780471985, 0, -5.07468037933238, 0, 17.0084012854152, 0, 1.52127765851133, 0, 0, 0, 0, 0},
 
382
    {0, 2.44948974278318, 0, 0, 9.14285714285715, 0, 0, 0, 14.8461497791618, 0, 0, 0, 0, 0, 0},
 
383
    {3.09838667696593, 0, 7.66811580507233, 0, 0, 10.733126291999, 0, 0, 0, 9.2951600308978, 0, 0, 0, 0, 0},
 
384
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
385
    
 
386
    static const double dmats1[15][15] = \
 
387
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
388
    {2.44948974278318, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
389
    {4.24264068711928, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
390
    {2.58198889747161, 4.74341649025257, -0.912870929175276, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
391
    {2, 6.12372435695795, 3.53553390593274, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
392
    {-2.3094010767585, 0, 8.16496580927726, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
393
    {2.64575131106459, 5.18459255872629, -1.49666295470958, 6.83130051063973, -1.05830052442584, 0.305505046330388, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
394
    {2.23606797749978, 2.19089023002066, 2.5298221281347, 8.08290376865476, 6.26099033699942, -1.80739222823014, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
395
    {1.73205080756888, -5.09116882454315, 3.91918358845308, 0, 9.69948452238572, 4.2, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
396
    {5, 0, -2.82842712474619, 0, 0, 12.1243556529821, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
397
    {2.68328157299975, 5.47722557505166, -1.89736659610103, 7.4230748895809, -1.91662969499982, 0.663940002206986, 8.87411967464942, -1.07142857142857, 0.276641667586244, -0.0958314847499919, 0, 0, 0, 0, 0},
 
398
    {2.36643191323985, 2.89827534923789, 1.67332005306815, 2.18217890235992, 5.74704893215392, -2.53734018966619, 10.0623058987491, 8.50420064270761, -2.1957751641342, 0.760638829255664, 0, 0, 0, 0, 0},
 
399
    {2, 1.22474487139159, 3.53553390593274, -7.37711113563317, 4.57142857142858, 1.64957219768464, 0, 11.4997781699989, 7.4230748895809, -2.57142857142857, 0, 0, 0, 0, 0},
 
400
    {1.54919333848297, 6.6407830863536, 3.83405790253617, 0, -6.19677335393188, 5.3665631459995, 0, 0, 13.4164078649987, 4.6475800154489, 0, 0, 0, 0, 0},
 
401
    {-3.57770876399967, 0, 8.85437744847147, 0, 0, -3.09838667696594, 0, 0, 0, 16.0996894379985, 0, 0, 0, 0, 0}};
 
402
    
 
403
    // Compute reference derivatives
 
404
    // Declare pointer to array of derivatives on FIAT element
 
405
    double *derivatives = new double [num_derivatives];
 
406
    
 
407
    // Declare coefficients
 
408
    double coeff0_0 = 0;
 
409
    double coeff0_1 = 0;
 
410
    double coeff0_2 = 0;
 
411
    double coeff0_3 = 0;
 
412
    double coeff0_4 = 0;
 
413
    double coeff0_5 = 0;
 
414
    double coeff0_6 = 0;
 
415
    double coeff0_7 = 0;
 
416
    double coeff0_8 = 0;
 
417
    double coeff0_9 = 0;
 
418
    double coeff0_10 = 0;
 
419
    double coeff0_11 = 0;
 
420
    double coeff0_12 = 0;
 
421
    double coeff0_13 = 0;
 
422
    double coeff0_14 = 0;
 
423
    
 
424
    // Declare new coefficients
 
425
    double new_coeff0_0 = 0;
 
426
    double new_coeff0_1 = 0;
 
427
    double new_coeff0_2 = 0;
 
428
    double new_coeff0_3 = 0;
 
429
    double new_coeff0_4 = 0;
 
430
    double new_coeff0_5 = 0;
 
431
    double new_coeff0_6 = 0;
 
432
    double new_coeff0_7 = 0;
 
433
    double new_coeff0_8 = 0;
 
434
    double new_coeff0_9 = 0;
 
435
    double new_coeff0_10 = 0;
 
436
    double new_coeff0_11 = 0;
 
437
    double new_coeff0_12 = 0;
 
438
    double new_coeff0_13 = 0;
 
439
    double new_coeff0_14 = 0;
 
440
    
 
441
    // Loop possible derivatives
 
442
    for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
443
    {
 
444
      // Get values from coefficients array
 
445
      new_coeff0_0 = coefficients0[dof][0];
 
446
      new_coeff0_1 = coefficients0[dof][1];
 
447
      new_coeff0_2 = coefficients0[dof][2];
 
448
      new_coeff0_3 = coefficients0[dof][3];
 
449
      new_coeff0_4 = coefficients0[dof][4];
 
450
      new_coeff0_5 = coefficients0[dof][5];
 
451
      new_coeff0_6 = coefficients0[dof][6];
 
452
      new_coeff0_7 = coefficients0[dof][7];
 
453
      new_coeff0_8 = coefficients0[dof][8];
 
454
      new_coeff0_9 = coefficients0[dof][9];
 
455
      new_coeff0_10 = coefficients0[dof][10];
 
456
      new_coeff0_11 = coefficients0[dof][11];
 
457
      new_coeff0_12 = coefficients0[dof][12];
 
458
      new_coeff0_13 = coefficients0[dof][13];
 
459
      new_coeff0_14 = coefficients0[dof][14];
 
460
    
 
461
      // Loop derivative order
 
462
      for (unsigned int j = 0; j < n; j++)
 
463
      {
 
464
        // Update old coefficients
 
465
        coeff0_0 = new_coeff0_0;
 
466
        coeff0_1 = new_coeff0_1;
 
467
        coeff0_2 = new_coeff0_2;
 
468
        coeff0_3 = new_coeff0_3;
 
469
        coeff0_4 = new_coeff0_4;
 
470
        coeff0_5 = new_coeff0_5;
 
471
        coeff0_6 = new_coeff0_6;
 
472
        coeff0_7 = new_coeff0_7;
 
473
        coeff0_8 = new_coeff0_8;
 
474
        coeff0_9 = new_coeff0_9;
 
475
        coeff0_10 = new_coeff0_10;
 
476
        coeff0_11 = new_coeff0_11;
 
477
        coeff0_12 = new_coeff0_12;
 
478
        coeff0_13 = new_coeff0_13;
 
479
        coeff0_14 = new_coeff0_14;
 
480
    
 
481
        if(combinations[deriv_num][j] == 0)
 
482
        {
 
483
          new_coeff0_0 = coeff0_0*dmats0[0][0] + coeff0_1*dmats0[1][0] + coeff0_2*dmats0[2][0] + coeff0_3*dmats0[3][0] + coeff0_4*dmats0[4][0] + coeff0_5*dmats0[5][0] + coeff0_6*dmats0[6][0] + coeff0_7*dmats0[7][0] + coeff0_8*dmats0[8][0] + coeff0_9*dmats0[9][0] + coeff0_10*dmats0[10][0] + coeff0_11*dmats0[11][0] + coeff0_12*dmats0[12][0] + coeff0_13*dmats0[13][0] + coeff0_14*dmats0[14][0];
 
484
          new_coeff0_1 = coeff0_0*dmats0[0][1] + coeff0_1*dmats0[1][1] + coeff0_2*dmats0[2][1] + coeff0_3*dmats0[3][1] + coeff0_4*dmats0[4][1] + coeff0_5*dmats0[5][1] + coeff0_6*dmats0[6][1] + coeff0_7*dmats0[7][1] + coeff0_8*dmats0[8][1] + coeff0_9*dmats0[9][1] + coeff0_10*dmats0[10][1] + coeff0_11*dmats0[11][1] + coeff0_12*dmats0[12][1] + coeff0_13*dmats0[13][1] + coeff0_14*dmats0[14][1];
 
485
          new_coeff0_2 = coeff0_0*dmats0[0][2] + coeff0_1*dmats0[1][2] + coeff0_2*dmats0[2][2] + coeff0_3*dmats0[3][2] + coeff0_4*dmats0[4][2] + coeff0_5*dmats0[5][2] + coeff0_6*dmats0[6][2] + coeff0_7*dmats0[7][2] + coeff0_8*dmats0[8][2] + coeff0_9*dmats0[9][2] + coeff0_10*dmats0[10][2] + coeff0_11*dmats0[11][2] + coeff0_12*dmats0[12][2] + coeff0_13*dmats0[13][2] + coeff0_14*dmats0[14][2];
 
486
          new_coeff0_3 = coeff0_0*dmats0[0][3] + coeff0_1*dmats0[1][3] + coeff0_2*dmats0[2][3] + coeff0_3*dmats0[3][3] + coeff0_4*dmats0[4][3] + coeff0_5*dmats0[5][3] + coeff0_6*dmats0[6][3] + coeff0_7*dmats0[7][3] + coeff0_8*dmats0[8][3] + coeff0_9*dmats0[9][3] + coeff0_10*dmats0[10][3] + coeff0_11*dmats0[11][3] + coeff0_12*dmats0[12][3] + coeff0_13*dmats0[13][3] + coeff0_14*dmats0[14][3];
 
487
          new_coeff0_4 = coeff0_0*dmats0[0][4] + coeff0_1*dmats0[1][4] + coeff0_2*dmats0[2][4] + coeff0_3*dmats0[3][4] + coeff0_4*dmats0[4][4] + coeff0_5*dmats0[5][4] + coeff0_6*dmats0[6][4] + coeff0_7*dmats0[7][4] + coeff0_8*dmats0[8][4] + coeff0_9*dmats0[9][4] + coeff0_10*dmats0[10][4] + coeff0_11*dmats0[11][4] + coeff0_12*dmats0[12][4] + coeff0_13*dmats0[13][4] + coeff0_14*dmats0[14][4];
 
488
          new_coeff0_5 = coeff0_0*dmats0[0][5] + coeff0_1*dmats0[1][5] + coeff0_2*dmats0[2][5] + coeff0_3*dmats0[3][5] + coeff0_4*dmats0[4][5] + coeff0_5*dmats0[5][5] + coeff0_6*dmats0[6][5] + coeff0_7*dmats0[7][5] + coeff0_8*dmats0[8][5] + coeff0_9*dmats0[9][5] + coeff0_10*dmats0[10][5] + coeff0_11*dmats0[11][5] + coeff0_12*dmats0[12][5] + coeff0_13*dmats0[13][5] + coeff0_14*dmats0[14][5];
 
489
          new_coeff0_6 = coeff0_0*dmats0[0][6] + coeff0_1*dmats0[1][6] + coeff0_2*dmats0[2][6] + coeff0_3*dmats0[3][6] + coeff0_4*dmats0[4][6] + coeff0_5*dmats0[5][6] + coeff0_6*dmats0[6][6] + coeff0_7*dmats0[7][6] + coeff0_8*dmats0[8][6] + coeff0_9*dmats0[9][6] + coeff0_10*dmats0[10][6] + coeff0_11*dmats0[11][6] + coeff0_12*dmats0[12][6] + coeff0_13*dmats0[13][6] + coeff0_14*dmats0[14][6];
 
490
          new_coeff0_7 = coeff0_0*dmats0[0][7] + coeff0_1*dmats0[1][7] + coeff0_2*dmats0[2][7] + coeff0_3*dmats0[3][7] + coeff0_4*dmats0[4][7] + coeff0_5*dmats0[5][7] + coeff0_6*dmats0[6][7] + coeff0_7*dmats0[7][7] + coeff0_8*dmats0[8][7] + coeff0_9*dmats0[9][7] + coeff0_10*dmats0[10][7] + coeff0_11*dmats0[11][7] + coeff0_12*dmats0[12][7] + coeff0_13*dmats0[13][7] + coeff0_14*dmats0[14][7];
 
491
          new_coeff0_8 = coeff0_0*dmats0[0][8] + coeff0_1*dmats0[1][8] + coeff0_2*dmats0[2][8] + coeff0_3*dmats0[3][8] + coeff0_4*dmats0[4][8] + coeff0_5*dmats0[5][8] + coeff0_6*dmats0[6][8] + coeff0_7*dmats0[7][8] + coeff0_8*dmats0[8][8] + coeff0_9*dmats0[9][8] + coeff0_10*dmats0[10][8] + coeff0_11*dmats0[11][8] + coeff0_12*dmats0[12][8] + coeff0_13*dmats0[13][8] + coeff0_14*dmats0[14][8];
 
492
          new_coeff0_9 = coeff0_0*dmats0[0][9] + coeff0_1*dmats0[1][9] + coeff0_2*dmats0[2][9] + coeff0_3*dmats0[3][9] + coeff0_4*dmats0[4][9] + coeff0_5*dmats0[5][9] + coeff0_6*dmats0[6][9] + coeff0_7*dmats0[7][9] + coeff0_8*dmats0[8][9] + coeff0_9*dmats0[9][9] + coeff0_10*dmats0[10][9] + coeff0_11*dmats0[11][9] + coeff0_12*dmats0[12][9] + coeff0_13*dmats0[13][9] + coeff0_14*dmats0[14][9];
 
493
          new_coeff0_10 = coeff0_0*dmats0[0][10] + coeff0_1*dmats0[1][10] + coeff0_2*dmats0[2][10] + coeff0_3*dmats0[3][10] + coeff0_4*dmats0[4][10] + coeff0_5*dmats0[5][10] + coeff0_6*dmats0[6][10] + coeff0_7*dmats0[7][10] + coeff0_8*dmats0[8][10] + coeff0_9*dmats0[9][10] + coeff0_10*dmats0[10][10] + coeff0_11*dmats0[11][10] + coeff0_12*dmats0[12][10] + coeff0_13*dmats0[13][10] + coeff0_14*dmats0[14][10];
 
494
          new_coeff0_11 = coeff0_0*dmats0[0][11] + coeff0_1*dmats0[1][11] + coeff0_2*dmats0[2][11] + coeff0_3*dmats0[3][11] + coeff0_4*dmats0[4][11] + coeff0_5*dmats0[5][11] + coeff0_6*dmats0[6][11] + coeff0_7*dmats0[7][11] + coeff0_8*dmats0[8][11] + coeff0_9*dmats0[9][11] + coeff0_10*dmats0[10][11] + coeff0_11*dmats0[11][11] + coeff0_12*dmats0[12][11] + coeff0_13*dmats0[13][11] + coeff0_14*dmats0[14][11];
 
495
          new_coeff0_12 = coeff0_0*dmats0[0][12] + coeff0_1*dmats0[1][12] + coeff0_2*dmats0[2][12] + coeff0_3*dmats0[3][12] + coeff0_4*dmats0[4][12] + coeff0_5*dmats0[5][12] + coeff0_6*dmats0[6][12] + coeff0_7*dmats0[7][12] + coeff0_8*dmats0[8][12] + coeff0_9*dmats0[9][12] + coeff0_10*dmats0[10][12] + coeff0_11*dmats0[11][12] + coeff0_12*dmats0[12][12] + coeff0_13*dmats0[13][12] + coeff0_14*dmats0[14][12];
 
496
          new_coeff0_13 = coeff0_0*dmats0[0][13] + coeff0_1*dmats0[1][13] + coeff0_2*dmats0[2][13] + coeff0_3*dmats0[3][13] + coeff0_4*dmats0[4][13] + coeff0_5*dmats0[5][13] + coeff0_6*dmats0[6][13] + coeff0_7*dmats0[7][13] + coeff0_8*dmats0[8][13] + coeff0_9*dmats0[9][13] + coeff0_10*dmats0[10][13] + coeff0_11*dmats0[11][13] + coeff0_12*dmats0[12][13] + coeff0_13*dmats0[13][13] + coeff0_14*dmats0[14][13];
 
497
          new_coeff0_14 = coeff0_0*dmats0[0][14] + coeff0_1*dmats0[1][14] + coeff0_2*dmats0[2][14] + coeff0_3*dmats0[3][14] + coeff0_4*dmats0[4][14] + coeff0_5*dmats0[5][14] + coeff0_6*dmats0[6][14] + coeff0_7*dmats0[7][14] + coeff0_8*dmats0[8][14] + coeff0_9*dmats0[9][14] + coeff0_10*dmats0[10][14] + coeff0_11*dmats0[11][14] + coeff0_12*dmats0[12][14] + coeff0_13*dmats0[13][14] + coeff0_14*dmats0[14][14];
 
498
        }
 
499
        if(combinations[deriv_num][j] == 1)
 
500
        {
 
501
          new_coeff0_0 = coeff0_0*dmats1[0][0] + coeff0_1*dmats1[1][0] + coeff0_2*dmats1[2][0] + coeff0_3*dmats1[3][0] + coeff0_4*dmats1[4][0] + coeff0_5*dmats1[5][0] + coeff0_6*dmats1[6][0] + coeff0_7*dmats1[7][0] + coeff0_8*dmats1[8][0] + coeff0_9*dmats1[9][0] + coeff0_10*dmats1[10][0] + coeff0_11*dmats1[11][0] + coeff0_12*dmats1[12][0] + coeff0_13*dmats1[13][0] + coeff0_14*dmats1[14][0];
 
502
          new_coeff0_1 = coeff0_0*dmats1[0][1] + coeff0_1*dmats1[1][1] + coeff0_2*dmats1[2][1] + coeff0_3*dmats1[3][1] + coeff0_4*dmats1[4][1] + coeff0_5*dmats1[5][1] + coeff0_6*dmats1[6][1] + coeff0_7*dmats1[7][1] + coeff0_8*dmats1[8][1] + coeff0_9*dmats1[9][1] + coeff0_10*dmats1[10][1] + coeff0_11*dmats1[11][1] + coeff0_12*dmats1[12][1] + coeff0_13*dmats1[13][1] + coeff0_14*dmats1[14][1];
 
503
          new_coeff0_2 = coeff0_0*dmats1[0][2] + coeff0_1*dmats1[1][2] + coeff0_2*dmats1[2][2] + coeff0_3*dmats1[3][2] + coeff0_4*dmats1[4][2] + coeff0_5*dmats1[5][2] + coeff0_6*dmats1[6][2] + coeff0_7*dmats1[7][2] + coeff0_8*dmats1[8][2] + coeff0_9*dmats1[9][2] + coeff0_10*dmats1[10][2] + coeff0_11*dmats1[11][2] + coeff0_12*dmats1[12][2] + coeff0_13*dmats1[13][2] + coeff0_14*dmats1[14][2];
 
504
          new_coeff0_3 = coeff0_0*dmats1[0][3] + coeff0_1*dmats1[1][3] + coeff0_2*dmats1[2][3] + coeff0_3*dmats1[3][3] + coeff0_4*dmats1[4][3] + coeff0_5*dmats1[5][3] + coeff0_6*dmats1[6][3] + coeff0_7*dmats1[7][3] + coeff0_8*dmats1[8][3] + coeff0_9*dmats1[9][3] + coeff0_10*dmats1[10][3] + coeff0_11*dmats1[11][3] + coeff0_12*dmats1[12][3] + coeff0_13*dmats1[13][3] + coeff0_14*dmats1[14][3];
 
505
          new_coeff0_4 = coeff0_0*dmats1[0][4] + coeff0_1*dmats1[1][4] + coeff0_2*dmats1[2][4] + coeff0_3*dmats1[3][4] + coeff0_4*dmats1[4][4] + coeff0_5*dmats1[5][4] + coeff0_6*dmats1[6][4] + coeff0_7*dmats1[7][4] + coeff0_8*dmats1[8][4] + coeff0_9*dmats1[9][4] + coeff0_10*dmats1[10][4] + coeff0_11*dmats1[11][4] + coeff0_12*dmats1[12][4] + coeff0_13*dmats1[13][4] + coeff0_14*dmats1[14][4];
 
506
          new_coeff0_5 = coeff0_0*dmats1[0][5] + coeff0_1*dmats1[1][5] + coeff0_2*dmats1[2][5] + coeff0_3*dmats1[3][5] + coeff0_4*dmats1[4][5] + coeff0_5*dmats1[5][5] + coeff0_6*dmats1[6][5] + coeff0_7*dmats1[7][5] + coeff0_8*dmats1[8][5] + coeff0_9*dmats1[9][5] + coeff0_10*dmats1[10][5] + coeff0_11*dmats1[11][5] + coeff0_12*dmats1[12][5] + coeff0_13*dmats1[13][5] + coeff0_14*dmats1[14][5];
 
507
          new_coeff0_6 = coeff0_0*dmats1[0][6] + coeff0_1*dmats1[1][6] + coeff0_2*dmats1[2][6] + coeff0_3*dmats1[3][6] + coeff0_4*dmats1[4][6] + coeff0_5*dmats1[5][6] + coeff0_6*dmats1[6][6] + coeff0_7*dmats1[7][6] + coeff0_8*dmats1[8][6] + coeff0_9*dmats1[9][6] + coeff0_10*dmats1[10][6] + coeff0_11*dmats1[11][6] + coeff0_12*dmats1[12][6] + coeff0_13*dmats1[13][6] + coeff0_14*dmats1[14][6];
 
508
          new_coeff0_7 = coeff0_0*dmats1[0][7] + coeff0_1*dmats1[1][7] + coeff0_2*dmats1[2][7] + coeff0_3*dmats1[3][7] + coeff0_4*dmats1[4][7] + coeff0_5*dmats1[5][7] + coeff0_6*dmats1[6][7] + coeff0_7*dmats1[7][7] + coeff0_8*dmats1[8][7] + coeff0_9*dmats1[9][7] + coeff0_10*dmats1[10][7] + coeff0_11*dmats1[11][7] + coeff0_12*dmats1[12][7] + coeff0_13*dmats1[13][7] + coeff0_14*dmats1[14][7];
 
509
          new_coeff0_8 = coeff0_0*dmats1[0][8] + coeff0_1*dmats1[1][8] + coeff0_2*dmats1[2][8] + coeff0_3*dmats1[3][8] + coeff0_4*dmats1[4][8] + coeff0_5*dmats1[5][8] + coeff0_6*dmats1[6][8] + coeff0_7*dmats1[7][8] + coeff0_8*dmats1[8][8] + coeff0_9*dmats1[9][8] + coeff0_10*dmats1[10][8] + coeff0_11*dmats1[11][8] + coeff0_12*dmats1[12][8] + coeff0_13*dmats1[13][8] + coeff0_14*dmats1[14][8];
 
510
          new_coeff0_9 = coeff0_0*dmats1[0][9] + coeff0_1*dmats1[1][9] + coeff0_2*dmats1[2][9] + coeff0_3*dmats1[3][9] + coeff0_4*dmats1[4][9] + coeff0_5*dmats1[5][9] + coeff0_6*dmats1[6][9] + coeff0_7*dmats1[7][9] + coeff0_8*dmats1[8][9] + coeff0_9*dmats1[9][9] + coeff0_10*dmats1[10][9] + coeff0_11*dmats1[11][9] + coeff0_12*dmats1[12][9] + coeff0_13*dmats1[13][9] + coeff0_14*dmats1[14][9];
 
511
          new_coeff0_10 = coeff0_0*dmats1[0][10] + coeff0_1*dmats1[1][10] + coeff0_2*dmats1[2][10] + coeff0_3*dmats1[3][10] + coeff0_4*dmats1[4][10] + coeff0_5*dmats1[5][10] + coeff0_6*dmats1[6][10] + coeff0_7*dmats1[7][10] + coeff0_8*dmats1[8][10] + coeff0_9*dmats1[9][10] + coeff0_10*dmats1[10][10] + coeff0_11*dmats1[11][10] + coeff0_12*dmats1[12][10] + coeff0_13*dmats1[13][10] + coeff0_14*dmats1[14][10];
 
512
          new_coeff0_11 = coeff0_0*dmats1[0][11] + coeff0_1*dmats1[1][11] + coeff0_2*dmats1[2][11] + coeff0_3*dmats1[3][11] + coeff0_4*dmats1[4][11] + coeff0_5*dmats1[5][11] + coeff0_6*dmats1[6][11] + coeff0_7*dmats1[7][11] + coeff0_8*dmats1[8][11] + coeff0_9*dmats1[9][11] + coeff0_10*dmats1[10][11] + coeff0_11*dmats1[11][11] + coeff0_12*dmats1[12][11] + coeff0_13*dmats1[13][11] + coeff0_14*dmats1[14][11];
 
513
          new_coeff0_12 = coeff0_0*dmats1[0][12] + coeff0_1*dmats1[1][12] + coeff0_2*dmats1[2][12] + coeff0_3*dmats1[3][12] + coeff0_4*dmats1[4][12] + coeff0_5*dmats1[5][12] + coeff0_6*dmats1[6][12] + coeff0_7*dmats1[7][12] + coeff0_8*dmats1[8][12] + coeff0_9*dmats1[9][12] + coeff0_10*dmats1[10][12] + coeff0_11*dmats1[11][12] + coeff0_12*dmats1[12][12] + coeff0_13*dmats1[13][12] + coeff0_14*dmats1[14][12];
 
514
          new_coeff0_13 = coeff0_0*dmats1[0][13] + coeff0_1*dmats1[1][13] + coeff0_2*dmats1[2][13] + coeff0_3*dmats1[3][13] + coeff0_4*dmats1[4][13] + coeff0_5*dmats1[5][13] + coeff0_6*dmats1[6][13] + coeff0_7*dmats1[7][13] + coeff0_8*dmats1[8][13] + coeff0_9*dmats1[9][13] + coeff0_10*dmats1[10][13] + coeff0_11*dmats1[11][13] + coeff0_12*dmats1[12][13] + coeff0_13*dmats1[13][13] + coeff0_14*dmats1[14][13];
 
515
          new_coeff0_14 = coeff0_0*dmats1[0][14] + coeff0_1*dmats1[1][14] + coeff0_2*dmats1[2][14] + coeff0_3*dmats1[3][14] + coeff0_4*dmats1[4][14] + coeff0_5*dmats1[5][14] + coeff0_6*dmats1[6][14] + coeff0_7*dmats1[7][14] + coeff0_8*dmats1[8][14] + coeff0_9*dmats1[9][14] + coeff0_10*dmats1[10][14] + coeff0_11*dmats1[11][14] + coeff0_12*dmats1[12][14] + coeff0_13*dmats1[13][14] + coeff0_14*dmats1[14][14];
 
516
        }
 
517
    
 
518
      }
 
519
      // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
520
      derivatives[deriv_num] = new_coeff0_0*basisvalue0 + new_coeff0_1*basisvalue1 + new_coeff0_2*basisvalue2 + new_coeff0_3*basisvalue3 + new_coeff0_4*basisvalue4 + new_coeff0_5*basisvalue5 + new_coeff0_6*basisvalue6 + new_coeff0_7*basisvalue7 + new_coeff0_8*basisvalue8 + new_coeff0_9*basisvalue9 + new_coeff0_10*basisvalue10 + new_coeff0_11*basisvalue11 + new_coeff0_12*basisvalue12 + new_coeff0_13*basisvalue13 + new_coeff0_14*basisvalue14;
 
521
    }
 
522
    
 
523
    // Transform derivatives back to physical element
 
524
    for (unsigned int row = 0; row < num_derivatives; row++)
 
525
    {
 
526
      for (unsigned int col = 0; col < num_derivatives; col++)
 
527
      {
 
528
        values[row] += transform[row][col]*derivatives[col];
 
529
      }
 
530
    }
 
531
    // Delete pointer to array of derivatives on FIAT element
 
532
    delete [] derivatives;
 
533
    
 
534
    // Delete pointer to array of combinations of derivatives and transform
 
535
    for (unsigned int row = 0; row < num_derivatives; row++)
 
536
    {
 
537
      delete [] combinations[row];
 
538
      delete [] transform[row];
 
539
    }
 
540
    
 
541
    delete [] combinations;
 
542
    delete [] transform;
 
543
  }
 
544
 
 
545
  /// Evaluate order n derivatives of all basis functions at given point in cell
 
546
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
547
                                              double* values,
 
548
                                              const double* coordinates,
 
549
                                              const ufc::cell& c) const
 
550
  {
 
551
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
 
552
  }
 
553
 
 
554
  /// Evaluate linear functional for dof i on the function f
 
555
  virtual double evaluate_dof(unsigned int i,
 
556
                              const ufc::function& f,
 
557
                              const ufc::cell& c) const
 
558
  {
 
559
    // The reference points, direction and weights:
 
560
    static const double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.75, 0.25}}, {{0.5, 0.5}}, {{0.25, 0.75}}, {{0, 0.25}}, {{0, 0.5}}, {{0, 0.75}}, {{0.25, 0}}, {{0.5, 0}}, {{0.75, 0}}, {{0.25, 0.25}}, {{0.5, 0.25}}, {{0.25, 0.5}}};
 
561
    static const double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
 
562
    static const double D[15][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
 
563
    
 
564
    const double * const * x = c.coordinates;
 
565
    double result = 0.0;
 
566
    // Iterate over the points:
 
567
    // Evaluate basis functions for affine mapping
 
568
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1];
 
569
    const double w1 = X[i][0][0];
 
570
    const double w2 = X[i][0][1];
 
571
    
 
572
    // Compute affine mapping y = F(X)
 
573
    double y[2];
 
574
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0];
 
575
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1];
 
576
    
 
577
    // Evaluate function at physical points
 
578
    double values[1];
 
579
    f.evaluate(values, y, c);
 
580
    
 
581
    // Map function values using appropriate mapping
 
582
    // Affine map: Do nothing
 
583
    
 
584
    // Note that we do not map the weights (yet).
 
585
    
 
586
    // Take directional components
 
587
    for(int k = 0; k < 1; k++)
 
588
      result += values[k]*D[i][0][k];
 
589
    // Multiply by weights
 
590
    result *= W[i][0];
 
591
    
 
592
    return result;
 
593
  }
 
594
 
 
595
  /// Evaluate linear functionals for all dofs on the function f
 
596
  virtual void evaluate_dofs(double* values,
 
597
                             const ufc::function& f,
 
598
                             const ufc::cell& c) const
 
599
  {
 
600
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
601
  }
 
602
 
 
603
  /// Interpolate vertex values from dof values
 
604
  virtual void interpolate_vertex_values(double* vertex_values,
 
605
                                         const double* dof_values,
 
606
                                         const ufc::cell& c) const
 
607
  {
 
608
    // Evaluate at vertices and use affine mapping
 
609
    vertex_values[0] = dof_values[0];
 
610
    vertex_values[1] = dof_values[1];
 
611
    vertex_values[2] = dof_values[2];
 
612
  }
 
613
 
 
614
  /// Return the number of sub elements (for a mixed element)
 
615
  virtual unsigned int num_sub_elements() const
 
616
  {
 
617
    return 1;
 
618
  }
 
619
 
 
620
  /// Create a new finite element for sub element i (for a mixed element)
 
621
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
622
  {
 
623
    return new poisson2d_4_0_finite_element_0();
 
624
  }
 
625
 
 
626
};
 
627
 
 
628
/// This class defines the interface for a finite element.
 
629
 
 
630
class poisson2d_4_0_finite_element_1: public ufc::finite_element
 
631
{
 
632
public:
 
633
 
 
634
  /// Constructor
 
635
  poisson2d_4_0_finite_element_1() : ufc::finite_element()
 
636
  {
 
637
    // Do nothing
 
638
  }
 
639
 
 
640
  /// Destructor
 
641
  virtual ~poisson2d_4_0_finite_element_1()
 
642
  {
 
643
    // Do nothing
 
644
  }
 
645
 
 
646
  /// Return a string identifying the finite element
 
647
  virtual const char* signature() const
 
648
  {
 
649
    return "FiniteElement('Lagrange', 'triangle', 4)";
 
650
  }
 
651
 
 
652
  /// Return the cell shape
 
653
  virtual ufc::shape cell_shape() const
 
654
  {
 
655
    return ufc::triangle;
 
656
  }
 
657
 
 
658
  /// Return the dimension of the finite element function space
 
659
  virtual unsigned int space_dimension() const
 
660
  {
 
661
    return 15;
 
662
  }
 
663
 
 
664
  /// Return the rank of the value space
 
665
  virtual unsigned int value_rank() const
 
666
  {
 
667
    return 0;
 
668
  }
 
669
 
 
670
  /// Return the dimension of the value space for axis i
 
671
  virtual unsigned int value_dimension(unsigned int i) const
 
672
  {
 
673
    return 1;
 
674
  }
 
675
 
 
676
  /// Evaluate basis function i at given point in cell
 
677
  virtual void evaluate_basis(unsigned int i,
 
678
                              double* values,
 
679
                              const double* coordinates,
 
680
                              const ufc::cell& c) const
 
681
  {
 
682
    // Extract vertex coordinates
 
683
    const double * const * element_coordinates = c.coordinates;
 
684
    
 
685
    // Compute Jacobian of affine map from reference cell
 
686
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
687
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
688
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
689
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
690
    
 
691
    // Compute determinant of Jacobian
 
692
    const double detJ = J_00*J_11 - J_01*J_10;
 
693
    
 
694
    // Compute inverse of Jacobian
 
695
    
 
696
    // Get coordinates and map to the reference (UFC) element
 
697
    double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
 
698
                element_coordinates[0][0]*element_coordinates[2][1] +\
 
699
                J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
 
700
    double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
 
701
                element_coordinates[1][0]*element_coordinates[0][1] -\
 
702
                J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
 
703
    
 
704
    // Map coordinates to the reference square
 
705
    if (std::abs(y - 1.0) < 1e-14)
 
706
      x = -1.0;
 
707
    else
 
708
      x = 2.0 *x/(1.0 - y) - 1.0;
 
709
    y = 2.0*y - 1.0;
 
710
    
 
711
    // Reset values
 
712
    *values = 0;
 
713
    
 
714
    // Map degree of freedom to element degree of freedom
 
715
    const unsigned int dof = i;
 
716
    
 
717
    // Generate scalings
 
718
    const double scalings_y_0 = 1;
 
719
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
 
720
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
 
721
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
 
722
    const double scalings_y_4 = scalings_y_3*(0.5 - 0.5*y);
 
723
    
 
724
    // Compute psitilde_a
 
725
    const double psitilde_a_0 = 1;
 
726
    const double psitilde_a_1 = x;
 
727
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
 
728
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
 
729
    const double psitilde_a_4 = 1.75*x*psitilde_a_3 - 0.75*psitilde_a_2;
 
730
    
 
731
    // Compute psitilde_bs
 
732
    const double psitilde_bs_0_0 = 1;
 
733
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
 
734
    const double psitilde_bs_0_2 = 0.111111111111111*psitilde_bs_0_1 + 1.66666666666667*y*psitilde_bs_0_1 - 0.555555555555556*psitilde_bs_0_0;
 
735
    const double psitilde_bs_0_3 = 0.05*psitilde_bs_0_2 + 1.75*y*psitilde_bs_0_2 - 0.7*psitilde_bs_0_1;
 
736
    const double psitilde_bs_0_4 = 0.0285714285714286*psitilde_bs_0_3 + 1.8*y*psitilde_bs_0_3 - 0.771428571428571*psitilde_bs_0_2;
 
737
    const double psitilde_bs_1_0 = 1;
 
738
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
 
739
    const double psitilde_bs_1_2 = 0.54*psitilde_bs_1_1 + 2.1*y*psitilde_bs_1_1 - 0.56*psitilde_bs_1_0;
 
740
    const double psitilde_bs_1_3 = 0.285714285714286*psitilde_bs_1_2 + 2*y*psitilde_bs_1_2 - 0.714285714285714*psitilde_bs_1_1;
 
741
    const double psitilde_bs_2_0 = 1;
 
742
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
 
743
    const double psitilde_bs_2_2 = 1.02040816326531*psitilde_bs_2_1 + 2.57142857142857*y*psitilde_bs_2_1 - 0.551020408163265*psitilde_bs_2_0;
 
744
    const double psitilde_bs_3_0 = 1;
 
745
    const double psitilde_bs_3_1 = 4.5*y + 3.5;
 
746
    const double psitilde_bs_4_0 = 1;
 
747
    
 
748
    // Compute basisvalues
 
749
    const double basisvalue0 = 0.707106781186548*psitilde_a_0*scalings_y_0*psitilde_bs_0_0;
 
750
    const double basisvalue1 = 1.73205080756888*psitilde_a_1*scalings_y_1*psitilde_bs_1_0;
 
751
    const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
 
752
    const double basisvalue3 = 2.73861278752583*psitilde_a_2*scalings_y_2*psitilde_bs_2_0;
 
753
    const double basisvalue4 = 2.12132034355964*psitilde_a_1*scalings_y_1*psitilde_bs_1_1;
 
754
    const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
 
755
    const double basisvalue6 = 3.74165738677394*psitilde_a_3*scalings_y_3*psitilde_bs_3_0;
 
756
    const double basisvalue7 = 3.16227766016838*psitilde_a_2*scalings_y_2*psitilde_bs_2_1;
 
757
    const double basisvalue8 = 2.44948974278318*psitilde_a_1*scalings_y_1*psitilde_bs_1_2;
 
758
    const double basisvalue9 = 1.4142135623731*psitilde_a_0*scalings_y_0*psitilde_bs_0_3;
 
759
    const double basisvalue10 = 4.74341649025257*psitilde_a_4*scalings_y_4*psitilde_bs_4_0;
 
760
    const double basisvalue11 = 4.18330013267038*psitilde_a_3*scalings_y_3*psitilde_bs_3_1;
 
761
    const double basisvalue12 = 3.53553390593274*psitilde_a_2*scalings_y_2*psitilde_bs_2_2;
 
762
    const double basisvalue13 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_3;
 
763
    const double basisvalue14 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_4;
 
764
    
 
765
    // Table(s) of coefficients
 
766
    static const double coefficients0[15][15] = \
 
767
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366311, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
 
768
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233824, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.0239443566116079, -0.0185472188784818, 0.0107082418122104},
 
769
    {0, 0, 0.0476190476190476, 0, 0, 0.038880789567987, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
 
770
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543896, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406278, 0.0834624849531682, -0.0535412090610519},
 
771
    {-0.0314269680527354, 0.0109971479845642, 0.00634920634920638, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
 
772
    {0.125707872210942, 0.0439885919382573, 0.126984126984127, 0, 0.035916534917412, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
 
773
    {0.125707872210942, -0.131965775814772, -0.0253968253968254, 0.139104141588614, 0.0718330698348239, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.0478887132232159, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
 
774
    {-0.0314269680527354, -0.0109971479845643, 0.00634920634920633, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
 
775
    {0.125707872210942, -0.0439885919382572, 0.126984126984127, 0, -0.0359165349174119, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
 
776
    {0.125707872210942, -0.0879771838765144, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
 
777
    {-0.0314269680527354, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951817, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.023944356611608, 0, 0.0107082418122104},
 
778
    {0.125707872210942, 0.0879771838765145, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277046, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
 
779
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406279, -0.0278208283177228, -0.0535412090610519},
 
780
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.0267706045305259, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406278, 0.0278208283177228, -0.0535412090610519},
 
781
    {0.251415744421883, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
 
782
    
 
783
    // Extract relevant coefficients
 
784
    const double coeff0_0 = coefficients0[dof][0];
 
785
    const double coeff0_1 = coefficients0[dof][1];
 
786
    const double coeff0_2 = coefficients0[dof][2];
 
787
    const double coeff0_3 = coefficients0[dof][3];
 
788
    const double coeff0_4 = coefficients0[dof][4];
 
789
    const double coeff0_5 = coefficients0[dof][5];
 
790
    const double coeff0_6 = coefficients0[dof][6];
 
791
    const double coeff0_7 = coefficients0[dof][7];
 
792
    const double coeff0_8 = coefficients0[dof][8];
 
793
    const double coeff0_9 = coefficients0[dof][9];
 
794
    const double coeff0_10 = coefficients0[dof][10];
 
795
    const double coeff0_11 = coefficients0[dof][11];
 
796
    const double coeff0_12 = coefficients0[dof][12];
 
797
    const double coeff0_13 = coefficients0[dof][13];
 
798
    const double coeff0_14 = coefficients0[dof][14];
 
799
    
 
800
    // Compute value(s)
 
801
    *values = coeff0_0*basisvalue0 + coeff0_1*basisvalue1 + coeff0_2*basisvalue2 + coeff0_3*basisvalue3 + coeff0_4*basisvalue4 + coeff0_5*basisvalue5 + coeff0_6*basisvalue6 + coeff0_7*basisvalue7 + coeff0_8*basisvalue8 + coeff0_9*basisvalue9 + coeff0_10*basisvalue10 + coeff0_11*basisvalue11 + coeff0_12*basisvalue12 + coeff0_13*basisvalue13 + coeff0_14*basisvalue14;
 
802
  }
 
803
 
 
804
  /// Evaluate all basis functions at given point in cell
 
805
  virtual void evaluate_basis_all(double* values,
 
806
                                  const double* coordinates,
 
807
                                  const ufc::cell& c) const
 
808
  {
 
809
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
 
810
  }
 
811
 
 
812
  /// Evaluate order n derivatives of basis function i at given point in cell
 
813
  virtual void evaluate_basis_derivatives(unsigned int i,
 
814
                                          unsigned int n,
 
815
                                          double* values,
 
816
                                          const double* coordinates,
 
817
                                          const ufc::cell& c) const
 
818
  {
 
819
    // Extract vertex coordinates
 
820
    const double * const * element_coordinates = c.coordinates;
 
821
    
 
822
    // Compute Jacobian of affine map from reference cell
 
823
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
824
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
825
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
826
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
827
    
 
828
    // Compute determinant of Jacobian
 
829
    const double detJ = J_00*J_11 - J_01*J_10;
 
830
    
 
831
    // Compute inverse of Jacobian
 
832
    
 
833
    // Get coordinates and map to the reference (UFC) element
 
834
    double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
 
835
                element_coordinates[0][0]*element_coordinates[2][1] +\
 
836
                J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
 
837
    double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
 
838
                element_coordinates[1][0]*element_coordinates[0][1] -\
 
839
                J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
 
840
    
 
841
    // Map coordinates to the reference square
 
842
    if (std::abs(y - 1.0) < 1e-14)
 
843
      x = -1.0;
 
844
    else
 
845
      x = 2.0 *x/(1.0 - y) - 1.0;
 
846
    y = 2.0*y - 1.0;
 
847
    
 
848
    // Compute number of derivatives
 
849
    unsigned int num_derivatives = 1;
 
850
    
 
851
    for (unsigned int j = 0; j < n; j++)
 
852
      num_derivatives *= 2;
 
853
    
 
854
    
 
855
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
 
856
    unsigned int **combinations = new unsigned int *[num_derivatives];
 
857
    
 
858
    for (unsigned int j = 0; j < num_derivatives; j++)
 
859
    {
 
860
      combinations[j] = new unsigned int [n];
 
861
      for (unsigned int k = 0; k < n; k++)
 
862
        combinations[j][k] = 0;
 
863
    }
 
864
    
 
865
    // Generate combinations of derivatives
 
866
    for (unsigned int row = 1; row < num_derivatives; row++)
 
867
    {
 
868
      for (unsigned int num = 0; num < row; num++)
 
869
      {
 
870
        for (unsigned int col = n-1; col+1 > 0; col--)
 
871
        {
 
872
          if (combinations[row][col] + 1 > 1)
 
873
            combinations[row][col] = 0;
 
874
          else
 
875
          {
 
876
            combinations[row][col] += 1;
 
877
            break;
 
878
          }
 
879
        }
 
880
      }
 
881
    }
 
882
    
 
883
    // Compute inverse of Jacobian
 
884
    const double Jinv[2][2] =  {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
 
885
    
 
886
    // Declare transformation matrix
 
887
    // Declare pointer to two dimensional array and initialise
 
888
    double **transform = new double *[num_derivatives];
 
889
    
 
890
    for (unsigned int j = 0; j < num_derivatives; j++)
 
891
    {
 
892
      transform[j] = new double [num_derivatives];
 
893
      for (unsigned int k = 0; k < num_derivatives; k++)
 
894
        transform[j][k] = 1;
 
895
    }
 
896
    
 
897
    // Construct transformation matrix
 
898
    for (unsigned int row = 0; row < num_derivatives; row++)
 
899
    {
 
900
      for (unsigned int col = 0; col < num_derivatives; col++)
 
901
      {
 
902
        for (unsigned int k = 0; k < n; k++)
 
903
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
 
904
      }
 
905
    }
 
906
    
 
907
    // Reset values
 
908
    for (unsigned int j = 0; j < 1*num_derivatives; j++)
 
909
      values[j] = 0;
 
910
    
 
911
    // Map degree of freedom to element degree of freedom
 
912
    const unsigned int dof = i;
 
913
    
 
914
    // Generate scalings
 
915
    const double scalings_y_0 = 1;
 
916
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
 
917
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
 
918
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
 
919
    const double scalings_y_4 = scalings_y_3*(0.5 - 0.5*y);
 
920
    
 
921
    // Compute psitilde_a
 
922
    const double psitilde_a_0 = 1;
 
923
    const double psitilde_a_1 = x;
 
924
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
 
925
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
 
926
    const double psitilde_a_4 = 1.75*x*psitilde_a_3 - 0.75*psitilde_a_2;
 
927
    
 
928
    // Compute psitilde_bs
 
929
    const double psitilde_bs_0_0 = 1;
 
930
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
 
931
    const double psitilde_bs_0_2 = 0.111111111111111*psitilde_bs_0_1 + 1.66666666666667*y*psitilde_bs_0_1 - 0.555555555555556*psitilde_bs_0_0;
 
932
    const double psitilde_bs_0_3 = 0.05*psitilde_bs_0_2 + 1.75*y*psitilde_bs_0_2 - 0.7*psitilde_bs_0_1;
 
933
    const double psitilde_bs_0_4 = 0.0285714285714286*psitilde_bs_0_3 + 1.8*y*psitilde_bs_0_3 - 0.771428571428571*psitilde_bs_0_2;
 
934
    const double psitilde_bs_1_0 = 1;
 
935
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
 
936
    const double psitilde_bs_1_2 = 0.54*psitilde_bs_1_1 + 2.1*y*psitilde_bs_1_1 - 0.56*psitilde_bs_1_0;
 
937
    const double psitilde_bs_1_3 = 0.285714285714286*psitilde_bs_1_2 + 2*y*psitilde_bs_1_2 - 0.714285714285714*psitilde_bs_1_1;
 
938
    const double psitilde_bs_2_0 = 1;
 
939
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
 
940
    const double psitilde_bs_2_2 = 1.02040816326531*psitilde_bs_2_1 + 2.57142857142857*y*psitilde_bs_2_1 - 0.551020408163265*psitilde_bs_2_0;
 
941
    const double psitilde_bs_3_0 = 1;
 
942
    const double psitilde_bs_3_1 = 4.5*y + 3.5;
 
943
    const double psitilde_bs_4_0 = 1;
 
944
    
 
945
    // Compute basisvalues
 
946
    const double basisvalue0 = 0.707106781186548*psitilde_a_0*scalings_y_0*psitilde_bs_0_0;
 
947
    const double basisvalue1 = 1.73205080756888*psitilde_a_1*scalings_y_1*psitilde_bs_1_0;
 
948
    const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
 
949
    const double basisvalue3 = 2.73861278752583*psitilde_a_2*scalings_y_2*psitilde_bs_2_0;
 
950
    const double basisvalue4 = 2.12132034355964*psitilde_a_1*scalings_y_1*psitilde_bs_1_1;
 
951
    const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
 
952
    const double basisvalue6 = 3.74165738677394*psitilde_a_3*scalings_y_3*psitilde_bs_3_0;
 
953
    const double basisvalue7 = 3.16227766016838*psitilde_a_2*scalings_y_2*psitilde_bs_2_1;
 
954
    const double basisvalue8 = 2.44948974278318*psitilde_a_1*scalings_y_1*psitilde_bs_1_2;
 
955
    const double basisvalue9 = 1.4142135623731*psitilde_a_0*scalings_y_0*psitilde_bs_0_3;
 
956
    const double basisvalue10 = 4.74341649025257*psitilde_a_4*scalings_y_4*psitilde_bs_4_0;
 
957
    const double basisvalue11 = 4.18330013267038*psitilde_a_3*scalings_y_3*psitilde_bs_3_1;
 
958
    const double basisvalue12 = 3.53553390593274*psitilde_a_2*scalings_y_2*psitilde_bs_2_2;
 
959
    const double basisvalue13 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_3;
 
960
    const double basisvalue14 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_4;
 
961
    
 
962
    // Table(s) of coefficients
 
963
    static const double coefficients0[15][15] = \
 
964
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366311, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
 
965
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233824, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.0239443566116079, -0.0185472188784818, 0.0107082418122104},
 
966
    {0, 0, 0.0476190476190476, 0, 0, 0.038880789567987, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
 
967
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543896, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406278, 0.0834624849531682, -0.0535412090610519},
 
968
    {-0.0314269680527354, 0.0109971479845642, 0.00634920634920638, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
 
969
    {0.125707872210942, 0.0439885919382573, 0.126984126984127, 0, 0.035916534917412, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
 
970
    {0.125707872210942, -0.131965775814772, -0.0253968253968254, 0.139104141588614, 0.0718330698348239, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.0478887132232159, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
 
971
    {-0.0314269680527354, -0.0109971479845643, 0.00634920634920633, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
 
972
    {0.125707872210942, -0.0439885919382572, 0.126984126984127, 0, -0.0359165349174119, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
 
973
    {0.125707872210942, -0.0879771838765144, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
 
974
    {-0.0314269680527354, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951817, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.023944356611608, 0, 0.0107082418122104},
 
975
    {0.125707872210942, 0.0879771838765145, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277046, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
 
976
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406279, -0.0278208283177228, -0.0535412090610519},
 
977
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.0267706045305259, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406278, 0.0278208283177228, -0.0535412090610519},
 
978
    {0.251415744421883, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
 
979
    
 
980
    // Interesting (new) part
 
981
    // Tables of derivatives of the polynomial base (transpose)
 
982
    static const double dmats0[15][15] = \
 
983
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
984
    {4.89897948556635, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
985
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
986
    {0, 9.48683298050514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
987
    {4, 0, 7.07106781186548, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
988
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
989
    {5.29150262212918, 0, -2.99332590941916, 13.6626010212795, 0, 0.611010092660776, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
990
    {0, 4.38178046004133, 0, 0, 12.5219806739988, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
991
    {3.46410161513776, 0, 7.83836717690617, 0, 0, 8.40000000000001, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
992
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
993
    {0, 10.9544511501033, 0, 0, -3.83325938999965, 0, 17.7482393492988, 0, 0.55328333517249, 0, 0, 0, 0, 0, 0},
 
994
    {4.73286382647969, 0, 3.3466401061363, 4.36435780471985, 0, -5.07468037933238, 0, 17.0084012854152, 0, 1.52127765851133, 0, 0, 0, 0, 0},
 
995
    {0, 2.44948974278318, 0, 0, 9.14285714285715, 0, 0, 0, 14.8461497791618, 0, 0, 0, 0, 0, 0},
 
996
    {3.09838667696593, 0, 7.66811580507233, 0, 0, 10.733126291999, 0, 0, 0, 9.2951600308978, 0, 0, 0, 0, 0},
 
997
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
998
    
 
999
    static const double dmats1[15][15] = \
 
1000
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1001
    {2.44948974278318, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1002
    {4.24264068711928, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1003
    {2.58198889747161, 4.74341649025257, -0.912870929175276, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1004
    {2, 6.12372435695795, 3.53553390593274, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1005
    {-2.3094010767585, 0, 8.16496580927726, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1006
    {2.64575131106459, 5.18459255872629, -1.49666295470958, 6.83130051063973, -1.05830052442584, 0.305505046330388, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1007
    {2.23606797749978, 2.19089023002066, 2.5298221281347, 8.08290376865476, 6.26099033699942, -1.80739222823014, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1008
    {1.73205080756888, -5.09116882454315, 3.91918358845308, 0, 9.69948452238572, 4.2, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1009
    {5, 0, -2.82842712474619, 0, 0, 12.1243556529821, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1010
    {2.68328157299975, 5.47722557505166, -1.89736659610103, 7.4230748895809, -1.91662969499982, 0.663940002206986, 8.87411967464942, -1.07142857142857, 0.276641667586244, -0.0958314847499919, 0, 0, 0, 0, 0},
 
1011
    {2.36643191323985, 2.89827534923789, 1.67332005306815, 2.18217890235992, 5.74704893215392, -2.53734018966619, 10.0623058987491, 8.50420064270761, -2.1957751641342, 0.760638829255664, 0, 0, 0, 0, 0},
 
1012
    {2, 1.22474487139159, 3.53553390593274, -7.37711113563317, 4.57142857142858, 1.64957219768464, 0, 11.4997781699989, 7.4230748895809, -2.57142857142857, 0, 0, 0, 0, 0},
 
1013
    {1.54919333848297, 6.6407830863536, 3.83405790253617, 0, -6.19677335393188, 5.3665631459995, 0, 0, 13.4164078649987, 4.6475800154489, 0, 0, 0, 0, 0},
 
1014
    {-3.57770876399967, 0, 8.85437744847147, 0, 0, -3.09838667696594, 0, 0, 0, 16.0996894379985, 0, 0, 0, 0, 0}};
 
1015
    
 
1016
    // Compute reference derivatives
 
1017
    // Declare pointer to array of derivatives on FIAT element
 
1018
    double *derivatives = new double [num_derivatives];
 
1019
    
 
1020
    // Declare coefficients
 
1021
    double coeff0_0 = 0;
 
1022
    double coeff0_1 = 0;
 
1023
    double coeff0_2 = 0;
 
1024
    double coeff0_3 = 0;
 
1025
    double coeff0_4 = 0;
 
1026
    double coeff0_5 = 0;
 
1027
    double coeff0_6 = 0;
 
1028
    double coeff0_7 = 0;
 
1029
    double coeff0_8 = 0;
 
1030
    double coeff0_9 = 0;
 
1031
    double coeff0_10 = 0;
 
1032
    double coeff0_11 = 0;
 
1033
    double coeff0_12 = 0;
 
1034
    double coeff0_13 = 0;
 
1035
    double coeff0_14 = 0;
 
1036
    
 
1037
    // Declare new coefficients
 
1038
    double new_coeff0_0 = 0;
 
1039
    double new_coeff0_1 = 0;
 
1040
    double new_coeff0_2 = 0;
 
1041
    double new_coeff0_3 = 0;
 
1042
    double new_coeff0_4 = 0;
 
1043
    double new_coeff0_5 = 0;
 
1044
    double new_coeff0_6 = 0;
 
1045
    double new_coeff0_7 = 0;
 
1046
    double new_coeff0_8 = 0;
 
1047
    double new_coeff0_9 = 0;
 
1048
    double new_coeff0_10 = 0;
 
1049
    double new_coeff0_11 = 0;
 
1050
    double new_coeff0_12 = 0;
 
1051
    double new_coeff0_13 = 0;
 
1052
    double new_coeff0_14 = 0;
 
1053
    
 
1054
    // Loop possible derivatives
 
1055
    for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
1056
    {
 
1057
      // Get values from coefficients array
 
1058
      new_coeff0_0 = coefficients0[dof][0];
 
1059
      new_coeff0_1 = coefficients0[dof][1];
 
1060
      new_coeff0_2 = coefficients0[dof][2];
 
1061
      new_coeff0_3 = coefficients0[dof][3];
 
1062
      new_coeff0_4 = coefficients0[dof][4];
 
1063
      new_coeff0_5 = coefficients0[dof][5];
 
1064
      new_coeff0_6 = coefficients0[dof][6];
 
1065
      new_coeff0_7 = coefficients0[dof][7];
 
1066
      new_coeff0_8 = coefficients0[dof][8];
 
1067
      new_coeff0_9 = coefficients0[dof][9];
 
1068
      new_coeff0_10 = coefficients0[dof][10];
 
1069
      new_coeff0_11 = coefficients0[dof][11];
 
1070
      new_coeff0_12 = coefficients0[dof][12];
 
1071
      new_coeff0_13 = coefficients0[dof][13];
 
1072
      new_coeff0_14 = coefficients0[dof][14];
 
1073
    
 
1074
      // Loop derivative order
 
1075
      for (unsigned int j = 0; j < n; j++)
 
1076
      {
 
1077
        // Update old coefficients
 
1078
        coeff0_0 = new_coeff0_0;
 
1079
        coeff0_1 = new_coeff0_1;
 
1080
        coeff0_2 = new_coeff0_2;
 
1081
        coeff0_3 = new_coeff0_3;
 
1082
        coeff0_4 = new_coeff0_4;
 
1083
        coeff0_5 = new_coeff0_5;
 
1084
        coeff0_6 = new_coeff0_6;
 
1085
        coeff0_7 = new_coeff0_7;
 
1086
        coeff0_8 = new_coeff0_8;
 
1087
        coeff0_9 = new_coeff0_9;
 
1088
        coeff0_10 = new_coeff0_10;
 
1089
        coeff0_11 = new_coeff0_11;
 
1090
        coeff0_12 = new_coeff0_12;
 
1091
        coeff0_13 = new_coeff0_13;
 
1092
        coeff0_14 = new_coeff0_14;
 
1093
    
 
1094
        if(combinations[deriv_num][j] == 0)
 
1095
        {
 
1096
          new_coeff0_0 = coeff0_0*dmats0[0][0] + coeff0_1*dmats0[1][0] + coeff0_2*dmats0[2][0] + coeff0_3*dmats0[3][0] + coeff0_4*dmats0[4][0] + coeff0_5*dmats0[5][0] + coeff0_6*dmats0[6][0] + coeff0_7*dmats0[7][0] + coeff0_8*dmats0[8][0] + coeff0_9*dmats0[9][0] + coeff0_10*dmats0[10][0] + coeff0_11*dmats0[11][0] + coeff0_12*dmats0[12][0] + coeff0_13*dmats0[13][0] + coeff0_14*dmats0[14][0];
 
1097
          new_coeff0_1 = coeff0_0*dmats0[0][1] + coeff0_1*dmats0[1][1] + coeff0_2*dmats0[2][1] + coeff0_3*dmats0[3][1] + coeff0_4*dmats0[4][1] + coeff0_5*dmats0[5][1] + coeff0_6*dmats0[6][1] + coeff0_7*dmats0[7][1] + coeff0_8*dmats0[8][1] + coeff0_9*dmats0[9][1] + coeff0_10*dmats0[10][1] + coeff0_11*dmats0[11][1] + coeff0_12*dmats0[12][1] + coeff0_13*dmats0[13][1] + coeff0_14*dmats0[14][1];
 
1098
          new_coeff0_2 = coeff0_0*dmats0[0][2] + coeff0_1*dmats0[1][2] + coeff0_2*dmats0[2][2] + coeff0_3*dmats0[3][2] + coeff0_4*dmats0[4][2] + coeff0_5*dmats0[5][2] + coeff0_6*dmats0[6][2] + coeff0_7*dmats0[7][2] + coeff0_8*dmats0[8][2] + coeff0_9*dmats0[9][2] + coeff0_10*dmats0[10][2] + coeff0_11*dmats0[11][2] + coeff0_12*dmats0[12][2] + coeff0_13*dmats0[13][2] + coeff0_14*dmats0[14][2];
 
1099
          new_coeff0_3 = coeff0_0*dmats0[0][3] + coeff0_1*dmats0[1][3] + coeff0_2*dmats0[2][3] + coeff0_3*dmats0[3][3] + coeff0_4*dmats0[4][3] + coeff0_5*dmats0[5][3] + coeff0_6*dmats0[6][3] + coeff0_7*dmats0[7][3] + coeff0_8*dmats0[8][3] + coeff0_9*dmats0[9][3] + coeff0_10*dmats0[10][3] + coeff0_11*dmats0[11][3] + coeff0_12*dmats0[12][3] + coeff0_13*dmats0[13][3] + coeff0_14*dmats0[14][3];
 
1100
          new_coeff0_4 = coeff0_0*dmats0[0][4] + coeff0_1*dmats0[1][4] + coeff0_2*dmats0[2][4] + coeff0_3*dmats0[3][4] + coeff0_4*dmats0[4][4] + coeff0_5*dmats0[5][4] + coeff0_6*dmats0[6][4] + coeff0_7*dmats0[7][4] + coeff0_8*dmats0[8][4] + coeff0_9*dmats0[9][4] + coeff0_10*dmats0[10][4] + coeff0_11*dmats0[11][4] + coeff0_12*dmats0[12][4] + coeff0_13*dmats0[13][4] + coeff0_14*dmats0[14][4];
 
1101
          new_coeff0_5 = coeff0_0*dmats0[0][5] + coeff0_1*dmats0[1][5] + coeff0_2*dmats0[2][5] + coeff0_3*dmats0[3][5] + coeff0_4*dmats0[4][5] + coeff0_5*dmats0[5][5] + coeff0_6*dmats0[6][5] + coeff0_7*dmats0[7][5] + coeff0_8*dmats0[8][5] + coeff0_9*dmats0[9][5] + coeff0_10*dmats0[10][5] + coeff0_11*dmats0[11][5] + coeff0_12*dmats0[12][5] + coeff0_13*dmats0[13][5] + coeff0_14*dmats0[14][5];
 
1102
          new_coeff0_6 = coeff0_0*dmats0[0][6] + coeff0_1*dmats0[1][6] + coeff0_2*dmats0[2][6] + coeff0_3*dmats0[3][6] + coeff0_4*dmats0[4][6] + coeff0_5*dmats0[5][6] + coeff0_6*dmats0[6][6] + coeff0_7*dmats0[7][6] + coeff0_8*dmats0[8][6] + coeff0_9*dmats0[9][6] + coeff0_10*dmats0[10][6] + coeff0_11*dmats0[11][6] + coeff0_12*dmats0[12][6] + coeff0_13*dmats0[13][6] + coeff0_14*dmats0[14][6];
 
1103
          new_coeff0_7 = coeff0_0*dmats0[0][7] + coeff0_1*dmats0[1][7] + coeff0_2*dmats0[2][7] + coeff0_3*dmats0[3][7] + coeff0_4*dmats0[4][7] + coeff0_5*dmats0[5][7] + coeff0_6*dmats0[6][7] + coeff0_7*dmats0[7][7] + coeff0_8*dmats0[8][7] + coeff0_9*dmats0[9][7] + coeff0_10*dmats0[10][7] + coeff0_11*dmats0[11][7] + coeff0_12*dmats0[12][7] + coeff0_13*dmats0[13][7] + coeff0_14*dmats0[14][7];
 
1104
          new_coeff0_8 = coeff0_0*dmats0[0][8] + coeff0_1*dmats0[1][8] + coeff0_2*dmats0[2][8] + coeff0_3*dmats0[3][8] + coeff0_4*dmats0[4][8] + coeff0_5*dmats0[5][8] + coeff0_6*dmats0[6][8] + coeff0_7*dmats0[7][8] + coeff0_8*dmats0[8][8] + coeff0_9*dmats0[9][8] + coeff0_10*dmats0[10][8] + coeff0_11*dmats0[11][8] + coeff0_12*dmats0[12][8] + coeff0_13*dmats0[13][8] + coeff0_14*dmats0[14][8];
 
1105
          new_coeff0_9 = coeff0_0*dmats0[0][9] + coeff0_1*dmats0[1][9] + coeff0_2*dmats0[2][9] + coeff0_3*dmats0[3][9] + coeff0_4*dmats0[4][9] + coeff0_5*dmats0[5][9] + coeff0_6*dmats0[6][9] + coeff0_7*dmats0[7][9] + coeff0_8*dmats0[8][9] + coeff0_9*dmats0[9][9] + coeff0_10*dmats0[10][9] + coeff0_11*dmats0[11][9] + coeff0_12*dmats0[12][9] + coeff0_13*dmats0[13][9] + coeff0_14*dmats0[14][9];
 
1106
          new_coeff0_10 = coeff0_0*dmats0[0][10] + coeff0_1*dmats0[1][10] + coeff0_2*dmats0[2][10] + coeff0_3*dmats0[3][10] + coeff0_4*dmats0[4][10] + coeff0_5*dmats0[5][10] + coeff0_6*dmats0[6][10] + coeff0_7*dmats0[7][10] + coeff0_8*dmats0[8][10] + coeff0_9*dmats0[9][10] + coeff0_10*dmats0[10][10] + coeff0_11*dmats0[11][10] + coeff0_12*dmats0[12][10] + coeff0_13*dmats0[13][10] + coeff0_14*dmats0[14][10];
 
1107
          new_coeff0_11 = coeff0_0*dmats0[0][11] + coeff0_1*dmats0[1][11] + coeff0_2*dmats0[2][11] + coeff0_3*dmats0[3][11] + coeff0_4*dmats0[4][11] + coeff0_5*dmats0[5][11] + coeff0_6*dmats0[6][11] + coeff0_7*dmats0[7][11] + coeff0_8*dmats0[8][11] + coeff0_9*dmats0[9][11] + coeff0_10*dmats0[10][11] + coeff0_11*dmats0[11][11] + coeff0_12*dmats0[12][11] + coeff0_13*dmats0[13][11] + coeff0_14*dmats0[14][11];
 
1108
          new_coeff0_12 = coeff0_0*dmats0[0][12] + coeff0_1*dmats0[1][12] + coeff0_2*dmats0[2][12] + coeff0_3*dmats0[3][12] + coeff0_4*dmats0[4][12] + coeff0_5*dmats0[5][12] + coeff0_6*dmats0[6][12] + coeff0_7*dmats0[7][12] + coeff0_8*dmats0[8][12] + coeff0_9*dmats0[9][12] + coeff0_10*dmats0[10][12] + coeff0_11*dmats0[11][12] + coeff0_12*dmats0[12][12] + coeff0_13*dmats0[13][12] + coeff0_14*dmats0[14][12];
 
1109
          new_coeff0_13 = coeff0_0*dmats0[0][13] + coeff0_1*dmats0[1][13] + coeff0_2*dmats0[2][13] + coeff0_3*dmats0[3][13] + coeff0_4*dmats0[4][13] + coeff0_5*dmats0[5][13] + coeff0_6*dmats0[6][13] + coeff0_7*dmats0[7][13] + coeff0_8*dmats0[8][13] + coeff0_9*dmats0[9][13] + coeff0_10*dmats0[10][13] + coeff0_11*dmats0[11][13] + coeff0_12*dmats0[12][13] + coeff0_13*dmats0[13][13] + coeff0_14*dmats0[14][13];
 
1110
          new_coeff0_14 = coeff0_0*dmats0[0][14] + coeff0_1*dmats0[1][14] + coeff0_2*dmats0[2][14] + coeff0_3*dmats0[3][14] + coeff0_4*dmats0[4][14] + coeff0_5*dmats0[5][14] + coeff0_6*dmats0[6][14] + coeff0_7*dmats0[7][14] + coeff0_8*dmats0[8][14] + coeff0_9*dmats0[9][14] + coeff0_10*dmats0[10][14] + coeff0_11*dmats0[11][14] + coeff0_12*dmats0[12][14] + coeff0_13*dmats0[13][14] + coeff0_14*dmats0[14][14];
 
1111
        }
 
1112
        if(combinations[deriv_num][j] == 1)
 
1113
        {
 
1114
          new_coeff0_0 = coeff0_0*dmats1[0][0] + coeff0_1*dmats1[1][0] + coeff0_2*dmats1[2][0] + coeff0_3*dmats1[3][0] + coeff0_4*dmats1[4][0] + coeff0_5*dmats1[5][0] + coeff0_6*dmats1[6][0] + coeff0_7*dmats1[7][0] + coeff0_8*dmats1[8][0] + coeff0_9*dmats1[9][0] + coeff0_10*dmats1[10][0] + coeff0_11*dmats1[11][0] + coeff0_12*dmats1[12][0] + coeff0_13*dmats1[13][0] + coeff0_14*dmats1[14][0];
 
1115
          new_coeff0_1 = coeff0_0*dmats1[0][1] + coeff0_1*dmats1[1][1] + coeff0_2*dmats1[2][1] + coeff0_3*dmats1[3][1] + coeff0_4*dmats1[4][1] + coeff0_5*dmats1[5][1] + coeff0_6*dmats1[6][1] + coeff0_7*dmats1[7][1] + coeff0_8*dmats1[8][1] + coeff0_9*dmats1[9][1] + coeff0_10*dmats1[10][1] + coeff0_11*dmats1[11][1] + coeff0_12*dmats1[12][1] + coeff0_13*dmats1[13][1] + coeff0_14*dmats1[14][1];
 
1116
          new_coeff0_2 = coeff0_0*dmats1[0][2] + coeff0_1*dmats1[1][2] + coeff0_2*dmats1[2][2] + coeff0_3*dmats1[3][2] + coeff0_4*dmats1[4][2] + coeff0_5*dmats1[5][2] + coeff0_6*dmats1[6][2] + coeff0_7*dmats1[7][2] + coeff0_8*dmats1[8][2] + coeff0_9*dmats1[9][2] + coeff0_10*dmats1[10][2] + coeff0_11*dmats1[11][2] + coeff0_12*dmats1[12][2] + coeff0_13*dmats1[13][2] + coeff0_14*dmats1[14][2];
 
1117
          new_coeff0_3 = coeff0_0*dmats1[0][3] + coeff0_1*dmats1[1][3] + coeff0_2*dmats1[2][3] + coeff0_3*dmats1[3][3] + coeff0_4*dmats1[4][3] + coeff0_5*dmats1[5][3] + coeff0_6*dmats1[6][3] + coeff0_7*dmats1[7][3] + coeff0_8*dmats1[8][3] + coeff0_9*dmats1[9][3] + coeff0_10*dmats1[10][3] + coeff0_11*dmats1[11][3] + coeff0_12*dmats1[12][3] + coeff0_13*dmats1[13][3] + coeff0_14*dmats1[14][3];
 
1118
          new_coeff0_4 = coeff0_0*dmats1[0][4] + coeff0_1*dmats1[1][4] + coeff0_2*dmats1[2][4] + coeff0_3*dmats1[3][4] + coeff0_4*dmats1[4][4] + coeff0_5*dmats1[5][4] + coeff0_6*dmats1[6][4] + coeff0_7*dmats1[7][4] + coeff0_8*dmats1[8][4] + coeff0_9*dmats1[9][4] + coeff0_10*dmats1[10][4] + coeff0_11*dmats1[11][4] + coeff0_12*dmats1[12][4] + coeff0_13*dmats1[13][4] + coeff0_14*dmats1[14][4];
 
1119
          new_coeff0_5 = coeff0_0*dmats1[0][5] + coeff0_1*dmats1[1][5] + coeff0_2*dmats1[2][5] + coeff0_3*dmats1[3][5] + coeff0_4*dmats1[4][5] + coeff0_5*dmats1[5][5] + coeff0_6*dmats1[6][5] + coeff0_7*dmats1[7][5] + coeff0_8*dmats1[8][5] + coeff0_9*dmats1[9][5] + coeff0_10*dmats1[10][5] + coeff0_11*dmats1[11][5] + coeff0_12*dmats1[12][5] + coeff0_13*dmats1[13][5] + coeff0_14*dmats1[14][5];
 
1120
          new_coeff0_6 = coeff0_0*dmats1[0][6] + coeff0_1*dmats1[1][6] + coeff0_2*dmats1[2][6] + coeff0_3*dmats1[3][6] + coeff0_4*dmats1[4][6] + coeff0_5*dmats1[5][6] + coeff0_6*dmats1[6][6] + coeff0_7*dmats1[7][6] + coeff0_8*dmats1[8][6] + coeff0_9*dmats1[9][6] + coeff0_10*dmats1[10][6] + coeff0_11*dmats1[11][6] + coeff0_12*dmats1[12][6] + coeff0_13*dmats1[13][6] + coeff0_14*dmats1[14][6];
 
1121
          new_coeff0_7 = coeff0_0*dmats1[0][7] + coeff0_1*dmats1[1][7] + coeff0_2*dmats1[2][7] + coeff0_3*dmats1[3][7] + coeff0_4*dmats1[4][7] + coeff0_5*dmats1[5][7] + coeff0_6*dmats1[6][7] + coeff0_7*dmats1[7][7] + coeff0_8*dmats1[8][7] + coeff0_9*dmats1[9][7] + coeff0_10*dmats1[10][7] + coeff0_11*dmats1[11][7] + coeff0_12*dmats1[12][7] + coeff0_13*dmats1[13][7] + coeff0_14*dmats1[14][7];
 
1122
          new_coeff0_8 = coeff0_0*dmats1[0][8] + coeff0_1*dmats1[1][8] + coeff0_2*dmats1[2][8] + coeff0_3*dmats1[3][8] + coeff0_4*dmats1[4][8] + coeff0_5*dmats1[5][8] + coeff0_6*dmats1[6][8] + coeff0_7*dmats1[7][8] + coeff0_8*dmats1[8][8] + coeff0_9*dmats1[9][8] + coeff0_10*dmats1[10][8] + coeff0_11*dmats1[11][8] + coeff0_12*dmats1[12][8] + coeff0_13*dmats1[13][8] + coeff0_14*dmats1[14][8];
 
1123
          new_coeff0_9 = coeff0_0*dmats1[0][9] + coeff0_1*dmats1[1][9] + coeff0_2*dmats1[2][9] + coeff0_3*dmats1[3][9] + coeff0_4*dmats1[4][9] + coeff0_5*dmats1[5][9] + coeff0_6*dmats1[6][9] + coeff0_7*dmats1[7][9] + coeff0_8*dmats1[8][9] + coeff0_9*dmats1[9][9] + coeff0_10*dmats1[10][9] + coeff0_11*dmats1[11][9] + coeff0_12*dmats1[12][9] + coeff0_13*dmats1[13][9] + coeff0_14*dmats1[14][9];
 
1124
          new_coeff0_10 = coeff0_0*dmats1[0][10] + coeff0_1*dmats1[1][10] + coeff0_2*dmats1[2][10] + coeff0_3*dmats1[3][10] + coeff0_4*dmats1[4][10] + coeff0_5*dmats1[5][10] + coeff0_6*dmats1[6][10] + coeff0_7*dmats1[7][10] + coeff0_8*dmats1[8][10] + coeff0_9*dmats1[9][10] + coeff0_10*dmats1[10][10] + coeff0_11*dmats1[11][10] + coeff0_12*dmats1[12][10] + coeff0_13*dmats1[13][10] + coeff0_14*dmats1[14][10];
 
1125
          new_coeff0_11 = coeff0_0*dmats1[0][11] + coeff0_1*dmats1[1][11] + coeff0_2*dmats1[2][11] + coeff0_3*dmats1[3][11] + coeff0_4*dmats1[4][11] + coeff0_5*dmats1[5][11] + coeff0_6*dmats1[6][11] + coeff0_7*dmats1[7][11] + coeff0_8*dmats1[8][11] + coeff0_9*dmats1[9][11] + coeff0_10*dmats1[10][11] + coeff0_11*dmats1[11][11] + coeff0_12*dmats1[12][11] + coeff0_13*dmats1[13][11] + coeff0_14*dmats1[14][11];
 
1126
          new_coeff0_12 = coeff0_0*dmats1[0][12] + coeff0_1*dmats1[1][12] + coeff0_2*dmats1[2][12] + coeff0_3*dmats1[3][12] + coeff0_4*dmats1[4][12] + coeff0_5*dmats1[5][12] + coeff0_6*dmats1[6][12] + coeff0_7*dmats1[7][12] + coeff0_8*dmats1[8][12] + coeff0_9*dmats1[9][12] + coeff0_10*dmats1[10][12] + coeff0_11*dmats1[11][12] + coeff0_12*dmats1[12][12] + coeff0_13*dmats1[13][12] + coeff0_14*dmats1[14][12];
 
1127
          new_coeff0_13 = coeff0_0*dmats1[0][13] + coeff0_1*dmats1[1][13] + coeff0_2*dmats1[2][13] + coeff0_3*dmats1[3][13] + coeff0_4*dmats1[4][13] + coeff0_5*dmats1[5][13] + coeff0_6*dmats1[6][13] + coeff0_7*dmats1[7][13] + coeff0_8*dmats1[8][13] + coeff0_9*dmats1[9][13] + coeff0_10*dmats1[10][13] + coeff0_11*dmats1[11][13] + coeff0_12*dmats1[12][13] + coeff0_13*dmats1[13][13] + coeff0_14*dmats1[14][13];
 
1128
          new_coeff0_14 = coeff0_0*dmats1[0][14] + coeff0_1*dmats1[1][14] + coeff0_2*dmats1[2][14] + coeff0_3*dmats1[3][14] + coeff0_4*dmats1[4][14] + coeff0_5*dmats1[5][14] + coeff0_6*dmats1[6][14] + coeff0_7*dmats1[7][14] + coeff0_8*dmats1[8][14] + coeff0_9*dmats1[9][14] + coeff0_10*dmats1[10][14] + coeff0_11*dmats1[11][14] + coeff0_12*dmats1[12][14] + coeff0_13*dmats1[13][14] + coeff0_14*dmats1[14][14];
 
1129
        }
 
1130
    
 
1131
      }
 
1132
      // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
1133
      derivatives[deriv_num] = new_coeff0_0*basisvalue0 + new_coeff0_1*basisvalue1 + new_coeff0_2*basisvalue2 + new_coeff0_3*basisvalue3 + new_coeff0_4*basisvalue4 + new_coeff0_5*basisvalue5 + new_coeff0_6*basisvalue6 + new_coeff0_7*basisvalue7 + new_coeff0_8*basisvalue8 + new_coeff0_9*basisvalue9 + new_coeff0_10*basisvalue10 + new_coeff0_11*basisvalue11 + new_coeff0_12*basisvalue12 + new_coeff0_13*basisvalue13 + new_coeff0_14*basisvalue14;
 
1134
    }
 
1135
    
 
1136
    // Transform derivatives back to physical element
 
1137
    for (unsigned int row = 0; row < num_derivatives; row++)
 
1138
    {
 
1139
      for (unsigned int col = 0; col < num_derivatives; col++)
 
1140
      {
 
1141
        values[row] += transform[row][col]*derivatives[col];
 
1142
      }
 
1143
    }
 
1144
    // Delete pointer to array of derivatives on FIAT element
 
1145
    delete [] derivatives;
 
1146
    
 
1147
    // Delete pointer to array of combinations of derivatives and transform
 
1148
    for (unsigned int row = 0; row < num_derivatives; row++)
 
1149
    {
 
1150
      delete [] combinations[row];
 
1151
      delete [] transform[row];
 
1152
    }
 
1153
    
 
1154
    delete [] combinations;
 
1155
    delete [] transform;
 
1156
  }
 
1157
 
 
1158
  /// Evaluate order n derivatives of all basis functions at given point in cell
 
1159
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
1160
                                              double* values,
 
1161
                                              const double* coordinates,
 
1162
                                              const ufc::cell& c) const
 
1163
  {
 
1164
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
 
1165
  }
 
1166
 
 
1167
  /// Evaluate linear functional for dof i on the function f
 
1168
  virtual double evaluate_dof(unsigned int i,
 
1169
                              const ufc::function& f,
 
1170
                              const ufc::cell& c) const
 
1171
  {
 
1172
    // The reference points, direction and weights:
 
1173
    static const double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.75, 0.25}}, {{0.5, 0.5}}, {{0.25, 0.75}}, {{0, 0.25}}, {{0, 0.5}}, {{0, 0.75}}, {{0.25, 0}}, {{0.5, 0}}, {{0.75, 0}}, {{0.25, 0.25}}, {{0.5, 0.25}}, {{0.25, 0.5}}};
 
1174
    static const double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
 
1175
    static const double D[15][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
 
1176
    
 
1177
    const double * const * x = c.coordinates;
 
1178
    double result = 0.0;
 
1179
    // Iterate over the points:
 
1180
    // Evaluate basis functions for affine mapping
 
1181
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1];
 
1182
    const double w1 = X[i][0][0];
 
1183
    const double w2 = X[i][0][1];
 
1184
    
 
1185
    // Compute affine mapping y = F(X)
 
1186
    double y[2];
 
1187
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0];
 
1188
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1];
 
1189
    
 
1190
    // Evaluate function at physical points
 
1191
    double values[1];
 
1192
    f.evaluate(values, y, c);
 
1193
    
 
1194
    // Map function values using appropriate mapping
 
1195
    // Affine map: Do nothing
 
1196
    
 
1197
    // Note that we do not map the weights (yet).
 
1198
    
 
1199
    // Take directional components
 
1200
    for(int k = 0; k < 1; k++)
 
1201
      result += values[k]*D[i][0][k];
 
1202
    // Multiply by weights
 
1203
    result *= W[i][0];
 
1204
    
 
1205
    return result;
 
1206
  }
 
1207
 
 
1208
  /// Evaluate linear functionals for all dofs on the function f
 
1209
  virtual void evaluate_dofs(double* values,
 
1210
                             const ufc::function& f,
 
1211
                             const ufc::cell& c) const
 
1212
  {
 
1213
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
1214
  }
 
1215
 
 
1216
  /// Interpolate vertex values from dof values
 
1217
  virtual void interpolate_vertex_values(double* vertex_values,
 
1218
                                         const double* dof_values,
 
1219
                                         const ufc::cell& c) const
 
1220
  {
 
1221
    // Evaluate at vertices and use affine mapping
 
1222
    vertex_values[0] = dof_values[0];
 
1223
    vertex_values[1] = dof_values[1];
 
1224
    vertex_values[2] = dof_values[2];
 
1225
  }
 
1226
 
 
1227
  /// Return the number of sub elements (for a mixed element)
 
1228
  virtual unsigned int num_sub_elements() const
 
1229
  {
 
1230
    return 1;
 
1231
  }
 
1232
 
 
1233
  /// Create a new finite element for sub element i (for a mixed element)
 
1234
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
1235
  {
 
1236
    return new poisson2d_4_0_finite_element_1();
 
1237
  }
 
1238
 
 
1239
};
 
1240
 
 
1241
/// This class defines the interface for a local-to-global mapping of
 
1242
/// degrees of freedom (dofs).
 
1243
 
 
1244
class poisson2d_4_0_dof_map_0: public ufc::dof_map
 
1245
{
 
1246
private:
 
1247
 
 
1248
  unsigned int __global_dimension;
 
1249
 
 
1250
public:
 
1251
 
 
1252
  /// Constructor
 
1253
  poisson2d_4_0_dof_map_0() : ufc::dof_map()
 
1254
  {
 
1255
    __global_dimension = 0;
 
1256
  }
 
1257
 
 
1258
  /// Destructor
 
1259
  virtual ~poisson2d_4_0_dof_map_0()
 
1260
  {
 
1261
    // Do nothing
 
1262
  }
 
1263
 
 
1264
  /// Return a string identifying the dof map
 
1265
  virtual const char* signature() const
 
1266
  {
 
1267
    return "FFC dof map for FiniteElement('Lagrange', 'triangle', 4)";
 
1268
  }
 
1269
 
 
1270
  /// Return true iff mesh entities of topological dimension d are needed
 
1271
  virtual bool needs_mesh_entities(unsigned int d) const
 
1272
  {
 
1273
    switch ( d )
 
1274
    {
 
1275
    case 0:
 
1276
      return true;
 
1277
      break;
 
1278
    case 1:
 
1279
      return true;
 
1280
      break;
 
1281
    case 2:
 
1282
      return true;
 
1283
      break;
 
1284
    }
 
1285
    return false;
 
1286
  }
 
1287
 
 
1288
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
1289
  virtual bool init_mesh(const ufc::mesh& m)
 
1290
  {
 
1291
    __global_dimension = m.num_entities[0] + 3*m.num_entities[1] + 3*m.num_entities[2];
 
1292
    return false;
 
1293
  }
 
1294
 
 
1295
  /// Initialize dof map for given cell
 
1296
  virtual void init_cell(const ufc::mesh& m,
 
1297
                         const ufc::cell& c)
 
1298
  {
 
1299
    // Do nothing
 
1300
  }
 
1301
 
 
1302
  /// Finish initialization of dof map for cells
 
1303
  virtual void init_cell_finalize()
 
1304
  {
 
1305
    // Do nothing
 
1306
  }
 
1307
 
 
1308
  /// Return the dimension of the global finite element function space
 
1309
  virtual unsigned int global_dimension() const
 
1310
  {
 
1311
    return __global_dimension;
 
1312
  }
 
1313
 
 
1314
  /// Return the dimension of the local finite element function space for a cell
 
1315
  virtual unsigned int local_dimension(const ufc::cell& c) const
 
1316
  {
 
1317
    return 15;
 
1318
  }
 
1319
 
 
1320
  /// Return the maximum dimension of the local finite element function space
 
1321
  virtual unsigned int max_local_dimension() const
 
1322
  {
 
1323
    return 15;
 
1324
  }
 
1325
 
 
1326
  // Return the geometric dimension of the coordinates this dof map provides
 
1327
  virtual unsigned int geometric_dimension() const
 
1328
  {
 
1329
    return 2;
 
1330
  }
 
1331
 
 
1332
  /// Return the number of dofs on each cell facet
 
1333
  virtual unsigned int num_facet_dofs() const
 
1334
  {
 
1335
    return 5;
 
1336
  }
 
1337
 
 
1338
  /// Return the number of dofs associated with each cell entity of dimension d
 
1339
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
1340
  {
 
1341
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
1342
  }
 
1343
 
 
1344
  /// Tabulate the local-to-global mapping of dofs on a cell
 
1345
  virtual void tabulate_dofs(unsigned int* dofs,
 
1346
                             const ufc::mesh& m,
 
1347
                             const ufc::cell& c) const
 
1348
  {
 
1349
    dofs[0] = c.entity_indices[0][0];
 
1350
    dofs[1] = c.entity_indices[0][1];
 
1351
    dofs[2] = c.entity_indices[0][2];
 
1352
    unsigned int offset = m.num_entities[0];
 
1353
    dofs[3] = offset + 3*c.entity_indices[1][0];
 
1354
    dofs[4] = offset + 3*c.entity_indices[1][0] + 1;
 
1355
    dofs[5] = offset + 3*c.entity_indices[1][0] + 2;
 
1356
    dofs[6] = offset + 3*c.entity_indices[1][1];
 
1357
    dofs[7] = offset + 3*c.entity_indices[1][1] + 1;
 
1358
    dofs[8] = offset + 3*c.entity_indices[1][1] + 2;
 
1359
    dofs[9] = offset + 3*c.entity_indices[1][2];
 
1360
    dofs[10] = offset + 3*c.entity_indices[1][2] + 1;
 
1361
    dofs[11] = offset + 3*c.entity_indices[1][2] + 2;
 
1362
    offset = offset + 3*m.num_entities[1];
 
1363
    dofs[12] = offset + 3*c.entity_indices[2][0];
 
1364
    dofs[13] = offset + 3*c.entity_indices[2][0] + 1;
 
1365
    dofs[14] = offset + 3*c.entity_indices[2][0] + 2;
 
1366
  }
 
1367
 
 
1368
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
1369
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
1370
                                   unsigned int facet) const
 
1371
  {
 
1372
    switch ( facet )
 
1373
    {
 
1374
    case 0:
 
1375
      dofs[0] = 1;
 
1376
      dofs[1] = 2;
 
1377
      dofs[2] = 3;
 
1378
      dofs[3] = 4;
 
1379
      dofs[4] = 5;
 
1380
      break;
 
1381
    case 1:
 
1382
      dofs[0] = 0;
 
1383
      dofs[1] = 2;
 
1384
      dofs[2] = 6;
 
1385
      dofs[3] = 7;
 
1386
      dofs[4] = 8;
 
1387
      break;
 
1388
    case 2:
 
1389
      dofs[0] = 0;
 
1390
      dofs[1] = 1;
 
1391
      dofs[2] = 9;
 
1392
      dofs[3] = 10;
 
1393
      dofs[4] = 11;
 
1394
      break;
 
1395
    }
 
1396
  }
 
1397
 
 
1398
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
1399
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
1400
                                    unsigned int d, unsigned int i) const
 
1401
  {
 
1402
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
1403
  }
 
1404
 
 
1405
  /// Tabulate the coordinates of all dofs on a cell
 
1406
  virtual void tabulate_coordinates(double** coordinates,
 
1407
                                    const ufc::cell& c) const
 
1408
  {
 
1409
    const double * const * x = c.coordinates;
 
1410
    coordinates[0][0] = x[0][0];
 
1411
    coordinates[0][1] = x[0][1];
 
1412
    coordinates[1][0] = x[1][0];
 
1413
    coordinates[1][1] = x[1][1];
 
1414
    coordinates[2][0] = x[2][0];
 
1415
    coordinates[2][1] = x[2][1];
 
1416
    coordinates[3][0] = 0.75*x[1][0] + 0.25*x[2][0];
 
1417
    coordinates[3][1] = 0.75*x[1][1] + 0.25*x[2][1];
 
1418
    coordinates[4][0] = 0.5*x[1][0] + 0.5*x[2][0];
 
1419
    coordinates[4][1] = 0.5*x[1][1] + 0.5*x[2][1];
 
1420
    coordinates[5][0] = 0.25*x[1][0] + 0.75*x[2][0];
 
1421
    coordinates[5][1] = 0.25*x[1][1] + 0.75*x[2][1];
 
1422
    coordinates[6][0] = 0.75*x[0][0] + 0.25*x[2][0];
 
1423
    coordinates[6][1] = 0.75*x[0][1] + 0.25*x[2][1];
 
1424
    coordinates[7][0] = 0.5*x[0][0] + 0.5*x[2][0];
 
1425
    coordinates[7][1] = 0.5*x[0][1] + 0.5*x[2][1];
 
1426
    coordinates[8][0] = 0.25*x[0][0] + 0.75*x[2][0];
 
1427
    coordinates[8][1] = 0.25*x[0][1] + 0.75*x[2][1];
 
1428
    coordinates[9][0] = 0.75*x[0][0] + 0.25*x[1][0];
 
1429
    coordinates[9][1] = 0.75*x[0][1] + 0.25*x[1][1];
 
1430
    coordinates[10][0] = 0.5*x[0][0] + 0.5*x[1][0];
 
1431
    coordinates[10][1] = 0.5*x[0][1] + 0.5*x[1][1];
 
1432
    coordinates[11][0] = 0.25*x[0][0] + 0.75*x[1][0];
 
1433
    coordinates[11][1] = 0.25*x[0][1] + 0.75*x[1][1];
 
1434
    coordinates[12][0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
 
1435
    coordinates[12][1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
 
1436
    coordinates[13][0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
 
1437
    coordinates[13][1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
 
1438
    coordinates[14][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
 
1439
    coordinates[14][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
1440
  }
 
1441
 
 
1442
  /// Return the number of sub dof maps (for a mixed element)
 
1443
  virtual unsigned int num_sub_dof_maps() const
 
1444
  {
 
1445
    return 1;
 
1446
  }
 
1447
 
 
1448
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
1449
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
1450
  {
 
1451
    return new poisson2d_4_0_dof_map_0();
 
1452
  }
 
1453
 
 
1454
};
 
1455
 
 
1456
/// This class defines the interface for a local-to-global mapping of
 
1457
/// degrees of freedom (dofs).
 
1458
 
 
1459
class poisson2d_4_0_dof_map_1: public ufc::dof_map
 
1460
{
 
1461
private:
 
1462
 
 
1463
  unsigned int __global_dimension;
 
1464
 
 
1465
public:
 
1466
 
 
1467
  /// Constructor
 
1468
  poisson2d_4_0_dof_map_1() : ufc::dof_map()
 
1469
  {
 
1470
    __global_dimension = 0;
 
1471
  }
 
1472
 
 
1473
  /// Destructor
 
1474
  virtual ~poisson2d_4_0_dof_map_1()
 
1475
  {
 
1476
    // Do nothing
 
1477
  }
 
1478
 
 
1479
  /// Return a string identifying the dof map
 
1480
  virtual const char* signature() const
 
1481
  {
 
1482
    return "FFC dof map for FiniteElement('Lagrange', 'triangle', 4)";
 
1483
  }
 
1484
 
 
1485
  /// Return true iff mesh entities of topological dimension d are needed
 
1486
  virtual bool needs_mesh_entities(unsigned int d) const
 
1487
  {
 
1488
    switch ( d )
 
1489
    {
 
1490
    case 0:
 
1491
      return true;
 
1492
      break;
 
1493
    case 1:
 
1494
      return true;
 
1495
      break;
 
1496
    case 2:
 
1497
      return true;
 
1498
      break;
 
1499
    }
 
1500
    return false;
 
1501
  }
 
1502
 
 
1503
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
1504
  virtual bool init_mesh(const ufc::mesh& m)
 
1505
  {
 
1506
    __global_dimension = m.num_entities[0] + 3*m.num_entities[1] + 3*m.num_entities[2];
 
1507
    return false;
 
1508
  }
 
1509
 
 
1510
  /// Initialize dof map for given cell
 
1511
  virtual void init_cell(const ufc::mesh& m,
 
1512
                         const ufc::cell& c)
 
1513
  {
 
1514
    // Do nothing
 
1515
  }
 
1516
 
 
1517
  /// Finish initialization of dof map for cells
 
1518
  virtual void init_cell_finalize()
 
1519
  {
 
1520
    // Do nothing
 
1521
  }
 
1522
 
 
1523
  /// Return the dimension of the global finite element function space
 
1524
  virtual unsigned int global_dimension() const
 
1525
  {
 
1526
    return __global_dimension;
 
1527
  }
 
1528
 
 
1529
  /// Return the dimension of the local finite element function space for a cell
 
1530
  virtual unsigned int local_dimension(const ufc::cell& c) const
 
1531
  {
 
1532
    return 15;
 
1533
  }
 
1534
 
 
1535
  /// Return the maximum dimension of the local finite element function space
 
1536
  virtual unsigned int max_local_dimension() const
 
1537
  {
 
1538
    return 15;
 
1539
  }
 
1540
 
 
1541
  // Return the geometric dimension of the coordinates this dof map provides
 
1542
  virtual unsigned int geometric_dimension() const
 
1543
  {
 
1544
    return 2;
 
1545
  }
 
1546
 
 
1547
  /// Return the number of dofs on each cell facet
 
1548
  virtual unsigned int num_facet_dofs() const
 
1549
  {
 
1550
    return 5;
 
1551
  }
 
1552
 
 
1553
  /// Return the number of dofs associated with each cell entity of dimension d
 
1554
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
1555
  {
 
1556
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
1557
  }
 
1558
 
 
1559
  /// Tabulate the local-to-global mapping of dofs on a cell
 
1560
  virtual void tabulate_dofs(unsigned int* dofs,
 
1561
                             const ufc::mesh& m,
 
1562
                             const ufc::cell& c) const
 
1563
  {
 
1564
    dofs[0] = c.entity_indices[0][0];
 
1565
    dofs[1] = c.entity_indices[0][1];
 
1566
    dofs[2] = c.entity_indices[0][2];
 
1567
    unsigned int offset = m.num_entities[0];
 
1568
    dofs[3] = offset + 3*c.entity_indices[1][0];
 
1569
    dofs[4] = offset + 3*c.entity_indices[1][0] + 1;
 
1570
    dofs[5] = offset + 3*c.entity_indices[1][0] + 2;
 
1571
    dofs[6] = offset + 3*c.entity_indices[1][1];
 
1572
    dofs[7] = offset + 3*c.entity_indices[1][1] + 1;
 
1573
    dofs[8] = offset + 3*c.entity_indices[1][1] + 2;
 
1574
    dofs[9] = offset + 3*c.entity_indices[1][2];
 
1575
    dofs[10] = offset + 3*c.entity_indices[1][2] + 1;
 
1576
    dofs[11] = offset + 3*c.entity_indices[1][2] + 2;
 
1577
    offset = offset + 3*m.num_entities[1];
 
1578
    dofs[12] = offset + 3*c.entity_indices[2][0];
 
1579
    dofs[13] = offset + 3*c.entity_indices[2][0] + 1;
 
1580
    dofs[14] = offset + 3*c.entity_indices[2][0] + 2;
 
1581
  }
 
1582
 
 
1583
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
1584
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
1585
                                   unsigned int facet) const
 
1586
  {
 
1587
    switch ( facet )
 
1588
    {
 
1589
    case 0:
 
1590
      dofs[0] = 1;
 
1591
      dofs[1] = 2;
 
1592
      dofs[2] = 3;
 
1593
      dofs[3] = 4;
 
1594
      dofs[4] = 5;
 
1595
      break;
 
1596
    case 1:
 
1597
      dofs[0] = 0;
 
1598
      dofs[1] = 2;
 
1599
      dofs[2] = 6;
 
1600
      dofs[3] = 7;
 
1601
      dofs[4] = 8;
 
1602
      break;
 
1603
    case 2:
 
1604
      dofs[0] = 0;
 
1605
      dofs[1] = 1;
 
1606
      dofs[2] = 9;
 
1607
      dofs[3] = 10;
 
1608
      dofs[4] = 11;
 
1609
      break;
 
1610
    }
 
1611
  }
 
1612
 
 
1613
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
1614
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
1615
                                    unsigned int d, unsigned int i) const
 
1616
  {
 
1617
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
1618
  }
 
1619
 
 
1620
  /// Tabulate the coordinates of all dofs on a cell
 
1621
  virtual void tabulate_coordinates(double** coordinates,
 
1622
                                    const ufc::cell& c) const
 
1623
  {
 
1624
    const double * const * x = c.coordinates;
 
1625
    coordinates[0][0] = x[0][0];
 
1626
    coordinates[0][1] = x[0][1];
 
1627
    coordinates[1][0] = x[1][0];
 
1628
    coordinates[1][1] = x[1][1];
 
1629
    coordinates[2][0] = x[2][0];
 
1630
    coordinates[2][1] = x[2][1];
 
1631
    coordinates[3][0] = 0.75*x[1][0] + 0.25*x[2][0];
 
1632
    coordinates[3][1] = 0.75*x[1][1] + 0.25*x[2][1];
 
1633
    coordinates[4][0] = 0.5*x[1][0] + 0.5*x[2][0];
 
1634
    coordinates[4][1] = 0.5*x[1][1] + 0.5*x[2][1];
 
1635
    coordinates[5][0] = 0.25*x[1][0] + 0.75*x[2][0];
 
1636
    coordinates[5][1] = 0.25*x[1][1] + 0.75*x[2][1];
 
1637
    coordinates[6][0] = 0.75*x[0][0] + 0.25*x[2][0];
 
1638
    coordinates[6][1] = 0.75*x[0][1] + 0.25*x[2][1];
 
1639
    coordinates[7][0] = 0.5*x[0][0] + 0.5*x[2][0];
 
1640
    coordinates[7][1] = 0.5*x[0][1] + 0.5*x[2][1];
 
1641
    coordinates[8][0] = 0.25*x[0][0] + 0.75*x[2][0];
 
1642
    coordinates[8][1] = 0.25*x[0][1] + 0.75*x[2][1];
 
1643
    coordinates[9][0] = 0.75*x[0][0] + 0.25*x[1][0];
 
1644
    coordinates[9][1] = 0.75*x[0][1] + 0.25*x[1][1];
 
1645
    coordinates[10][0] = 0.5*x[0][0] + 0.5*x[1][0];
 
1646
    coordinates[10][1] = 0.5*x[0][1] + 0.5*x[1][1];
 
1647
    coordinates[11][0] = 0.25*x[0][0] + 0.75*x[1][0];
 
1648
    coordinates[11][1] = 0.25*x[0][1] + 0.75*x[1][1];
 
1649
    coordinates[12][0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
 
1650
    coordinates[12][1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
 
1651
    coordinates[13][0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
 
1652
    coordinates[13][1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
 
1653
    coordinates[14][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
 
1654
    coordinates[14][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
1655
  }
 
1656
 
 
1657
  /// Return the number of sub dof maps (for a mixed element)
 
1658
  virtual unsigned int num_sub_dof_maps() const
 
1659
  {
 
1660
    return 1;
 
1661
  }
 
1662
 
 
1663
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
1664
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
1665
  {
 
1666
    return new poisson2d_4_0_dof_map_1();
1655
1667
  }
1656
1668
 
1657
1669
};
1660
1672
/// tensor corresponding to the local contribution to a form from
1661
1673
/// the integral over a cell.
1662
1674
 
1663
 
class UFC_Poisson2D_4BilinearForm_cell_integral_0: public ufc::cell_integral
 
1675
class poisson2d_4_0_cell_integral_0_quadrature: public ufc::cell_integral
1664
1676
{
1665
1677
public:
1666
1678
 
1667
1679
  /// Constructor
1668
 
  UFC_Poisson2D_4BilinearForm_cell_integral_0() : ufc::cell_integral()
 
1680
  poisson2d_4_0_cell_integral_0_quadrature() : ufc::cell_integral()
1669
1681
  {
1670
1682
    // Do nothing
1671
1683
  }
1672
1684
 
1673
1685
  /// Destructor
1674
 
  virtual ~UFC_Poisson2D_4BilinearForm_cell_integral_0()
 
1686
  virtual ~poisson2d_4_0_cell_integral_0_quadrature()
1675
1687
  {
1676
1688
    // Do nothing
1677
1689
  }
1689
1701
    const double J_01 = x[2][0] - x[0][0];
1690
1702
    const double J_10 = x[1][1] - x[0][1];
1691
1703
    const double J_11 = x[2][1] - x[0][1];
1692
 
      
 
1704
    
1693
1705
    // Compute determinant of Jacobian
1694
1706
    double detJ = J_00*J_11 - J_01*J_10;
1695
 
      
 
1707
    
1696
1708
    // Compute inverse of Jacobian
1697
1709
    const double Jinv_00 =  J_11 / detJ;
1698
1710
    const double Jinv_01 = -J_01 / detJ;
1702
1714
    // Set scale factor
1703
1715
    const double det = std::abs(detJ);
1704
1716
    
1705
 
    // Number of operations to compute element tensor = 1215
1706
 
    // Compute geometry tensors
1707
 
    // Number of operations to compute decalrations = 16
1708
 
    const double G0_0_0 = det*(Jinv_00*Jinv_00 + Jinv_01*Jinv_01);
1709
 
    const double G0_0_1 = det*(Jinv_00*Jinv_10 + Jinv_01*Jinv_11);
1710
 
    const double G0_1_0 = det*(Jinv_10*Jinv_00 + Jinv_11*Jinv_01);
1711
 
    const double G0_1_1 = det*(Jinv_10*Jinv_10 + Jinv_11*Jinv_11);
1712
 
    
1713
 
    // Compute element tensor
1714
 
    // Number of operations to compute tensor = 1199
1715
 
    A[0] = 0.373015873015873*G0_0_0 + 0.373015873015873*G0_0_1 + 0.373015873015873*G0_1_0 + 0.373015873015873*G0_1_1;
1716
 
    A[1] = 0.0566137566137565*G0_0_0 + 0.0566137566137567*G0_1_0;
1717
 
    A[2] = 0.0566137566137567*G0_0_1 + 0.0566137566137567*G0_1_1;
1718
 
    A[3] = 0.0423280423280419*G0_0_0 + 0.042328042328042*G0_0_1 + 0.0423280423280421*G0_1_0 + 0.0423280423280425*G0_1_1;
1719
 
    A[4] = 0.0423280423280418*G0_0_0 + 0.0423280423280422*G0_0_1 + 0.0423280423280417*G0_1_0 + 0.0423280423280418*G0_1_1;
1720
 
    A[5] = 0.0423280423280426*G0_0_0 + 0.0423280423280422*G0_0_1 + 0.0423280423280427*G0_1_0 + 0.0423280423280424*G0_1_1;
1721
 
    A[6] = 0.126984126984127*G0_0_0 - 0.651851851851851*G0_0_1 + 0.126984126984126*G0_1_0 - 0.651851851851851*G0_1_1;
1722
 
    A[7] = 0.042328042328042*G0_0_0 + 0.467724867724868*G0_0_1 + 0.0423280423280422*G0_1_0 + 0.467724867724868*G0_1_1;
1723
 
    A[8] = -0.0423280423280426*G0_0_0 - 0.245502645502646*G0_0_1 - 0.0423280423280427*G0_1_0 - 0.245502645502646*G0_1_1;
1724
 
    A[9] = -0.651851851851851*G0_0_0 + 0.126984126984127*G0_0_1 - 0.651851851851851*G0_1_0 + 0.126984126984127*G0_1_1;
1725
 
    A[10] = 0.467724867724868*G0_0_0 + 0.0423280423280421*G0_0_1 + 0.467724867724867*G0_1_0 + 0.0423280423280423*G0_1_1;
1726
 
    A[11] = -0.245502645502645*G0_0_0 - 0.042328042328042*G0_0_1 - 0.245502645502646*G0_1_0 - 0.0423280423280425*G0_1_1;
1727
 
    A[12] = -0.0846560846560853*G0_0_0 - 0.0846560846560857*G0_0_1 - 0.0846560846560846*G0_1_0 - 0.0846560846560853*G0_1_1;
1728
 
    A[13] = -0.0846560846560834*G0_0_0 - 0.0846560846560842*G0_0_1 - 0.0846560846560839*G0_1_0 - 0.0846560846560841*G0_1_1;
1729
 
    A[14] = -0.0846560846560838*G0_0_0 - 0.0846560846560836*G0_0_1 - 0.0846560846560839*G0_1_0 - 0.0846560846560838*G0_1_1;
1730
 
    A[15] = 0.0566137566137565*G0_0_0 + 0.0566137566137567*G0_0_1;
1731
 
    A[16] = 0.373015873015872*G0_0_0;
1732
 
    A[17] = -0.0566137566137565*G0_0_1;
1733
 
    A[18] = 0.126984126984126*G0_0_0 + 0.778835978835977*G0_0_1;
1734
 
    A[19] = 0.0423280423280417*G0_0_0 - 0.425396825396826*G0_0_1;
1735
 
    A[20] = -0.0423280423280422*G0_0_0 + 0.203174603174603*G0_0_1;
1736
 
    A[21] = 0.0423280423280422*G0_0_0;
1737
 
    A[22] = 0.0423280423280423*G0_0_0;
1738
 
    A[23] = 0.0423280423280422*G0_0_0;
1739
 
    A[24] = -0.245502645502645*G0_0_0 - 0.203174603174603*G0_0_1;
1740
 
    A[25] = 0.467724867724867*G0_0_0 + 0.425396825396824*G0_0_1;
1741
 
    A[26] = -0.651851851851851*G0_0_0 - 0.778835978835977*G0_0_1;
1742
 
    A[27] = -0.0846560846560842*G0_0_0;
1743
 
    A[28] = -0.0846560846560839*G0_0_0;
1744
 
    A[29] = -0.084656084656084*G0_0_0;
1745
 
    A[30] = 0.0566137566137567*G0_1_0 + 0.0566137566137567*G0_1_1;
1746
 
    A[31] = -0.0566137566137565*G0_1_0;
1747
 
    A[32] = 0.373015873015873*G0_1_1;
1748
 
    A[33] = 0.203174603174602*G0_1_0 - 0.0423280423280427*G0_1_1;
1749
 
    A[34] = -0.425396825396825*G0_1_0 + 0.0423280423280415*G0_1_1;
1750
 
    A[35] = 0.77883597883598*G0_1_0 + 0.126984126984127*G0_1_1;
1751
 
    A[36] = -0.203174603174603*G0_1_0 - 0.245502645502646*G0_1_1;
1752
 
    A[37] = 0.425396825396826*G0_1_0 + 0.467724867724869*G0_1_1;
1753
 
    A[38] = -0.77883597883598*G0_1_0 - 0.651851851851853*G0_1_1;
1754
 
    A[39] = 0.0423280423280426*G0_1_1;
1755
 
    A[40] = 0.0423280423280424*G0_1_1;
1756
 
    A[41] = 0.0423280423280427*G0_1_1;
1757
 
    A[42] = -0.084656084656085*G0_1_1;
1758
 
    A[43] = -0.0846560846560841*G0_1_1;
1759
 
    A[44] = -0.0846560846560844*G0_1_1;
1760
 
    A[45] = 0.0423280423280419*G0_0_0 + 0.0423280423280421*G0_0_1 + 0.042328042328042*G0_1_0 + 0.0423280423280425*G0_1_1;
1761
 
    A[46] = 0.126984126984126*G0_0_0 + 0.778835978835977*G0_1_0;
1762
 
    A[47] = 0.203174603174602*G0_0_1 - 0.0423280423280428*G0_1_1;
1763
 
    A[48] = 1.82857142857142*G0_0_0 + 1.04973544973545*G0_0_1 + 1.04973544973545*G0_1_0 + 2.09947089947089*G0_1_1;
1764
 
    A[49] = -0.660317460317461*G0_0_0 + 0.821164021164019*G0_0_1 - 0.296296296296297*G0_1_0 - 0.761904761904764*G0_1_1;
1765
 
    A[50] = 0.338624338624336*G0_0_0 - 0.440211640211642*G0_0_1 + 0.1015873015873*G0_1_0 + 0.338624338624337*G0_1_1;
1766
 
    A[51] = -0.203174603174601*G0_0_0 - 0.101587301587301*G0_0_1 - 0.101587301587301*G0_1_0;
1767
 
    A[52] = -0.152380952380953*G0_0_0 - 0.0423280423280444*G0_0_1 - 0.042328042328043*G0_1_0;
1768
 
    A[53] = -0.338624338624336*G0_0_0 - 0.1015873015873*G0_0_1 - 0.1015873015873*G0_1_0;
1769
 
    A[54] = -0.135449735449734*G0_0_0 - 0.237037037037035*G0_0_1 - 0.237037037037036*G0_1_0 - 0.338624338624337*G0_1_1;
1770
 
    A[55] = 0.1015873015873*G0_0_0 + 0.465608465608463*G0_0_1 + 0.465608465608464*G0_1_0 + 0.761904761904759*G0_1_1;
1771
 
    A[56] = -0.135449735449734*G0_0_0 - 1.04973544973545*G0_0_1 - 1.04973544973545*G0_1_0 - 2.09947089947089*G0_1_1;
1772
 
    A[57] = 0.81269841269841*G0_0_0 + 0.338624338624337*G0_0_1 + 0.338624338624338*G0_1_0;
1773
 
    A[58] = -2.43809523809523*G0_0_0 - 1.28677248677248*G0_0_1 - 1.28677248677248*G0_1_0;
1774
 
    A[59] = 0.812698412698414*G0_0_0 + 0.338624338624341*G0_0_1 + 0.33862433862434*G0_1_0;
1775
 
    A[60] = 0.0423280423280418*G0_0_0 + 0.0423280423280417*G0_0_1 + 0.0423280423280422*G0_1_0 + 0.0423280423280418*G0_1_1;
1776
 
    A[61] = 0.0423280423280417*G0_0_0 - 0.425396825396826*G0_1_0;
1777
 
    A[62] = -0.425396825396825*G0_0_1 + 0.0423280423280415*G0_1_1;
1778
 
    A[63] = -0.660317460317461*G0_0_0 - 0.296296296296297*G0_0_1 + 0.821164021164019*G0_1_0 - 0.761904761904764*G0_1_1;
1779
 
    A[64] = 2.45079365079365*G0_0_0 + 0.971428571428573*G0_0_1 + 0.971428571428573*G0_1_0 + 2.45079365079365*G0_1_1;
1780
 
    A[65] = -0.761904761904761*G0_0_0 + 0.821164021164022*G0_0_1 - 0.296296296296298*G0_1_0 - 0.660317460317461*G0_1_1;
1781
 
    A[66] = -0.152380952380952*G0_0_0 - 0.110052910052909*G0_0_1 - 0.110052910052908*G0_1_0 - 0.0677248677248663*G0_1_1;
1782
 
    A[67] = 0.393650793650792*G0_0_0 + 0.196825396825395*G0_0_1 + 0.196825396825396*G0_1_0 + 0.0507936507936483*G0_1_1;
1783
 
    A[68] = 0.761904761904761*G0_0_0 + 0.296296296296298*G0_0_1 + 0.296296296296298*G0_1_0 - 0.0677248677248656*G0_1_1;
1784
 
    A[69] = -0.0677248677248673*G0_0_0 - 0.110052910052911*G0_0_1 - 0.110052910052909*G0_1_0 - 0.152380952380951*G0_1_1;
1785
 
    A[70] = 0.0507936507936505*G0_0_0 + 0.196825396825397*G0_0_1 + 0.196825396825396*G0_1_0 + 0.393650793650793*G0_1_1;
1786
 
    A[71] = -0.0677248677248669*G0_0_0 + 0.296296296296297*G0_0_1 + 0.296296296296297*G0_1_0 + 0.761904761904763*G0_1_1;
1787
 
    A[72] = 0.406349206349205*G0_0_0 + 0.457142857142857*G0_0_1 + 0.457142857142853*G0_1_0 + 0.406349206349204*G0_1_1;
1788
 
    A[73] = 0.406349206349208*G0_0_0 - 1.16825396825397*G0_0_1 - 1.16825396825396*G0_1_0 - 2.84444444444444*G0_1_1;
1789
 
    A[74] = -2.84444444444444*G0_0_0 - 1.16825396825397*G0_0_1 - 1.16825396825397*G0_1_0 + 0.406349206349207*G0_1_1;
1790
 
    A[75] = 0.0423280423280426*G0_0_0 + 0.0423280423280427*G0_0_1 + 0.0423280423280422*G0_1_0 + 0.0423280423280424*G0_1_1;
1791
 
    A[76] = -0.0423280423280422*G0_0_0 + 0.203174603174603*G0_1_0;
1792
 
    A[77] = 0.77883597883598*G0_0_1 + 0.126984126984127*G0_1_1;
1793
 
    A[78] = 0.338624338624336*G0_0_0 + 0.1015873015873*G0_0_1 - 0.440211640211642*G0_1_0 + 0.338624338624337*G0_1_1;
1794
 
    A[79] = -0.761904761904761*G0_0_0 - 0.296296296296298*G0_0_1 + 0.821164021164022*G0_1_0 - 0.660317460317461*G0_1_1;
1795
 
    A[80] = 2.0994708994709*G0_0_0 + 1.04973544973545*G0_0_1 + 1.04973544973545*G0_1_0 + 1.82857142857143*G0_1_1;
1796
 
    A[81] = -0.338624338624338*G0_0_0 - 0.237037037037038*G0_0_1 - 0.237037037037036*G0_1_0 - 0.135449735449736*G0_1_1;
1797
 
    A[82] = 0.761904761904765*G0_0_0 + 0.465608465608468*G0_0_1 + 0.465608465608466*G0_1_0 + 0.101587301587303*G0_1_1;
1798
 
    A[83] = -2.0994708994709*G0_0_0 - 1.04973544973545*G0_0_1 - 1.04973544973545*G0_1_0 - 0.135449735449736*G0_1_1;
1799
 
    A[84] = -0.101587301587301*G0_0_1 - 0.101587301587301*G0_1_0 - 0.203174603174603*G0_1_1;
1800
 
    A[85] = -0.0423280423280421*G0_0_1 - 0.0423280423280423*G0_1_0 - 0.152380952380952*G0_1_1;
1801
 
    A[86] = -0.1015873015873*G0_0_1 - 0.101587301587301*G0_1_0 - 0.338624338624337*G0_1_1;
1802
 
    A[87] = 0.338624338624338*G0_0_1 + 0.338624338624338*G0_1_0 + 0.812698412698412*G0_1_1;
1803
 
    A[88] = 0.33862433862434*G0_0_1 + 0.338624338624341*G0_1_0 + 0.812698412698414*G0_1_1;
1804
 
    A[89] = -1.28677248677249*G0_0_1 - 1.28677248677249*G0_1_0 - 2.43809523809524*G0_1_1;
1805
 
    A[90] = 0.126984126984127*G0_0_0 + 0.126984126984126*G0_0_1 - 0.651851851851851*G0_1_0 - 0.651851851851851*G0_1_1;
1806
 
    A[91] = 0.0423280423280422*G0_0_0;
1807
 
    A[92] = -0.203174603174603*G0_0_1 - 0.245502645502646*G0_1_1;
1808
 
    A[93] = -0.203174603174601*G0_0_0 - 0.101587301587301*G0_0_1 - 0.101587301587301*G0_1_0;
1809
 
    A[94] = -0.152380952380952*G0_0_0 - 0.110052910052908*G0_0_1 - 0.110052910052909*G0_1_0 - 0.0677248677248664*G0_1_1;
1810
 
    A[95] = -0.338624338624338*G0_0_0 - 0.237037037037036*G0_0_1 - 0.237037037037038*G0_1_0 - 0.135449735449736*G0_1_1;
1811
 
    A[96] = 1.82857142857143*G0_0_0 + 0.778835978835979*G0_0_1 + 0.778835978835979*G0_1_0 + 1.82857142857143*G0_1_1;
1812
 
    A[97] = -0.66031746031746*G0_0_0 - 1.48148148148148*G0_0_1 - 0.364021164021164*G0_1_0 - 1.94708994708995*G0_1_1;
1813
 
    A[98] = 0.338624338624339*G0_0_0 + 0.778835978835979*G0_0_1 + 0.237037037037038*G0_1_0 + 1.01587301587302*G0_1_1;
1814
 
    A[99] = -0.135449735449736*G0_0_0 + 0.914285714285712*G0_0_1 + 0.914285714285713*G0_1_0 - 0.135449735449737*G0_1_1;
1815
 
    A[100] = 0.101587301587301*G0_0_0 - 0.364021164021164*G0_0_1 - 0.364021164021164*G0_1_0 - 0.0677248677248687*G0_1_1;
1816
 
    A[101] = -0.135449735449735*G0_0_0 + 0.101587301587301*G0_0_1 + 0.101587301587303*G0_1_0;
1817
 
    A[102] = -2.43809523809524*G0_0_0 - 1.15132275132275*G0_0_1 - 1.15132275132275*G0_1_0 + 0.135449735449738*G0_1_1;
1818
 
    A[103] = 0.812698412698411*G0_0_0 + 0.474074074074072*G0_0_1 + 0.474074074074073*G0_1_0 + 0.135449735449735*G0_1_1;
1819
 
    A[104] = 0.812698412698411*G0_0_0 + 0.474074074074073*G0_0_1 + 0.474074074074072*G0_1_0 + 0.135449735449733*G0_1_1;
1820
 
    A[105] = 0.0423280423280419*G0_0_0 + 0.0423280423280422*G0_0_1 + 0.467724867724868*G0_1_0 + 0.467724867724868*G0_1_1;
1821
 
    A[106] = 0.0423280423280423*G0_0_0;
1822
 
    A[107] = 0.425396825396826*G0_0_1 + 0.467724867724868*G0_1_1;
1823
 
    A[108] = -0.152380952380953*G0_0_0 - 0.042328042328043*G0_0_1 - 0.0423280423280444*G0_1_0;
1824
 
    A[109] = 0.393650793650792*G0_0_0 + 0.196825396825396*G0_0_1 + 0.196825396825395*G0_1_0 + 0.0507936507936483*G0_1_1;
1825
 
    A[110] = 0.761904761904765*G0_0_0 + 0.465608465608466*G0_0_1 + 0.465608465608468*G0_1_0 + 0.101587301587303*G0_1_1;
1826
 
    A[111] = -0.66031746031746*G0_0_0 - 0.364021164021164*G0_0_1 - 1.48148148148148*G0_1_0 - 1.94708994708995*G0_1_1;
1827
 
    A[112] = 2.45079365079365*G0_0_0 + 1.47936507936508*G0_0_1 + 1.47936507936508*G0_1_0 + 2.95873015873016*G0_1_1;
1828
 
    A[113] = -0.761904761904765*G0_0_0 - 1.58306878306878*G0_0_1 - 0.465608465608468*G0_1_0 - 1.94708994708995*G0_1_1;
1829
 
    A[114] = -0.0677248677248675*G0_0_0 - 0.364021164021165*G0_0_1 - 0.364021164021164*G0_1_0 + 0.101587301587303*G0_1_1;
1830
 
    A[115] = 0.0507936507936522*G0_0_0 - 0.146031746031745*G0_0_1 - 0.146031746031745*G0_1_0 + 0.050793650793652*G0_1_1;
1831
 
    A[116] = -0.0677248677248685*G0_0_0 + 0.0423280423280425*G0_0_1 + 0.0423280423280409*G0_1_0;
1832
 
    A[117] = 0.406349206349204*G0_0_0 + 1.57460317460317*G0_0_1 + 1.57460317460317*G0_1_0 - 0.101587301587305*G0_1_1;
1833
 
    A[118] = 0.40634920634921*G0_0_0 - 0.0507936507936507*G0_0_1 - 0.0507936507936484*G0_1_0 - 0.101587301587301*G0_1_1;
1834
 
    A[119] = -2.84444444444444*G0_0_0 - 1.67619047619047*G0_0_1 - 1.67619047619047*G0_1_0 - 0.101587301587299*G0_1_1;
1835
 
    A[120] = -0.0423280423280426*G0_0_0 - 0.0423280423280427*G0_0_1 - 0.245502645502646*G0_1_0 - 0.245502645502646*G0_1_1;
1836
 
    A[121] = 0.0423280423280422*G0_0_0;
1837
 
    A[122] = -0.77883597883598*G0_0_1 - 0.651851851851853*G0_1_1;
1838
 
    A[123] = -0.338624338624336*G0_0_0 - 0.1015873015873*G0_0_1 - 0.1015873015873*G0_1_0;
1839
 
    A[124] = 0.761904761904761*G0_0_0 + 0.296296296296298*G0_0_1 + 0.296296296296298*G0_1_0 - 0.0677248677248656*G0_1_1;
1840
 
    A[125] = -2.0994708994709*G0_0_0 - 1.04973544973545*G0_0_1 - 1.04973544973545*G0_1_0 - 0.135449735449736*G0_1_1;
1841
 
    A[126] = 0.338624338624339*G0_0_0 + 0.237037037037038*G0_0_1 + 0.778835978835979*G0_1_0 + 1.01587301587302*G0_1_1;
1842
 
    A[127] = -0.761904761904765*G0_0_0 - 0.465608465608468*G0_0_1 - 1.58306878306878*G0_1_0 - 1.94708994708995*G0_1_1;
1843
 
    A[128] = 2.0994708994709*G0_0_0 + 1.04973544973545*G0_0_1 + 1.04973544973545*G0_1_0 + 1.82857142857143*G0_1_1;
1844
 
    A[129] = 0.101587301587301*G0_0_1 + 0.101587301587302*G0_1_0 - 0.135449735449736*G0_1_1;
1845
 
    A[130] = 0.0423280423280421*G0_0_1 + 0.0423280423280413*G0_1_0 - 0.0677248677248682*G0_1_1;
1846
 
    A[131] = 0.1015873015873*G0_0_1 + 0.101587301587302*G0_1_0;
1847
 
    A[132] = -0.338624338624337*G0_0_1 - 0.338624338624338*G0_1_0 + 0.135449735449737*G0_1_1;
1848
 
    A[133] = -0.33862433862434*G0_0_1 - 0.338624338624341*G0_1_0 + 0.135449735449734*G0_1_1;
1849
 
    A[134] = 1.28677248677249*G0_0_1 + 1.28677248677248*G0_1_0 + 0.135449735449734*G0_1_1;
1850
 
    A[135] = -0.651851851851851*G0_0_0 - 0.651851851851851*G0_0_1 + 0.126984126984127*G0_1_0 + 0.126984126984127*G0_1_1;
1851
 
    A[136] = -0.245502645502645*G0_0_0 - 0.203174603174603*G0_1_0;
1852
 
    A[137] = 0.0423280423280426*G0_1_1;
1853
 
    A[138] = -0.135449735449734*G0_0_0 - 0.237037037037036*G0_0_1 - 0.237037037037035*G0_1_0 - 0.338624338624337*G0_1_1;
1854
 
    A[139] = -0.0677248677248673*G0_0_0 - 0.110052910052909*G0_0_1 - 0.110052910052911*G0_1_0 - 0.152380952380951*G0_1_1;
1855
 
    A[140] = -0.101587301587301*G0_0_1 - 0.101587301587301*G0_1_0 - 0.203174603174603*G0_1_1;
1856
 
    A[141] = -0.135449735449736*G0_0_0 + 0.914285714285713*G0_0_1 + 0.914285714285712*G0_1_0 - 0.135449735449737*G0_1_1;
1857
 
    A[142] = -0.0677248677248675*G0_0_0 - 0.364021164021164*G0_0_1 - 0.364021164021165*G0_1_0 + 0.101587301587303*G0_1_1;
1858
 
    A[143] = 0.101587301587302*G0_0_1 + 0.101587301587301*G0_1_0 - 0.135449735449736*G0_1_1;
1859
 
    A[144] = 1.82857142857143*G0_0_0 + 0.778835978835977*G0_0_1 + 0.778835978835977*G0_1_0 + 1.82857142857143*G0_1_1;
1860
 
    A[145] = -1.94708994708995*G0_0_0 - 0.364021164021164*G0_0_1 - 1.48148148148148*G0_1_0 - 0.66031746031746*G0_1_1;
1861
 
    A[146] = 1.01587301587301*G0_0_0 + 0.237037037037036*G0_0_1 + 0.778835978835978*G0_1_0 + 0.338624338624338*G0_1_1;
1862
 
    A[147] = 0.135449735449736*G0_0_0 - 1.15132275132275*G0_0_1 - 1.15132275132275*G0_1_0 - 2.43809523809524*G0_1_1;
1863
 
    A[148] = 0.135449735449734*G0_0_0 + 0.474074074074073*G0_0_1 + 0.474074074074072*G0_1_0 + 0.81269841269841*G0_1_1;
1864
 
    A[149] = 0.135449735449735*G0_0_0 + 0.474074074074073*G0_0_1 + 0.474074074074075*G0_1_0 + 0.812698412698414*G0_1_1;
1865
 
    A[150] = 0.467724867724868*G0_0_0 + 0.467724867724867*G0_0_1 + 0.0423280423280421*G0_1_0 + 0.0423280423280423*G0_1_1;
1866
 
    A[151] = 0.467724867724867*G0_0_0 + 0.425396825396824*G0_1_0;
1867
 
    A[152] = 0.0423280423280424*G0_1_1;
1868
 
    A[153] = 0.1015873015873*G0_0_0 + 0.465608465608464*G0_0_1 + 0.465608465608463*G0_1_0 + 0.761904761904759*G0_1_1;
1869
 
    A[154] = 0.0507936507936505*G0_0_0 + 0.196825396825396*G0_0_1 + 0.196825396825397*G0_1_0 + 0.393650793650793*G0_1_1;
1870
 
    A[155] = -0.0423280423280423*G0_0_1 - 0.0423280423280421*G0_1_0 - 0.152380952380952*G0_1_1;
1871
 
    A[156] = 0.101587301587301*G0_0_0 - 0.364021164021164*G0_0_1 - 0.364021164021164*G0_1_0 - 0.0677248677248687*G0_1_1;
1872
 
    A[157] = 0.0507936507936522*G0_0_0 - 0.146031746031745*G0_0_1 - 0.146031746031745*G0_1_0 + 0.050793650793652*G0_1_1;
1873
 
    A[158] = 0.0423280423280413*G0_0_1 + 0.0423280423280421*G0_1_0 - 0.0677248677248683*G0_1_1;
1874
 
    A[159] = -1.94708994708995*G0_0_0 - 1.48148148148148*G0_0_1 - 0.364021164021164*G0_1_0 - 0.66031746031746*G0_1_1;
1875
 
    A[160] = 2.95873015873015*G0_0_0 + 1.47936507936508*G0_0_1 + 1.47936507936508*G0_1_0 + 2.45079365079365*G0_1_1;
1876
 
    A[161] = -1.94708994708994*G0_0_0 - 0.465608465608464*G0_0_1 - 1.58306878306878*G0_1_0 - 0.76190476190476*G0_1_1;
1877
 
    A[162] = -0.101587301587303*G0_0_0 + 1.57460317460317*G0_0_1 + 1.57460317460317*G0_1_0 + 0.406349206349207*G0_1_1;
1878
 
    A[163] = -0.101587301587299*G0_0_0 - 1.67619047619047*G0_0_1 - 1.67619047619047*G0_1_0 - 2.84444444444444*G0_1_1;
1879
 
    A[164] = -0.101587301587303*G0_0_0 - 0.050793650793652*G0_0_1 - 0.050793650793653*G0_1_0 + 0.406349206349204*G0_1_1;
1880
 
    A[165] = -0.245502645502645*G0_0_0 - 0.245502645502645*G0_0_1 - 0.042328042328042*G0_1_0 - 0.0423280423280425*G0_1_1;
1881
 
    A[166] = -0.651851851851851*G0_0_0 - 0.778835978835977*G0_1_0;
1882
 
    A[167] = 0.0423280423280427*G0_1_1;
1883
 
    A[168] = -0.135449735449734*G0_0_0 - 1.04973544973545*G0_0_1 - 1.04973544973545*G0_1_0 - 2.09947089947089*G0_1_1;
1884
 
    A[169] = -0.0677248677248669*G0_0_0 + 0.296296296296297*G0_0_1 + 0.296296296296297*G0_1_0 + 0.761904761904763*G0_1_1;
1885
 
    A[170] = -0.101587301587302*G0_0_1 - 0.1015873015873*G0_1_0 - 0.338624338624337*G0_1_1;
1886
 
    A[171] = -0.135449735449735*G0_0_0 + 0.101587301587303*G0_0_1 + 0.101587301587301*G0_1_0;
1887
 
    A[172] = -0.0677248677248685*G0_0_0 + 0.0423280423280408*G0_0_1 + 0.0423280423280425*G0_1_0;
1888
 
    A[173] = 0.101587301587302*G0_0_1 + 0.1015873015873*G0_1_0;
1889
 
    A[174] = 1.01587301587301*G0_0_0 + 0.778835978835978*G0_0_1 + 0.237037037037036*G0_1_0 + 0.338624338624338*G0_1_1;
1890
 
    A[175] = -1.94708994708994*G0_0_0 - 1.58306878306878*G0_0_1 - 0.465608465608464*G0_1_0 - 0.76190476190476*G0_1_1;
1891
 
    A[176] = 1.82857142857143*G0_0_0 + 1.04973544973545*G0_0_1 + 1.04973544973545*G0_1_0 + 2.09947089947089*G0_1_1;
1892
 
    A[177] = 0.135449735449735*G0_0_0 - 0.338624338624339*G0_0_1 - 0.33862433862434*G0_1_0;
1893
 
    A[178] = 0.135449735449733*G0_0_0 + 1.28677248677248*G0_0_1 + 1.28677248677248*G0_1_0;
1894
 
    A[179] = 0.135449735449735*G0_0_0 - 0.338624338624338*G0_0_1 - 0.33862433862434*G0_1_0;
1895
 
    A[180] = -0.0846560846560853*G0_0_0 - 0.0846560846560846*G0_0_1 - 0.0846560846560857*G0_1_0 - 0.0846560846560853*G0_1_1;
1896
 
    A[181] = -0.0846560846560842*G0_0_0;
1897
 
    A[182] = -0.084656084656085*G0_1_1;
1898
 
    A[183] = 0.81269841269841*G0_0_0 + 0.338624338624338*G0_0_1 + 0.338624338624337*G0_1_0;
1899
 
    A[184] = 0.406349206349205*G0_0_0 + 0.457142857142853*G0_0_1 + 0.457142857142857*G0_1_0 + 0.406349206349204*G0_1_1;
1900
 
    A[185] = 0.338624338624338*G0_0_1 + 0.338624338624338*G0_1_0 + 0.812698412698412*G0_1_1;
1901
 
    A[186] = -2.43809523809524*G0_0_0 - 1.15132275132275*G0_0_1 - 1.15132275132275*G0_1_0 + 0.135449735449739*G0_1_1;
1902
 
    A[187] = 0.406349206349204*G0_0_0 + 1.57460317460317*G0_0_1 + 1.57460317460317*G0_1_0 - 0.101587301587305*G0_1_1;
1903
 
    A[188] = -0.338624338624337*G0_0_1 - 0.338624338624337*G0_1_0 + 0.135449735449737*G0_1_1;
1904
 
    A[189] = 0.135449735449736*G0_0_0 - 1.15132275132275*G0_0_1 - 1.15132275132275*G0_1_0 - 2.43809523809524*G0_1_1;
1905
 
    A[190] = -0.101587301587303*G0_0_0 + 1.57460317460317*G0_0_1 + 1.57460317460317*G0_1_0 + 0.406349206349207*G0_1_1;
1906
 
    A[191] = 0.135449735449735*G0_0_0 - 0.33862433862434*G0_0_1 - 0.338624338624338*G0_1_0;
1907
 
    A[192] = 5.68888888888889*G0_0_0 + 2.84444444444444*G0_0_1 + 2.84444444444444*G0_1_0 + 5.68888888888888*G0_1_1;
1908
 
    A[193] = -4.06349206349206*G0_0_0 - 2.03174603174602*G0_0_1 - 2.03174603174603*G0_1_0 - 0.812698412698408*G0_1_1;
1909
 
    A[194] = -0.81269841269841*G0_0_0 - 2.03174603174603*G0_0_1 - 2.03174603174603*G0_1_0 - 4.06349206349206*G0_1_1;
1910
 
    A[195] = -0.0846560846560834*G0_0_0 - 0.0846560846560839*G0_0_1 - 0.0846560846560842*G0_1_0 - 0.0846560846560841*G0_1_1;
1911
 
    A[196] = -0.0846560846560839*G0_0_0;
1912
 
    A[197] = -0.0846560846560841*G0_1_1;
1913
 
    A[198] = -2.43809523809523*G0_0_0 - 1.28677248677248*G0_0_1 - 1.28677248677248*G0_1_0;
1914
 
    A[199] = 0.406349206349208*G0_0_0 - 1.16825396825396*G0_0_1 - 1.16825396825397*G0_1_0 - 2.84444444444444*G0_1_1;
1915
 
    A[200] = 0.338624338624341*G0_0_1 + 0.33862433862434*G0_1_0 + 0.812698412698414*G0_1_1;
1916
 
    A[201] = 0.812698412698411*G0_0_0 + 0.474074074074073*G0_0_1 + 0.474074074074072*G0_1_0 + 0.135449735449735*G0_1_1;
1917
 
    A[202] = 0.40634920634921*G0_0_0 - 0.0507936507936484*G0_0_1 - 0.0507936507936507*G0_1_0 - 0.101587301587301*G0_1_1;
1918
 
    A[203] = -0.338624338624341*G0_0_1 - 0.33862433862434*G0_1_0 + 0.135449735449734*G0_1_1;
1919
 
    A[204] = 0.135449735449734*G0_0_0 + 0.474074074074073*G0_0_1 + 0.474074074074073*G0_1_0 + 0.81269841269841*G0_1_1;
1920
 
    A[205] = -0.101587301587299*G0_0_0 - 1.67619047619047*G0_0_1 - 1.67619047619047*G0_1_0 - 2.84444444444444*G0_1_1;
1921
 
    A[206] = 0.135449735449733*G0_0_0 + 1.28677248677248*G0_0_1 + 1.28677248677248*G0_1_0;
1922
 
    A[207] = -4.06349206349206*G0_0_0 - 2.03174603174603*G0_0_1 - 2.03174603174602*G0_1_0 - 0.812698412698408*G0_1_1;
1923
 
    A[208] = 5.68888888888888*G0_0_0 + 2.84444444444443*G0_0_1 + 2.84444444444443*G0_1_0 + 5.68888888888888*G0_1_1;
1924
 
    A[209] = -0.812698412698415*G0_0_0 + 1.21904761904762*G0_0_1 + 1.21904761904762*G0_1_0 - 0.812698412698413*G0_1_1;
1925
 
    A[210] = -0.0846560846560838*G0_0_0 - 0.0846560846560839*G0_0_1 - 0.0846560846560836*G0_1_0 - 0.0846560846560839*G0_1_1;
1926
 
    A[211] = -0.084656084656084*G0_0_0;
1927
 
    A[212] = -0.0846560846560844*G0_1_1;
1928
 
    A[213] = 0.812698412698414*G0_0_0 + 0.33862433862434*G0_0_1 + 0.338624338624341*G0_1_0;
1929
 
    A[214] = -2.84444444444444*G0_0_0 - 1.16825396825397*G0_0_1 - 1.16825396825397*G0_1_0 + 0.406349206349207*G0_1_1;
1930
 
    A[215] = -1.28677248677249*G0_0_1 - 1.28677248677249*G0_1_0 - 2.43809523809524*G0_1_1;
1931
 
    A[216] = 0.812698412698412*G0_0_0 + 0.474074074074072*G0_0_1 + 0.474074074074073*G0_1_0 + 0.135449735449733*G0_1_1;
1932
 
    A[217] = -2.84444444444444*G0_0_0 - 1.67619047619047*G0_0_1 - 1.67619047619047*G0_1_0 - 0.101587301587299*G0_1_1;
1933
 
    A[218] = 1.28677248677248*G0_0_1 + 1.28677248677249*G0_1_0 + 0.135449735449734*G0_1_1;
1934
 
    A[219] = 0.135449735449735*G0_0_0 + 0.474074074074075*G0_0_1 + 0.474074074074073*G0_1_0 + 0.812698412698414*G0_1_1;
1935
 
    A[220] = -0.101587301587303*G0_0_0 - 0.050793650793653*G0_0_1 - 0.0507936507936519*G0_1_0 + 0.406349206349204*G0_1_1;
1936
 
    A[221] = 0.135449735449735*G0_0_0 - 0.33862433862434*G0_0_1 - 0.338624338624338*G0_1_0;
1937
 
    A[222] = -0.81269841269841*G0_0_0 - 2.03174603174603*G0_0_1 - 2.03174603174603*G0_1_0 - 4.06349206349206*G0_1_1;
1938
 
    A[223] = -0.812698412698415*G0_0_0 + 1.21904761904762*G0_0_1 + 1.21904761904762*G0_1_0 - 0.812698412698413*G0_1_1;
1939
 
    A[224] = 5.68888888888888*G0_0_0 + 2.84444444444444*G0_0_1 + 2.84444444444444*G0_1_0 + 5.68888888888888*G0_1_1;
 
1717
    
 
1718
    // Array of quadrature weights
 
1719
    static const double W16[16] = {0.0235683681933823, 0.0353880678980859, 0.0225840492823699, 0.00542322591052525, 0.0441850885223617, 0.0663442161070497, 0.0423397245217463, 0.0101672595644788, 0.0441850885223617, 0.0663442161070497, 0.0423397245217463, 0.0101672595644788, 0.0235683681933823, 0.0353880678980859, 0.0225840492823699, 0.00542322591052525};
 
1720
    // Quadrature points on the UFC reference element: (0.0654669945550145, 0.0571041961145177), (0.0502101232113698, 0.276843013638124), (0.028912084224389, 0.583590432368917), (0.00970378512694614, 0.860240135656219), (0.311164552244357, 0.0571041961145177), (0.238648659731443, 0.276843013638124), (0.137419104134574, 0.583590432368917), (0.0461220799064521, 0.860240135656219), (0.631731251641125, 0.0571041961145177), (0.484508326630433, 0.276843013638124), (0.278990463496509, 0.583590432368917), (0.0936377844373285, 0.860240135656219), (0.877428809330468, 0.0571041961145177), (0.672946863150506, 0.276843013638124), (0.387497483406694, 0.583590432368917), (0.130056079216834, 0.860240135656219)
 
1721
    
 
1722
    // Value of basis functions at quadrature points.
 
1723
    static const double FE0_D10[16][14] = \
 
1724
    {{-3.73667068880549, -0.233570224452107, 0.0966228344496925, 0.0839379928612574, 0.208152237272669, -2.725166300732, 1.06087981875107, -0.208152237272669, 5.7411745777295, -3.03160282431785, 1.26066915984596, 3.30386135811979, -0.675317891837485, -1.14481781161233},
 
1725
    {-0.135353153966957, -0.379194714537729, 0.676211395491377, -0.0711406170260814, -0.070756125405991, -5.6006702651324, -0.521210618546692, 0.0707561254059909, 1.08445997810359, -2.02112474134269, 1.45121263174378, 8.13593533436945, -3.21147646472843, 0.592351235572775},
 
1726
    {0.041574995010714, -0.615048549486149, 2.09506411754925, -2.39442088791299, 0.69433176786841, 0.144004003002008, -6.54119149343768, -0.694331767868411, -0.248615170559767, -0.4405304167576, 1.2626191417928, 2.84614570829717, -5.08521382884843, 8.93561238135068},
 
1727
    {-0.189449171833465, -0.862158677217329, 4.06407032884026, -7.74721285981905, 8.06865751447747, 0.709860712496761, -0.339738142939493, -8.06865751447747, 0.254233229252954, 0.231724238201308, 0.565650381596533, -1.72847015697951, -3.04546088435752, 8.08695100275855},
 
1728
    {0.133791234088097, 0.201686066324276, -0.124932877353596, -0.262480933735918, 0.208152237272669, -0.912829598508756, 0.714460892153895, -0.208152237272669, -3.61866862252097, 4.51195409827869, -1.22876277617009, -0.54236775812999, 1.58013023399234, -0.451979958417977},
 
1729
    {0.308996527150274, 0.346344400331789, -0.733682016231346, 0.108103343990413, -0.0707561254059901, -1.21051966595309, -0.341966657530195, 0.0707561254059909, -1.11861274426953, 1.77751077492138, -1.31423895813391, -2.0542592757119, 3.99846095789633, 0.233863313539781},
 
1730
    {-0.282271801510132, 0.219768719105237, -0.609464514172854, 0.309472446238023, 0.694331767868412, 1.49346012094672, -3.83729815928666, -0.694331767868411, 0.275399448600713, 0.317798003075364, -0.530694369271183, -2.55729515931436, 1.67329955254049, 3.52782571304864},
 
1731
    {0.012481334080739, -0.421464492679139, 2.28291193021773, -5.30012227701789, 8.06865751447747, -0.398139408627657, 2.10735243986167, -8.06865751447747, 0.232508180390023, 0.110077002722749, 0.0663979754856287, -1.2936283133532, -0.591144208236882, 3.19276983715622},
 
1732
    {-0.201686066324276, -0.133791234088098, 0.912829598508756, -0.714460892153898, 0.208152237272668, 0.124932877353594, 0.262480933735918, -0.208152237272668, 1.22876277617009, -4.51195409827869, 3.61866862252097, -1.58013023399234, 0.542367758129988, 0.45197995841798},
 
1733
    {-0.346344400331788, -0.308996527150274, 1.21051966595309, 0.341966657530195, -0.0707561254059904, 0.733682016231345, -0.108103343990414, 0.070756125405991, 1.31423895813391, -1.77751077492138, 1.11861274426953, -3.99846095789633, 2.0542592757119, -0.233863313539782},
 
1734
    {-0.219768719105237, 0.282271801510133, -1.49346012094673, 3.83729815928666, 0.694331767868412, 0.609464514172855, -0.309472446238024, -0.694331767868411, 0.530694369271182, -0.317798003075363, -0.275399448600714, -1.67329955254049, 2.55729515931436, -3.52782571304864},
 
1735
    {0.421464492679139, -0.0124813340807378, 0.398139408627655, -2.10735243986167, 8.06865751447747, -2.28291193021773, 5.30012227701789, -8.06865751447747, -0.0663979754856275, -0.11007700272275, -0.232508180390023, 0.591144208236879, 1.2936283133532, -3.19276983715622},
 
1736
    {0.233570224452106, 3.73667068880549, 2.72516630073201, -1.06087981875107, 0.208152237272667, -0.0966228344496893, -0.0839379928612628, -0.208152237272667, -1.26066915984595, 3.03160282431784, -5.74117457772949, 0.67531789183748, -3.3038613581198, 1.14481781161233},
 
1737
    {0.379194714537727, 0.135353153966954, 5.6006702651324, 0.521210618546692, -0.0707561254059913, -0.676211395491377, 0.071140617026085, 0.0707561254059904, -1.45121263174378, 2.02112474134268, -1.08445997810358, 3.21147646472842, -8.13593533436944, -0.592351235572774},
 
1738
    {0.615048549486149, -0.0415749950107143, -0.144004003002004, 6.54119149343768, 0.694331767868411, -2.09506411754924, 2.39442088791299, -0.69433176786841, -1.2626191417928, 0.440530416757599, 0.248615170559768, 5.08521382884843, -2.84614570829718, -8.93561238135068},
 
1739
    {0.862158677217331, 0.189449171833467, -0.709860712496765, 0.339738142939498, 8.06865751447747, -4.06407032884026, 7.74721285981906, -8.06865751447747, -0.565650381596532, -0.23172423820131, -0.254233229252955, 3.04546088435751, 1.72847015697951, -8.08695100275856}};
 
1740
    
 
1741
    // Array of non-zero columns
 
1742
    static const unsigned int nzc0[14] = {0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
 
1743
    static const double FE0_D01[16][14] = \
 
1744
    {{-3.73667068880549, -0.311049493080666, 0.223979331051484, 0.104990345117053, 0.137222657043637, 6.14026988141177, -3.72353966515002, 1.63098996562441, -3.12426160441429, 1.16351461867751, -0.223979331051485, 3.89316339902554, -1.26850496379456, -0.906124451654887},
 
1745
    {-0.135353153966956, 0.286839134679351, 0.192514372389235, -0.194970789566951, -0.129262778980058, -3.50043481058447, 5.01065174007844, -1.66170291020636, -1.01577547644434, 0.703579506158883, -0.192514372389235, -0.120631271757254, -0.508608716591932, 1.26566952718165},
 
1746
    {0.0415749950107143, -0.308068880728994, 0.128479868913391, -0.375214285885598, 0.334729745719716, -0.111745376126849, -3.41368229886305, 3.79192156070818, 0.00713420856908987, 0.214772918995342, -0.128479868913391, -0.9366668220304, 0.160441366890255, 0.594802867741595},
 
1747
    {-0.189449171833465, 3.25735599136756, 0.0487792767304792, -0.219445802063653, 0.436666840246956, 0.956086484833186, -1.80781257328652, -2.21618073108076, 0.00800745691652764, 0.00150907887808005, -0.0487792767304799, -0.0301805673092532, 0.217936723185569, -0.414493729854223},
 
1748
    {0.133791234088097, -0.311049493080666, -0.153342364114824, -0.165402786473896, 0.652219136176816, 0.442570807553649, -1.38130603505231, 1.11599348649123, -4.97406902858338, -1.23446157521331, 0.153342364114824, 7.29981484256821, 1.3998643616872, -2.97796495016165},
 
1749
    {0.308996527150275, 0.286839134679351, 0.0302078341708127, -0.0526515215640018, -0.614385844601296, -1.28562081113318, 1.86636499388868, -1.17657984458513, -1.04351159908944, 0.124659409468332, -0.030207834170812, -2.60973956167772, -0.07200788790433, 4.26763700536846},
 
1750
    {-0.282271801510132, -0.308068880728994, 0.239334576747594, -0.908127385775843, 1.59097010879606, 1.41719178937472, -3.36253230476743, 2.53568119763184, 0.351667780172715, 0.304940851746765, -0.239334576747594, -3.01920386250499, 0.603186534029078, 1.07656597353622},
 
1751
    {0.0124813340807392, 3.25735599136756, 0.182098701605662, -0.884949023586175, 2.07547700561113, -0.144284842667495, 0.729438413664127, -3.85499089644493, -0.0213463855701417, -0.0377481596742723, -0.182098701605662, 0.232110875241371, 0.922697183260444, -2.28624149528235},
 
1752
    {-0.201686066324276, -0.311049493080666, 1.35540040606241, -2.09576692720621, 1.3241457237639, -0.0284094867612302, 0.0970781472620227, 0.444066898904147, 1.38210514028491, -5.746415673492, -1.3554004060624, -0.180265872305134, 7.8421826006982, -2.52598499174367},
 
1753
    {-0.346344400331788, 0.286839134679351, -0.0751011451800893, 2.20833165141887, -1.24733596999112, 0.763889850402157, -0.160754865554415, -0.543629719195305, 1.2840311239631, -1.65285136545305, 0.0751011451800901, -4.07046884580066, -0.555480285965825, 4.03377369182868},
 
1754
    {-0.219768719105237, -0.308068880728994, -0.0762683315720011, 0.474765854519231, 3.23001296550025, 0.848799090920448, -1.21759983201387, 0.896638340927649, 0.291359792523589, -0.0128571513285981, 0.0762683315720014, -1.07011301851141, -0.461908703190633, -2.45125973951242},
 
1755
    {0.42146449267914, 3.25735599136756, 0.253854565960165, -1.37791402619755, 4.21366661803254, -2.10081322861207, 4.41517325343172, -5.99318050886635, -0.24849667709129, -0.147825162397021, -0.253854565960166, 1.51384139149732, 1.52573918859457, -5.47901133243857},
 
1756
    {0.233570224452107, -0.311049493080666, 8.86543618214378, -4.78441948390109, 1.83914220289707, 0.12735649660179, 0.0210523522557947, -0.0709295802290293, -1.48464849089743, 4.19511744299535, -8.86543618214378, -0.593187071957086, 0.589302040905749, 0.238693359957449},
 
1757
    {0.379194714537727, 0.286839134679351, 2.10023545454793, 5.53186235862513, -1.73245903561236, -0.483697023102141, -0.123830172540868, -0.0585066535740681, -1.64372700413302, 2.72470424750157, -2.10023545454793, 2.70286774813649, -8.25656660612669, 0.673318291608878},
 
1758
    {0.61504854948615, -0.308068880728994, -0.255749379128854, 3.12750919457463, 4.48625332857659, -1.96658424863586, 2.0192066020274, -0.359602022148696, -1.39109901070619, 0.655303335752943, 0.255749379128853, 5.24565519573868, -3.78281253032757, -8.34080951360909},
 
1759
    {0.862158677217331, 3.25735599136756, 0.246225772336429, -1.46807443034703, 5.85247678339672, -4.01529105210978, 7.52776705775541, -7.63199067423052, -0.614429658327012, -0.230215159323226, -0.246225772336429, 3.26339760754308, 1.69828958967026, -8.50144473261278}};
 
1760
    
 
1761
    // Array of non-zero columns
 
1762
    static const unsigned int nzc1[14] = {0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
 
1763
    
 
1764
    // Number of operations to compute geometry constants: 12
 
1765
    const double G0 = det*(Jinv_10*Jinv_10 + Jinv_11*Jinv_11);
 
1766
    const double G1 = det*(Jinv_00*Jinv_10 + Jinv_01*Jinv_11);
 
1767
    const double G2 = det*(Jinv_00*Jinv_00 + Jinv_01*Jinv_01);
 
1768
    
 
1769
    // Compute element tensor using UFL quadrature representation
 
1770
    // Optimisations: ('simplify expressions', True), ('ignore zero tables', True), ('non zero columns', True), ('remove zero terms', True), ('ignore ones', True)
 
1771
    // Total number of operations to compute element tensor: 37692
 
1772
    
 
1773
    // Loop quadrature points for integral
 
1774
    // Number of operations to compute element tensor for following IP loop = 37680
 
1775
    for (unsigned int ip = 0; ip < 16; ip++)
 
1776
    {
 
1777
      
 
1778
      // Number of operations to compute ip constants: 3
 
1779
      // Number of operations: 1
 
1780
      const double Gip0 = G0*W16[ip];
 
1781
      
 
1782
      // Number of operations: 1
 
1783
      const double Gip1 = G1*W16[ip];
 
1784
      
 
1785
      // Number of operations: 1
 
1786
      const double Gip2 = G2*W16[ip];
 
1787
      
 
1788
      
 
1789
      // Number of operations for primary indices = 2352
 
1790
      for (unsigned int j = 0; j < 14; j++)
 
1791
      {
 
1792
        for (unsigned int k = 0; k < 14; k++)
 
1793
        {
 
1794
          // Number of operations to compute entry = 3
 
1795
          A[nzc1[j]*15 + nzc1[k]] += FE0_D01[ip][j]*FE0_D01[ip][k]*Gip0;
 
1796
          // Number of operations to compute entry = 3
 
1797
          A[nzc0[j]*15 + nzc1[k]] += FE0_D01[ip][k]*FE0_D10[ip][j]*Gip1;
 
1798
          // Number of operations to compute entry = 3
 
1799
          A[nzc0[j]*15 + nzc0[k]] += FE0_D10[ip][j]*FE0_D10[ip][k]*Gip2;
 
1800
          // Number of operations to compute entry = 3
 
1801
          A[nzc1[j]*15 + nzc0[k]] += FE0_D01[ip][j]*FE0_D10[ip][k]*Gip1;
 
1802
        }// end loop over 'k'
 
1803
      }// end loop over 'j'
 
1804
    }// end loop over 'ip'
 
1805
  }
 
1806
 
 
1807
};
 
1808
 
 
1809
/// This class defines the interface for the tabulation of the cell
 
1810
/// tensor corresponding to the local contribution to a form from
 
1811
/// the integral over a cell.
 
1812
 
 
1813
class poisson2d_4_0_cell_integral_0: public ufc::cell_integral
 
1814
{
 
1815
private:
 
1816
 
 
1817
  poisson2d_4_0_cell_integral_0_quadrature integral_0_quadrature;
 
1818
 
 
1819
public:
 
1820
 
 
1821
  /// Constructor
 
1822
  poisson2d_4_0_cell_integral_0() : ufc::cell_integral()
 
1823
  {
 
1824
    // Do nothing
 
1825
  }
 
1826
 
 
1827
  /// Destructor
 
1828
  virtual ~poisson2d_4_0_cell_integral_0()
 
1829
  {
 
1830
    // Do nothing
 
1831
  }
 
1832
 
 
1833
  /// Tabulate the tensor for the contribution from a local cell
 
1834
  virtual void tabulate_tensor(double* A,
 
1835
                               const double * const * w,
 
1836
                               const ufc::cell& c) const
 
1837
  {
 
1838
    // Reset values of the element tensor block
 
1839
    for (unsigned int j = 0; j < 225; j++)
 
1840
      A[j] = 0;
 
1841
    
 
1842
    // Add all contributions to element tensor
 
1843
    integral_0_quadrature.tabulate_tensor(A, w, c);
1940
1844
  }
1941
1845
 
1942
1846
};
1956
1860
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
1957
1861
/// fixed functions (coefficients).
1958
1862
 
1959
 
class UFC_Poisson2D_4BilinearForm: public ufc::form
 
1863
class poisson2d_4_form_0: public ufc::form
1960
1864
{
1961
1865
public:
1962
1866
 
1963
1867
  /// Constructor
1964
 
  UFC_Poisson2D_4BilinearForm() : ufc::form()
 
1868
  poisson2d_4_form_0() : ufc::form()
1965
1869
  {
1966
1870
    // Do nothing
1967
1871
  }
1968
1872
 
1969
1873
  /// Destructor
1970
 
  virtual ~UFC_Poisson2D_4BilinearForm()
 
1874
  virtual ~poisson2d_4_form_0()
1971
1875
  {
1972
1876
    // Do nothing
1973
1877
  }
1975
1879
  /// Return a string identifying the form
1976
1880
  virtual const char* signature() const
1977
1881
  {
1978
 
    return "(dXa0[0, 1]/dxb0[0, 1])(dXa1[0, 1]/dxb0[0, 1]) | ((d/dXa0[0, 1])vi0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])*((d/dXa1[0, 1])vi1[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])*dX(0)";
 
1882
    return "Form([Integral(IndexSum(Product(SpatialDerivative(BasisFunction(FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 4), 0), MultiIndex((Index(0),), {Index(0): 2})), SpatialDerivative(BasisFunction(FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 4), 1), MultiIndex((Index(0),), {Index(0): 2}))), MultiIndex((Index(0),), {Index(0): 2})), Measure('cell', 0, None))])";
1979
1883
  }
1980
1884
 
1981
1885
  /// Return the rank of the global tensor (r)
1995
1899
  {
1996
1900
    return 1;
1997
1901
  }
1998
 
  
 
1902
 
1999
1903
  /// Return the number of exterior facet integrals
2000
1904
  virtual unsigned int num_exterior_facet_integrals() const
2001
1905
  {
2002
1906
    return 0;
2003
1907
  }
2004
 
  
 
1908
 
2005
1909
  /// Return the number of interior facet integrals
2006
1910
  virtual unsigned int num_interior_facet_integrals() const
2007
1911
  {
2008
1912
    return 0;
2009
1913
  }
2010
 
    
 
1914
 
2011
1915
  /// Create a new finite element for argument function i
2012
1916
  virtual ufc::finite_element* create_finite_element(unsigned int i) const
2013
1917
  {
2014
1918
    switch ( i )
2015
1919
    {
2016
1920
    case 0:
2017
 
      return new UFC_Poisson2D_4BilinearForm_finite_element_0();
 
1921
      return new poisson2d_4_0_finite_element_0();
2018
1922
      break;
2019
1923
    case 1:
2020
 
      return new UFC_Poisson2D_4BilinearForm_finite_element_1();
 
1924
      return new poisson2d_4_0_finite_element_1();
2021
1925
      break;
2022
1926
    }
2023
1927
    return 0;
2024
1928
  }
2025
 
  
 
1929
 
2026
1930
  /// Create a new dof map for argument function i
2027
1931
  virtual ufc::dof_map* create_dof_map(unsigned int i) const
2028
1932
  {
2029
1933
    switch ( i )
2030
1934
    {
2031
1935
    case 0:
2032
 
      return new UFC_Poisson2D_4BilinearForm_dof_map_0();
 
1936
      return new poisson2d_4_0_dof_map_0();
2033
1937
      break;
2034
1938
    case 1:
2035
 
      return new UFC_Poisson2D_4BilinearForm_dof_map_1();
 
1939
      return new poisson2d_4_0_dof_map_1();
2036
1940
      break;
2037
1941
    }
2038
1942
    return 0;
2041
1945
  /// Create a new cell integral on sub domain i
2042
1946
  virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
2043
1947
  {
2044
 
    return new UFC_Poisson2D_4BilinearForm_cell_integral_0();
 
1948
    return new poisson2d_4_0_cell_integral_0();
2045
1949
  }
2046
1950
 
2047
1951
  /// Create a new exterior facet integral on sub domain i
2060
1964
 
2061
1965
/// This class defines the interface for a finite element.
2062
1966
 
2063
 
class UFC_Poisson2D_4LinearForm_finite_element_0: public ufc::finite_element
 
1967
class poisson2d_4_1_finite_element_0: public ufc::finite_element
2064
1968
{
2065
1969
public:
2066
1970
 
2067
1971
  /// Constructor
2068
 
  UFC_Poisson2D_4LinearForm_finite_element_0() : ufc::finite_element()
 
1972
  poisson2d_4_1_finite_element_0() : ufc::finite_element()
2069
1973
  {
2070
1974
    // Do nothing
2071
1975
  }
2072
1976
 
2073
1977
  /// Destructor
2074
 
  virtual ~UFC_Poisson2D_4LinearForm_finite_element_0()
 
1978
  virtual ~poisson2d_4_1_finite_element_0()
2075
1979
  {
2076
1980
    // Do nothing
2077
1981
  }
2120
2024
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
2121
2025
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
2122
2026
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
2123
 
      
 
2027
    
2124
2028
    // Compute determinant of Jacobian
2125
2029
    const double detJ = J_00*J_11 - J_01*J_10;
2126
2030
    
2196
2100
    const double basisvalue14 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_4;
2197
2101
    
2198
2102
    // Table(s) of coefficients
2199
 
    const static double coefficients0[15][15] = \
2200
 
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366312, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
2201
 
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233825, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.023944356611608, -0.0185472188784818, 0.0107082418122104},
2202
 
    {0, 0, 0.0476190476190476, 0, 0, 0.0388807895679869, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
2203
 
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543895, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406279, 0.0834624849531681, -0.0535412090610519},
2204
 
    {-0.0314269680527355, 0.0109971479845644, 0.00634920634920629, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
2205
 
    {0.125707872210942, 0.0439885919382572, 0.126984126984127, 0, 0.0359165349174119, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
2206
 
    {0.125707872210942, -0.131965775814772, -0.0253968253968255, 0.139104141588614, 0.0718330698348238, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.047888713223216, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
2207
 
    {-0.0314269680527357, -0.0109971479845642, 0.00634920634920626, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
2208
 
    {0.125707872210942, -0.0439885919382573, 0.126984126984127, 0, -0.035916534917412, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
2209
 
    {0.125707872210942, -0.0879771838765143, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
2210
 
    {-0.0314269680527355, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951818, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.0239443566116079, 0, 0.0107082418122103},
2211
 
    {0.125707872210942, 0.0879771838765144, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277045, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
2212
 
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406278, -0.0278208283177228, -0.0535412090610519},
2213
 
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.026770604530526, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406279, 0.0278208283177227, -0.0535412090610519},
2214
 
    {0.251415744421884, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
 
2103
    static const double coefficients0[15][15] = \
 
2104
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366311, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
 
2105
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233824, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.0239443566116079, -0.0185472188784818, 0.0107082418122104},
 
2106
    {0, 0, 0.0476190476190476, 0, 0, 0.038880789567987, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
 
2107
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543896, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406278, 0.0834624849531682, -0.0535412090610519},
 
2108
    {-0.0314269680527354, 0.0109971479845642, 0.00634920634920638, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
 
2109
    {0.125707872210942, 0.0439885919382573, 0.126984126984127, 0, 0.035916534917412, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
 
2110
    {0.125707872210942, -0.131965775814772, -0.0253968253968254, 0.139104141588614, 0.0718330698348239, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.0478887132232159, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
 
2111
    {-0.0314269680527354, -0.0109971479845643, 0.00634920634920633, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
 
2112
    {0.125707872210942, -0.0439885919382572, 0.126984126984127, 0, -0.0359165349174119, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
 
2113
    {0.125707872210942, -0.0879771838765144, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
 
2114
    {-0.0314269680527354, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951817, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.023944356611608, 0, 0.0107082418122104},
 
2115
    {0.125707872210942, 0.0879771838765145, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277046, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
 
2116
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406279, -0.0278208283177228, -0.0535412090610519},
 
2117
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.0267706045305259, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406278, 0.0278208283177228, -0.0535412090610519},
 
2118
    {0.251415744421883, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
2215
2119
    
2216
2120
    // Extract relevant coefficients
2217
2121
    const double coeff0_0 = coefficients0[dof][0];
2257
2161
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
2258
2162
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
2259
2163
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
2260
 
      
 
2164
    
2261
2165
    // Compute determinant of Jacobian
2262
2166
    const double detJ = J_00*J_11 - J_01*J_10;
2263
2167
    
2287
2191
    
2288
2192
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
2289
2193
    unsigned int **combinations = new unsigned int *[num_derivatives];
2290
 
        
 
2194
    
2291
2195
    for (unsigned int j = 0; j < num_derivatives; j++)
2292
2196
    {
2293
2197
      combinations[j] = new unsigned int [n];
2294
2198
      for (unsigned int k = 0; k < n; k++)
2295
2199
        combinations[j][k] = 0;
2296
2200
    }
2297
 
        
 
2201
    
2298
2202
    // Generate combinations of derivatives
2299
2203
    for (unsigned int row = 1; row < num_derivatives; row++)
2300
2204
    {
2319
2223
    // Declare transformation matrix
2320
2224
    // Declare pointer to two dimensional array and initialise
2321
2225
    double **transform = new double *[num_derivatives];
2322
 
        
 
2226
    
2323
2227
    for (unsigned int j = 0; j < num_derivatives; j++)
2324
2228
    {
2325
2229
      transform[j] = new double [num_derivatives];
2393
2297
    const double basisvalue14 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_4;
2394
2298
    
2395
2299
    // Table(s) of coefficients
2396
 
    const static double coefficients0[15][15] = \
2397
 
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366312, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
2398
 
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233825, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.023944356611608, -0.0185472188784818, 0.0107082418122104},
2399
 
    {0, 0, 0.0476190476190476, 0, 0, 0.0388807895679869, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
2400
 
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543895, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406279, 0.0834624849531681, -0.0535412090610519},
2401
 
    {-0.0314269680527355, 0.0109971479845644, 0.00634920634920629, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
2402
 
    {0.125707872210942, 0.0439885919382572, 0.126984126984127, 0, 0.0359165349174119, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
2403
 
    {0.125707872210942, -0.131965775814772, -0.0253968253968255, 0.139104141588614, 0.0718330698348238, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.047888713223216, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
2404
 
    {-0.0314269680527357, -0.0109971479845642, 0.00634920634920626, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
2405
 
    {0.125707872210942, -0.0439885919382573, 0.126984126984127, 0, -0.035916534917412, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
2406
 
    {0.125707872210942, -0.0879771838765143, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
2407
 
    {-0.0314269680527355, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951818, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.0239443566116079, 0, 0.0107082418122103},
2408
 
    {0.125707872210942, 0.0879771838765144, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277045, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
2409
 
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406278, -0.0278208283177228, -0.0535412090610519},
2410
 
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.026770604530526, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406279, 0.0278208283177227, -0.0535412090610519},
2411
 
    {0.251415744421884, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
 
2300
    static const double coefficients0[15][15] = \
 
2301
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366311, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
 
2302
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233824, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.0239443566116079, -0.0185472188784818, 0.0107082418122104},
 
2303
    {0, 0, 0.0476190476190476, 0, 0, 0.038880789567987, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
 
2304
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543896, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406278, 0.0834624849531682, -0.0535412090610519},
 
2305
    {-0.0314269680527354, 0.0109971479845642, 0.00634920634920638, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
 
2306
    {0.125707872210942, 0.0439885919382573, 0.126984126984127, 0, 0.035916534917412, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
 
2307
    {0.125707872210942, -0.131965775814772, -0.0253968253968254, 0.139104141588614, 0.0718330698348239, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.0478887132232159, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
 
2308
    {-0.0314269680527354, -0.0109971479845643, 0.00634920634920633, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
 
2309
    {0.125707872210942, -0.0439885919382572, 0.126984126984127, 0, -0.0359165349174119, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
 
2310
    {0.125707872210942, -0.0879771838765144, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
 
2311
    {-0.0314269680527354, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951817, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.023944356611608, 0, 0.0107082418122104},
 
2312
    {0.125707872210942, 0.0879771838765145, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277046, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
 
2313
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406279, -0.0278208283177228, -0.0535412090610519},
 
2314
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.0267706045305259, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406278, 0.0278208283177228, -0.0535412090610519},
 
2315
    {0.251415744421883, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
2412
2316
    
2413
2317
    // Interesting (new) part
2414
2318
    // Tables of derivatives of the polynomial base (transpose)
2415
 
    const static double dmats0[15][15] = \
 
2319
    static const double dmats0[15][15] = \
2416
2320
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2417
2321
    {4.89897948556635, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2418
2322
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2419
 
    {0, 9.48683298050513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2323
    {0, 9.48683298050514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2420
2324
    {4, 0, 7.07106781186548, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2421
2325
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2422
 
    {5.29150262212917, 0, -2.99332590941916, 13.6626010212795, 0, 0.611010092660778, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2423
 
    {0, 4.38178046004132, 0, 0, 12.5219806739988, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2326
    {5.29150262212918, 0, -2.99332590941916, 13.6626010212795, 0, 0.611010092660776, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2327
    {0, 4.38178046004133, 0, 0, 12.5219806739988, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2424
2328
    {3.46410161513776, 0, 7.83836717690617, 0, 0, 8.40000000000001, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2425
2329
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2426
 
    {0, 10.9544511501033, 0, 0, -3.83325938999965, 0, 17.7482393492988, 0, 0.553283335172492, 0, 0, 0, 0, 0, 0},
2427
 
    {4.73286382647968, 0, 3.3466401061363, 4.36435780471985, 0, -5.07468037933239, 0, 17.0084012854152, 0, 1.52127765851133, 0, 0, 0, 0, 0},
2428
 
    {0, 2.44948974278317, 0, 0, 9.14285714285714, 0, 0, 0, 14.8461497791618, 0, 0, 0, 0, 0, 0},
2429
 
    {3.09838667696594, 0, 7.66811580507233, 0, 0, 10.733126291999, 0, 0, 0, 9.2951600308978, 0, 0, 0, 0, 0},
 
2330
    {0, 10.9544511501033, 0, 0, -3.83325938999965, 0, 17.7482393492988, 0, 0.55328333517249, 0, 0, 0, 0, 0, 0},
 
2331
    {4.73286382647969, 0, 3.3466401061363, 4.36435780471985, 0, -5.07468037933238, 0, 17.0084012854152, 0, 1.52127765851133, 0, 0, 0, 0, 0},
 
2332
    {0, 2.44948974278318, 0, 0, 9.14285714285715, 0, 0, 0, 14.8461497791618, 0, 0, 0, 0, 0, 0},
 
2333
    {3.09838667696593, 0, 7.66811580507233, 0, 0, 10.733126291999, 0, 0, 0, 9.2951600308978, 0, 0, 0, 0, 0},
2430
2334
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
2431
2335
    
2432
 
    const static double dmats1[15][15] = \
 
2336
    static const double dmats1[15][15] = \
2433
2337
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2434
 
    {2.44948974278317, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2338
    {2.44948974278318, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2435
2339
    {4.24264068711928, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2436
 
    {2.58198889747161, 4.74341649025257, -0.912870929175277, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2437
 
    {2, 6.12372435695794, 3.53553390593274, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2438
 
    {-2.30940107675849, 0, 8.16496580927726, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2439
 
    {2.64575131106458, 5.18459255872628, -1.49666295470958, 6.83130051063973, -1.05830052442584, 0.305505046330385, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2340
    {2.58198889747161, 4.74341649025257, -0.912870929175276, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2341
    {2, 6.12372435695795, 3.53553390593274, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2342
    {-2.3094010767585, 0, 8.16496580927726, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2343
    {2.64575131106459, 5.18459255872629, -1.49666295470958, 6.83130051063973, -1.05830052442584, 0.305505046330388, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2440
2344
    {2.23606797749978, 2.19089023002066, 2.5298221281347, 8.08290376865476, 6.26099033699942, -1.80739222823014, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2441
 
    {1.73205080756888, -5.09116882454314, 3.91918358845309, 0, 9.69948452238572, 4.2, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2442
 
    {5, 0, -2.8284271247462, 0, 0, 12.1243556529821, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2443
 
    {2.68328157299974, 5.47722557505166, -1.89736659610103, 7.4230748895809, -1.91662969499982, 0.663940002206987, 8.87411967464942, -1.07142857142857, 0.276641667586245, -0.095831484749991, 0, 0, 0, 0, 0},
2444
 
    {2.36643191323984, 2.89827534923788, 1.67332005306815, 2.18217890235993, 5.74704893215391, -2.53734018966619, 10.0623058987491, 8.50420064270761, -2.1957751641342, 0.760638829255663, 0, 0, 0, 0, 0},
2445
 
    {2, 1.22474487139159, 3.53553390593274, -7.37711113563317, 4.57142857142857, 1.64957219768464, 0, 11.4997781699989, 7.4230748895809, -2.57142857142858, 0, 0, 0, 0, 0},
2446
 
    {1.54919333848296, 6.6407830863536, 3.83405790253616, 0, -6.19677335393188, 5.3665631459995, 0, 0, 13.4164078649987, 4.6475800154489, 0, 0, 0, 0, 0},
2447
 
    {-3.57770876399967, 0, 8.85437744847147, 0, 0, -3.09838667696593, 0, 0, 0, 16.0996894379985, 0, 0, 0, 0, 0}};
 
2345
    {1.73205080756888, -5.09116882454315, 3.91918358845308, 0, 9.69948452238572, 4.2, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2346
    {5, 0, -2.82842712474619, 0, 0, 12.1243556529821, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2347
    {2.68328157299975, 5.47722557505166, -1.89736659610103, 7.4230748895809, -1.91662969499982, 0.663940002206986, 8.87411967464942, -1.07142857142857, 0.276641667586244, -0.0958314847499919, 0, 0, 0, 0, 0},
 
2348
    {2.36643191323985, 2.89827534923789, 1.67332005306815, 2.18217890235992, 5.74704893215392, -2.53734018966619, 10.0623058987491, 8.50420064270761, -2.1957751641342, 0.760638829255664, 0, 0, 0, 0, 0},
 
2349
    {2, 1.22474487139159, 3.53553390593274, -7.37711113563317, 4.57142857142858, 1.64957219768464, 0, 11.4997781699989, 7.4230748895809, -2.57142857142857, 0, 0, 0, 0, 0},
 
2350
    {1.54919333848297, 6.6407830863536, 3.83405790253617, 0, -6.19677335393188, 5.3665631459995, 0, 0, 13.4164078649987, 4.6475800154489, 0, 0, 0, 0, 0},
 
2351
    {-3.57770876399967, 0, 8.85437744847147, 0, 0, -3.09838667696594, 0, 0, 0, 16.0996894379985, 0, 0, 0, 0, 0}};
2448
2352
    
2449
2353
    // Compute reference derivatives
2450
2354
    // Declare pointer to array of derivatives on FIAT element
2603
2507
                              const ufc::cell& c) const
2604
2508
  {
2605
2509
    // The reference points, direction and weights:
2606
 
    const static double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.75, 0.25}}, {{0.5, 0.5}}, {{0.25, 0.75}}, {{0, 0.25}}, {{0, 0.5}}, {{0, 0.75}}, {{0.25, 0}}, {{0.5, 0}}, {{0.75, 0}}, {{0.25, 0.25}}, {{0.5, 0.25}}, {{0.25, 0.5}}};
2607
 
    const static double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
2608
 
    const static double D[15][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
 
2510
    static const double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.75, 0.25}}, {{0.5, 0.5}}, {{0.25, 0.75}}, {{0, 0.25}}, {{0, 0.5}}, {{0, 0.75}}, {{0.25, 0}}, {{0.5, 0}}, {{0.75, 0}}, {{0.25, 0.25}}, {{0.5, 0.25}}, {{0.25, 0.5}}};
 
2511
    static const double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
 
2512
    static const double D[15][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
2609
2513
    
2610
2514
    const double * const * x = c.coordinates;
2611
2515
    double result = 0.0;
2632
2536
    // Take directional components
2633
2537
    for(int k = 0; k < 1; k++)
2634
2538
      result += values[k]*D[i][0][k];
2635
 
    // Multiply by weights 
 
2539
    // Multiply by weights
2636
2540
    result *= W[i][0];
2637
2541
    
2638
2542
    return result;
2666
2570
  /// Create a new finite element for sub element i (for a mixed element)
2667
2571
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
2668
2572
  {
2669
 
    return new UFC_Poisson2D_4LinearForm_finite_element_0();
 
2573
    return new poisson2d_4_1_finite_element_0();
2670
2574
  }
2671
2575
 
2672
2576
};
2673
2577
 
2674
2578
/// This class defines the interface for a finite element.
2675
2579
 
2676
 
class UFC_Poisson2D_4LinearForm_finite_element_1: public ufc::finite_element
 
2580
class poisson2d_4_1_finite_element_1: public ufc::finite_element
2677
2581
{
2678
2582
public:
2679
2583
 
2680
2584
  /// Constructor
2681
 
  UFC_Poisson2D_4LinearForm_finite_element_1() : ufc::finite_element()
 
2585
  poisson2d_4_1_finite_element_1() : ufc::finite_element()
2682
2586
  {
2683
2587
    // Do nothing
2684
2588
  }
2685
2589
 
2686
2590
  /// Destructor
2687
 
  virtual ~UFC_Poisson2D_4LinearForm_finite_element_1()
 
2591
  virtual ~poisson2d_4_1_finite_element_1()
2688
2592
  {
2689
2593
    // Do nothing
2690
2594
  }
2733
2637
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
2734
2638
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
2735
2639
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
2736
 
      
 
2640
    
2737
2641
    // Compute determinant of Jacobian
2738
2642
    const double detJ = J_00*J_11 - J_01*J_10;
2739
2643
    
2809
2713
    const double basisvalue14 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_4;
2810
2714
    
2811
2715
    // Table(s) of coefficients
2812
 
    const static double coefficients0[15][15] = \
2813
 
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366312, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
2814
 
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233825, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.023944356611608, -0.0185472188784818, 0.0107082418122104},
2815
 
    {0, 0, 0.0476190476190476, 0, 0, 0.0388807895679869, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
2816
 
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543895, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406279, 0.0834624849531681, -0.0535412090610519},
2817
 
    {-0.0314269680527355, 0.0109971479845644, 0.00634920634920629, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
2818
 
    {0.125707872210942, 0.0439885919382572, 0.126984126984127, 0, 0.0359165349174119, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
2819
 
    {0.125707872210942, -0.131965775814772, -0.0253968253968255, 0.139104141588614, 0.0718330698348238, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.047888713223216, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
2820
 
    {-0.0314269680527357, -0.0109971479845642, 0.00634920634920626, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
2821
 
    {0.125707872210942, -0.0439885919382573, 0.126984126984127, 0, -0.035916534917412, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
2822
 
    {0.125707872210942, -0.0879771838765143, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
2823
 
    {-0.0314269680527355, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951818, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.0239443566116079, 0, 0.0107082418122103},
2824
 
    {0.125707872210942, 0.0879771838765144, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277045, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
2825
 
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406278, -0.0278208283177228, -0.0535412090610519},
2826
 
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.026770604530526, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406279, 0.0278208283177227, -0.0535412090610519},
2827
 
    {0.251415744421884, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
 
2716
    static const double coefficients0[15][15] = \
 
2717
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366311, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
 
2718
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233824, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.0239443566116079, -0.0185472188784818, 0.0107082418122104},
 
2719
    {0, 0, 0.0476190476190476, 0, 0, 0.038880789567987, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
 
2720
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543896, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406278, 0.0834624849531682, -0.0535412090610519},
 
2721
    {-0.0314269680527354, 0.0109971479845642, 0.00634920634920638, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
 
2722
    {0.125707872210942, 0.0439885919382573, 0.126984126984127, 0, 0.035916534917412, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
 
2723
    {0.125707872210942, -0.131965775814772, -0.0253968253968254, 0.139104141588614, 0.0718330698348239, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.0478887132232159, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
 
2724
    {-0.0314269680527354, -0.0109971479845643, 0.00634920634920633, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
 
2725
    {0.125707872210942, -0.0439885919382572, 0.126984126984127, 0, -0.0359165349174119, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
 
2726
    {0.125707872210942, -0.0879771838765144, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
 
2727
    {-0.0314269680527354, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951817, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.023944356611608, 0, 0.0107082418122104},
 
2728
    {0.125707872210942, 0.0879771838765145, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277046, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
 
2729
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406279, -0.0278208283177228, -0.0535412090610519},
 
2730
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.0267706045305259, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406278, 0.0278208283177228, -0.0535412090610519},
 
2731
    {0.251415744421883, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
2828
2732
    
2829
2733
    // Extract relevant coefficients
2830
2734
    const double coeff0_0 = coefficients0[dof][0];
2870
2774
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
2871
2775
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
2872
2776
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
2873
 
      
 
2777
    
2874
2778
    // Compute determinant of Jacobian
2875
2779
    const double detJ = J_00*J_11 - J_01*J_10;
2876
2780
    
2900
2804
    
2901
2805
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
2902
2806
    unsigned int **combinations = new unsigned int *[num_derivatives];
2903
 
        
 
2807
    
2904
2808
    for (unsigned int j = 0; j < num_derivatives; j++)
2905
2809
    {
2906
2810
      combinations[j] = new unsigned int [n];
2907
2811
      for (unsigned int k = 0; k < n; k++)
2908
2812
        combinations[j][k] = 0;
2909
2813
    }
2910
 
        
 
2814
    
2911
2815
    // Generate combinations of derivatives
2912
2816
    for (unsigned int row = 1; row < num_derivatives; row++)
2913
2817
    {
2932
2836
    // Declare transformation matrix
2933
2837
    // Declare pointer to two dimensional array and initialise
2934
2838
    double **transform = new double *[num_derivatives];
2935
 
        
 
2839
    
2936
2840
    for (unsigned int j = 0; j < num_derivatives; j++)
2937
2841
    {
2938
2842
      transform[j] = new double [num_derivatives];
3006
2910
    const double basisvalue14 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_4;
3007
2911
    
3008
2912
    // Table(s) of coefficients
3009
 
    const static double coefficients0[15][15] = \
3010
 
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366312, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
3011
 
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233825, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.023944356611608, -0.0185472188784818, 0.0107082418122104},
3012
 
    {0, 0, 0.0476190476190476, 0, 0, 0.0388807895679869, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
3013
 
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543895, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406279, 0.0834624849531681, -0.0535412090610519},
3014
 
    {-0.0314269680527355, 0.0109971479845644, 0.00634920634920629, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
3015
 
    {0.125707872210942, 0.0439885919382572, 0.126984126984127, 0, 0.0359165349174119, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
3016
 
    {0.125707872210942, -0.131965775814772, -0.0253968253968255, 0.139104141588614, 0.0718330698348238, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.047888713223216, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
3017
 
    {-0.0314269680527357, -0.0109971479845642, 0.00634920634920626, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
3018
 
    {0.125707872210942, -0.0439885919382573, 0.126984126984127, 0, -0.035916534917412, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
3019
 
    {0.125707872210942, -0.0879771838765143, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
3020
 
    {-0.0314269680527355, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951818, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.0239443566116079, 0, 0.0107082418122103},
3021
 
    {0.125707872210942, 0.0879771838765144, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277045, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
3022
 
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406278, -0.0278208283177228, -0.0535412090610519},
3023
 
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.026770604530526, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406279, 0.0278208283177227, -0.0535412090610519},
3024
 
    {0.251415744421884, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
 
2913
    static const double coefficients0[15][15] = \
 
2914
    {{0, -0.0412393049421161, -0.0238095238095238, 0.0289800294976279, 0.0224478343233825, 0.012960263189329, -0.0395942580610999, -0.0334632556631574, -0.025920526378658, -0.014965222882255, 0.0321247254366311, 0.0283313448138523, 0.0239443566116079, 0.0185472188784818, 0.0107082418122104},
 
2915
    {0, 0.0412393049421161, -0.0238095238095238, 0.0289800294976278, -0.0224478343233824, 0.012960263189329, 0.0395942580610999, -0.0334632556631574, 0.025920526378658, -0.014965222882255, 0.0321247254366312, -0.0283313448138523, 0.0239443566116079, -0.0185472188784818, 0.0107082418122104},
 
2916
    {0, 0, 0.0476190476190476, 0, 0, 0.038880789567987, 0, 0, 0, 0.0598608915290199, 0, 0, 0, 0, 0.0535412090610519},
 
2917
    {0.125707872210942, 0.131965775814772, -0.0253968253968254, 0.139104141588614, -0.0718330698348239, 0.0311046316543896, 0.0633508128977598, 0.0267706045305259, -0.0622092633087792, 0.0478887132232159, 0, 0.0566626896277046, -0.0838052481406278, 0.0834624849531682, -0.0535412090610519},
 
2918
    {-0.0314269680527354, 0.0109971479845642, 0.00634920634920638, 0, 0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, -0.139104141588614, 0.107082418122104},
 
2919
    {0.125707872210942, 0.0439885919382573, 0.126984126984127, 0, 0.035916534917412, 0.155523158271948, 0, 0, 0.103682105514632, -0.011972178305804, 0, 0, 0, 0.0927360943924091, -0.107082418122104},
 
2920
    {0.125707872210942, -0.131965775814772, -0.0253968253968254, 0.139104141588614, 0.0718330698348239, 0.0311046316543895, -0.0633508128977598, 0.0267706045305259, 0.0622092633087791, 0.0478887132232159, 0, -0.0566626896277046, -0.0838052481406278, -0.0834624849531682, -0.0535412090610519},
 
2921
    {-0.0314269680527354, -0.0109971479845643, 0.00634920634920633, 0, -0.188561808316413, -0.163299316185545, 0, 0.0936971158568409, 0, -0.0419026240703139, 0, 0, 0.0838052481406278, 0.139104141588614, 0.107082418122104},
 
2922
    {0.125707872210942, -0.0439885919382572, 0.126984126984127, 0, -0.0359165349174119, 0.155523158271948, 0, 0, -0.103682105514632, -0.011972178305804, 0, 0, 0, -0.0927360943924091, -0.107082418122104},
 
2923
    {0.125707872210942, -0.0879771838765144, -0.101587301587302, 0.0927360943924091, 0.107749604752236, 0.0725774738602423, 0.0791885161221998, -0.013385302265263, -0.0518410527573159, -0.0419026240703139, -0.128498901746525, -0.0566626896277046, -0.011972178305804, 0.00927360943924092, 0.0107082418122104},
 
2924
    {-0.0314269680527354, 0, -0.0126984126984127, -0.243432247780074, 0, 0.0544331053951817, 0, 0.0936971158568408, 0, -0.0419026240703139, 0.192748352619787, 0, -0.023944356611608, 0, 0.0107082418122104},
 
2925
    {0.125707872210942, 0.0879771838765145, -0.101587301587302, 0.0927360943924091, -0.107749604752236, 0.0725774738602423, -0.0791885161221998, -0.013385302265263, 0.0518410527573159, -0.0419026240703139, -0.128498901746525, 0.0566626896277046, -0.011972178305804, -0.0092736094392409, 0.0107082418122104},
 
2926
    {0.251415744421884, -0.351908735506058, -0.203174603174603, -0.139104141588614, -0.107749604752236, -0.0622092633087791, 0.19005243869328, -0.0267706045305259, 0.124418526617558, 0.155638317975452, 0, 0.169988068883114, 0.0838052481406279, -0.0278208283177228, -0.0535412090610519},
 
2927
    {0.251415744421884, 0.351908735506058, -0.203174603174603, -0.139104141588614, 0.107749604752236, -0.0622092633087791, -0.19005243869328, -0.0267706045305259, -0.124418526617558, 0.155638317975452, 0, -0.169988068883114, 0.0838052481406278, 0.0278208283177228, -0.0535412090610519},
 
2928
    {0.251415744421883, 0, 0.406349206349206, 0, 0, -0.186627789926337, 0, -0.187394231713682, 0, -0.203527031198668, 0, 0, -0.167610496281256, 0, 0.107082418122104}};
3025
2929
    
3026
2930
    // Interesting (new) part
3027
2931
    // Tables of derivatives of the polynomial base (transpose)
3028
 
    const static double dmats0[15][15] = \
 
2932
    static const double dmats0[15][15] = \
3029
2933
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3030
2934
    {4.89897948556635, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3031
2935
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3032
 
    {0, 9.48683298050513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2936
    {0, 9.48683298050514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3033
2937
    {4, 0, 7.07106781186548, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3034
2938
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3035
 
    {5.29150262212917, 0, -2.99332590941916, 13.6626010212795, 0, 0.611010092660778, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3036
 
    {0, 4.38178046004132, 0, 0, 12.5219806739988, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2939
    {5.29150262212918, 0, -2.99332590941916, 13.6626010212795, 0, 0.611010092660776, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2940
    {0, 4.38178046004133, 0, 0, 12.5219806739988, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3037
2941
    {3.46410161513776, 0, 7.83836717690617, 0, 0, 8.40000000000001, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3038
2942
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3039
 
    {0, 10.9544511501033, 0, 0, -3.83325938999965, 0, 17.7482393492988, 0, 0.553283335172492, 0, 0, 0, 0, 0, 0},
3040
 
    {4.73286382647968, 0, 3.3466401061363, 4.36435780471985, 0, -5.07468037933239, 0, 17.0084012854152, 0, 1.52127765851133, 0, 0, 0, 0, 0},
3041
 
    {0, 2.44948974278317, 0, 0, 9.14285714285714, 0, 0, 0, 14.8461497791618, 0, 0, 0, 0, 0, 0},
3042
 
    {3.09838667696594, 0, 7.66811580507233, 0, 0, 10.733126291999, 0, 0, 0, 9.2951600308978, 0, 0, 0, 0, 0},
 
2943
    {0, 10.9544511501033, 0, 0, -3.83325938999965, 0, 17.7482393492988, 0, 0.55328333517249, 0, 0, 0, 0, 0, 0},
 
2944
    {4.73286382647969, 0, 3.3466401061363, 4.36435780471985, 0, -5.07468037933238, 0, 17.0084012854152, 0, 1.52127765851133, 0, 0, 0, 0, 0},
 
2945
    {0, 2.44948974278318, 0, 0, 9.14285714285715, 0, 0, 0, 14.8461497791618, 0, 0, 0, 0, 0, 0},
 
2946
    {3.09838667696593, 0, 7.66811580507233, 0, 0, 10.733126291999, 0, 0, 0, 9.2951600308978, 0, 0, 0, 0, 0},
3043
2947
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
3044
2948
    
3045
 
    const static double dmats1[15][15] = \
 
2949
    static const double dmats1[15][15] = \
3046
2950
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3047
 
    {2.44948974278317, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2951
    {2.44948974278318, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3048
2952
    {4.24264068711928, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3049
 
    {2.58198889747161, 4.74341649025257, -0.912870929175277, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3050
 
    {2, 6.12372435695794, 3.53553390593274, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3051
 
    {-2.30940107675849, 0, 8.16496580927726, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3052
 
    {2.64575131106458, 5.18459255872628, -1.49666295470958, 6.83130051063973, -1.05830052442584, 0.305505046330385, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2953
    {2.58198889747161, 4.74341649025257, -0.912870929175276, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2954
    {2, 6.12372435695795, 3.53553390593274, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2955
    {-2.3094010767585, 0, 8.16496580927726, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2956
    {2.64575131106459, 5.18459255872629, -1.49666295470958, 6.83130051063973, -1.05830052442584, 0.305505046330388, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3053
2957
    {2.23606797749978, 2.19089023002066, 2.5298221281347, 8.08290376865476, 6.26099033699942, -1.80739222823014, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3054
 
    {1.73205080756888, -5.09116882454314, 3.91918358845309, 0, 9.69948452238572, 4.2, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3055
 
    {5, 0, -2.8284271247462, 0, 0, 12.1243556529821, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3056
 
    {2.68328157299974, 5.47722557505166, -1.89736659610103, 7.4230748895809, -1.91662969499982, 0.663940002206987, 8.87411967464942, -1.07142857142857, 0.276641667586245, -0.095831484749991, 0, 0, 0, 0, 0},
3057
 
    {2.36643191323984, 2.89827534923788, 1.67332005306815, 2.18217890235993, 5.74704893215391, -2.53734018966619, 10.0623058987491, 8.50420064270761, -2.1957751641342, 0.760638829255663, 0, 0, 0, 0, 0},
3058
 
    {2, 1.22474487139159, 3.53553390593274, -7.37711113563317, 4.57142857142857, 1.64957219768464, 0, 11.4997781699989, 7.4230748895809, -2.57142857142858, 0, 0, 0, 0, 0},
3059
 
    {1.54919333848296, 6.6407830863536, 3.83405790253616, 0, -6.19677335393188, 5.3665631459995, 0, 0, 13.4164078649987, 4.6475800154489, 0, 0, 0, 0, 0},
3060
 
    {-3.57770876399967, 0, 8.85437744847147, 0, 0, -3.09838667696593, 0, 0, 0, 16.0996894379985, 0, 0, 0, 0, 0}};
 
2958
    {1.73205080756888, -5.09116882454315, 3.91918358845308, 0, 9.69948452238572, 4.2, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2959
    {5, 0, -2.82842712474619, 0, 0, 12.1243556529821, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
2960
    {2.68328157299975, 5.47722557505166, -1.89736659610103, 7.4230748895809, -1.91662969499982, 0.663940002206986, 8.87411967464942, -1.07142857142857, 0.276641667586244, -0.0958314847499919, 0, 0, 0, 0, 0},
 
2961
    {2.36643191323985, 2.89827534923789, 1.67332005306815, 2.18217890235992, 5.74704893215392, -2.53734018966619, 10.0623058987491, 8.50420064270761, -2.1957751641342, 0.760638829255664, 0, 0, 0, 0, 0},
 
2962
    {2, 1.22474487139159, 3.53553390593274, -7.37711113563317, 4.57142857142858, 1.64957219768464, 0, 11.4997781699989, 7.4230748895809, -2.57142857142857, 0, 0, 0, 0, 0},
 
2963
    {1.54919333848297, 6.6407830863536, 3.83405790253617, 0, -6.19677335393188, 5.3665631459995, 0, 0, 13.4164078649987, 4.6475800154489, 0, 0, 0, 0, 0},
 
2964
    {-3.57770876399967, 0, 8.85437744847147, 0, 0, -3.09838667696594, 0, 0, 0, 16.0996894379985, 0, 0, 0, 0, 0}};
3061
2965
    
3062
2966
    // Compute reference derivatives
3063
2967
    // Declare pointer to array of derivatives on FIAT element
3216
3120
                              const ufc::cell& c) const
3217
3121
  {
3218
3122
    // The reference points, direction and weights:
3219
 
    const static double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.75, 0.25}}, {{0.5, 0.5}}, {{0.25, 0.75}}, {{0, 0.25}}, {{0, 0.5}}, {{0, 0.75}}, {{0.25, 0}}, {{0.5, 0}}, {{0.75, 0}}, {{0.25, 0.25}}, {{0.5, 0.25}}, {{0.25, 0.5}}};
3220
 
    const static double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
3221
 
    const static double D[15][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
 
3123
    static const double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.75, 0.25}}, {{0.5, 0.5}}, {{0.25, 0.75}}, {{0, 0.25}}, {{0, 0.5}}, {{0, 0.75}}, {{0.25, 0}}, {{0.5, 0}}, {{0.75, 0}}, {{0.25, 0.25}}, {{0.5, 0.25}}, {{0.25, 0.5}}};
 
3124
    static const double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
 
3125
    static const double D[15][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
3222
3126
    
3223
3127
    const double * const * x = c.coordinates;
3224
3128
    double result = 0.0;
3245
3149
    // Take directional components
3246
3150
    for(int k = 0; k < 1; k++)
3247
3151
      result += values[k]*D[i][0][k];
3248
 
    // Multiply by weights 
 
3152
    // Multiply by weights
3249
3153
    result *= W[i][0];
3250
3154
    
3251
3155
    return result;
3279
3183
  /// Create a new finite element for sub element i (for a mixed element)
3280
3184
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
3281
3185
  {
3282
 
    return new UFC_Poisson2D_4LinearForm_finite_element_1();
3283
 
  }
3284
 
 
3285
 
};
3286
 
 
3287
 
/// This class defines the interface for a local-to-global mapping of
3288
 
/// degrees of freedom (dofs).
3289
 
 
3290
 
class UFC_Poisson2D_4LinearForm_dof_map_0: public ufc::dof_map
3291
 
{
3292
 
private:
3293
 
 
3294
 
  unsigned int __global_dimension;
3295
 
 
3296
 
public:
3297
 
 
3298
 
  /// Constructor
3299
 
  UFC_Poisson2D_4LinearForm_dof_map_0() : ufc::dof_map()
3300
 
  {
3301
 
    __global_dimension = 0;
3302
 
  }
3303
 
 
3304
 
  /// Destructor
3305
 
  virtual ~UFC_Poisson2D_4LinearForm_dof_map_0()
3306
 
  {
3307
 
    // Do nothing
3308
 
  }
3309
 
 
3310
 
  /// Return a string identifying the dof map
3311
 
  virtual const char* signature() const
3312
 
  {
3313
 
    return "FFC dof map for FiniteElement('Lagrange', 'triangle', 4)";
3314
 
  }
3315
 
 
3316
 
  /// Return true iff mesh entities of topological dimension d are needed
3317
 
  virtual bool needs_mesh_entities(unsigned int d) const
3318
 
  {
3319
 
    switch ( d )
3320
 
    {
3321
 
    case 0:
3322
 
      return true;
3323
 
      break;
3324
 
    case 1:
3325
 
      return true;
3326
 
      break;
3327
 
    case 2:
3328
 
      return true;
3329
 
      break;
3330
 
    }
3331
 
    return false;
3332
 
  }
3333
 
 
3334
 
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
3335
 
  virtual bool init_mesh(const ufc::mesh& m)
3336
 
  {
3337
 
    __global_dimension = m.num_entities[0] + 3*m.num_entities[1] + 3*m.num_entities[2];
3338
 
    return false;
3339
 
  }
3340
 
 
3341
 
  /// Initialize dof map for given cell
3342
 
  virtual void init_cell(const ufc::mesh& m,
3343
 
                         const ufc::cell& c)
3344
 
  {
3345
 
    // Do nothing
3346
 
  }
3347
 
 
3348
 
  /// Finish initialization of dof map for cells
3349
 
  virtual void init_cell_finalize()
3350
 
  {
3351
 
    // Do nothing
3352
 
  }
3353
 
 
3354
 
  /// Return the dimension of the global finite element function space
3355
 
  virtual unsigned int global_dimension() const
3356
 
  {
3357
 
    return __global_dimension;
3358
 
  }
3359
 
 
3360
 
  /// Return the dimension of the local finite element function space
3361
 
  virtual unsigned int local_dimension() const
3362
 
  {
3363
 
    return 15;
3364
 
  }
3365
 
 
3366
 
  // Return the geometric dimension of the coordinates this dof map provides
3367
 
  virtual unsigned int geometric_dimension() const
3368
 
  {
3369
 
    return 2;
3370
 
  }
3371
 
 
3372
 
  /// Return the number of dofs on each cell facet
3373
 
  virtual unsigned int num_facet_dofs() const
3374
 
  {
3375
 
    return 5;
3376
 
  }
3377
 
 
3378
 
  /// Return the number of dofs associated with each cell entity of dimension d
3379
 
  virtual unsigned int num_entity_dofs(unsigned int d) const
3380
 
  {
3381
 
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
3382
 
  }
3383
 
 
3384
 
  /// Tabulate the local-to-global mapping of dofs on a cell
3385
 
  virtual void tabulate_dofs(unsigned int* dofs,
3386
 
                             const ufc::mesh& m,
3387
 
                             const ufc::cell& c) const
3388
 
  {
3389
 
    dofs[0] = c.entity_indices[0][0];
3390
 
    dofs[1] = c.entity_indices[0][1];
3391
 
    dofs[2] = c.entity_indices[0][2];
3392
 
    unsigned int offset = m.num_entities[0];
3393
 
    dofs[3] = offset + 3*c.entity_indices[1][0];
3394
 
    dofs[4] = offset + 3*c.entity_indices[1][0] + 1;
3395
 
    dofs[5] = offset + 3*c.entity_indices[1][0] + 2;
3396
 
    dofs[6] = offset + 3*c.entity_indices[1][1];
3397
 
    dofs[7] = offset + 3*c.entity_indices[1][1] + 1;
3398
 
    dofs[8] = offset + 3*c.entity_indices[1][1] + 2;
3399
 
    dofs[9] = offset + 3*c.entity_indices[1][2];
3400
 
    dofs[10] = offset + 3*c.entity_indices[1][2] + 1;
3401
 
    dofs[11] = offset + 3*c.entity_indices[1][2] + 2;
3402
 
    offset = offset + 3*m.num_entities[1];
3403
 
    dofs[12] = offset + 3*c.entity_indices[2][0];
3404
 
    dofs[13] = offset + 3*c.entity_indices[2][0] + 1;
3405
 
    dofs[14] = offset + 3*c.entity_indices[2][0] + 2;
3406
 
  }
3407
 
 
3408
 
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
3409
 
  virtual void tabulate_facet_dofs(unsigned int* dofs,
3410
 
                                   unsigned int facet) const
3411
 
  {
3412
 
    switch ( facet )
3413
 
    {
3414
 
    case 0:
3415
 
      dofs[0] = 1;
3416
 
      dofs[1] = 2;
3417
 
      dofs[2] = 3;
3418
 
      dofs[3] = 4;
3419
 
      dofs[4] = 5;
3420
 
      break;
3421
 
    case 1:
3422
 
      dofs[0] = 0;
3423
 
      dofs[1] = 2;
3424
 
      dofs[2] = 6;
3425
 
      dofs[3] = 7;
3426
 
      dofs[4] = 8;
3427
 
      break;
3428
 
    case 2:
3429
 
      dofs[0] = 0;
3430
 
      dofs[1] = 1;
3431
 
      dofs[2] = 9;
3432
 
      dofs[3] = 10;
3433
 
      dofs[4] = 11;
3434
 
      break;
3435
 
    }
3436
 
  }
3437
 
 
3438
 
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
3439
 
  virtual void tabulate_entity_dofs(unsigned int* dofs,
3440
 
                                    unsigned int d, unsigned int i) const
3441
 
  {
3442
 
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
3443
 
  }
3444
 
 
3445
 
  /// Tabulate the coordinates of all dofs on a cell
3446
 
  virtual void tabulate_coordinates(double** coordinates,
3447
 
                                    const ufc::cell& c) const
3448
 
  {
3449
 
    const double * const * x = c.coordinates;
3450
 
    coordinates[0][0] = x[0][0];
3451
 
    coordinates[0][1] = x[0][1];
3452
 
    coordinates[1][0] = x[1][0];
3453
 
    coordinates[1][1] = x[1][1];
3454
 
    coordinates[2][0] = x[2][0];
3455
 
    coordinates[2][1] = x[2][1];
3456
 
    coordinates[3][0] = 0.75*x[1][0] + 0.25*x[2][0];
3457
 
    coordinates[3][1] = 0.75*x[1][1] + 0.25*x[2][1];
3458
 
    coordinates[4][0] = 0.5*x[1][0] + 0.5*x[2][0];
3459
 
    coordinates[4][1] = 0.5*x[1][1] + 0.5*x[2][1];
3460
 
    coordinates[5][0] = 0.25*x[1][0] + 0.75*x[2][0];
3461
 
    coordinates[5][1] = 0.25*x[1][1] + 0.75*x[2][1];
3462
 
    coordinates[6][0] = 0.75*x[0][0] + 0.25*x[2][0];
3463
 
    coordinates[6][1] = 0.75*x[0][1] + 0.25*x[2][1];
3464
 
    coordinates[7][0] = 0.5*x[0][0] + 0.5*x[2][0];
3465
 
    coordinates[7][1] = 0.5*x[0][1] + 0.5*x[2][1];
3466
 
    coordinates[8][0] = 0.25*x[0][0] + 0.75*x[2][0];
3467
 
    coordinates[8][1] = 0.25*x[0][1] + 0.75*x[2][1];
3468
 
    coordinates[9][0] = 0.75*x[0][0] + 0.25*x[1][0];
3469
 
    coordinates[9][1] = 0.75*x[0][1] + 0.25*x[1][1];
3470
 
    coordinates[10][0] = 0.5*x[0][0] + 0.5*x[1][0];
3471
 
    coordinates[10][1] = 0.5*x[0][1] + 0.5*x[1][1];
3472
 
    coordinates[11][0] = 0.25*x[0][0] + 0.75*x[1][0];
3473
 
    coordinates[11][1] = 0.25*x[0][1] + 0.75*x[1][1];
3474
 
    coordinates[12][0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
3475
 
    coordinates[12][1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
3476
 
    coordinates[13][0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
3477
 
    coordinates[13][1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
3478
 
    coordinates[14][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
3479
 
    coordinates[14][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
3480
 
  }
3481
 
 
3482
 
  /// Return the number of sub dof maps (for a mixed element)
3483
 
  virtual unsigned int num_sub_dof_maps() const
3484
 
  {
3485
 
    return 1;
3486
 
  }
3487
 
 
3488
 
  /// Create a new dof_map for sub dof map i (for a mixed element)
3489
 
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
3490
 
  {
3491
 
    return new UFC_Poisson2D_4LinearForm_dof_map_0();
3492
 
  }
3493
 
 
3494
 
};
3495
 
 
3496
 
/// This class defines the interface for a local-to-global mapping of
3497
 
/// degrees of freedom (dofs).
3498
 
 
3499
 
class UFC_Poisson2D_4LinearForm_dof_map_1: public ufc::dof_map
3500
 
{
3501
 
private:
3502
 
 
3503
 
  unsigned int __global_dimension;
3504
 
 
3505
 
public:
3506
 
 
3507
 
  /// Constructor
3508
 
  UFC_Poisson2D_4LinearForm_dof_map_1() : ufc::dof_map()
3509
 
  {
3510
 
    __global_dimension = 0;
3511
 
  }
3512
 
 
3513
 
  /// Destructor
3514
 
  virtual ~UFC_Poisson2D_4LinearForm_dof_map_1()
3515
 
  {
3516
 
    // Do nothing
3517
 
  }
3518
 
 
3519
 
  /// Return a string identifying the dof map
3520
 
  virtual const char* signature() const
3521
 
  {
3522
 
    return "FFC dof map for FiniteElement('Lagrange', 'triangle', 4)";
3523
 
  }
3524
 
 
3525
 
  /// Return true iff mesh entities of topological dimension d are needed
3526
 
  virtual bool needs_mesh_entities(unsigned int d) const
3527
 
  {
3528
 
    switch ( d )
3529
 
    {
3530
 
    case 0:
3531
 
      return true;
3532
 
      break;
3533
 
    case 1:
3534
 
      return true;
3535
 
      break;
3536
 
    case 2:
3537
 
      return true;
3538
 
      break;
3539
 
    }
3540
 
    return false;
3541
 
  }
3542
 
 
3543
 
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
3544
 
  virtual bool init_mesh(const ufc::mesh& m)
3545
 
  {
3546
 
    __global_dimension = m.num_entities[0] + 3*m.num_entities[1] + 3*m.num_entities[2];
3547
 
    return false;
3548
 
  }
3549
 
 
3550
 
  /// Initialize dof map for given cell
3551
 
  virtual void init_cell(const ufc::mesh& m,
3552
 
                         const ufc::cell& c)
3553
 
  {
3554
 
    // Do nothing
3555
 
  }
3556
 
 
3557
 
  /// Finish initialization of dof map for cells
3558
 
  virtual void init_cell_finalize()
3559
 
  {
3560
 
    // Do nothing
3561
 
  }
3562
 
 
3563
 
  /// Return the dimension of the global finite element function space
3564
 
  virtual unsigned int global_dimension() const
3565
 
  {
3566
 
    return __global_dimension;
3567
 
  }
3568
 
 
3569
 
  /// Return the dimension of the local finite element function space
3570
 
  virtual unsigned int local_dimension() const
3571
 
  {
3572
 
    return 15;
3573
 
  }
3574
 
 
3575
 
  // Return the geometric dimension of the coordinates this dof map provides
3576
 
  virtual unsigned int geometric_dimension() const
3577
 
  {
3578
 
    return 2;
3579
 
  }
3580
 
 
3581
 
  /// Return the number of dofs on each cell facet
3582
 
  virtual unsigned int num_facet_dofs() const
3583
 
  {
3584
 
    return 5;
3585
 
  }
3586
 
 
3587
 
  /// Return the number of dofs associated with each cell entity of dimension d
3588
 
  virtual unsigned int num_entity_dofs(unsigned int d) const
3589
 
  {
3590
 
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
3591
 
  }
3592
 
 
3593
 
  /// Tabulate the local-to-global mapping of dofs on a cell
3594
 
  virtual void tabulate_dofs(unsigned int* dofs,
3595
 
                             const ufc::mesh& m,
3596
 
                             const ufc::cell& c) const
3597
 
  {
3598
 
    dofs[0] = c.entity_indices[0][0];
3599
 
    dofs[1] = c.entity_indices[0][1];
3600
 
    dofs[2] = c.entity_indices[0][2];
3601
 
    unsigned int offset = m.num_entities[0];
3602
 
    dofs[3] = offset + 3*c.entity_indices[1][0];
3603
 
    dofs[4] = offset + 3*c.entity_indices[1][0] + 1;
3604
 
    dofs[5] = offset + 3*c.entity_indices[1][0] + 2;
3605
 
    dofs[6] = offset + 3*c.entity_indices[1][1];
3606
 
    dofs[7] = offset + 3*c.entity_indices[1][1] + 1;
3607
 
    dofs[8] = offset + 3*c.entity_indices[1][1] + 2;
3608
 
    dofs[9] = offset + 3*c.entity_indices[1][2];
3609
 
    dofs[10] = offset + 3*c.entity_indices[1][2] + 1;
3610
 
    dofs[11] = offset + 3*c.entity_indices[1][2] + 2;
3611
 
    offset = offset + 3*m.num_entities[1];
3612
 
    dofs[12] = offset + 3*c.entity_indices[2][0];
3613
 
    dofs[13] = offset + 3*c.entity_indices[2][0] + 1;
3614
 
    dofs[14] = offset + 3*c.entity_indices[2][0] + 2;
3615
 
  }
3616
 
 
3617
 
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
3618
 
  virtual void tabulate_facet_dofs(unsigned int* dofs,
3619
 
                                   unsigned int facet) const
3620
 
  {
3621
 
    switch ( facet )
3622
 
    {
3623
 
    case 0:
3624
 
      dofs[0] = 1;
3625
 
      dofs[1] = 2;
3626
 
      dofs[2] = 3;
3627
 
      dofs[3] = 4;
3628
 
      dofs[4] = 5;
3629
 
      break;
3630
 
    case 1:
3631
 
      dofs[0] = 0;
3632
 
      dofs[1] = 2;
3633
 
      dofs[2] = 6;
3634
 
      dofs[3] = 7;
3635
 
      dofs[4] = 8;
3636
 
      break;
3637
 
    case 2:
3638
 
      dofs[0] = 0;
3639
 
      dofs[1] = 1;
3640
 
      dofs[2] = 9;
3641
 
      dofs[3] = 10;
3642
 
      dofs[4] = 11;
3643
 
      break;
3644
 
    }
3645
 
  }
3646
 
 
3647
 
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
3648
 
  virtual void tabulate_entity_dofs(unsigned int* dofs,
3649
 
                                    unsigned int d, unsigned int i) const
3650
 
  {
3651
 
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
3652
 
  }
3653
 
 
3654
 
  /// Tabulate the coordinates of all dofs on a cell
3655
 
  virtual void tabulate_coordinates(double** coordinates,
3656
 
                                    const ufc::cell& c) const
3657
 
  {
3658
 
    const double * const * x = c.coordinates;
3659
 
    coordinates[0][0] = x[0][0];
3660
 
    coordinates[0][1] = x[0][1];
3661
 
    coordinates[1][0] = x[1][0];
3662
 
    coordinates[1][1] = x[1][1];
3663
 
    coordinates[2][0] = x[2][0];
3664
 
    coordinates[2][1] = x[2][1];
3665
 
    coordinates[3][0] = 0.75*x[1][0] + 0.25*x[2][0];
3666
 
    coordinates[3][1] = 0.75*x[1][1] + 0.25*x[2][1];
3667
 
    coordinates[4][0] = 0.5*x[1][0] + 0.5*x[2][0];
3668
 
    coordinates[4][1] = 0.5*x[1][1] + 0.5*x[2][1];
3669
 
    coordinates[5][0] = 0.25*x[1][0] + 0.75*x[2][0];
3670
 
    coordinates[5][1] = 0.25*x[1][1] + 0.75*x[2][1];
3671
 
    coordinates[6][0] = 0.75*x[0][0] + 0.25*x[2][0];
3672
 
    coordinates[6][1] = 0.75*x[0][1] + 0.25*x[2][1];
3673
 
    coordinates[7][0] = 0.5*x[0][0] + 0.5*x[2][0];
3674
 
    coordinates[7][1] = 0.5*x[0][1] + 0.5*x[2][1];
3675
 
    coordinates[8][0] = 0.25*x[0][0] + 0.75*x[2][0];
3676
 
    coordinates[8][1] = 0.25*x[0][1] + 0.75*x[2][1];
3677
 
    coordinates[9][0] = 0.75*x[0][0] + 0.25*x[1][0];
3678
 
    coordinates[9][1] = 0.75*x[0][1] + 0.25*x[1][1];
3679
 
    coordinates[10][0] = 0.5*x[0][0] + 0.5*x[1][0];
3680
 
    coordinates[10][1] = 0.5*x[0][1] + 0.5*x[1][1];
3681
 
    coordinates[11][0] = 0.25*x[0][0] + 0.75*x[1][0];
3682
 
    coordinates[11][1] = 0.25*x[0][1] + 0.75*x[1][1];
3683
 
    coordinates[12][0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
3684
 
    coordinates[12][1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
3685
 
    coordinates[13][0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
3686
 
    coordinates[13][1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
3687
 
    coordinates[14][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
3688
 
    coordinates[14][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
3689
 
  }
3690
 
 
3691
 
  /// Return the number of sub dof maps (for a mixed element)
3692
 
  virtual unsigned int num_sub_dof_maps() const
3693
 
  {
3694
 
    return 1;
3695
 
  }
3696
 
 
3697
 
  /// Create a new dof_map for sub dof map i (for a mixed element)
3698
 
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
3699
 
  {
3700
 
    return new UFC_Poisson2D_4LinearForm_dof_map_1();
 
3186
    return new poisson2d_4_1_finite_element_1();
 
3187
  }
 
3188
 
 
3189
};
 
3190
 
 
3191
/// This class defines the interface for a local-to-global mapping of
 
3192
/// degrees of freedom (dofs).
 
3193
 
 
3194
class poisson2d_4_1_dof_map_0: public ufc::dof_map
 
3195
{
 
3196
private:
 
3197
 
 
3198
  unsigned int __global_dimension;
 
3199
 
 
3200
public:
 
3201
 
 
3202
  /// Constructor
 
3203
  poisson2d_4_1_dof_map_0() : ufc::dof_map()
 
3204
  {
 
3205
    __global_dimension = 0;
 
3206
  }
 
3207
 
 
3208
  /// Destructor
 
3209
  virtual ~poisson2d_4_1_dof_map_0()
 
3210
  {
 
3211
    // Do nothing
 
3212
  }
 
3213
 
 
3214
  /// Return a string identifying the dof map
 
3215
  virtual const char* signature() const
 
3216
  {
 
3217
    return "FFC dof map for FiniteElement('Lagrange', 'triangle', 4)";
 
3218
  }
 
3219
 
 
3220
  /// Return true iff mesh entities of topological dimension d are needed
 
3221
  virtual bool needs_mesh_entities(unsigned int d) const
 
3222
  {
 
3223
    switch ( d )
 
3224
    {
 
3225
    case 0:
 
3226
      return true;
 
3227
      break;
 
3228
    case 1:
 
3229
      return true;
 
3230
      break;
 
3231
    case 2:
 
3232
      return true;
 
3233
      break;
 
3234
    }
 
3235
    return false;
 
3236
  }
 
3237
 
 
3238
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
3239
  virtual bool init_mesh(const ufc::mesh& m)
 
3240
  {
 
3241
    __global_dimension = m.num_entities[0] + 3*m.num_entities[1] + 3*m.num_entities[2];
 
3242
    return false;
 
3243
  }
 
3244
 
 
3245
  /// Initialize dof map for given cell
 
3246
  virtual void init_cell(const ufc::mesh& m,
 
3247
                         const ufc::cell& c)
 
3248
  {
 
3249
    // Do nothing
 
3250
  }
 
3251
 
 
3252
  /// Finish initialization of dof map for cells
 
3253
  virtual void init_cell_finalize()
 
3254
  {
 
3255
    // Do nothing
 
3256
  }
 
3257
 
 
3258
  /// Return the dimension of the global finite element function space
 
3259
  virtual unsigned int global_dimension() const
 
3260
  {
 
3261
    return __global_dimension;
 
3262
  }
 
3263
 
 
3264
  /// Return the dimension of the local finite element function space for a cell
 
3265
  virtual unsigned int local_dimension(const ufc::cell& c) const
 
3266
  {
 
3267
    return 15;
 
3268
  }
 
3269
 
 
3270
  /// Return the maximum dimension of the local finite element function space
 
3271
  virtual unsigned int max_local_dimension() const
 
3272
  {
 
3273
    return 15;
 
3274
  }
 
3275
 
 
3276
  // Return the geometric dimension of the coordinates this dof map provides
 
3277
  virtual unsigned int geometric_dimension() const
 
3278
  {
 
3279
    return 2;
 
3280
  }
 
3281
 
 
3282
  /// Return the number of dofs on each cell facet
 
3283
  virtual unsigned int num_facet_dofs() const
 
3284
  {
 
3285
    return 5;
 
3286
  }
 
3287
 
 
3288
  /// Return the number of dofs associated with each cell entity of dimension d
 
3289
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
3290
  {
 
3291
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
3292
  }
 
3293
 
 
3294
  /// Tabulate the local-to-global mapping of dofs on a cell
 
3295
  virtual void tabulate_dofs(unsigned int* dofs,
 
3296
                             const ufc::mesh& m,
 
3297
                             const ufc::cell& c) const
 
3298
  {
 
3299
    dofs[0] = c.entity_indices[0][0];
 
3300
    dofs[1] = c.entity_indices[0][1];
 
3301
    dofs[2] = c.entity_indices[0][2];
 
3302
    unsigned int offset = m.num_entities[0];
 
3303
    dofs[3] = offset + 3*c.entity_indices[1][0];
 
3304
    dofs[4] = offset + 3*c.entity_indices[1][0] + 1;
 
3305
    dofs[5] = offset + 3*c.entity_indices[1][0] + 2;
 
3306
    dofs[6] = offset + 3*c.entity_indices[1][1];
 
3307
    dofs[7] = offset + 3*c.entity_indices[1][1] + 1;
 
3308
    dofs[8] = offset + 3*c.entity_indices[1][1] + 2;
 
3309
    dofs[9] = offset + 3*c.entity_indices[1][2];
 
3310
    dofs[10] = offset + 3*c.entity_indices[1][2] + 1;
 
3311
    dofs[11] = offset + 3*c.entity_indices[1][2] + 2;
 
3312
    offset = offset + 3*m.num_entities[1];
 
3313
    dofs[12] = offset + 3*c.entity_indices[2][0];
 
3314
    dofs[13] = offset + 3*c.entity_indices[2][0] + 1;
 
3315
    dofs[14] = offset + 3*c.entity_indices[2][0] + 2;
 
3316
  }
 
3317
 
 
3318
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
3319
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
3320
                                   unsigned int facet) const
 
3321
  {
 
3322
    switch ( facet )
 
3323
    {
 
3324
    case 0:
 
3325
      dofs[0] = 1;
 
3326
      dofs[1] = 2;
 
3327
      dofs[2] = 3;
 
3328
      dofs[3] = 4;
 
3329
      dofs[4] = 5;
 
3330
      break;
 
3331
    case 1:
 
3332
      dofs[0] = 0;
 
3333
      dofs[1] = 2;
 
3334
      dofs[2] = 6;
 
3335
      dofs[3] = 7;
 
3336
      dofs[4] = 8;
 
3337
      break;
 
3338
    case 2:
 
3339
      dofs[0] = 0;
 
3340
      dofs[1] = 1;
 
3341
      dofs[2] = 9;
 
3342
      dofs[3] = 10;
 
3343
      dofs[4] = 11;
 
3344
      break;
 
3345
    }
 
3346
  }
 
3347
 
 
3348
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
3349
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
3350
                                    unsigned int d, unsigned int i) const
 
3351
  {
 
3352
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
3353
  }
 
3354
 
 
3355
  /// Tabulate the coordinates of all dofs on a cell
 
3356
  virtual void tabulate_coordinates(double** coordinates,
 
3357
                                    const ufc::cell& c) const
 
3358
  {
 
3359
    const double * const * x = c.coordinates;
 
3360
    coordinates[0][0] = x[0][0];
 
3361
    coordinates[0][1] = x[0][1];
 
3362
    coordinates[1][0] = x[1][0];
 
3363
    coordinates[1][1] = x[1][1];
 
3364
    coordinates[2][0] = x[2][0];
 
3365
    coordinates[2][1] = x[2][1];
 
3366
    coordinates[3][0] = 0.75*x[1][0] + 0.25*x[2][0];
 
3367
    coordinates[3][1] = 0.75*x[1][1] + 0.25*x[2][1];
 
3368
    coordinates[4][0] = 0.5*x[1][0] + 0.5*x[2][0];
 
3369
    coordinates[4][1] = 0.5*x[1][1] + 0.5*x[2][1];
 
3370
    coordinates[5][0] = 0.25*x[1][0] + 0.75*x[2][0];
 
3371
    coordinates[5][1] = 0.25*x[1][1] + 0.75*x[2][1];
 
3372
    coordinates[6][0] = 0.75*x[0][0] + 0.25*x[2][0];
 
3373
    coordinates[6][1] = 0.75*x[0][1] + 0.25*x[2][1];
 
3374
    coordinates[7][0] = 0.5*x[0][0] + 0.5*x[2][0];
 
3375
    coordinates[7][1] = 0.5*x[0][1] + 0.5*x[2][1];
 
3376
    coordinates[8][0] = 0.25*x[0][0] + 0.75*x[2][0];
 
3377
    coordinates[8][1] = 0.25*x[0][1] + 0.75*x[2][1];
 
3378
    coordinates[9][0] = 0.75*x[0][0] + 0.25*x[1][0];
 
3379
    coordinates[9][1] = 0.75*x[0][1] + 0.25*x[1][1];
 
3380
    coordinates[10][0] = 0.5*x[0][0] + 0.5*x[1][0];
 
3381
    coordinates[10][1] = 0.5*x[0][1] + 0.5*x[1][1];
 
3382
    coordinates[11][0] = 0.25*x[0][0] + 0.75*x[1][0];
 
3383
    coordinates[11][1] = 0.25*x[0][1] + 0.75*x[1][1];
 
3384
    coordinates[12][0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
 
3385
    coordinates[12][1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
 
3386
    coordinates[13][0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
 
3387
    coordinates[13][1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
 
3388
    coordinates[14][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
 
3389
    coordinates[14][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
3390
  }
 
3391
 
 
3392
  /// Return the number of sub dof maps (for a mixed element)
 
3393
  virtual unsigned int num_sub_dof_maps() const
 
3394
  {
 
3395
    return 1;
 
3396
  }
 
3397
 
 
3398
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
3399
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
3400
  {
 
3401
    return new poisson2d_4_1_dof_map_0();
 
3402
  }
 
3403
 
 
3404
};
 
3405
 
 
3406
/// This class defines the interface for a local-to-global mapping of
 
3407
/// degrees of freedom (dofs).
 
3408
 
 
3409
class poisson2d_4_1_dof_map_1: public ufc::dof_map
 
3410
{
 
3411
private:
 
3412
 
 
3413
  unsigned int __global_dimension;
 
3414
 
 
3415
public:
 
3416
 
 
3417
  /// Constructor
 
3418
  poisson2d_4_1_dof_map_1() : ufc::dof_map()
 
3419
  {
 
3420
    __global_dimension = 0;
 
3421
  }
 
3422
 
 
3423
  /// Destructor
 
3424
  virtual ~poisson2d_4_1_dof_map_1()
 
3425
  {
 
3426
    // Do nothing
 
3427
  }
 
3428
 
 
3429
  /// Return a string identifying the dof map
 
3430
  virtual const char* signature() const
 
3431
  {
 
3432
    return "FFC dof map for FiniteElement('Lagrange', 'triangle', 4)";
 
3433
  }
 
3434
 
 
3435
  /// Return true iff mesh entities of topological dimension d are needed
 
3436
  virtual bool needs_mesh_entities(unsigned int d) const
 
3437
  {
 
3438
    switch ( d )
 
3439
    {
 
3440
    case 0:
 
3441
      return true;
 
3442
      break;
 
3443
    case 1:
 
3444
      return true;
 
3445
      break;
 
3446
    case 2:
 
3447
      return true;
 
3448
      break;
 
3449
    }
 
3450
    return false;
 
3451
  }
 
3452
 
 
3453
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
3454
  virtual bool init_mesh(const ufc::mesh& m)
 
3455
  {
 
3456
    __global_dimension = m.num_entities[0] + 3*m.num_entities[1] + 3*m.num_entities[2];
 
3457
    return false;
 
3458
  }
 
3459
 
 
3460
  /// Initialize dof map for given cell
 
3461
  virtual void init_cell(const ufc::mesh& m,
 
3462
                         const ufc::cell& c)
 
3463
  {
 
3464
    // Do nothing
 
3465
  }
 
3466
 
 
3467
  /// Finish initialization of dof map for cells
 
3468
  virtual void init_cell_finalize()
 
3469
  {
 
3470
    // Do nothing
 
3471
  }
 
3472
 
 
3473
  /// Return the dimension of the global finite element function space
 
3474
  virtual unsigned int global_dimension() const
 
3475
  {
 
3476
    return __global_dimension;
 
3477
  }
 
3478
 
 
3479
  /// Return the dimension of the local finite element function space for a cell
 
3480
  virtual unsigned int local_dimension(const ufc::cell& c) const
 
3481
  {
 
3482
    return 15;
 
3483
  }
 
3484
 
 
3485
  /// Return the maximum dimension of the local finite element function space
 
3486
  virtual unsigned int max_local_dimension() const
 
3487
  {
 
3488
    return 15;
 
3489
  }
 
3490
 
 
3491
  // Return the geometric dimension of the coordinates this dof map provides
 
3492
  virtual unsigned int geometric_dimension() const
 
3493
  {
 
3494
    return 2;
 
3495
  }
 
3496
 
 
3497
  /// Return the number of dofs on each cell facet
 
3498
  virtual unsigned int num_facet_dofs() const
 
3499
  {
 
3500
    return 5;
 
3501
  }
 
3502
 
 
3503
  /// Return the number of dofs associated with each cell entity of dimension d
 
3504
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
3505
  {
 
3506
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
3507
  }
 
3508
 
 
3509
  /// Tabulate the local-to-global mapping of dofs on a cell
 
3510
  virtual void tabulate_dofs(unsigned int* dofs,
 
3511
                             const ufc::mesh& m,
 
3512
                             const ufc::cell& c) const
 
3513
  {
 
3514
    dofs[0] = c.entity_indices[0][0];
 
3515
    dofs[1] = c.entity_indices[0][1];
 
3516
    dofs[2] = c.entity_indices[0][2];
 
3517
    unsigned int offset = m.num_entities[0];
 
3518
    dofs[3] = offset + 3*c.entity_indices[1][0];
 
3519
    dofs[4] = offset + 3*c.entity_indices[1][0] + 1;
 
3520
    dofs[5] = offset + 3*c.entity_indices[1][0] + 2;
 
3521
    dofs[6] = offset + 3*c.entity_indices[1][1];
 
3522
    dofs[7] = offset + 3*c.entity_indices[1][1] + 1;
 
3523
    dofs[8] = offset + 3*c.entity_indices[1][1] + 2;
 
3524
    dofs[9] = offset + 3*c.entity_indices[1][2];
 
3525
    dofs[10] = offset + 3*c.entity_indices[1][2] + 1;
 
3526
    dofs[11] = offset + 3*c.entity_indices[1][2] + 2;
 
3527
    offset = offset + 3*m.num_entities[1];
 
3528
    dofs[12] = offset + 3*c.entity_indices[2][0];
 
3529
    dofs[13] = offset + 3*c.entity_indices[2][0] + 1;
 
3530
    dofs[14] = offset + 3*c.entity_indices[2][0] + 2;
 
3531
  }
 
3532
 
 
3533
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
3534
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
3535
                                   unsigned int facet) const
 
3536
  {
 
3537
    switch ( facet )
 
3538
    {
 
3539
    case 0:
 
3540
      dofs[0] = 1;
 
3541
      dofs[1] = 2;
 
3542
      dofs[2] = 3;
 
3543
      dofs[3] = 4;
 
3544
      dofs[4] = 5;
 
3545
      break;
 
3546
    case 1:
 
3547
      dofs[0] = 0;
 
3548
      dofs[1] = 2;
 
3549
      dofs[2] = 6;
 
3550
      dofs[3] = 7;
 
3551
      dofs[4] = 8;
 
3552
      break;
 
3553
    case 2:
 
3554
      dofs[0] = 0;
 
3555
      dofs[1] = 1;
 
3556
      dofs[2] = 9;
 
3557
      dofs[3] = 10;
 
3558
      dofs[4] = 11;
 
3559
      break;
 
3560
    }
 
3561
  }
 
3562
 
 
3563
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
3564
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
3565
                                    unsigned int d, unsigned int i) const
 
3566
  {
 
3567
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
3568
  }
 
3569
 
 
3570
  /// Tabulate the coordinates of all dofs on a cell
 
3571
  virtual void tabulate_coordinates(double** coordinates,
 
3572
                                    const ufc::cell& c) const
 
3573
  {
 
3574
    const double * const * x = c.coordinates;
 
3575
    coordinates[0][0] = x[0][0];
 
3576
    coordinates[0][1] = x[0][1];
 
3577
    coordinates[1][0] = x[1][0];
 
3578
    coordinates[1][1] = x[1][1];
 
3579
    coordinates[2][0] = x[2][0];
 
3580
    coordinates[2][1] = x[2][1];
 
3581
    coordinates[3][0] = 0.75*x[1][0] + 0.25*x[2][0];
 
3582
    coordinates[3][1] = 0.75*x[1][1] + 0.25*x[2][1];
 
3583
    coordinates[4][0] = 0.5*x[1][0] + 0.5*x[2][0];
 
3584
    coordinates[4][1] = 0.5*x[1][1] + 0.5*x[2][1];
 
3585
    coordinates[5][0] = 0.25*x[1][0] + 0.75*x[2][0];
 
3586
    coordinates[5][1] = 0.25*x[1][1] + 0.75*x[2][1];
 
3587
    coordinates[6][0] = 0.75*x[0][0] + 0.25*x[2][0];
 
3588
    coordinates[6][1] = 0.75*x[0][1] + 0.25*x[2][1];
 
3589
    coordinates[7][0] = 0.5*x[0][0] + 0.5*x[2][0];
 
3590
    coordinates[7][1] = 0.5*x[0][1] + 0.5*x[2][1];
 
3591
    coordinates[8][0] = 0.25*x[0][0] + 0.75*x[2][0];
 
3592
    coordinates[8][1] = 0.25*x[0][1] + 0.75*x[2][1];
 
3593
    coordinates[9][0] = 0.75*x[0][0] + 0.25*x[1][0];
 
3594
    coordinates[9][1] = 0.75*x[0][1] + 0.25*x[1][1];
 
3595
    coordinates[10][0] = 0.5*x[0][0] + 0.5*x[1][0];
 
3596
    coordinates[10][1] = 0.5*x[0][1] + 0.5*x[1][1];
 
3597
    coordinates[11][0] = 0.25*x[0][0] + 0.75*x[1][0];
 
3598
    coordinates[11][1] = 0.25*x[0][1] + 0.75*x[1][1];
 
3599
    coordinates[12][0] = 0.5*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0];
 
3600
    coordinates[12][1] = 0.5*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1];
 
3601
    coordinates[13][0] = 0.25*x[0][0] + 0.5*x[1][0] + 0.25*x[2][0];
 
3602
    coordinates[13][1] = 0.25*x[0][1] + 0.5*x[1][1] + 0.25*x[2][1];
 
3603
    coordinates[14][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.5*x[2][0];
 
3604
    coordinates[14][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.5*x[2][1];
 
3605
  }
 
3606
 
 
3607
  /// Return the number of sub dof maps (for a mixed element)
 
3608
  virtual unsigned int num_sub_dof_maps() const
 
3609
  {
 
3610
    return 1;
 
3611
  }
 
3612
 
 
3613
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
3614
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
3615
  {
 
3616
    return new poisson2d_4_1_dof_map_1();
3701
3617
  }
3702
3618
 
3703
3619
};
3706
3622
/// tensor corresponding to the local contribution to a form from
3707
3623
/// the integral over a cell.
3708
3624
 
3709
 
class UFC_Poisson2D_4LinearForm_cell_integral_0: public ufc::cell_integral
 
3625
class poisson2d_4_1_cell_integral_0_quadrature: public ufc::cell_integral
3710
3626
{
3711
3627
public:
3712
3628
 
3713
3629
  /// Constructor
3714
 
  UFC_Poisson2D_4LinearForm_cell_integral_0() : ufc::cell_integral()
 
3630
  poisson2d_4_1_cell_integral_0_quadrature() : ufc::cell_integral()
3715
3631
  {
3716
3632
    // Do nothing
3717
3633
  }
3718
3634
 
3719
3635
  /// Destructor
3720
 
  virtual ~UFC_Poisson2D_4LinearForm_cell_integral_0()
 
3636
  virtual ~poisson2d_4_1_cell_integral_0_quadrature()
3721
3637
  {
3722
3638
    // Do nothing
3723
3639
  }
3735
3651
    const double J_01 = x[2][0] - x[0][0];
3736
3652
    const double J_10 = x[1][1] - x[0][1];
3737
3653
    const double J_11 = x[2][1] - x[0][1];
3738
 
      
 
3654
    
3739
3655
    // Compute determinant of Jacobian
3740
3656
    double detJ = J_00*J_11 - J_01*J_10;
3741
 
      
 
3657
    
3742
3658
    // Compute inverse of Jacobian
3743
3659
    
3744
3660
    // Set scale factor
3745
3661
    const double det = std::abs(detJ);
3746
3662
    
3747
 
    // Number of operations to compute element tensor = 426
3748
 
    // Compute coefficients
3749
 
    const double c0_0_0_0 = w[0][0];
3750
 
    const double c0_0_0_1 = w[0][1];
3751
 
    const double c0_0_0_2 = w[0][2];
3752
 
    const double c0_0_0_3 = w[0][3];
3753
 
    const double c0_0_0_4 = w[0][4];
3754
 
    const double c0_0_0_5 = w[0][5];
3755
 
    const double c0_0_0_6 = w[0][6];
3756
 
    const double c0_0_0_7 = w[0][7];
3757
 
    const double c0_0_0_8 = w[0][8];
3758
 
    const double c0_0_0_9 = w[0][9];
3759
 
    const double c0_0_0_10 = w[0][10];
3760
 
    const double c0_0_0_11 = w[0][11];
3761
 
    const double c0_0_0_12 = w[0][12];
3762
 
    const double c0_0_0_13 = w[0][13];
3763
 
    const double c0_0_0_14 = w[0][14];
3764
 
    
3765
 
    // Compute geometry tensors
3766
 
    // Number of operations to compute decalrations = 15
3767
 
    const double G0_0 = det*c0_0_0_0;
3768
 
    const double G0_1 = det*c0_0_0_1;
3769
 
    const double G0_2 = det*c0_0_0_2;
3770
 
    const double G0_3 = det*c0_0_0_3;
3771
 
    const double G0_4 = det*c0_0_0_4;
3772
 
    const double G0_5 = det*c0_0_0_5;
3773
 
    const double G0_6 = det*c0_0_0_6;
3774
 
    const double G0_7 = det*c0_0_0_7;
3775
 
    const double G0_8 = det*c0_0_0_8;
3776
 
    const double G0_9 = det*c0_0_0_9;
3777
 
    const double G0_10 = det*c0_0_0_10;
3778
 
    const double G0_11 = det*c0_0_0_11;
3779
 
    const double G0_12 = det*c0_0_0_12;
3780
 
    const double G0_13 = det*c0_0_0_13;
3781
 
    const double G0_14 = det*c0_0_0_14;
3782
 
    
3783
 
    // Compute element tensor
3784
 
    // Number of operations to compute tensor = 411
3785
 
    A[0] = 0.00255731922398588*G0_0 - 0.000238095238095237*G0_1 - 0.000238095238095236*G0_2 - 0.000987654320987648*G0_3 - 0.000105820105820107*G0_4 - 0.00098765432098765*G0_5 + 0.00141093474426807*G0_6 - 0.000705467372134031*G0_7 + 0.00141093474426807*G0_9 - 0.000705467372134036*G0_10 + 0.00141093474426807*G0_12 - 0.00141093474426807*G0_13 - 0.00141093474426807*G0_14;
3786
 
    A[1] = -0.000238095238095237*G0_0 + 0.00255731922398587*G0_1 - 0.000238095238095236*G0_2 + 0.00141093474426806*G0_3 - 0.00070546737213403*G0_4 - 0.000987654320987651*G0_6 - 0.000105820105820104*G0_7 - 0.000987654320987651*G0_8 - 0.000705467372134033*G0_10 + 0.00141093474426807*G0_11 - 0.00141093474426807*G0_12 + 0.00141093474426807*G0_13 - 0.00141093474426807*G0_14;
3787
 
    A[2] = -0.000238095238095236*G0_0 - 0.000238095238095236*G0_1 + 0.00255731922398588*G0_2 - 0.000705467372134035*G0_4 + 0.00141093474426807*G0_5 - 0.000705467372134034*G0_7 + 0.00141093474426807*G0_8 - 0.000987654320987648*G0_9 - 0.000105820105820105*G0_10 - 0.000987654320987649*G0_11 - 0.00141093474426807*G0_12 - 0.00141093474426807*G0_13 + 0.00141093474426806*G0_14;
3788
 
    A[3] = -0.000987654320987648*G0_0 + 0.00141093474426806*G0_1 + 0.0225749559082891*G0_3 - 0.0112874779541446*G0_4 + 0.00677248677248673*G0_5 + 0.00225749559082891*G0_6 + 0.000564373897707229*G0_7 + 0.00451499118165782*G0_8 + 0.00451499118165783*G0_9 - 0.00846560846560843*G0_10 + 0.0112874779541446*G0_11 - 0.00225749559082891*G0_12 + 0.0112874779541446*G0_13 + 0.00225749559082893*G0_14;
3789
 
    A[4] = -0.000105820105820107*G0_0 - 0.00070546737213403*G0_1 - 0.000705467372134034*G0_2 - 0.0112874779541446*G0_3 + 0.0279365079365078*G0_4 - 0.0112874779541446*G0_5 + 0.000564373897707235*G0_6 + 0.000423280423280406*G0_7 - 0.00846560846560842*G0_8 + 0.000564373897707238*G0_9 + 0.000423280423280415*G0_10 - 0.00846560846560841*G0_11 - 0.00677248677248675*G0_12 + 0.0033862433862434*G0_13 + 0.00338624338624337*G0_14;
3790
 
    A[5] = -0.00098765432098765*G0_0 + 0.00141093474426807*G0_2 + 0.00677248677248673*G0_3 - 0.0112874779541446*G0_4 + 0.0225749559082891*G0_5 + 0.00451499118165782*G0_6 - 0.00846560846560843*G0_7 + 0.0112874779541446*G0_8 + 0.00225749559082891*G0_9 + 0.00056437389770723*G0_10 + 0.00451499118165781*G0_11 - 0.00225749559082892*G0_12 + 0.00225749559082891*G0_13 + 0.0112874779541446*G0_14;
3791
 
    A[6] = 0.00141093474426807*G0_0 - 0.000987654320987651*G0_1 + 0.00225749559082892*G0_3 + 0.000564373897707235*G0_4 + 0.00451499118165782*G0_5 + 0.0225749559082891*G0_6 - 0.0112874779541446*G0_7 + 0.00677248677248674*G0_8 + 0.0112874779541446*G0_9 - 0.00846560846560843*G0_10 + 0.00451499118165783*G0_11 + 0.0112874779541446*G0_12 - 0.00225749559082891*G0_13 + 0.00225749559082892*G0_14;
3792
 
    A[7] = -0.000705467372134031*G0_0 - 0.000105820105820104*G0_1 - 0.000705467372134034*G0_2 + 0.000564373897707229*G0_3 + 0.000423280423280407*G0_4 - 0.00846560846560843*G0_5 - 0.0112874779541446*G0_6 + 0.0279365079365078*G0_7 - 0.0112874779541446*G0_8 - 0.00846560846560842*G0_9 + 0.000423280423280424*G0_10 + 0.000564373897707227*G0_11 + 0.00338624338624335*G0_12 - 0.00677248677248674*G0_13 + 0.00338624338624334*G0_14;
3793
 
    A[8] = -0.000987654320987651*G0_1 + 0.00141093474426807*G0_2 + 0.00451499118165782*G0_3 - 0.00846560846560842*G0_4 + 0.0112874779541446*G0_5 + 0.00677248677248674*G0_6 - 0.0112874779541446*G0_7 + 0.0225749559082891*G0_8 + 0.00451499118165782*G0_9 + 0.000564373897707226*G0_10 + 0.0022574955908289*G0_11 + 0.00225749559082892*G0_12 - 0.00225749559082892*G0_13 + 0.0112874779541446*G0_14;
3794
 
    A[9] = 0.00141093474426807*G0_0 - 0.000987654320987648*G0_2 + 0.00451499118165783*G0_3 + 0.000564373897707238*G0_4 + 0.00225749559082891*G0_5 + 0.0112874779541446*G0_6 - 0.00846560846560842*G0_7 + 0.00451499118165782*G0_8 + 0.0225749559082891*G0_9 - 0.0112874779541446*G0_10 + 0.00677248677248674*G0_11 + 0.0112874779541446*G0_12 + 0.00225749559082892*G0_13 - 0.00225749559082889*G0_14;
3795
 
    A[10] = -0.000705467372134036*G0_0 - 0.000705467372134033*G0_1 - 0.000105820105820105*G0_2 - 0.00846560846560843*G0_3 + 0.000423280423280414*G0_4 + 0.00056437389770723*G0_5 - 0.00846560846560843*G0_6 + 0.000423280423280424*G0_7 + 0.000564373897707226*G0_8 - 0.0112874779541446*G0_9 + 0.0279365079365078*G0_10 - 0.0112874779541446*G0_11 + 0.00338624338624335*G0_12 + 0.00338624338624337*G0_13 - 0.00677248677248675*G0_14;
3796
 
    A[11] = 0.00141093474426807*G0_1 - 0.000987654320987649*G0_2 + 0.0112874779541446*G0_3 - 0.00846560846560841*G0_4 + 0.00451499118165781*G0_5 + 0.00451499118165783*G0_6 + 0.000564373897707227*G0_7 + 0.0022574955908289*G0_8 + 0.00677248677248674*G0_9 - 0.0112874779541446*G0_10 + 0.0225749559082891*G0_11 + 0.00225749559082891*G0_12 + 0.0112874779541446*G0_13 - 0.00225749559082891*G0_14;
3797
 
    A[12] = 0.00141093474426807*G0_0 - 0.00141093474426807*G0_1 - 0.00141093474426807*G0_2 - 0.00225749559082891*G0_3 - 0.00677248677248675*G0_4 - 0.00225749559082892*G0_5 + 0.0112874779541446*G0_6 + 0.00338624338624335*G0_7 + 0.00225749559082892*G0_8 + 0.0112874779541446*G0_9 + 0.00338624338624335*G0_10 + 0.00225749559082891*G0_11 + 0.0948148148148144*G0_12 - 0.0135449735449735*G0_13 - 0.0135449735449735*G0_14;
3798
 
    A[13] = -0.00141093474426807*G0_0 + 0.00141093474426807*G0_1 - 0.00141093474426807*G0_2 + 0.0112874779541446*G0_3 + 0.0033862433862434*G0_4 + 0.00225749559082891*G0_5 - 0.00225749559082891*G0_6 - 0.00677248677248674*G0_7 - 0.00225749559082892*G0_8 + 0.00225749559082892*G0_9 + 0.00338624338624337*G0_10 + 0.0112874779541446*G0_11 - 0.0135449735449735*G0_12 + 0.0948148148148145*G0_13 - 0.0135449735449735*G0_14;
3799
 
    A[14] = -0.00141093474426807*G0_0 - 0.00141093474426807*G0_1 + 0.00141093474426806*G0_2 + 0.00225749559082893*G0_3 + 0.00338624338624337*G0_4 + 0.0112874779541446*G0_5 + 0.00225749559082892*G0_6 + 0.00338624338624334*G0_7 + 0.0112874779541446*G0_8 - 0.00225749559082889*G0_9 - 0.00677248677248675*G0_10 - 0.00225749559082891*G0_11 - 0.0135449735449735*G0_12 - 0.0135449735449735*G0_13 + 0.0948148148148145*G0_14;
 
3663
    
 
3664
    // Array of quadrature weights
 
3665
    static const double W25[25] = {0.0114650803515925, 0.0198040831320473, 0.0173415064313656, 0.0087554991821638, 0.00186555216687783, 0.0231612219294983, 0.0400072873861603, 0.0350325045033716, 0.0176874521104834, 0.0037687016953276, 0.0275289856644697, 0.0475518970579538, 0.0416389652151948, 0.021022967487322, 0.00447940679728133, 0.0231612219294983, 0.0400072873861603, 0.0350325045033716, 0.0176874521104834, 0.0037687016953276, 0.0114650803515925, 0.0198040831320473, 0.0173415064313656, 0.0087554991821638, 0.00186555216687783};
 
3666
    // Quadrature points on the UFC reference element: (0.0450425935698037, 0.0398098570514687), (0.0376212523451112, 0.198013417873608), (0.0263646449444709, 0.437974810247386), (0.0142857943955714, 0.695464273353636), (0.00462228846504642, 0.901464914201174), (0.221578609552379, 0.0398098570514687), (0.185070710267389, 0.198013417873608), (0.129695936782254, 0.437974810247386), (0.0702762920082817, 0.695464273353636), (0.022738483063764, 0.901464914201174), (0.480095071474266, 0.0398098570514687), (0.400993291063196, 0.198013417873608), (0.281012594876307, 0.437974810247386), (0.152267863323182, 0.695464273353636), (0.0492675428994132, 0.901464914201174), (0.738611533396152, 0.0398098570514687), (0.616915871859002, 0.198013417873608), (0.43232925297036, 0.437974810247386), (0.234259434638082, 0.695464273353636), (0.0757966027350624, 0.901464914201174), (0.915147549378728, 0.0398098570514687), (0.764365329781281, 0.198013417873608), (0.535660544808143, 0.437974810247386), (0.290249932250792, 0.695464273353636), (0.09391279733378, 0.901464914201174)
 
3667
    
 
3668
    // Value of basis functions at quadrature points.
 
3669
    static const double FE0[25][15] = \
 
3670
    {{0.445156226392547, -0.0315827066853605, -0.0291704843038615, 0.00713406527528782, 0.00494390302967963, 0.0074003520425001, 0.429230849744385, -0.325980824651526, 0.150355774379167, 0.485650342518488, -0.359646713982119, 0.163997633685216, 0.139711801803414, -0.0430505510725603, -0.0441496681752572},
 
3671
    {0.0159265419837222, -0.0280725488715022, -0.0183033581130483, 0.0312122806513761, 0.00526393070506968, 0.00498994197780144, 0.878133411796469, -0.259023118319191, 0.101382553947527, 0.166839596188151, -0.2010466984854, 0.120484689621101, 0.374895740359003, -0.154792485474193, -0.0378904779668863},
 
3672
    {-0.0124755223559809, -0.0215553463039364, 0.0169955517944373, 0.0521848394572087, -0.0310664159359758, -0.0057441732707666, 0.10196843192882, 0.806248057040335, -0.116706558733174, 0.00613816466255062, -0.0577407317141719, 0.0638241261377217, 0.226162683532578, -0.177056205175583, 0.148823098935937},
 
3673
    {0.0120168299638107, -0.0128353827169193, -0.035226128971713, 0.0485327049359034, -0.0667663799679944, 0.0369103533986062, -0.0727114709060112, 0.231635414227961, 0.749921724802327, -0.0014935937953417, -0.00251771986590467, 0.0202549790971516, 0.014856840830271, -0.0870055733827926, 0.164427402350646},
 
3674
    {-0.0416583119739728, -0.00446718301487101, 0.380915129245166, 0.0216105670502482, -0.0426296719091545, 0.0464978867840787, 0.228954361412766, -0.550949644932603, 0.944715296551356, 0.00117397037545054, 0.00106405531464626, 0.00225134530660734, -0.0078182205459707, -0.0122906749116919, 0.0326310952479451},
 
3675
    {-0.0104608074149251, -0.00988291055472082, -0.0291704843038615, 0.00297820840373333, 0.0033725320948123, 0.0364046469312236, 0.146268417801009, -0.193269238973081, 0.121351479490444, 0.814118789622188, -0.145456430759666, 0.0552561410358951, 0.407481803286924, -0.0237022637411396, -0.175289882918835},
 
3676
    {-0.0375682445666015, -0.0228041670217816, -0.0183033581130483, 0.0319723628129167, 0.00791670028481512, 0.0245470857150986, 0.22358839071367, -0.149127693933143, 0.08182541021023, 0.208974031766544, -0.174080754470082, 0.0996107147279931, 1.06178044825661, -0.187892254450544, -0.150438671932679},
 
3677
    {0.0180749828439264, -0.0382294890062686, 0.0169955517944373, 0.107969972703516, -0.0822120406470856, -0.0282573854099214, -0.099680405014501, 0.415336154256794, -0.0941933465940192, -0.0295180069828396, -0.0787150209063744, 0.106578224477739, 0.573134363428599, -0.378164181374591, 0.590880626430588},
 
3678
    {-0.00539057742418074, -0.0393518056736196, -0.035226128971713, 0.161052348865788, -0.250427424267609, 0.181573575941528, 0.0290762779820009, -0.0731113992256328, 0.605258502259406, 0.00293814230330426, 0.0029806542443266, 0.0542486992329662, -0.023068058870058, -0.263388066500361, 0.652835260103854},
 
3679
    {-0.0402809925511414, -0.0191321218464864, 0.380915129245166, 0.094859613369816, -0.194225935966402, 0.228737652168572, 0.215435885617666, -0.496279337853032, 0.762475531166862, 0.00543413854413313, 0.00436690480348766, 0.00797594705786741, -0.0346438897097149, -0.045195576272416, 0.129557052225622},
 
3680
    {0.00633045207143156, 0.00633045207143158, -0.0291704843038615, -0.00373486165534525, -0.0591585474081252, 0.0788780632108337, -0.00373486165534525, -0.0591585474081253, 0.0788780632108337, -0.0450413240884349, 0.780996525962778, -0.0450413240884348, 0.270247944530609, 0.270247944530609, -0.246869494980853},
 
3681
    {0.0223162840810259, 0.0223162840810259, -0.0183033581130483, -0.0506457162222918, -0.0398896859719983, 0.0531862479626644, -0.0506457162222918, -0.0398896859719983, 0.0531862479626643, -0.10256169831477, 0.23462240890356, -0.10256169831477, 0.615370189888619, 0.615370189888619, -0.211870293637011},
 
3682
    {0.00954713210350603, 0.00954713210350603, 0.0169955517944373, -0.0356632466096778, 0.0459190245014777, -0.0612253660019703, -0.0356632466096778, 0.0459190245014777, -0.0612253660019703, -0.0228821869135316, 0.00486080004623414, -0.0228821869135316, 0.137293121481189, 0.13729312148119, 0.832166691037341},
 
3683
    {-0.0329933038013481, -0.0329933038013481, -0.035226128971713, 0.153551483320339, -0.29506202932535, 0.393416039100467, 0.153551483320339, -0.29506202932535, 0.393416039100467, 0.0336192054302757, 0.0141733094249415, 0.0336192054302757, -0.201715232581654, -0.201715232581654, 0.919420495261312},
 
3684
    {-0.0333179517004776, -0.0333179517004775, 0.380915129245166, 0.17144896981256, -0.371704943750788, 0.495606591667717, 0.17144896981256, -0.371704943750788, 0.495606591667717, 0.00937015888498066, 0.00625946163885411, 0.0093701588849807, -0.0562209533098841, -0.056220953309884, 0.182461665907764},
 
3685
    {-0.00988291055472082, -0.0104608074149253, -0.0291704843038615, 0.146268417801009, -0.193269238973081, 0.121351479490444, 0.00297820840373329, 0.00337253209481225, 0.0364046469312236, 0.0552561410358949, -0.145456430759665, 0.814118789622188, -0.0237022637411395, 0.407481803286924, -0.175289882918835},
 
3686
    {-0.0228041670217816, -0.0375682445666015, -0.0183033581130483, 0.223588390713669, -0.149127693933143, 0.0818254102102302, 0.0319723628129166, 0.00791670028481506, 0.0245470857150986, 0.0996107147279929, -0.174080754470082, 0.208974031766544, -0.187892254450543, 1.06178044825661, -0.150438671932679},
 
3687
    {-0.0382294890062686, 0.0180749828439264, 0.0169955517944373, -0.099680405014501, 0.415336154256794, -0.0941933465940191, 0.107969972703516, -0.0822120406470857, -0.0282573854099214, 0.106578224477739, -0.0787150209063744, -0.0295180069828396, -0.378164181374591, 0.573134363428599, 0.590880626430588},
 
3688
    {-0.0393518056736197, -0.0053905774241807, -0.035226128971713, 0.029076277982001, -0.0731113992256331, 0.605258502259406, 0.161052348865788, -0.250427424267609, 0.181573575941528, 0.0542486992329662, 0.00298065424432661, 0.00293814230330432, -0.263388066500361, -0.0230680588700581, 0.652835260103854},
 
3689
    {-0.0191321218464865, -0.0402809925511413, 0.380915129245166, 0.215435885617666, -0.496279337853032, 0.762475531166862, 0.0948596133698159, -0.194225935966402, 0.228737652168573, 0.0079759470578674, 0.00436690480348766, 0.00543413854413321, -0.0451955762724161, -0.0346438897097148, 0.129557052225622},
 
3690
    {-0.0315827066853605, 0.445156226392546, -0.0291704843038615, 0.429230849744385, -0.325980824651526, 0.150355774379167, 0.0071340652752878, 0.00494390302967961, 0.00740035204250016, 0.163997633685216, -0.359646713982119, 0.485650342518489, -0.0430505510725604, 0.139711801803414, -0.0441496681752573},
 
3691
    {-0.0280725488715023, 0.0159265419837221, -0.0183033581130483, 0.878133411796469, -0.259023118319191, 0.101382553947527, 0.0312122806513761, 0.0052639307050696, 0.00498994197780149, 0.120484689621101, -0.2010466984854, 0.166839596188151, -0.154792485474193, 0.374895740359004, -0.0378904779668863},
 
3692
    {-0.0215553463039365, -0.0124755223559809, 0.0169955517944373, 0.101968431928819, 0.806248057040335, -0.116706558733174, 0.0521848394572089, -0.0310664159359761, -0.0057441732707665, 0.0638241261377219, -0.0577407317141721, 0.0061381646625506, -0.177056205175583, 0.226162683532579, 0.148823098935938},
 
3693
    {-0.0128353827169194, 0.0120168299638107, -0.035226128971713, -0.0727114709060111, 0.23163541422796, 0.749921724802327, 0.0485327049359036, -0.0667663799679951, 0.0369103533986067, 0.0202549790971518, -0.00251771986590469, -0.00149359379534168, -0.0870055733827933, 0.0148568408302711, 0.164427402350647},
 
3694
    {-0.00446718301487108, -0.0416583119739727, 0.380915129245166, 0.228954361412766, -0.550949644932603, 0.944715296551356, 0.021610567050248, -0.0426296719091546, 0.0464978867840788, 0.00225134530660736, 0.00106405531464626, 0.00117397037545064, -0.012290674911692, -0.00781822054597067, 0.0326310952479451}};
 
3695
    
 
3696
    
 
3697
    // Compute element tensor using UFL quadrature representation
 
3698
    // Optimisations: ('simplify expressions', True), ('ignore zero tables', True), ('non zero columns', True), ('remove zero terms', True), ('ignore ones', True)
 
3699
    // Total number of operations to compute element tensor: 1550
 
3700
    
 
3701
    // Loop quadrature points for integral
 
3702
    // Number of operations to compute element tensor for following IP loop = 1550
 
3703
    for (unsigned int ip = 0; ip < 25; ip++)
 
3704
    {
 
3705
      
 
3706
      // Function declarations
 
3707
      double F0 = 0;
 
3708
      
 
3709
      // Total number of operations to compute function values = 30
 
3710
      for (unsigned int r = 0; r < 15; r++)
 
3711
      {
 
3712
        F0 += FE0[ip][r]*w[0][r];
 
3713
      }// end loop over 'r'
 
3714
      
 
3715
      // Number of operations to compute ip constants: 2
 
3716
      // Number of operations: 2
 
3717
      const double Gip0 = F0*W25[ip]*det;
 
3718
      
 
3719
      
 
3720
      // Number of operations for primary indices = 30
 
3721
      for (unsigned int j = 0; j < 15; j++)
 
3722
      {
 
3723
        // Number of operations to compute entry = 2
 
3724
        A[j] += FE0[ip][j]*Gip0;
 
3725
      }// end loop over 'j'
 
3726
    }// end loop over 'ip'
 
3727
  }
 
3728
 
 
3729
};
 
3730
 
 
3731
/// This class defines the interface for the tabulation of the cell
 
3732
/// tensor corresponding to the local contribution to a form from
 
3733
/// the integral over a cell.
 
3734
 
 
3735
class poisson2d_4_1_cell_integral_0: public ufc::cell_integral
 
3736
{
 
3737
private:
 
3738
 
 
3739
  poisson2d_4_1_cell_integral_0_quadrature integral_0_quadrature;
 
3740
 
 
3741
public:
 
3742
 
 
3743
  /// Constructor
 
3744
  poisson2d_4_1_cell_integral_0() : ufc::cell_integral()
 
3745
  {
 
3746
    // Do nothing
 
3747
  }
 
3748
 
 
3749
  /// Destructor
 
3750
  virtual ~poisson2d_4_1_cell_integral_0()
 
3751
  {
 
3752
    // Do nothing
 
3753
  }
 
3754
 
 
3755
  /// Tabulate the tensor for the contribution from a local cell
 
3756
  virtual void tabulate_tensor(double* A,
 
3757
                               const double * const * w,
 
3758
                               const ufc::cell& c) const
 
3759
  {
 
3760
    // Reset values of the element tensor block
 
3761
    for (unsigned int j = 0; j < 15; j++)
 
3762
      A[j] = 0;
 
3763
    
 
3764
    // Add all contributions to element tensor
 
3765
    integral_0_quadrature.tabulate_tensor(A, w, c);
3800
3766
  }
3801
3767
 
3802
3768
};
3816
3782
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
3817
3783
/// fixed functions (coefficients).
3818
3784
 
3819
 
class UFC_Poisson2D_4LinearForm: public ufc::form
 
3785
class poisson2d_4_form_1: public ufc::form
3820
3786
{
3821
3787
public:
3822
3788
 
3823
3789
  /// Constructor
3824
 
  UFC_Poisson2D_4LinearForm() : ufc::form()
 
3790
  poisson2d_4_form_1() : ufc::form()
3825
3791
  {
3826
3792
    // Do nothing
3827
3793
  }
3828
3794
 
3829
3795
  /// Destructor
3830
 
  virtual ~UFC_Poisson2D_4LinearForm()
 
3796
  virtual ~poisson2d_4_form_1()
3831
3797
  {
3832
3798
    // Do nothing
3833
3799
  }
3835
3801
  /// Return a string identifying the form
3836
3802
  virtual const char* signature() const
3837
3803
  {
3838
 
    return "w0_a0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | vi0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]*va0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]*dX(0)";
 
3804
    return "Form([Integral(Product(BasisFunction(FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 4), 0), Function(FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 4), 0)), Measure('cell', 0, None))])";
3839
3805
  }
3840
3806
 
3841
3807
  /// Return the rank of the global tensor (r)
3855
3821
  {
3856
3822
    return 1;
3857
3823
  }
3858
 
  
 
3824
 
3859
3825
  /// Return the number of exterior facet integrals
3860
3826
  virtual unsigned int num_exterior_facet_integrals() const
3861
3827
  {
3862
3828
    return 0;
3863
3829
  }
3864
 
  
 
3830
 
3865
3831
  /// Return the number of interior facet integrals
3866
3832
  virtual unsigned int num_interior_facet_integrals() const
3867
3833
  {
3868
3834
    return 0;
3869
3835
  }
3870
 
    
 
3836
 
3871
3837
  /// Create a new finite element for argument function i
3872
3838
  virtual ufc::finite_element* create_finite_element(unsigned int i) const
3873
3839
  {
3874
3840
    switch ( i )
3875
3841
    {
3876
3842
    case 0:
3877
 
      return new UFC_Poisson2D_4LinearForm_finite_element_0();
 
3843
      return new poisson2d_4_1_finite_element_0();
3878
3844
      break;
3879
3845
    case 1:
3880
 
      return new UFC_Poisson2D_4LinearForm_finite_element_1();
 
3846
      return new poisson2d_4_1_finite_element_1();
3881
3847
      break;
3882
3848
    }
3883
3849
    return 0;
3884
3850
  }
3885
 
  
 
3851
 
3886
3852
  /// Create a new dof map for argument function i
3887
3853
  virtual ufc::dof_map* create_dof_map(unsigned int i) const
3888
3854
  {
3889
3855
    switch ( i )
3890
3856
    {
3891
3857
    case 0:
3892
 
      return new UFC_Poisson2D_4LinearForm_dof_map_0();
 
3858
      return new poisson2d_4_1_dof_map_0();
3893
3859
      break;
3894
3860
    case 1:
3895
 
      return new UFC_Poisson2D_4LinearForm_dof_map_1();
 
3861
      return new poisson2d_4_1_dof_map_1();
3896
3862
      break;
3897
3863
    }
3898
3864
    return 0;
3901
3867
  /// Create a new cell integral on sub domain i
3902
3868
  virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
3903
3869
  {
3904
 
    return new UFC_Poisson2D_4LinearForm_cell_integral_0();
 
3870
    return new poisson2d_4_1_cell_integral_0();
3905
3871
  }
3906
3872
 
3907
3873
  /// Create a new exterior facet integral on sub domain i
3920
3886
 
3921
3887
// DOLFIN wrappers
3922
3888
 
3923
 
#include <dolfin/fem/Form.h>
 
3889
// Standard library includes
 
3890
#include <string>
 
3891
 
 
3892
// DOLFIN includes
 
3893
#include <dolfin/common/NoDeleter.h>
3924
3894
#include <dolfin/fem/FiniteElement.h>
3925
3895
#include <dolfin/fem/DofMap.h>
3926
 
#include <dolfin/function/Coefficient.h>
3927
 
#include <dolfin/function/Function.h>
 
3896
#include <dolfin/fem/Form.h>
3928
3897
#include <dolfin/function/FunctionSpace.h>
3929
 
 
3930
 
class Poisson2D_4BilinearFormFunctionSpace0 : public dolfin::FunctionSpace
3931
 
{
3932
 
public:
3933
 
 
3934
 
  Poisson2D_4BilinearFormFunctionSpace0(const dolfin::Mesh& mesh)
3935
 
    : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
3936
 
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Poisson2D_4LinearForm_finite_element_1()))),
3937
 
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Poisson2D_4LinearForm_dof_map_1()), mesh)))
3938
 
  {
3939
 
    // Do nothing
3940
 
  }
3941
 
 
3942
 
};
3943
 
 
3944
 
class Poisson2D_4BilinearFormFunctionSpace1 : public dolfin::FunctionSpace
3945
 
{
3946
 
public:
3947
 
 
3948
 
  Poisson2D_4BilinearFormFunctionSpace1(const dolfin::Mesh& mesh)
3949
 
    : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
3950
 
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Poisson2D_4LinearForm_finite_element_1()))),
3951
 
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Poisson2D_4LinearForm_dof_map_1()), mesh)))
3952
 
  {
3953
 
    // Do nothing
3954
 
  }
3955
 
 
3956
 
};
3957
 
 
3958
 
class Poisson2D_4LinearFormFunctionSpace0 : public dolfin::FunctionSpace
3959
 
{
3960
 
public:
3961
 
 
3962
 
  Poisson2D_4LinearFormFunctionSpace0(const dolfin::Mesh& mesh)
3963
 
    : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
3964
 
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Poisson2D_4LinearForm_finite_element_1()))),
3965
 
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Poisson2D_4LinearForm_dof_map_1()), mesh)))
3966
 
  {
3967
 
    // Do nothing
3968
 
  }
3969
 
 
3970
 
};
3971
 
 
3972
 
class Poisson2D_4LinearFormCoefficientSpace0 : public dolfin::FunctionSpace
3973
 
{
3974
 
public:
3975
 
 
3976
 
  Poisson2D_4LinearFormCoefficientSpace0(const dolfin::Mesh& mesh)
3977
 
    : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
3978
 
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Poisson2D_4LinearForm_finite_element_1()))),
3979
 
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Poisson2D_4LinearForm_dof_map_1()), mesh)))
3980
 
  {
3981
 
    // Do nothing
3982
 
  }
3983
 
 
3984
 
};
3985
 
 
3986
 
class Poisson2D_4TestSpace : public dolfin::FunctionSpace
3987
 
{
3988
 
public:
3989
 
 
3990
 
  Poisson2D_4TestSpace(const dolfin::Mesh& mesh)
3991
 
    : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
3992
 
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Poisson2D_4LinearForm_finite_element_1()))),
3993
 
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Poisson2D_4LinearForm_dof_map_1()), mesh)))
3994
 
  {
3995
 
    // Do nothing
3996
 
  }
3997
 
 
3998
 
};
3999
 
 
4000
 
class Poisson2D_4TrialSpace : public dolfin::FunctionSpace
4001
 
{
4002
 
public:
4003
 
 
4004
 
  Poisson2D_4TrialSpace(const dolfin::Mesh& mesh)
4005
 
    : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
4006
 
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Poisson2D_4LinearForm_finite_element_1()))),
4007
 
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Poisson2D_4LinearForm_dof_map_1()), mesh)))
4008
 
  {
4009
 
    // Do nothing
4010
 
  }
4011
 
 
4012
 
};
4013
 
 
4014
 
class Poisson2D_4CoefficientSpace : public dolfin::FunctionSpace
4015
 
{
4016
 
public:
4017
 
 
4018
 
  Poisson2D_4CoefficientSpace(const dolfin::Mesh& mesh)
4019
 
    : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
4020
 
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Poisson2D_4LinearForm_finite_element_1()))),
4021
 
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Poisson2D_4LinearForm_dof_map_1()), mesh)))
4022
 
  {
4023
 
    // Do nothing
4024
 
  }
4025
 
 
4026
 
};
4027
 
 
4028
 
class Poisson2D_4FunctionSpace : public dolfin::FunctionSpace
4029
 
{
4030
 
public:
4031
 
 
4032
 
  Poisson2D_4FunctionSpace(const dolfin::Mesh& mesh)
4033
 
    : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
4034
 
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Poisson2D_4LinearForm_finite_element_1()))),
4035
 
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Poisson2D_4LinearForm_dof_map_1()), mesh)))
4036
 
  {
4037
 
    // Do nothing
4038
 
  }
4039
 
 
4040
 
};
4041
 
 
4042
 
class Poisson2D_4BilinearForm : public dolfin::Form
4043
 
{
4044
 
public:
4045
 
 
4046
 
  // Create form on given function space(s)
4047
 
  Poisson2D_4BilinearForm(const dolfin::FunctionSpace& V0, const dolfin::FunctionSpace& V1) : dolfin::Form()
4048
 
  {
4049
 
    boost::shared_ptr<const dolfin::FunctionSpace> _V0(&V0, dolfin::NoDeleter<const dolfin::FunctionSpace>());
4050
 
    _function_spaces.push_back(_V0);
4051
 
    boost::shared_ptr<const dolfin::FunctionSpace> _V1(&V1, dolfin::NoDeleter<const dolfin::FunctionSpace>());
4052
 
    _function_spaces.push_back(_V1);
4053
 
 
4054
 
    _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Poisson2D_4BilinearForm());
4055
 
  }
4056
 
 
4057
 
  // Create form on given function space(s) (shared data)
4058
 
  Poisson2D_4BilinearForm(boost::shared_ptr<const dolfin::FunctionSpace> V0, boost::shared_ptr<const dolfin::FunctionSpace> V1) : dolfin::Form()
4059
 
  {
4060
 
    _function_spaces.push_back(V0);
4061
 
    _function_spaces.push_back(V1);
4062
 
 
4063
 
    _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Poisson2D_4BilinearForm());
4064
 
  }
4065
 
 
4066
 
  // Destructor
4067
 
  ~Poisson2D_4BilinearForm() {}
4068
 
 
4069
 
};
4070
 
 
4071
 
class Poisson2D_4LinearFormCoefficient0 : public dolfin::Coefficient
4072
 
{
4073
 
public:
4074
 
 
4075
 
  // Constructor
4076
 
  Poisson2D_4LinearFormCoefficient0(dolfin::Form& form) : dolfin::Coefficient(form) {}
4077
 
 
4078
 
  // Destructor  
4079
 
  ~Poisson2D_4LinearFormCoefficient0() {}
4080
 
 
4081
 
  // Attach function to coefficient
4082
 
  const Poisson2D_4LinearFormCoefficient0& operator= (dolfin::Function& v)
4083
 
  {
4084
 
    attach(v);
4085
 
    return *this;
4086
 
  }
4087
 
 
4088
 
  /// Create function space for coefficient
4089
 
  const dolfin::FunctionSpace* create_function_space() const
4090
 
  {
4091
 
    return new Poisson2D_4LinearFormCoefficientSpace0(form.mesh());
4092
 
  }
4093
 
  
4094
 
  /// Return coefficient number
4095
 
  dolfin::uint number() const
4096
 
  {
4097
 
    return 0;
4098
 
  }
4099
 
  
4100
 
  /// Return coefficient name
4101
 
  virtual std::string name() const
4102
 
  {
4103
 
    return "f";
4104
 
  }
4105
 
  
4106
 
};
4107
 
class Poisson2D_4LinearForm : public dolfin::Form
4108
 
{
4109
 
public:
4110
 
 
4111
 
  // Create form on given function space(s)
4112
 
  Poisson2D_4LinearForm(const dolfin::FunctionSpace& V0) : dolfin::Form(), f(*this)
4113
 
  {
4114
 
    boost::shared_ptr<const dolfin::FunctionSpace> _V0(&V0, dolfin::NoDeleter<const dolfin::FunctionSpace>());
4115
 
    _function_spaces.push_back(_V0);
4116
 
 
4117
 
    _coefficients.push_back(boost::shared_ptr<const dolfin::Function>(static_cast<const dolfin::Function*>(0)));
4118
 
 
4119
 
    _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Poisson2D_4LinearForm());
4120
 
  }
4121
 
 
4122
 
  // Create form on given function space(s) (shared data)
4123
 
  Poisson2D_4LinearForm(boost::shared_ptr<const dolfin::FunctionSpace> V0) : dolfin::Form(), f(*this)
4124
 
  {
4125
 
    _function_spaces.push_back(V0);
4126
 
 
4127
 
    _coefficients.push_back(boost::shared_ptr<const dolfin::Function>(static_cast<const dolfin::Function*>(0)));
4128
 
 
4129
 
    _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Poisson2D_4LinearForm());
4130
 
  }
4131
 
 
4132
 
  // Create form on given function space(s) with given coefficient(s)
4133
 
  Poisson2D_4LinearForm(const dolfin::FunctionSpace& V0, dolfin::Function& w0) : dolfin::Form(), f(*this)
4134
 
  {
4135
 
    boost::shared_ptr<const dolfin::FunctionSpace> _V0(&V0, dolfin::NoDeleter<const dolfin::FunctionSpace>());
4136
 
    _function_spaces.push_back(_V0);
4137
 
 
4138
 
    _coefficients.push_back(boost::shared_ptr<const dolfin::Function>(static_cast<const dolfin::Function*>(0)));
4139
 
 
4140
 
    this->f = w0;
4141
 
 
4142
 
    _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Poisson2D_4LinearForm());
4143
 
  }
4144
 
 
4145
 
  // Create form on given function space(s) with given coefficient(s) (shared data)
4146
 
  Poisson2D_4LinearForm(boost::shared_ptr<const dolfin::FunctionSpace> V0, dolfin::Function& w0) : dolfin::Form(), f(*this)
4147
 
  {
4148
 
    _function_spaces.push_back(V0);
4149
 
 
4150
 
    _coefficients.push_back(boost::shared_ptr<const dolfin::Function>(static_cast<const dolfin::Function*>(0)));
4151
 
 
4152
 
    this->f = w0;
4153
 
 
4154
 
    _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Poisson2D_4LinearForm());
4155
 
  }
4156
 
 
4157
 
  // Destructor
4158
 
  ~Poisson2D_4LinearForm() {}
4159
 
 
4160
 
  // Coefficients
4161
 
  Poisson2D_4LinearFormCoefficient0 f;
4162
 
 
4163
 
};
 
3898
#include <dolfin/function/GenericFunction.h>
 
3899
#include <dolfin/function/CoefficientAssigner.h>
 
3900
 
 
3901
namespace Poisson2D_4
 
3902
{
 
3903
 
 
3904
class CoefficientSpace_f: public dolfin::FunctionSpace
 
3905
{
 
3906
public:
 
3907
 
 
3908
  CoefficientSpace_f(const dolfin::Mesh& mesh):
 
3909
      dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
 
3910
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_1_finite_element_1()))),
 
3911
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_1_dof_map_1()), dolfin::reference_to_no_delete_pointer(mesh))))
 
3912
  {
 
3913
    // Do nothing
 
3914
  }
 
3915
 
 
3916
  CoefficientSpace_f(dolfin::Mesh& mesh):
 
3917
    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
 
3918
                          boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_1_finite_element_1()))),
 
3919
                          boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_1_dof_map_1()), dolfin::reference_to_no_delete_pointer(mesh))))
 
3920
  {
 
3921
    // Do nothing
 
3922
  }
 
3923
 
 
3924
  CoefficientSpace_f(boost::shared_ptr<dolfin::Mesh> mesh):
 
3925
      dolfin::FunctionSpace(mesh,
 
3926
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_1_finite_element_1()))),
 
3927
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_1_dof_map_1()), mesh)))
 
3928
  {
 
3929
      // Do nothing
 
3930
  }
 
3931
 
 
3932
  CoefficientSpace_f(boost::shared_ptr<const dolfin::Mesh> mesh):
 
3933
      dolfin::FunctionSpace(mesh,
 
3934
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_1_finite_element_1()))),
 
3935
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_1_dof_map_1()), mesh)))
 
3936
  {
 
3937
      // Do nothing
 
3938
  }
 
3939
 
 
3940
 
 
3941
  ~CoefficientSpace_f()
 
3942
  {
 
3943
  }
 
3944
 
 
3945
};
 
3946
 
 
3947
class Form_0_FunctionSpace_0: public dolfin::FunctionSpace
 
3948
{
 
3949
public:
 
3950
 
 
3951
  Form_0_FunctionSpace_0(const dolfin::Mesh& mesh):
 
3952
      dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
 
3953
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_0_finite_element_0()))),
 
3954
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_0_dof_map_0()), dolfin::reference_to_no_delete_pointer(mesh))))
 
3955
  {
 
3956
    // Do nothing
 
3957
  }
 
3958
 
 
3959
  Form_0_FunctionSpace_0(dolfin::Mesh& mesh):
 
3960
    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
 
3961
                          boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_0_finite_element_0()))),
 
3962
                          boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_0_dof_map_0()), dolfin::reference_to_no_delete_pointer(mesh))))
 
3963
  {
 
3964
    // Do nothing
 
3965
  }
 
3966
 
 
3967
  Form_0_FunctionSpace_0(boost::shared_ptr<dolfin::Mesh> mesh):
 
3968
      dolfin::FunctionSpace(mesh,
 
3969
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_0_finite_element_0()))),
 
3970
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_0_dof_map_0()), mesh)))
 
3971
  {
 
3972
      // Do nothing
 
3973
  }
 
3974
 
 
3975
  Form_0_FunctionSpace_0(boost::shared_ptr<const dolfin::Mesh> mesh):
 
3976
      dolfin::FunctionSpace(mesh,
 
3977
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_0_finite_element_0()))),
 
3978
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_0_dof_map_0()), mesh)))
 
3979
  {
 
3980
      // Do nothing
 
3981
  }
 
3982
 
 
3983
 
 
3984
  ~Form_0_FunctionSpace_0()
 
3985
  {
 
3986
  }
 
3987
 
 
3988
};
 
3989
 
 
3990
class Form_0_FunctionSpace_1: public dolfin::FunctionSpace
 
3991
{
 
3992
public:
 
3993
 
 
3994
  Form_0_FunctionSpace_1(const dolfin::Mesh& mesh):
 
3995
      dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
 
3996
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_0_finite_element_1()))),
 
3997
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_0_dof_map_1()), dolfin::reference_to_no_delete_pointer(mesh))))
 
3998
  {
 
3999
    // Do nothing
 
4000
  }
 
4001
 
 
4002
  Form_0_FunctionSpace_1(dolfin::Mesh& mesh):
 
4003
    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
 
4004
                          boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_0_finite_element_1()))),
 
4005
                          boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_0_dof_map_1()), dolfin::reference_to_no_delete_pointer(mesh))))
 
4006
  {
 
4007
    // Do nothing
 
4008
  }
 
4009
 
 
4010
  Form_0_FunctionSpace_1(boost::shared_ptr<dolfin::Mesh> mesh):
 
4011
      dolfin::FunctionSpace(mesh,
 
4012
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_0_finite_element_1()))),
 
4013
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_0_dof_map_1()), mesh)))
 
4014
  {
 
4015
      // Do nothing
 
4016
  }
 
4017
 
 
4018
  Form_0_FunctionSpace_1(boost::shared_ptr<const dolfin::Mesh> mesh):
 
4019
      dolfin::FunctionSpace(mesh,
 
4020
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_0_finite_element_1()))),
 
4021
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_0_dof_map_1()), mesh)))
 
4022
  {
 
4023
      // Do nothing
 
4024
  }
 
4025
 
 
4026
 
 
4027
  ~Form_0_FunctionSpace_1()
 
4028
  {
 
4029
  }
 
4030
 
 
4031
};
 
4032
 
 
4033
class Form_0: public dolfin::Form
 
4034
{
 
4035
public:
 
4036
 
 
4037
  // Constructor
 
4038
  Form_0(const dolfin::FunctionSpace& V0, const dolfin::FunctionSpace& V1):
 
4039
    dolfin::Form(2, 0)
 
4040
  {
 
4041
    _function_spaces[0] = reference_to_no_delete_pointer(V0);
 
4042
    _function_spaces[1] = reference_to_no_delete_pointer(V1);
 
4043
 
 
4044
    _ufc_form = boost::shared_ptr<const ufc::form>(new poisson2d_4_form_0());
 
4045
  }
 
4046
 
 
4047
  // Constructor
 
4048
  Form_0(boost::shared_ptr<const dolfin::FunctionSpace> V0, boost::shared_ptr<const dolfin::FunctionSpace> V1):
 
4049
    dolfin::Form(2, 0)
 
4050
  {
 
4051
    _function_spaces[0] = V0;
 
4052
    _function_spaces[1] = V1;
 
4053
 
 
4054
    _ufc_form = boost::shared_ptr<const ufc::form>(new poisson2d_4_form_0());
 
4055
  }
 
4056
 
 
4057
  // Destructor
 
4058
  ~Form_0()
 
4059
  {}
 
4060
 
 
4061
  /// Return the number of the coefficient with this name
 
4062
  virtual dolfin::uint coefficient_number(const std::string& name) const
 
4063
  {
 
4064
 
 
4065
    dolfin::error("No coefficients.");
 
4066
    return 0;
 
4067
  }
 
4068
 
 
4069
  /// Return the name of the coefficient with this number
 
4070
  virtual std::string coefficient_name(dolfin::uint i) const
 
4071
  {
 
4072
 
 
4073
    dolfin::error("No coefficients.");
 
4074
    return "unnamed";
 
4075
  }
 
4076
 
 
4077
  // Typedefs
 
4078
  typedef Form_0_FunctionSpace_0 TestSpace;
 
4079
  typedef Form_0_FunctionSpace_1 TrialSpace;
 
4080
 
 
4081
  // Coefficients
 
4082
};
 
4083
 
 
4084
class Form_1_FunctionSpace_0: public dolfin::FunctionSpace
 
4085
{
 
4086
public:
 
4087
 
 
4088
  Form_1_FunctionSpace_0(const dolfin::Mesh& mesh):
 
4089
      dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
 
4090
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_1_finite_element_0()))),
 
4091
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_1_dof_map_0()), dolfin::reference_to_no_delete_pointer(mesh))))
 
4092
  {
 
4093
    // Do nothing
 
4094
  }
 
4095
 
 
4096
  Form_1_FunctionSpace_0(dolfin::Mesh& mesh):
 
4097
    dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
 
4098
                          boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_1_finite_element_0()))),
 
4099
                          boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_1_dof_map_0()), dolfin::reference_to_no_delete_pointer(mesh))))
 
4100
  {
 
4101
    // Do nothing
 
4102
  }
 
4103
 
 
4104
  Form_1_FunctionSpace_0(boost::shared_ptr<dolfin::Mesh> mesh):
 
4105
      dolfin::FunctionSpace(mesh,
 
4106
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_1_finite_element_0()))),
 
4107
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_1_dof_map_0()), mesh)))
 
4108
  {
 
4109
      // Do nothing
 
4110
  }
 
4111
 
 
4112
  Form_1_FunctionSpace_0(boost::shared_ptr<const dolfin::Mesh> mesh):
 
4113
      dolfin::FunctionSpace(mesh,
 
4114
                            boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new poisson2d_4_1_finite_element_0()))),
 
4115
                            boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new poisson2d_4_1_dof_map_0()), mesh)))
 
4116
  {
 
4117
      // Do nothing
 
4118
  }
 
4119
 
 
4120
 
 
4121
  ~Form_1_FunctionSpace_0()
 
4122
  {
 
4123
  }
 
4124
 
 
4125
};
 
4126
 
 
4127
typedef CoefficientSpace_f Form_1_FunctionSpace_1;
 
4128
 
 
4129
class Form_1: public dolfin::Form
 
4130
{
 
4131
public:
 
4132
 
 
4133
  // Constructor
 
4134
  Form_1(const dolfin::FunctionSpace& V0):
 
4135
    dolfin::Form(1, 1), f(*this, 0)
 
4136
  {
 
4137
    _function_spaces[0] = reference_to_no_delete_pointer(V0);
 
4138
 
 
4139
    _ufc_form = boost::shared_ptr<const ufc::form>(new poisson2d_4_form_1());
 
4140
  }
 
4141
 
 
4142
  // Constructor
 
4143
  Form_1(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
 
4144
    dolfin::Form(1, 1), f(*this, 0)
 
4145
  {
 
4146
    _function_spaces[0] = reference_to_no_delete_pointer(V0);
 
4147
 
 
4148
    this->f = f;
 
4149
 
 
4150
    _ufc_form = boost::shared_ptr<const ufc::form>(new poisson2d_4_form_1());
 
4151
  }
 
4152
 
 
4153
  // Constructor
 
4154
  Form_1(const dolfin::FunctionSpace& V0, boost::shared_ptr<const dolfin::GenericFunction> f):
 
4155
    dolfin::Form(1, 1), f(*this, 0)
 
4156
  {
 
4157
    _function_spaces[0] = reference_to_no_delete_pointer(V0);
 
4158
 
 
4159
    this->f = *f;
 
4160
 
 
4161
    _ufc_form = boost::shared_ptr<const ufc::form>(new poisson2d_4_form_1());
 
4162
  }
 
4163
 
 
4164
  // Constructor
 
4165
  Form_1(boost::shared_ptr<const dolfin::FunctionSpace> V0):
 
4166
    dolfin::Form(1, 1), f(*this, 0)
 
4167
  {
 
4168
    _function_spaces[0] = V0;
 
4169
 
 
4170
    _ufc_form = boost::shared_ptr<const ufc::form>(new poisson2d_4_form_1());
 
4171
  }
 
4172
 
 
4173
  // Constructor
 
4174
  Form_1(boost::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
 
4175
    dolfin::Form(1, 1), f(*this, 0)
 
4176
  {
 
4177
    _function_spaces[0] = V0;
 
4178
 
 
4179
    this->f = f;
 
4180
 
 
4181
    _ufc_form = boost::shared_ptr<const ufc::form>(new poisson2d_4_form_1());
 
4182
  }
 
4183
 
 
4184
  // Constructor
 
4185
  Form_1(boost::shared_ptr<const dolfin::FunctionSpace> V0, boost::shared_ptr<const dolfin::GenericFunction> f):
 
4186
    dolfin::Form(1, 1), f(*this, 0)
 
4187
  {
 
4188
    _function_spaces[0] = V0;
 
4189
 
 
4190
    this->f = *f;
 
4191
 
 
4192
    _ufc_form = boost::shared_ptr<const ufc::form>(new poisson2d_4_form_1());
 
4193
  }
 
4194
 
 
4195
  // Destructor
 
4196
  ~Form_1()
 
4197
  {}
 
4198
 
 
4199
  /// Return the number of the coefficient with this name
 
4200
  virtual dolfin::uint coefficient_number(const std::string& name) const
 
4201
  {
 
4202
    if (name == "f")
 
4203
      return 0;
 
4204
 
 
4205
    dolfin::error("Invalid coefficient.");
 
4206
    return 0;
 
4207
  }
 
4208
 
 
4209
  /// Return the name of the coefficient with this number
 
4210
  virtual std::string coefficient_name(dolfin::uint i) const
 
4211
  {
 
4212
    switch (i)
 
4213
    {
 
4214
    case 0:
 
4215
      return "f";
 
4216
    }
 
4217
 
 
4218
    dolfin::error("Invalid coefficient.");
 
4219
    return "unnamed";
 
4220
  }
 
4221
 
 
4222
  // Typedefs
 
4223
  typedef Form_1_FunctionSpace_0 TestSpace;
 
4224
  typedef Form_1_FunctionSpace_1 CoefficientSpace_f;
 
4225
 
 
4226
  // Coefficients
 
4227
  dolfin::CoefficientAssigner f;
 
4228
};
 
4229
 
 
4230
// Class typedefs
 
4231
typedef Form_0 BilinearForm;
 
4232
typedef Form_1 LinearForm;
 
4233
typedef Form_0::TestSpace FunctionSpace;
 
4234
 
 
4235
} // namespace Poisson2D_4
4164
4236
 
4165
4237
#endif