~njansson/dolfin/hpc

« back to all changes in this revision

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

  • Committer: Johannes Ring
  • Date: 2008-03-05 22:43:06 UTC
  • Revision ID: johannr@simula.no-20080305224306-2npsdyhfdpl2esji
The BIG commit!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// This code conforms with the UFC specification version 1.0
 
2
// and was automatically generated by FFC version 0.4.3.
 
3
//
 
4
// Warning: This code was generated with the option '-l dolfin'
 
5
// and contains DOLFIN-specific wrappers that depend on DOLFIN.
 
6
 
 
7
#ifndef __POISSON3D_3_H
 
8
#define __POISSON3D_3_H
 
9
 
 
10
#include <cmath>
 
11
#include <stdexcept>
 
12
#include <fstream>
 
13
#include <ufc.h>
 
14
 
 
15
/// This class defines the interface for a finite element.
 
16
 
 
17
class UFC_Poisson3D_3BilinearForm_finite_element_0: public ufc::finite_element
 
18
{
 
19
public:
 
20
 
 
21
  /// Constructor
 
22
  UFC_Poisson3D_3BilinearForm_finite_element_0() : ufc::finite_element()
 
23
  {
 
24
    // Do nothing
 
25
  }
 
26
 
 
27
  /// Destructor
 
28
  virtual ~UFC_Poisson3D_3BilinearForm_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 "Lagrange finite element of degree 3 on a tetrahedron";
 
37
  }
 
38
 
 
39
  /// Return the cell shape
 
40
  virtual ufc::shape cell_shape() const
 
41
  {
 
42
    return ufc::tetrahedron;
 
43
  }
 
44
 
 
45
  /// Return the dimension of the finite element function space
 
46
  virtual unsigned int space_dimension() const
 
47
  {
 
48
    return 20;
 
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_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
76
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
77
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
78
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
79
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
80
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
81
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
82
      
 
83
    // Compute sub determinants
 
84
    const double d00 = J_11*J_22 - J_12*J_21;
 
85
    const double d01 = J_12*J_20 - J_10*J_22;
 
86
    const double d02 = J_10*J_21 - J_11*J_20;
 
87
    
 
88
    const double d10 = J_02*J_21 - J_01*J_22;
 
89
    const double d11 = J_00*J_22 - J_02*J_20;
 
90
    const double d12 = J_01*J_20 - J_00*J_21;
 
91
    
 
92
    const double d20 = J_01*J_12 - J_02*J_11;
 
93
    const double d21 = J_02*J_10 - J_00*J_12;
 
94
    const double d22 = J_00*J_11 - J_01*J_10;
 
95
      
 
96
    // Compute determinant of Jacobian
 
97
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
98
    
 
99
    // Compute inverse of Jacobian
 
100
    
 
101
    // Compute constants
 
102
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
103
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
104
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
105
    
 
106
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
107
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
108
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
109
    
 
110
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
111
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
112
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
113
    
 
114
    // Get coordinates and map to the UFC reference element
 
115
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
116
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
117
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
118
    
 
119
    // Map coordinates to the reference cube
 
120
    if (std::abs(y + z - 1.0) < 1e-14)
 
121
      x = 1.0;
 
122
    else
 
123
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
124
    if (std::abs(z - 1.0) < 1e-14)
 
125
      y = -1.0;
 
126
    else
 
127
      y = 2.0 * y/(1.0 - z) - 1.0;
 
128
    z = 2.0 * z - 1.0;
 
129
    
 
130
    // Reset values
 
131
    *values = 0;
 
132
    
 
133
    // Map degree of freedom to element degree of freedom
 
134
    const unsigned int dof = i;
 
135
    
 
136
    // Generate scalings
 
137
    const double scalings_y_0 = 1;
 
138
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
 
139
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
 
140
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
 
141
    const double scalings_z_0 = 1;
 
142
    const double scalings_z_1 = scalings_z_0*(0.5 - 0.5*z);
 
143
    const double scalings_z_2 = scalings_z_1*(0.5 - 0.5*z);
 
144
    const double scalings_z_3 = scalings_z_2*(0.5 - 0.5*z);
 
145
    
 
146
    // Compute psitilde_a
 
147
    const double psitilde_a_0 = 1;
 
148
    const double psitilde_a_1 = x;
 
149
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
 
150
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
 
151
    
 
152
    // Compute psitilde_bs
 
153
    const double psitilde_bs_0_0 = 1;
 
154
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
 
155
    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;
 
156
    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;
 
157
    const double psitilde_bs_1_0 = 1;
 
158
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
 
159
    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;
 
160
    const double psitilde_bs_2_0 = 1;
 
161
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
 
162
    const double psitilde_bs_3_0 = 1;
 
163
    
 
164
    // Compute psitilde_cs
 
165
    const double psitilde_cs_00_0 = 1;
 
166
    const double psitilde_cs_00_1 = 2*z + 1;
 
167
    const double psitilde_cs_00_2 = 0.3125*psitilde_cs_00_1 + 1.875*z*psitilde_cs_00_1 - 0.5625*psitilde_cs_00_0;
 
168
    const double psitilde_cs_00_3 = 0.155555555555556*psitilde_cs_00_2 + 1.86666666666667*z*psitilde_cs_00_2 - 0.711111111111111*psitilde_cs_00_1;
 
169
    const double psitilde_cs_01_0 = 1;
 
170
    const double psitilde_cs_01_1 = 3*z + 2;
 
171
    const double psitilde_cs_01_2 = 0.777777777777778*psitilde_cs_01_1 + 2.33333333333333*z*psitilde_cs_01_1 - 0.555555555555556*psitilde_cs_01_0;
 
172
    const double psitilde_cs_02_0 = 1;
 
173
    const double psitilde_cs_02_1 = 4*z + 3;
 
174
    const double psitilde_cs_03_0 = 1;
 
175
    const double psitilde_cs_10_0 = 1;
 
176
    const double psitilde_cs_10_1 = 3*z + 2;
 
177
    const double psitilde_cs_10_2 = 0.777777777777778*psitilde_cs_10_1 + 2.33333333333333*z*psitilde_cs_10_1 - 0.555555555555556*psitilde_cs_10_0;
 
178
    const double psitilde_cs_11_0 = 1;
 
179
    const double psitilde_cs_11_1 = 4*z + 3;
 
180
    const double psitilde_cs_12_0 = 1;
 
181
    const double psitilde_cs_20_0 = 1;
 
182
    const double psitilde_cs_20_1 = 4*z + 3;
 
183
    const double psitilde_cs_21_0 = 1;
 
184
    const double psitilde_cs_30_0 = 1;
 
185
    
 
186
    // Compute basisvalues
 
187
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
188
    const double basisvalue1 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_0;
 
189
    const double basisvalue2 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_0;
 
190
    const double basisvalue3 = 1.11803398874989*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_1;
 
191
    const double basisvalue4 = 5.1234753829798*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_0;
 
192
    const double basisvalue5 = 3.96862696659689*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_0;
 
193
    const double basisvalue6 = 2.29128784747792*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_0;
 
194
    const double basisvalue7 = 3.24037034920393*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_1;
 
195
    const double basisvalue8 = 1.87082869338697*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_1;
 
196
    const double basisvalue9 = 1.3228756555323*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_2;
 
197
    const double basisvalue10 = 7.93725393319377*psitilde_a_3*scalings_y_3*psitilde_bs_3_0*scalings_z_3*psitilde_cs_30_0;
 
198
    const double basisvalue11 = 6.70820393249937*psitilde_a_2*scalings_y_2*psitilde_bs_2_1*scalings_z_3*psitilde_cs_21_0;
 
199
    const double basisvalue12 = 5.19615242270663*psitilde_a_1*scalings_y_1*psitilde_bs_1_2*scalings_z_3*psitilde_cs_12_0;
 
200
    const double basisvalue13 = 3*psitilde_a_0*scalings_y_0*psitilde_bs_0_3*scalings_z_3*psitilde_cs_03_0;
 
201
    const double basisvalue14 = 5.80947501931113*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_1;
 
202
    const double basisvalue15 = 4.5*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_1;
 
203
    const double basisvalue16 = 2.59807621135332*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_1;
 
204
    const double basisvalue17 = 3.67423461417477*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_2;
 
205
    const double basisvalue18 = 2.12132034355964*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_2;
 
206
    const double basisvalue19 = 1.5*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_3;
 
207
    
 
208
    // Table(s) of coefficients
 
209
    const static double coefficients0[20][20] = \
 
210
    {{0.0288675134594813, 0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, 0.014173667737846, 0.00818317088384971, 0.0115727512471569, 0.0066815310478106, 0.00472455591261534, -0.028347335475692, -0.0239578711874978, -0.0185576872239523, -0.0107142857142857, -0.0207481250689683, -0.0160714285714286, -0.00927884361197613, -0.0131222664791956, -0.00757614408414158, -0.00535714285714285},
 
211
    {0.0288675134594813, -0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, -0.014173667737846, 0.00818317088384972, -0.0115727512471569, 0.00668153104781061, 0.00472455591261535, 0.028347335475692, -0.0239578711874977, 0.0185576872239523, -0.0107142857142857, -0.0207481250689683, 0.0160714285714286, -0.00927884361197613, 0.0131222664791956, -0.00757614408414158, -0.00535714285714286},
 
212
    {0.0288675134594813, 0, -0.0150584650484208, 0.00532397137499948, 0, 0, 0.0245495126515492, 0, -0.0133630620956212, 0.00472455591261535, 0, 0, 0, 0.0428571428571429, 0, 0, -0.0278365308359284, 0, 0.0151522881682832, -0.00535714285714286},
 
213
    {0.0288675134594812, 0, 0, -0.0159719141249985, 0, 0, 0, 0, 0, 0.0283473354756921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0535714285714286},
 
214
    {0, 0, 0.112938487863156, -0.063887656499994, 0, 0, 0.0736485379546474, 0, 0.0267261241912424, -0.0236227795630767, 0, 0, 0, 0, 0, 0, 0.0649519052838329, 0, -0.0606091526731327, 0.0267857142857143},
 
215
    {0, 0, -0.0225876975726313, 0.127775312999988, 0, 0, 0, 0, 0.0668153104781061, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0, 0.0757614408414158, -0.0535714285714286},
 
216
    {0, 0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, -0.0425210032135381, 0.0245495126515492, 0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, -0.0375, 0.021650635094611, -0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
217
    {0, -0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, 0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
218
    {0, 0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, 0.014173667737846, -0.0245495126515492, -0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, -0.0618589574131742, 0.0428571428571429, -0.0069160416896561, -0.0160714285714286, 0.0154647393532936, 0.00874817765279706, 0, -0.00535714285714286},
 
219
    {0, -0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, 0.0566946709513841, 0.0245495126515492, -0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, 0.0618589574131742, -0.0642857142857143, 0, -0.0214285714285714, 0.00927884361197612, 0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
220
    {0, -0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, 0.0425210032135381, 0.0245495126515492, -0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, 0.0375, 0.021650635094611, 0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
221
    {0, 0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, -0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, -0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
222
    {0, -0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, -0.014173667737846, -0.0245495126515491, 0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, 0.0618589574131742, 0.0428571428571429, -0.0069160416896561, 0.0160714285714286, 0.0154647393532935, -0.00874817765279706, 0, -0.00535714285714285},
 
223
    {0, 0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, -0.0566946709513841, 0.0245495126515491, 0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, -0.0618589574131742, -0.0642857142857143, 0, 0.0214285714285714, 0.00927884361197613, -0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
224
    {0, -0.117369119465393, -0.0451753951452625, -0.031943828249997, -0.018298126367785, 0.042521003213538, 0.0409158544192486, 0.0347182537414707, 0.033407655239053, 0.0236227795630767, 0.0850420064270761, 0.0239578711874978, -0.00618589574131742, -0.0107142857142857, 0.0207481250689683, -0.00535714285714286, -0.00927884361197612, -0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
225
    {0, 0.117369119465393, -0.0451753951452626, -0.031943828249997, -0.018298126367785, -0.0425210032135381, 0.0409158544192486, -0.0347182537414707, 0.033407655239053, 0.0236227795630767, -0.0850420064270761, 0.0239578711874977, 0.00618589574131741, -0.0107142857142857, 0.0207481250689683, 0.00535714285714286, -0.00927884361197612, 0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
226
    {0.259807621135332, 0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, 0.0850420064270761, -0.0736485379546474, 0.0694365074829413, 0.0400891862868637, -0.0992156741649221, 0, 0, 0, 0, 0, 0.075, -0.0649519052838329, -0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
227
    {0.259807621135332, -0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, -0.0850420064270761, -0.0736485379546474, -0.0694365074829414, 0.0400891862868637, -0.0992156741649222, 0, 0, 0, 0, 0, -0.075, -0.0649519052838329, 0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
228
    {0.259807621135332, 0, -0.135526185435788, 0.0479157423749955, -0.10978875820671, 0, 0.0245495126515491, 0, -0.0801783725737273, -0.0992156741649221, 0, 0, 0, 0, -0.0968245836551854, 0, 0.021650635094611, 0, 0.0303045763365663, 0.0267857142857143},
 
229
    {0.259807621135332, 0, 0, -0.143747227124986, -0.10978875820671, 0, -0.122747563257746, 0, 0, 0.0425210032135381, 0, -0.095831484749991, 0, 0.0428571428571429, 0.0138320833793122, 0, 0.0154647393532935, 0, 0, -0.00535714285714285}};
 
230
    
 
231
    // Extract relevant coefficients
 
232
    const double coeff0_0 = coefficients0[dof][0];
 
233
    const double coeff0_1 = coefficients0[dof][1];
 
234
    const double coeff0_2 = coefficients0[dof][2];
 
235
    const double coeff0_3 = coefficients0[dof][3];
 
236
    const double coeff0_4 = coefficients0[dof][4];
 
237
    const double coeff0_5 = coefficients0[dof][5];
 
238
    const double coeff0_6 = coefficients0[dof][6];
 
239
    const double coeff0_7 = coefficients0[dof][7];
 
240
    const double coeff0_8 = coefficients0[dof][8];
 
241
    const double coeff0_9 = coefficients0[dof][9];
 
242
    const double coeff0_10 = coefficients0[dof][10];
 
243
    const double coeff0_11 = coefficients0[dof][11];
 
244
    const double coeff0_12 = coefficients0[dof][12];
 
245
    const double coeff0_13 = coefficients0[dof][13];
 
246
    const double coeff0_14 = coefficients0[dof][14];
 
247
    const double coeff0_15 = coefficients0[dof][15];
 
248
    const double coeff0_16 = coefficients0[dof][16];
 
249
    const double coeff0_17 = coefficients0[dof][17];
 
250
    const double coeff0_18 = coefficients0[dof][18];
 
251
    const double coeff0_19 = coefficients0[dof][19];
 
252
    
 
253
    // Compute value(s)
 
254
    *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 + coeff0_15*basisvalue15 + coeff0_16*basisvalue16 + coeff0_17*basisvalue17 + coeff0_18*basisvalue18 + coeff0_19*basisvalue19;
 
255
  }
 
256
 
 
257
  /// Evaluate all basis functions at given point in cell
 
258
  virtual void evaluate_basis_all(double* values,
 
259
                                  const double* coordinates,
 
260
                                  const ufc::cell& c) const
 
261
  {
 
262
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
 
263
  }
 
264
 
 
265
  /// Evaluate order n derivatives of basis function i at given point in cell
 
266
  virtual void evaluate_basis_derivatives(unsigned int i,
 
267
                                          unsigned int n,
 
268
                                          double* values,
 
269
                                          const double* coordinates,
 
270
                                          const ufc::cell& c) const
 
271
  {
 
272
    // Extract vertex coordinates
 
273
    const double * const * element_coordinates = c.coordinates;
 
274
    
 
275
    // Compute Jacobian of affine map from reference cell
 
276
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
277
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
278
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
279
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
280
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
281
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
282
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
283
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
284
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
285
      
 
286
    // Compute sub determinants
 
287
    const double d00 = J_11*J_22 - J_12*J_21;
 
288
    const double d01 = J_12*J_20 - J_10*J_22;
 
289
    const double d02 = J_10*J_21 - J_11*J_20;
 
290
    
 
291
    const double d10 = J_02*J_21 - J_01*J_22;
 
292
    const double d11 = J_00*J_22 - J_02*J_20;
 
293
    const double d12 = J_01*J_20 - J_00*J_21;
 
294
    
 
295
    const double d20 = J_01*J_12 - J_02*J_11;
 
296
    const double d21 = J_02*J_10 - J_00*J_12;
 
297
    const double d22 = J_00*J_11 - J_01*J_10;
 
298
      
 
299
    // Compute determinant of Jacobian
 
300
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
301
    
 
302
    // Compute inverse of Jacobian
 
303
    
 
304
    // Compute constants
 
305
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
306
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
307
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
308
    
 
309
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
310
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
311
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
312
    
 
313
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
314
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
315
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
316
    
 
317
    // Get coordinates and map to the UFC reference element
 
318
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
319
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
320
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
321
    
 
322
    // Map coordinates to the reference cube
 
323
    if (std::abs(y + z - 1.0) < 1e-14)
 
324
      x = 1.0;
 
325
    else
 
326
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
327
    if (std::abs(z - 1.0) < 1e-14)
 
328
      y = -1.0;
 
329
    else
 
330
      y = 2.0 * y/(1.0 - z) - 1.0;
 
331
    z = 2.0 * z - 1.0;
 
332
    
 
333
    // Compute number of derivatives
 
334
    unsigned int num_derivatives = 1;
 
335
    
 
336
    for (unsigned int j = 0; j < n; j++)
 
337
      num_derivatives *= 3;
 
338
    
 
339
    
 
340
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
 
341
    unsigned int **combinations = new unsigned int *[num_derivatives];
 
342
        
 
343
    for (unsigned int j = 0; j < num_derivatives; j++)
 
344
    {
 
345
      combinations[j] = new unsigned int [n];
 
346
      for (unsigned int k = 0; k < n; k++)
 
347
        combinations[j][k] = 0;
 
348
    }
 
349
        
 
350
    // Generate combinations of derivatives
 
351
    for (unsigned int row = 1; row < num_derivatives; row++)
 
352
    {
 
353
      for (unsigned int num = 0; num < row; num++)
 
354
      {
 
355
        for (unsigned int col = n-1; col+1 > 0; col--)
 
356
        {
 
357
          if (combinations[row][col] + 1 > 2)
 
358
            combinations[row][col] = 0;
 
359
          else
 
360
          {
 
361
            combinations[row][col] += 1;
 
362
            break;
 
363
          }
 
364
        }
 
365
      }
 
366
    }
 
367
    
 
368
    // Compute inverse of Jacobian
 
369
    const double Jinv[3][3] ={{d00 / detJ, d10 / detJ, d20 / detJ}, {d01 / detJ, d11 / detJ, d21 / detJ}, {d02 / detJ, d12 / detJ, d22 / detJ}};
 
370
    
 
371
    // Declare transformation matrix
 
372
    // Declare pointer to two dimensional array and initialise
 
373
    double **transform = new double *[num_derivatives];
 
374
        
 
375
    for (unsigned int j = 0; j < num_derivatives; j++)
 
376
    {
 
377
      transform[j] = new double [num_derivatives];
 
378
      for (unsigned int k = 0; k < num_derivatives; k++)
 
379
        transform[j][k] = 1;
 
380
    }
 
381
    
 
382
    // Construct transformation matrix
 
383
    for (unsigned int row = 0; row < num_derivatives; row++)
 
384
    {
 
385
      for (unsigned int col = 0; col < num_derivatives; col++)
 
386
      {
 
387
        for (unsigned int k = 0; k < n; k++)
 
388
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
 
389
      }
 
390
    }
 
391
    
 
392
    // Reset values
 
393
    for (unsigned int j = 0; j < 1*num_derivatives; j++)
 
394
      values[j] = 0;
 
395
    
 
396
    // Map degree of freedom to element degree of freedom
 
397
    const unsigned int dof = i;
 
398
    
 
399
    // Generate scalings
 
400
    const double scalings_y_0 = 1;
 
401
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
 
402
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
 
403
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
 
404
    const double scalings_z_0 = 1;
 
405
    const double scalings_z_1 = scalings_z_0*(0.5 - 0.5*z);
 
406
    const double scalings_z_2 = scalings_z_1*(0.5 - 0.5*z);
 
407
    const double scalings_z_3 = scalings_z_2*(0.5 - 0.5*z);
 
408
    
 
409
    // Compute psitilde_a
 
410
    const double psitilde_a_0 = 1;
 
411
    const double psitilde_a_1 = x;
 
412
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
 
413
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
 
414
    
 
415
    // Compute psitilde_bs
 
416
    const double psitilde_bs_0_0 = 1;
 
417
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
 
418
    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;
 
419
    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;
 
420
    const double psitilde_bs_1_0 = 1;
 
421
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
 
422
    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;
 
423
    const double psitilde_bs_2_0 = 1;
 
424
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
 
425
    const double psitilde_bs_3_0 = 1;
 
426
    
 
427
    // Compute psitilde_cs
 
428
    const double psitilde_cs_00_0 = 1;
 
429
    const double psitilde_cs_00_1 = 2*z + 1;
 
430
    const double psitilde_cs_00_2 = 0.3125*psitilde_cs_00_1 + 1.875*z*psitilde_cs_00_1 - 0.5625*psitilde_cs_00_0;
 
431
    const double psitilde_cs_00_3 = 0.155555555555556*psitilde_cs_00_2 + 1.86666666666667*z*psitilde_cs_00_2 - 0.711111111111111*psitilde_cs_00_1;
 
432
    const double psitilde_cs_01_0 = 1;
 
433
    const double psitilde_cs_01_1 = 3*z + 2;
 
434
    const double psitilde_cs_01_2 = 0.777777777777778*psitilde_cs_01_1 + 2.33333333333333*z*psitilde_cs_01_1 - 0.555555555555556*psitilde_cs_01_0;
 
435
    const double psitilde_cs_02_0 = 1;
 
436
    const double psitilde_cs_02_1 = 4*z + 3;
 
437
    const double psitilde_cs_03_0 = 1;
 
438
    const double psitilde_cs_10_0 = 1;
 
439
    const double psitilde_cs_10_1 = 3*z + 2;
 
440
    const double psitilde_cs_10_2 = 0.777777777777778*psitilde_cs_10_1 + 2.33333333333333*z*psitilde_cs_10_1 - 0.555555555555556*psitilde_cs_10_0;
 
441
    const double psitilde_cs_11_0 = 1;
 
442
    const double psitilde_cs_11_1 = 4*z + 3;
 
443
    const double psitilde_cs_12_0 = 1;
 
444
    const double psitilde_cs_20_0 = 1;
 
445
    const double psitilde_cs_20_1 = 4*z + 3;
 
446
    const double psitilde_cs_21_0 = 1;
 
447
    const double psitilde_cs_30_0 = 1;
 
448
    
 
449
    // Compute basisvalues
 
450
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
451
    const double basisvalue1 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_0;
 
452
    const double basisvalue2 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_0;
 
453
    const double basisvalue3 = 1.11803398874989*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_1;
 
454
    const double basisvalue4 = 5.1234753829798*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_0;
 
455
    const double basisvalue5 = 3.96862696659689*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_0;
 
456
    const double basisvalue6 = 2.29128784747792*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_0;
 
457
    const double basisvalue7 = 3.24037034920393*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_1;
 
458
    const double basisvalue8 = 1.87082869338697*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_1;
 
459
    const double basisvalue9 = 1.3228756555323*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_2;
 
460
    const double basisvalue10 = 7.93725393319377*psitilde_a_3*scalings_y_3*psitilde_bs_3_0*scalings_z_3*psitilde_cs_30_0;
 
461
    const double basisvalue11 = 6.70820393249937*psitilde_a_2*scalings_y_2*psitilde_bs_2_1*scalings_z_3*psitilde_cs_21_0;
 
462
    const double basisvalue12 = 5.19615242270663*psitilde_a_1*scalings_y_1*psitilde_bs_1_2*scalings_z_3*psitilde_cs_12_0;
 
463
    const double basisvalue13 = 3*psitilde_a_0*scalings_y_0*psitilde_bs_0_3*scalings_z_3*psitilde_cs_03_0;
 
464
    const double basisvalue14 = 5.80947501931113*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_1;
 
465
    const double basisvalue15 = 4.5*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_1;
 
466
    const double basisvalue16 = 2.59807621135332*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_1;
 
467
    const double basisvalue17 = 3.67423461417477*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_2;
 
468
    const double basisvalue18 = 2.12132034355964*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_2;
 
469
    const double basisvalue19 = 1.5*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_3;
 
470
    
 
471
    // Table(s) of coefficients
 
472
    const static double coefficients0[20][20] = \
 
473
    {{0.0288675134594813, 0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, 0.014173667737846, 0.00818317088384971, 0.0115727512471569, 0.0066815310478106, 0.00472455591261534, -0.028347335475692, -0.0239578711874978, -0.0185576872239523, -0.0107142857142857, -0.0207481250689683, -0.0160714285714286, -0.00927884361197613, -0.0131222664791956, -0.00757614408414158, -0.00535714285714285},
 
474
    {0.0288675134594813, -0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, -0.014173667737846, 0.00818317088384972, -0.0115727512471569, 0.00668153104781061, 0.00472455591261535, 0.028347335475692, -0.0239578711874977, 0.0185576872239523, -0.0107142857142857, -0.0207481250689683, 0.0160714285714286, -0.00927884361197613, 0.0131222664791956, -0.00757614408414158, -0.00535714285714286},
 
475
    {0.0288675134594813, 0, -0.0150584650484208, 0.00532397137499948, 0, 0, 0.0245495126515492, 0, -0.0133630620956212, 0.00472455591261535, 0, 0, 0, 0.0428571428571429, 0, 0, -0.0278365308359284, 0, 0.0151522881682832, -0.00535714285714286},
 
476
    {0.0288675134594812, 0, 0, -0.0159719141249985, 0, 0, 0, 0, 0, 0.0283473354756921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0535714285714286},
 
477
    {0, 0, 0.112938487863156, -0.063887656499994, 0, 0, 0.0736485379546474, 0, 0.0267261241912424, -0.0236227795630767, 0, 0, 0, 0, 0, 0, 0.0649519052838329, 0, -0.0606091526731327, 0.0267857142857143},
 
478
    {0, 0, -0.0225876975726313, 0.127775312999988, 0, 0, 0, 0, 0.0668153104781061, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0, 0.0757614408414158, -0.0535714285714286},
 
479
    {0, 0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, -0.0425210032135381, 0.0245495126515492, 0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, -0.0375, 0.021650635094611, -0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
480
    {0, -0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, 0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
481
    {0, 0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, 0.014173667737846, -0.0245495126515492, -0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, -0.0618589574131742, 0.0428571428571429, -0.0069160416896561, -0.0160714285714286, 0.0154647393532936, 0.00874817765279706, 0, -0.00535714285714286},
 
482
    {0, -0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, 0.0566946709513841, 0.0245495126515492, -0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, 0.0618589574131742, -0.0642857142857143, 0, -0.0214285714285714, 0.00927884361197612, 0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
483
    {0, -0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, 0.0425210032135381, 0.0245495126515492, -0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, 0.0375, 0.021650635094611, 0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
484
    {0, 0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, -0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, -0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
485
    {0, -0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, -0.014173667737846, -0.0245495126515491, 0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, 0.0618589574131742, 0.0428571428571429, -0.0069160416896561, 0.0160714285714286, 0.0154647393532935, -0.00874817765279706, 0, -0.00535714285714285},
 
486
    {0, 0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, -0.0566946709513841, 0.0245495126515491, 0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, -0.0618589574131742, -0.0642857142857143, 0, 0.0214285714285714, 0.00927884361197613, -0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
487
    {0, -0.117369119465393, -0.0451753951452625, -0.031943828249997, -0.018298126367785, 0.042521003213538, 0.0409158544192486, 0.0347182537414707, 0.033407655239053, 0.0236227795630767, 0.0850420064270761, 0.0239578711874978, -0.00618589574131742, -0.0107142857142857, 0.0207481250689683, -0.00535714285714286, -0.00927884361197612, -0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
488
    {0, 0.117369119465393, -0.0451753951452626, -0.031943828249997, -0.018298126367785, -0.0425210032135381, 0.0409158544192486, -0.0347182537414707, 0.033407655239053, 0.0236227795630767, -0.0850420064270761, 0.0239578711874977, 0.00618589574131741, -0.0107142857142857, 0.0207481250689683, 0.00535714285714286, -0.00927884361197612, 0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
489
    {0.259807621135332, 0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, 0.0850420064270761, -0.0736485379546474, 0.0694365074829413, 0.0400891862868637, -0.0992156741649221, 0, 0, 0, 0, 0, 0.075, -0.0649519052838329, -0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
490
    {0.259807621135332, -0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, -0.0850420064270761, -0.0736485379546474, -0.0694365074829414, 0.0400891862868637, -0.0992156741649222, 0, 0, 0, 0, 0, -0.075, -0.0649519052838329, 0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
491
    {0.259807621135332, 0, -0.135526185435788, 0.0479157423749955, -0.10978875820671, 0, 0.0245495126515491, 0, -0.0801783725737273, -0.0992156741649221, 0, 0, 0, 0, -0.0968245836551854, 0, 0.021650635094611, 0, 0.0303045763365663, 0.0267857142857143},
 
492
    {0.259807621135332, 0, 0, -0.143747227124986, -0.10978875820671, 0, -0.122747563257746, 0, 0, 0.0425210032135381, 0, -0.095831484749991, 0, 0.0428571428571429, 0.0138320833793122, 0, 0.0154647393532935, 0, 0, -0.00535714285714285}};
 
493
    
 
494
    // Interesting (new) part
 
495
    // Tables of derivatives of the polynomial base (transpose)
 
496
    const static double dmats0[20][20] = \
 
497
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
498
    {6.32455532033676, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
499
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
500
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
501
    {0, 11.2249721603218, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
502
    {4.58257569495584, 0, 8.36660026534076, -1.18321595661992, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
503
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
504
    {3.74165738677394, 0, 0, 8.69482604771366, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
505
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
506
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
507
    {5.49909083394701, 0, -3.3466401061363, -2.36643191323985, 15.4919333848297, 0, 0.692820323027551, 0, 0.565685424949239, 0.400000000000001, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
508
    {0, 4.89897948556636, 0, 0, 0, 14.1985914794391, 0, -0.82807867121083, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
509
    {3.6, 0, 8.76356092008266, -1.54919333848297, 0, 0, 9.52470471983253, 0, -1.48131215963608, 0.261861468283192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
510
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
511
    {0, 4.24264068711928, 0, 0, 0, 0, 0, 14.3427433120127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
512
    {3.11769145362398, 0, 3.16227766016838, 4.91934955049954, 0, 0, 0, 0, 10.690449676497, -2.41897262725906, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
513
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
514
    {2.54558441227157, 0, 0, 7.66811580507233, 0, 0, 0, 0, 0, 10.3691851174526, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
515
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
516
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
517
    
 
518
    const static double dmats1[20][20] = \
 
519
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
520
    {3.16227766016838, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
521
    {5.47722557505166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
522
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
523
    {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
524
    {2.29128784747792, 7.24568837309472, 4.18330013267038, -0.591607978309959, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
525
    {-2.64575131106459, 0, 9.66091783079296, 0.683130051063973, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
526
    {1.87082869338697, 0, 0, 4.34741302385683, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
527
    {3.24037034920393, 0, 0, 7.52994023880668, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
528
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
529
    {2.74954541697351, 5.79655069847577, -1.67332005306815, -1.18321595661992, 7.74596669241483, -1.2, 0.346410161513776, -0.979795897113271, 0.28284271247462, 0.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
530
    {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 9.16515138991168, 7.09929573971954, -2.04939015319192, -0.414039335605415, -0.478091443733757, 0.169030850945704, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
531
    {1.8, -5.69209978830308, 4.38178046004133, -0.774596669241487, 0, 10.998181667894, 4.76235235991626, 0.962140470884726, -0.740656079818041, 0.130930734141596, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
532
    {5.19615242270664, 0, -3.16227766016838, -2.23606797749979, 0, 0, 13.7477270848675, 0, 0.534522483824849, 0.37796447300923, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
533
    {2.01246117974981, 2.12132034355964, -0.408248290463864, 3.17542648054294, 0, 0, 0, 7.17137165600636, -1.38013111868471, -1.56144011671765, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
534
    {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0, 0, 0, 9.25820099772551, 5.34522483824849, -1.20948631362953, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
535
    {-1.8, 0, 3.65148371670111, -2.84018778721878, 0, 0, 0, 0, 12.3442679969674, 1.39659449751035, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
536
    {1.27279220613579, 0, 0, 3.83405790253616, 0, 0, 0, 0, 0, 5.18459255872629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
537
    {2.20454076850486, 0, 0, 6.6407830863536, 0, 0, 0, 0, 0, 8.97997772825746, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
538
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
539
    
 
540
    const static double dmats2[20][20] = \
 
541
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
542
    {3.16227766016838, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
543
    {1.82574185835055, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
544
    {5.16397779494322, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
545
    {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
546
    {2.29128784747792, 1.44913767461895, 4.18330013267038, -0.59160797830996, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
547
    {1.32287565553229, 0, 3.86436713231718, -0.341565025531987, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
548
    {1.87082869338697, 7.09929573971954, 0, 4.34741302385683, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
549
    {1.08012344973464, 0, 7.09929573971954, 2.50998007960222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
550
    {-3.81881307912986, 0, 0, 8.87411967464942, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
551
    {2.74954541697351, 5.79655069847577, -1.67332005306815, -1.18321595661992, 7.74596669241483, -1.2, 0.346410161513776, -0.979795897113271, 0.282842712474619, 0.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
552
    {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141595, 7.09929573971954, -2.04939015319192, -0.414039335605415, -0.478091443733757, 0.169030850945704, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
553
    {1.8, 0.632455532033675, 4.38178046004133, -0.774596669241484, 0, 3.14233761939829, 4.76235235991626, -0.10690449676497, -0.740656079818042, 0.130930734141596, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
554
    {1.03923048454133, 0, 3.16227766016838, -0.447213595499959, 0, 0, 5.8918830363718, 0, -0.53452248382485, 0.0755928946018459, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
555
    {2.01246117974981, 2.12132034355964, -0.408248290463863, 3.17542648054294, 9.07114735222145, 0, 0, 7.17137165600636, -1.38013111868471, -1.56144011671765, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
556
    {1.55884572681199, 0.547722557505165, 1.58113883008419, 2.45967477524977, 0, 9.07114735222145, 0, 1.8516401995451, 5.34522483824849, -1.20948631362953, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
557
    {0.900000000000001, 0, 1.46059348668045, 1.42009389360939, 0, 0, 9.07114735222145, 0, 4.93770719878694, -0.698297248755175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
558
    {1.27279220613578, -6.26099033699941, 0, 3.83405790253616, 0, 0, 0, 10.5830052442584, 0, 5.18459255872629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
559
    {0.734846922834954, 0, -6.26099033699941, 2.21359436211787, 0, 0, 0, 0, 10.5830052442584, 2.99332590941915, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
560
    {5.7157676649773, 0, 0, -4.69574275274955, 0, 0, 0, 0, 0, 12.69960629311, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
561
    
 
562
    // Compute reference derivatives
 
563
    // Declare pointer to array of derivatives on FIAT element
 
564
    double *derivatives = new double [num_derivatives];
 
565
    
 
566
    // Declare coefficients
 
567
    double coeff0_0 = 0;
 
568
    double coeff0_1 = 0;
 
569
    double coeff0_2 = 0;
 
570
    double coeff0_3 = 0;
 
571
    double coeff0_4 = 0;
 
572
    double coeff0_5 = 0;
 
573
    double coeff0_6 = 0;
 
574
    double coeff0_7 = 0;
 
575
    double coeff0_8 = 0;
 
576
    double coeff0_9 = 0;
 
577
    double coeff0_10 = 0;
 
578
    double coeff0_11 = 0;
 
579
    double coeff0_12 = 0;
 
580
    double coeff0_13 = 0;
 
581
    double coeff0_14 = 0;
 
582
    double coeff0_15 = 0;
 
583
    double coeff0_16 = 0;
 
584
    double coeff0_17 = 0;
 
585
    double coeff0_18 = 0;
 
586
    double coeff0_19 = 0;
 
587
    
 
588
    // Declare new coefficients
 
589
    double new_coeff0_0 = 0;
 
590
    double new_coeff0_1 = 0;
 
591
    double new_coeff0_2 = 0;
 
592
    double new_coeff0_3 = 0;
 
593
    double new_coeff0_4 = 0;
 
594
    double new_coeff0_5 = 0;
 
595
    double new_coeff0_6 = 0;
 
596
    double new_coeff0_7 = 0;
 
597
    double new_coeff0_8 = 0;
 
598
    double new_coeff0_9 = 0;
 
599
    double new_coeff0_10 = 0;
 
600
    double new_coeff0_11 = 0;
 
601
    double new_coeff0_12 = 0;
 
602
    double new_coeff0_13 = 0;
 
603
    double new_coeff0_14 = 0;
 
604
    double new_coeff0_15 = 0;
 
605
    double new_coeff0_16 = 0;
 
606
    double new_coeff0_17 = 0;
 
607
    double new_coeff0_18 = 0;
 
608
    double new_coeff0_19 = 0;
 
609
    
 
610
    // Loop possible derivatives
 
611
    for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
612
    {
 
613
      // Get values from coefficients array
 
614
      new_coeff0_0 = coefficients0[dof][0];
 
615
      new_coeff0_1 = coefficients0[dof][1];
 
616
      new_coeff0_2 = coefficients0[dof][2];
 
617
      new_coeff0_3 = coefficients0[dof][3];
 
618
      new_coeff0_4 = coefficients0[dof][4];
 
619
      new_coeff0_5 = coefficients0[dof][5];
 
620
      new_coeff0_6 = coefficients0[dof][6];
 
621
      new_coeff0_7 = coefficients0[dof][7];
 
622
      new_coeff0_8 = coefficients0[dof][8];
 
623
      new_coeff0_9 = coefficients0[dof][9];
 
624
      new_coeff0_10 = coefficients0[dof][10];
 
625
      new_coeff0_11 = coefficients0[dof][11];
 
626
      new_coeff0_12 = coefficients0[dof][12];
 
627
      new_coeff0_13 = coefficients0[dof][13];
 
628
      new_coeff0_14 = coefficients0[dof][14];
 
629
      new_coeff0_15 = coefficients0[dof][15];
 
630
      new_coeff0_16 = coefficients0[dof][16];
 
631
      new_coeff0_17 = coefficients0[dof][17];
 
632
      new_coeff0_18 = coefficients0[dof][18];
 
633
      new_coeff0_19 = coefficients0[dof][19];
 
634
    
 
635
      // Loop derivative order
 
636
      for (unsigned int j = 0; j < n; j++)
 
637
      {
 
638
        // Update old coefficients
 
639
        coeff0_0 = new_coeff0_0;
 
640
        coeff0_1 = new_coeff0_1;
 
641
        coeff0_2 = new_coeff0_2;
 
642
        coeff0_3 = new_coeff0_3;
 
643
        coeff0_4 = new_coeff0_4;
 
644
        coeff0_5 = new_coeff0_5;
 
645
        coeff0_6 = new_coeff0_6;
 
646
        coeff0_7 = new_coeff0_7;
 
647
        coeff0_8 = new_coeff0_8;
 
648
        coeff0_9 = new_coeff0_9;
 
649
        coeff0_10 = new_coeff0_10;
 
650
        coeff0_11 = new_coeff0_11;
 
651
        coeff0_12 = new_coeff0_12;
 
652
        coeff0_13 = new_coeff0_13;
 
653
        coeff0_14 = new_coeff0_14;
 
654
        coeff0_15 = new_coeff0_15;
 
655
        coeff0_16 = new_coeff0_16;
 
656
        coeff0_17 = new_coeff0_17;
 
657
        coeff0_18 = new_coeff0_18;
 
658
        coeff0_19 = new_coeff0_19;
 
659
    
 
660
        if(combinations[deriv_num][j] == 0)
 
661
        {
 
662
          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] + coeff0_15*dmats0[15][0] + coeff0_16*dmats0[16][0] + coeff0_17*dmats0[17][0] + coeff0_18*dmats0[18][0] + coeff0_19*dmats0[19][0];
 
663
          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] + coeff0_15*dmats0[15][1] + coeff0_16*dmats0[16][1] + coeff0_17*dmats0[17][1] + coeff0_18*dmats0[18][1] + coeff0_19*dmats0[19][1];
 
664
          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] + coeff0_15*dmats0[15][2] + coeff0_16*dmats0[16][2] + coeff0_17*dmats0[17][2] + coeff0_18*dmats0[18][2] + coeff0_19*dmats0[19][2];
 
665
          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] + coeff0_15*dmats0[15][3] + coeff0_16*dmats0[16][3] + coeff0_17*dmats0[17][3] + coeff0_18*dmats0[18][3] + coeff0_19*dmats0[19][3];
 
666
          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] + coeff0_15*dmats0[15][4] + coeff0_16*dmats0[16][4] + coeff0_17*dmats0[17][4] + coeff0_18*dmats0[18][4] + coeff0_19*dmats0[19][4];
 
667
          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] + coeff0_15*dmats0[15][5] + coeff0_16*dmats0[16][5] + coeff0_17*dmats0[17][5] + coeff0_18*dmats0[18][5] + coeff0_19*dmats0[19][5];
 
668
          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] + coeff0_15*dmats0[15][6] + coeff0_16*dmats0[16][6] + coeff0_17*dmats0[17][6] + coeff0_18*dmats0[18][6] + coeff0_19*dmats0[19][6];
 
669
          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] + coeff0_15*dmats0[15][7] + coeff0_16*dmats0[16][7] + coeff0_17*dmats0[17][7] + coeff0_18*dmats0[18][7] + coeff0_19*dmats0[19][7];
 
670
          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] + coeff0_15*dmats0[15][8] + coeff0_16*dmats0[16][8] + coeff0_17*dmats0[17][8] + coeff0_18*dmats0[18][8] + coeff0_19*dmats0[19][8];
 
671
          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] + coeff0_15*dmats0[15][9] + coeff0_16*dmats0[16][9] + coeff0_17*dmats0[17][9] + coeff0_18*dmats0[18][9] + coeff0_19*dmats0[19][9];
 
672
          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] + coeff0_15*dmats0[15][10] + coeff0_16*dmats0[16][10] + coeff0_17*dmats0[17][10] + coeff0_18*dmats0[18][10] + coeff0_19*dmats0[19][10];
 
673
          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] + coeff0_15*dmats0[15][11] + coeff0_16*dmats0[16][11] + coeff0_17*dmats0[17][11] + coeff0_18*dmats0[18][11] + coeff0_19*dmats0[19][11];
 
674
          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] + coeff0_15*dmats0[15][12] + coeff0_16*dmats0[16][12] + coeff0_17*dmats0[17][12] + coeff0_18*dmats0[18][12] + coeff0_19*dmats0[19][12];
 
675
          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] + coeff0_15*dmats0[15][13] + coeff0_16*dmats0[16][13] + coeff0_17*dmats0[17][13] + coeff0_18*dmats0[18][13] + coeff0_19*dmats0[19][13];
 
676
          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] + coeff0_15*dmats0[15][14] + coeff0_16*dmats0[16][14] + coeff0_17*dmats0[17][14] + coeff0_18*dmats0[18][14] + coeff0_19*dmats0[19][14];
 
677
          new_coeff0_15 = coeff0_0*dmats0[0][15] + coeff0_1*dmats0[1][15] + coeff0_2*dmats0[2][15] + coeff0_3*dmats0[3][15] + coeff0_4*dmats0[4][15] + coeff0_5*dmats0[5][15] + coeff0_6*dmats0[6][15] + coeff0_7*dmats0[7][15] + coeff0_8*dmats0[8][15] + coeff0_9*dmats0[9][15] + coeff0_10*dmats0[10][15] + coeff0_11*dmats0[11][15] + coeff0_12*dmats0[12][15] + coeff0_13*dmats0[13][15] + coeff0_14*dmats0[14][15] + coeff0_15*dmats0[15][15] + coeff0_16*dmats0[16][15] + coeff0_17*dmats0[17][15] + coeff0_18*dmats0[18][15] + coeff0_19*dmats0[19][15];
 
678
          new_coeff0_16 = coeff0_0*dmats0[0][16] + coeff0_1*dmats0[1][16] + coeff0_2*dmats0[2][16] + coeff0_3*dmats0[3][16] + coeff0_4*dmats0[4][16] + coeff0_5*dmats0[5][16] + coeff0_6*dmats0[6][16] + coeff0_7*dmats0[7][16] + coeff0_8*dmats0[8][16] + coeff0_9*dmats0[9][16] + coeff0_10*dmats0[10][16] + coeff0_11*dmats0[11][16] + coeff0_12*dmats0[12][16] + coeff0_13*dmats0[13][16] + coeff0_14*dmats0[14][16] + coeff0_15*dmats0[15][16] + coeff0_16*dmats0[16][16] + coeff0_17*dmats0[17][16] + coeff0_18*dmats0[18][16] + coeff0_19*dmats0[19][16];
 
679
          new_coeff0_17 = coeff0_0*dmats0[0][17] + coeff0_1*dmats0[1][17] + coeff0_2*dmats0[2][17] + coeff0_3*dmats0[3][17] + coeff0_4*dmats0[4][17] + coeff0_5*dmats0[5][17] + coeff0_6*dmats0[6][17] + coeff0_7*dmats0[7][17] + coeff0_8*dmats0[8][17] + coeff0_9*dmats0[9][17] + coeff0_10*dmats0[10][17] + coeff0_11*dmats0[11][17] + coeff0_12*dmats0[12][17] + coeff0_13*dmats0[13][17] + coeff0_14*dmats0[14][17] + coeff0_15*dmats0[15][17] + coeff0_16*dmats0[16][17] + coeff0_17*dmats0[17][17] + coeff0_18*dmats0[18][17] + coeff0_19*dmats0[19][17];
 
680
          new_coeff0_18 = coeff0_0*dmats0[0][18] + coeff0_1*dmats0[1][18] + coeff0_2*dmats0[2][18] + coeff0_3*dmats0[3][18] + coeff0_4*dmats0[4][18] + coeff0_5*dmats0[5][18] + coeff0_6*dmats0[6][18] + coeff0_7*dmats0[7][18] + coeff0_8*dmats0[8][18] + coeff0_9*dmats0[9][18] + coeff0_10*dmats0[10][18] + coeff0_11*dmats0[11][18] + coeff0_12*dmats0[12][18] + coeff0_13*dmats0[13][18] + coeff0_14*dmats0[14][18] + coeff0_15*dmats0[15][18] + coeff0_16*dmats0[16][18] + coeff0_17*dmats0[17][18] + coeff0_18*dmats0[18][18] + coeff0_19*dmats0[19][18];
 
681
          new_coeff0_19 = coeff0_0*dmats0[0][19] + coeff0_1*dmats0[1][19] + coeff0_2*dmats0[2][19] + coeff0_3*dmats0[3][19] + coeff0_4*dmats0[4][19] + coeff0_5*dmats0[5][19] + coeff0_6*dmats0[6][19] + coeff0_7*dmats0[7][19] + coeff0_8*dmats0[8][19] + coeff0_9*dmats0[9][19] + coeff0_10*dmats0[10][19] + coeff0_11*dmats0[11][19] + coeff0_12*dmats0[12][19] + coeff0_13*dmats0[13][19] + coeff0_14*dmats0[14][19] + coeff0_15*dmats0[15][19] + coeff0_16*dmats0[16][19] + coeff0_17*dmats0[17][19] + coeff0_18*dmats0[18][19] + coeff0_19*dmats0[19][19];
 
682
        }
 
683
        if(combinations[deriv_num][j] == 1)
 
684
        {
 
685
          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] + coeff0_15*dmats1[15][0] + coeff0_16*dmats1[16][0] + coeff0_17*dmats1[17][0] + coeff0_18*dmats1[18][0] + coeff0_19*dmats1[19][0];
 
686
          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] + coeff0_15*dmats1[15][1] + coeff0_16*dmats1[16][1] + coeff0_17*dmats1[17][1] + coeff0_18*dmats1[18][1] + coeff0_19*dmats1[19][1];
 
687
          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] + coeff0_15*dmats1[15][2] + coeff0_16*dmats1[16][2] + coeff0_17*dmats1[17][2] + coeff0_18*dmats1[18][2] + coeff0_19*dmats1[19][2];
 
688
          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] + coeff0_15*dmats1[15][3] + coeff0_16*dmats1[16][3] + coeff0_17*dmats1[17][3] + coeff0_18*dmats1[18][3] + coeff0_19*dmats1[19][3];
 
689
          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] + coeff0_15*dmats1[15][4] + coeff0_16*dmats1[16][4] + coeff0_17*dmats1[17][4] + coeff0_18*dmats1[18][4] + coeff0_19*dmats1[19][4];
 
690
          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] + coeff0_15*dmats1[15][5] + coeff0_16*dmats1[16][5] + coeff0_17*dmats1[17][5] + coeff0_18*dmats1[18][5] + coeff0_19*dmats1[19][5];
 
691
          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] + coeff0_15*dmats1[15][6] + coeff0_16*dmats1[16][6] + coeff0_17*dmats1[17][6] + coeff0_18*dmats1[18][6] + coeff0_19*dmats1[19][6];
 
692
          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] + coeff0_15*dmats1[15][7] + coeff0_16*dmats1[16][7] + coeff0_17*dmats1[17][7] + coeff0_18*dmats1[18][7] + coeff0_19*dmats1[19][7];
 
693
          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] + coeff0_15*dmats1[15][8] + coeff0_16*dmats1[16][8] + coeff0_17*dmats1[17][8] + coeff0_18*dmats1[18][8] + coeff0_19*dmats1[19][8];
 
694
          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] + coeff0_15*dmats1[15][9] + coeff0_16*dmats1[16][9] + coeff0_17*dmats1[17][9] + coeff0_18*dmats1[18][9] + coeff0_19*dmats1[19][9];
 
695
          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] + coeff0_15*dmats1[15][10] + coeff0_16*dmats1[16][10] + coeff0_17*dmats1[17][10] + coeff0_18*dmats1[18][10] + coeff0_19*dmats1[19][10];
 
696
          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] + coeff0_15*dmats1[15][11] + coeff0_16*dmats1[16][11] + coeff0_17*dmats1[17][11] + coeff0_18*dmats1[18][11] + coeff0_19*dmats1[19][11];
 
697
          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] + coeff0_15*dmats1[15][12] + coeff0_16*dmats1[16][12] + coeff0_17*dmats1[17][12] + coeff0_18*dmats1[18][12] + coeff0_19*dmats1[19][12];
 
698
          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] + coeff0_15*dmats1[15][13] + coeff0_16*dmats1[16][13] + coeff0_17*dmats1[17][13] + coeff0_18*dmats1[18][13] + coeff0_19*dmats1[19][13];
 
699
          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] + coeff0_15*dmats1[15][14] + coeff0_16*dmats1[16][14] + coeff0_17*dmats1[17][14] + coeff0_18*dmats1[18][14] + coeff0_19*dmats1[19][14];
 
700
          new_coeff0_15 = coeff0_0*dmats1[0][15] + coeff0_1*dmats1[1][15] + coeff0_2*dmats1[2][15] + coeff0_3*dmats1[3][15] + coeff0_4*dmats1[4][15] + coeff0_5*dmats1[5][15] + coeff0_6*dmats1[6][15] + coeff0_7*dmats1[7][15] + coeff0_8*dmats1[8][15] + coeff0_9*dmats1[9][15] + coeff0_10*dmats1[10][15] + coeff0_11*dmats1[11][15] + coeff0_12*dmats1[12][15] + coeff0_13*dmats1[13][15] + coeff0_14*dmats1[14][15] + coeff0_15*dmats1[15][15] + coeff0_16*dmats1[16][15] + coeff0_17*dmats1[17][15] + coeff0_18*dmats1[18][15] + coeff0_19*dmats1[19][15];
 
701
          new_coeff0_16 = coeff0_0*dmats1[0][16] + coeff0_1*dmats1[1][16] + coeff0_2*dmats1[2][16] + coeff0_3*dmats1[3][16] + coeff0_4*dmats1[4][16] + coeff0_5*dmats1[5][16] + coeff0_6*dmats1[6][16] + coeff0_7*dmats1[7][16] + coeff0_8*dmats1[8][16] + coeff0_9*dmats1[9][16] + coeff0_10*dmats1[10][16] + coeff0_11*dmats1[11][16] + coeff0_12*dmats1[12][16] + coeff0_13*dmats1[13][16] + coeff0_14*dmats1[14][16] + coeff0_15*dmats1[15][16] + coeff0_16*dmats1[16][16] + coeff0_17*dmats1[17][16] + coeff0_18*dmats1[18][16] + coeff0_19*dmats1[19][16];
 
702
          new_coeff0_17 = coeff0_0*dmats1[0][17] + coeff0_1*dmats1[1][17] + coeff0_2*dmats1[2][17] + coeff0_3*dmats1[3][17] + coeff0_4*dmats1[4][17] + coeff0_5*dmats1[5][17] + coeff0_6*dmats1[6][17] + coeff0_7*dmats1[7][17] + coeff0_8*dmats1[8][17] + coeff0_9*dmats1[9][17] + coeff0_10*dmats1[10][17] + coeff0_11*dmats1[11][17] + coeff0_12*dmats1[12][17] + coeff0_13*dmats1[13][17] + coeff0_14*dmats1[14][17] + coeff0_15*dmats1[15][17] + coeff0_16*dmats1[16][17] + coeff0_17*dmats1[17][17] + coeff0_18*dmats1[18][17] + coeff0_19*dmats1[19][17];
 
703
          new_coeff0_18 = coeff0_0*dmats1[0][18] + coeff0_1*dmats1[1][18] + coeff0_2*dmats1[2][18] + coeff0_3*dmats1[3][18] + coeff0_4*dmats1[4][18] + coeff0_5*dmats1[5][18] + coeff0_6*dmats1[6][18] + coeff0_7*dmats1[7][18] + coeff0_8*dmats1[8][18] + coeff0_9*dmats1[9][18] + coeff0_10*dmats1[10][18] + coeff0_11*dmats1[11][18] + coeff0_12*dmats1[12][18] + coeff0_13*dmats1[13][18] + coeff0_14*dmats1[14][18] + coeff0_15*dmats1[15][18] + coeff0_16*dmats1[16][18] + coeff0_17*dmats1[17][18] + coeff0_18*dmats1[18][18] + coeff0_19*dmats1[19][18];
 
704
          new_coeff0_19 = coeff0_0*dmats1[0][19] + coeff0_1*dmats1[1][19] + coeff0_2*dmats1[2][19] + coeff0_3*dmats1[3][19] + coeff0_4*dmats1[4][19] + coeff0_5*dmats1[5][19] + coeff0_6*dmats1[6][19] + coeff0_7*dmats1[7][19] + coeff0_8*dmats1[8][19] + coeff0_9*dmats1[9][19] + coeff0_10*dmats1[10][19] + coeff0_11*dmats1[11][19] + coeff0_12*dmats1[12][19] + coeff0_13*dmats1[13][19] + coeff0_14*dmats1[14][19] + coeff0_15*dmats1[15][19] + coeff0_16*dmats1[16][19] + coeff0_17*dmats1[17][19] + coeff0_18*dmats1[18][19] + coeff0_19*dmats1[19][19];
 
705
        }
 
706
        if(combinations[deriv_num][j] == 2)
 
707
        {
 
708
          new_coeff0_0 = coeff0_0*dmats2[0][0] + coeff0_1*dmats2[1][0] + coeff0_2*dmats2[2][0] + coeff0_3*dmats2[3][0] + coeff0_4*dmats2[4][0] + coeff0_5*dmats2[5][0] + coeff0_6*dmats2[6][0] + coeff0_7*dmats2[7][0] + coeff0_8*dmats2[8][0] + coeff0_9*dmats2[9][0] + coeff0_10*dmats2[10][0] + coeff0_11*dmats2[11][0] + coeff0_12*dmats2[12][0] + coeff0_13*dmats2[13][0] + coeff0_14*dmats2[14][0] + coeff0_15*dmats2[15][0] + coeff0_16*dmats2[16][0] + coeff0_17*dmats2[17][0] + coeff0_18*dmats2[18][0] + coeff0_19*dmats2[19][0];
 
709
          new_coeff0_1 = coeff0_0*dmats2[0][1] + coeff0_1*dmats2[1][1] + coeff0_2*dmats2[2][1] + coeff0_3*dmats2[3][1] + coeff0_4*dmats2[4][1] + coeff0_5*dmats2[5][1] + coeff0_6*dmats2[6][1] + coeff0_7*dmats2[7][1] + coeff0_8*dmats2[8][1] + coeff0_9*dmats2[9][1] + coeff0_10*dmats2[10][1] + coeff0_11*dmats2[11][1] + coeff0_12*dmats2[12][1] + coeff0_13*dmats2[13][1] + coeff0_14*dmats2[14][1] + coeff0_15*dmats2[15][1] + coeff0_16*dmats2[16][1] + coeff0_17*dmats2[17][1] + coeff0_18*dmats2[18][1] + coeff0_19*dmats2[19][1];
 
710
          new_coeff0_2 = coeff0_0*dmats2[0][2] + coeff0_1*dmats2[1][2] + coeff0_2*dmats2[2][2] + coeff0_3*dmats2[3][2] + coeff0_4*dmats2[4][2] + coeff0_5*dmats2[5][2] + coeff0_6*dmats2[6][2] + coeff0_7*dmats2[7][2] + coeff0_8*dmats2[8][2] + coeff0_9*dmats2[9][2] + coeff0_10*dmats2[10][2] + coeff0_11*dmats2[11][2] + coeff0_12*dmats2[12][2] + coeff0_13*dmats2[13][2] + coeff0_14*dmats2[14][2] + coeff0_15*dmats2[15][2] + coeff0_16*dmats2[16][2] + coeff0_17*dmats2[17][2] + coeff0_18*dmats2[18][2] + coeff0_19*dmats2[19][2];
 
711
          new_coeff0_3 = coeff0_0*dmats2[0][3] + coeff0_1*dmats2[1][3] + coeff0_2*dmats2[2][3] + coeff0_3*dmats2[3][3] + coeff0_4*dmats2[4][3] + coeff0_5*dmats2[5][3] + coeff0_6*dmats2[6][3] + coeff0_7*dmats2[7][3] + coeff0_8*dmats2[8][3] + coeff0_9*dmats2[9][3] + coeff0_10*dmats2[10][3] + coeff0_11*dmats2[11][3] + coeff0_12*dmats2[12][3] + coeff0_13*dmats2[13][3] + coeff0_14*dmats2[14][3] + coeff0_15*dmats2[15][3] + coeff0_16*dmats2[16][3] + coeff0_17*dmats2[17][3] + coeff0_18*dmats2[18][3] + coeff0_19*dmats2[19][3];
 
712
          new_coeff0_4 = coeff0_0*dmats2[0][4] + coeff0_1*dmats2[1][4] + coeff0_2*dmats2[2][4] + coeff0_3*dmats2[3][4] + coeff0_4*dmats2[4][4] + coeff0_5*dmats2[5][4] + coeff0_6*dmats2[6][4] + coeff0_7*dmats2[7][4] + coeff0_8*dmats2[8][4] + coeff0_9*dmats2[9][4] + coeff0_10*dmats2[10][4] + coeff0_11*dmats2[11][4] + coeff0_12*dmats2[12][4] + coeff0_13*dmats2[13][4] + coeff0_14*dmats2[14][4] + coeff0_15*dmats2[15][4] + coeff0_16*dmats2[16][4] + coeff0_17*dmats2[17][4] + coeff0_18*dmats2[18][4] + coeff0_19*dmats2[19][4];
 
713
          new_coeff0_5 = coeff0_0*dmats2[0][5] + coeff0_1*dmats2[1][5] + coeff0_2*dmats2[2][5] + coeff0_3*dmats2[3][5] + coeff0_4*dmats2[4][5] + coeff0_5*dmats2[5][5] + coeff0_6*dmats2[6][5] + coeff0_7*dmats2[7][5] + coeff0_8*dmats2[8][5] + coeff0_9*dmats2[9][5] + coeff0_10*dmats2[10][5] + coeff0_11*dmats2[11][5] + coeff0_12*dmats2[12][5] + coeff0_13*dmats2[13][5] + coeff0_14*dmats2[14][5] + coeff0_15*dmats2[15][5] + coeff0_16*dmats2[16][5] + coeff0_17*dmats2[17][5] + coeff0_18*dmats2[18][5] + coeff0_19*dmats2[19][5];
 
714
          new_coeff0_6 = coeff0_0*dmats2[0][6] + coeff0_1*dmats2[1][6] + coeff0_2*dmats2[2][6] + coeff0_3*dmats2[3][6] + coeff0_4*dmats2[4][6] + coeff0_5*dmats2[5][6] + coeff0_6*dmats2[6][6] + coeff0_7*dmats2[7][6] + coeff0_8*dmats2[8][6] + coeff0_9*dmats2[9][6] + coeff0_10*dmats2[10][6] + coeff0_11*dmats2[11][6] + coeff0_12*dmats2[12][6] + coeff0_13*dmats2[13][6] + coeff0_14*dmats2[14][6] + coeff0_15*dmats2[15][6] + coeff0_16*dmats2[16][6] + coeff0_17*dmats2[17][6] + coeff0_18*dmats2[18][6] + coeff0_19*dmats2[19][6];
 
715
          new_coeff0_7 = coeff0_0*dmats2[0][7] + coeff0_1*dmats2[1][7] + coeff0_2*dmats2[2][7] + coeff0_3*dmats2[3][7] + coeff0_4*dmats2[4][7] + coeff0_5*dmats2[5][7] + coeff0_6*dmats2[6][7] + coeff0_7*dmats2[7][7] + coeff0_8*dmats2[8][7] + coeff0_9*dmats2[9][7] + coeff0_10*dmats2[10][7] + coeff0_11*dmats2[11][7] + coeff0_12*dmats2[12][7] + coeff0_13*dmats2[13][7] + coeff0_14*dmats2[14][7] + coeff0_15*dmats2[15][7] + coeff0_16*dmats2[16][7] + coeff0_17*dmats2[17][7] + coeff0_18*dmats2[18][7] + coeff0_19*dmats2[19][7];
 
716
          new_coeff0_8 = coeff0_0*dmats2[0][8] + coeff0_1*dmats2[1][8] + coeff0_2*dmats2[2][8] + coeff0_3*dmats2[3][8] + coeff0_4*dmats2[4][8] + coeff0_5*dmats2[5][8] + coeff0_6*dmats2[6][8] + coeff0_7*dmats2[7][8] + coeff0_8*dmats2[8][8] + coeff0_9*dmats2[9][8] + coeff0_10*dmats2[10][8] + coeff0_11*dmats2[11][8] + coeff0_12*dmats2[12][8] + coeff0_13*dmats2[13][8] + coeff0_14*dmats2[14][8] + coeff0_15*dmats2[15][8] + coeff0_16*dmats2[16][8] + coeff0_17*dmats2[17][8] + coeff0_18*dmats2[18][8] + coeff0_19*dmats2[19][8];
 
717
          new_coeff0_9 = coeff0_0*dmats2[0][9] + coeff0_1*dmats2[1][9] + coeff0_2*dmats2[2][9] + coeff0_3*dmats2[3][9] + coeff0_4*dmats2[4][9] + coeff0_5*dmats2[5][9] + coeff0_6*dmats2[6][9] + coeff0_7*dmats2[7][9] + coeff0_8*dmats2[8][9] + coeff0_9*dmats2[9][9] + coeff0_10*dmats2[10][9] + coeff0_11*dmats2[11][9] + coeff0_12*dmats2[12][9] + coeff0_13*dmats2[13][9] + coeff0_14*dmats2[14][9] + coeff0_15*dmats2[15][9] + coeff0_16*dmats2[16][9] + coeff0_17*dmats2[17][9] + coeff0_18*dmats2[18][9] + coeff0_19*dmats2[19][9];
 
718
          new_coeff0_10 = coeff0_0*dmats2[0][10] + coeff0_1*dmats2[1][10] + coeff0_2*dmats2[2][10] + coeff0_3*dmats2[3][10] + coeff0_4*dmats2[4][10] + coeff0_5*dmats2[5][10] + coeff0_6*dmats2[6][10] + coeff0_7*dmats2[7][10] + coeff0_8*dmats2[8][10] + coeff0_9*dmats2[9][10] + coeff0_10*dmats2[10][10] + coeff0_11*dmats2[11][10] + coeff0_12*dmats2[12][10] + coeff0_13*dmats2[13][10] + coeff0_14*dmats2[14][10] + coeff0_15*dmats2[15][10] + coeff0_16*dmats2[16][10] + coeff0_17*dmats2[17][10] + coeff0_18*dmats2[18][10] + coeff0_19*dmats2[19][10];
 
719
          new_coeff0_11 = coeff0_0*dmats2[0][11] + coeff0_1*dmats2[1][11] + coeff0_2*dmats2[2][11] + coeff0_3*dmats2[3][11] + coeff0_4*dmats2[4][11] + coeff0_5*dmats2[5][11] + coeff0_6*dmats2[6][11] + coeff0_7*dmats2[7][11] + coeff0_8*dmats2[8][11] + coeff0_9*dmats2[9][11] + coeff0_10*dmats2[10][11] + coeff0_11*dmats2[11][11] + coeff0_12*dmats2[12][11] + coeff0_13*dmats2[13][11] + coeff0_14*dmats2[14][11] + coeff0_15*dmats2[15][11] + coeff0_16*dmats2[16][11] + coeff0_17*dmats2[17][11] + coeff0_18*dmats2[18][11] + coeff0_19*dmats2[19][11];
 
720
          new_coeff0_12 = coeff0_0*dmats2[0][12] + coeff0_1*dmats2[1][12] + coeff0_2*dmats2[2][12] + coeff0_3*dmats2[3][12] + coeff0_4*dmats2[4][12] + coeff0_5*dmats2[5][12] + coeff0_6*dmats2[6][12] + coeff0_7*dmats2[7][12] + coeff0_8*dmats2[8][12] + coeff0_9*dmats2[9][12] + coeff0_10*dmats2[10][12] + coeff0_11*dmats2[11][12] + coeff0_12*dmats2[12][12] + coeff0_13*dmats2[13][12] + coeff0_14*dmats2[14][12] + coeff0_15*dmats2[15][12] + coeff0_16*dmats2[16][12] + coeff0_17*dmats2[17][12] + coeff0_18*dmats2[18][12] + coeff0_19*dmats2[19][12];
 
721
          new_coeff0_13 = coeff0_0*dmats2[0][13] + coeff0_1*dmats2[1][13] + coeff0_2*dmats2[2][13] + coeff0_3*dmats2[3][13] + coeff0_4*dmats2[4][13] + coeff0_5*dmats2[5][13] + coeff0_6*dmats2[6][13] + coeff0_7*dmats2[7][13] + coeff0_8*dmats2[8][13] + coeff0_9*dmats2[9][13] + coeff0_10*dmats2[10][13] + coeff0_11*dmats2[11][13] + coeff0_12*dmats2[12][13] + coeff0_13*dmats2[13][13] + coeff0_14*dmats2[14][13] + coeff0_15*dmats2[15][13] + coeff0_16*dmats2[16][13] + coeff0_17*dmats2[17][13] + coeff0_18*dmats2[18][13] + coeff0_19*dmats2[19][13];
 
722
          new_coeff0_14 = coeff0_0*dmats2[0][14] + coeff0_1*dmats2[1][14] + coeff0_2*dmats2[2][14] + coeff0_3*dmats2[3][14] + coeff0_4*dmats2[4][14] + coeff0_5*dmats2[5][14] + coeff0_6*dmats2[6][14] + coeff0_7*dmats2[7][14] + coeff0_8*dmats2[8][14] + coeff0_9*dmats2[9][14] + coeff0_10*dmats2[10][14] + coeff0_11*dmats2[11][14] + coeff0_12*dmats2[12][14] + coeff0_13*dmats2[13][14] + coeff0_14*dmats2[14][14] + coeff0_15*dmats2[15][14] + coeff0_16*dmats2[16][14] + coeff0_17*dmats2[17][14] + coeff0_18*dmats2[18][14] + coeff0_19*dmats2[19][14];
 
723
          new_coeff0_15 = coeff0_0*dmats2[0][15] + coeff0_1*dmats2[1][15] + coeff0_2*dmats2[2][15] + coeff0_3*dmats2[3][15] + coeff0_4*dmats2[4][15] + coeff0_5*dmats2[5][15] + coeff0_6*dmats2[6][15] + coeff0_7*dmats2[7][15] + coeff0_8*dmats2[8][15] + coeff0_9*dmats2[9][15] + coeff0_10*dmats2[10][15] + coeff0_11*dmats2[11][15] + coeff0_12*dmats2[12][15] + coeff0_13*dmats2[13][15] + coeff0_14*dmats2[14][15] + coeff0_15*dmats2[15][15] + coeff0_16*dmats2[16][15] + coeff0_17*dmats2[17][15] + coeff0_18*dmats2[18][15] + coeff0_19*dmats2[19][15];
 
724
          new_coeff0_16 = coeff0_0*dmats2[0][16] + coeff0_1*dmats2[1][16] + coeff0_2*dmats2[2][16] + coeff0_3*dmats2[3][16] + coeff0_4*dmats2[4][16] + coeff0_5*dmats2[5][16] + coeff0_6*dmats2[6][16] + coeff0_7*dmats2[7][16] + coeff0_8*dmats2[8][16] + coeff0_9*dmats2[9][16] + coeff0_10*dmats2[10][16] + coeff0_11*dmats2[11][16] + coeff0_12*dmats2[12][16] + coeff0_13*dmats2[13][16] + coeff0_14*dmats2[14][16] + coeff0_15*dmats2[15][16] + coeff0_16*dmats2[16][16] + coeff0_17*dmats2[17][16] + coeff0_18*dmats2[18][16] + coeff0_19*dmats2[19][16];
 
725
          new_coeff0_17 = coeff0_0*dmats2[0][17] + coeff0_1*dmats2[1][17] + coeff0_2*dmats2[2][17] + coeff0_3*dmats2[3][17] + coeff0_4*dmats2[4][17] + coeff0_5*dmats2[5][17] + coeff0_6*dmats2[6][17] + coeff0_7*dmats2[7][17] + coeff0_8*dmats2[8][17] + coeff0_9*dmats2[9][17] + coeff0_10*dmats2[10][17] + coeff0_11*dmats2[11][17] + coeff0_12*dmats2[12][17] + coeff0_13*dmats2[13][17] + coeff0_14*dmats2[14][17] + coeff0_15*dmats2[15][17] + coeff0_16*dmats2[16][17] + coeff0_17*dmats2[17][17] + coeff0_18*dmats2[18][17] + coeff0_19*dmats2[19][17];
 
726
          new_coeff0_18 = coeff0_0*dmats2[0][18] + coeff0_1*dmats2[1][18] + coeff0_2*dmats2[2][18] + coeff0_3*dmats2[3][18] + coeff0_4*dmats2[4][18] + coeff0_5*dmats2[5][18] + coeff0_6*dmats2[6][18] + coeff0_7*dmats2[7][18] + coeff0_8*dmats2[8][18] + coeff0_9*dmats2[9][18] + coeff0_10*dmats2[10][18] + coeff0_11*dmats2[11][18] + coeff0_12*dmats2[12][18] + coeff0_13*dmats2[13][18] + coeff0_14*dmats2[14][18] + coeff0_15*dmats2[15][18] + coeff0_16*dmats2[16][18] + coeff0_17*dmats2[17][18] + coeff0_18*dmats2[18][18] + coeff0_19*dmats2[19][18];
 
727
          new_coeff0_19 = coeff0_0*dmats2[0][19] + coeff0_1*dmats2[1][19] + coeff0_2*dmats2[2][19] + coeff0_3*dmats2[3][19] + coeff0_4*dmats2[4][19] + coeff0_5*dmats2[5][19] + coeff0_6*dmats2[6][19] + coeff0_7*dmats2[7][19] + coeff0_8*dmats2[8][19] + coeff0_9*dmats2[9][19] + coeff0_10*dmats2[10][19] + coeff0_11*dmats2[11][19] + coeff0_12*dmats2[12][19] + coeff0_13*dmats2[13][19] + coeff0_14*dmats2[14][19] + coeff0_15*dmats2[15][19] + coeff0_16*dmats2[16][19] + coeff0_17*dmats2[17][19] + coeff0_18*dmats2[18][19] + coeff0_19*dmats2[19][19];
 
728
        }
 
729
    
 
730
      }
 
731
      // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
732
      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 + new_coeff0_15*basisvalue15 + new_coeff0_16*basisvalue16 + new_coeff0_17*basisvalue17 + new_coeff0_18*basisvalue18 + new_coeff0_19*basisvalue19;
 
733
    }
 
734
    
 
735
    // Transform derivatives back to physical element
 
736
    for (unsigned int row = 0; row < num_derivatives; row++)
 
737
    {
 
738
      for (unsigned int col = 0; col < num_derivatives; col++)
 
739
      {
 
740
        values[row] += transform[row][col]*derivatives[col];
 
741
      }
 
742
    }
 
743
    // Delete pointer to array of derivatives on FIAT element
 
744
    delete [] derivatives;
 
745
    
 
746
    // Delete pointer to array of combinations of derivatives and transform
 
747
    for (unsigned int row = 0; row < num_derivatives; row++)
 
748
    {
 
749
      delete [] combinations[row];
 
750
      delete [] transform[row];
 
751
    }
 
752
    
 
753
    delete [] combinations;
 
754
    delete [] transform;
 
755
  }
 
756
 
 
757
  /// Evaluate order n derivatives of all basis functions at given point in cell
 
758
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
759
                                              double* values,
 
760
                                              const double* coordinates,
 
761
                                              const ufc::cell& c) const
 
762
  {
 
763
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
 
764
  }
 
765
 
 
766
  /// Evaluate linear functional for dof i on the function f
 
767
  virtual double evaluate_dof(unsigned int i,
 
768
                              const ufc::function& f,
 
769
                              const ufc::cell& c) const
 
770
  {
 
771
    // The reference points, direction and weights:
 
772
    const static double X[20][1][3] = {{{0, 0, 0}}, {{1, 0, 0}}, {{0, 1, 0}}, {{0, 0, 1}}, {{0, 0.666666666666667, 0.333333333333333}}, {{0, 0.333333333333333, 0.666666666666667}}, {{0.666666666666667, 0, 0.333333333333333}}, {{0.333333333333333, 0, 0.666666666666667}}, {{0.666666666666667, 0.333333333333333, 0}}, {{0.333333333333333, 0.666666666666667, 0}}, {{0, 0, 0.333333333333333}}, {{0, 0, 0.666666666666667}}, {{0, 0.333333333333333, 0}}, {{0, 0.666666666666667, 0}}, {{0.333333333333333, 0, 0}}, {{0.666666666666667, 0, 0}}, {{0.333333333333333, 0.333333333333333, 0.333333333333333}}, {{0, 0.333333333333333, 0.333333333333333}}, {{0.333333333333333, 0, 0.333333333333333}}, {{0.333333333333333, 0.333333333333333, 0}}};
 
773
    const static double W[20][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
 
774
    const static double D[20][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
 
775
    
 
776
    const double * const * x = c.coordinates;
 
777
    double result = 0.0;
 
778
    // Iterate over the points:
 
779
    // Evaluate basis functions for affine mapping
 
780
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1] - X[i][0][2];
 
781
    const double w1 = X[i][0][0];
 
782
    const double w2 = X[i][0][1];
 
783
    const double w3 = X[i][0][2];
 
784
    
 
785
    // Compute affine mapping y = F(X)
 
786
    double y[3];
 
787
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0] + w3*x[3][0];
 
788
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1] + w3*x[3][1];
 
789
    y[2] = w0*x[0][2] + w1*x[1][2] + w2*x[2][2] + w3*x[3][2];
 
790
    
 
791
    // Evaluate function at physical points
 
792
    double values[1];
 
793
    f.evaluate(values, y, c);
 
794
    
 
795
    // Map function values using appropriate mapping
 
796
    // Affine map: Do nothing
 
797
    
 
798
    // Note that we do not map the weights (yet).
 
799
    
 
800
    // Take directional components
 
801
    for(int k = 0; k < 1; k++)
 
802
      result += values[k]*D[i][0][k];
 
803
    // Multiply by weights 
 
804
    result *= W[i][0];
 
805
    
 
806
    return result;
 
807
  }
 
808
 
 
809
  /// Evaluate linear functionals for all dofs on the function f
 
810
  virtual void evaluate_dofs(double* values,
 
811
                             const ufc::function& f,
 
812
                             const ufc::cell& c) const
 
813
  {
 
814
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
815
  }
 
816
 
 
817
  /// Interpolate vertex values from dof values
 
818
  virtual void interpolate_vertex_values(double* vertex_values,
 
819
                                         const double* dof_values,
 
820
                                         const ufc::cell& c) const
 
821
  {
 
822
    // Evaluate at vertices and use affine mapping
 
823
    vertex_values[0] = dof_values[0];
 
824
    vertex_values[1] = dof_values[1];
 
825
    vertex_values[2] = dof_values[2];
 
826
    vertex_values[3] = dof_values[3];
 
827
  }
 
828
 
 
829
  /// Return the number of sub elements (for a mixed element)
 
830
  virtual unsigned int num_sub_elements() const
 
831
  {
 
832
    return 1;
 
833
  }
 
834
 
 
835
  /// Create a new finite element for sub element i (for a mixed element)
 
836
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
837
  {
 
838
    return new UFC_Poisson3D_3BilinearForm_finite_element_0();
 
839
  }
 
840
 
 
841
};
 
842
 
 
843
/// This class defines the interface for a finite element.
 
844
 
 
845
class UFC_Poisson3D_3BilinearForm_finite_element_1: public ufc::finite_element
 
846
{
 
847
public:
 
848
 
 
849
  /// Constructor
 
850
  UFC_Poisson3D_3BilinearForm_finite_element_1() : ufc::finite_element()
 
851
  {
 
852
    // Do nothing
 
853
  }
 
854
 
 
855
  /// Destructor
 
856
  virtual ~UFC_Poisson3D_3BilinearForm_finite_element_1()
 
857
  {
 
858
    // Do nothing
 
859
  }
 
860
 
 
861
  /// Return a string identifying the finite element
 
862
  virtual const char* signature() const
 
863
  {
 
864
    return "Lagrange finite element of degree 3 on a tetrahedron";
 
865
  }
 
866
 
 
867
  /// Return the cell shape
 
868
  virtual ufc::shape cell_shape() const
 
869
  {
 
870
    return ufc::tetrahedron;
 
871
  }
 
872
 
 
873
  /// Return the dimension of the finite element function space
 
874
  virtual unsigned int space_dimension() const
 
875
  {
 
876
    return 20;
 
877
  }
 
878
 
 
879
  /// Return the rank of the value space
 
880
  virtual unsigned int value_rank() const
 
881
  {
 
882
    return 0;
 
883
  }
 
884
 
 
885
  /// Return the dimension of the value space for axis i
 
886
  virtual unsigned int value_dimension(unsigned int i) const
 
887
  {
 
888
    return 1;
 
889
  }
 
890
 
 
891
  /// Evaluate basis function i at given point in cell
 
892
  virtual void evaluate_basis(unsigned int i,
 
893
                              double* values,
 
894
                              const double* coordinates,
 
895
                              const ufc::cell& c) const
 
896
  {
 
897
    // Extract vertex coordinates
 
898
    const double * const * element_coordinates = c.coordinates;
 
899
    
 
900
    // Compute Jacobian of affine map from reference cell
 
901
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
902
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
903
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
904
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
905
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
906
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
907
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
908
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
909
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
910
      
 
911
    // Compute sub determinants
 
912
    const double d00 = J_11*J_22 - J_12*J_21;
 
913
    const double d01 = J_12*J_20 - J_10*J_22;
 
914
    const double d02 = J_10*J_21 - J_11*J_20;
 
915
    
 
916
    const double d10 = J_02*J_21 - J_01*J_22;
 
917
    const double d11 = J_00*J_22 - J_02*J_20;
 
918
    const double d12 = J_01*J_20 - J_00*J_21;
 
919
    
 
920
    const double d20 = J_01*J_12 - J_02*J_11;
 
921
    const double d21 = J_02*J_10 - J_00*J_12;
 
922
    const double d22 = J_00*J_11 - J_01*J_10;
 
923
      
 
924
    // Compute determinant of Jacobian
 
925
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
926
    
 
927
    // Compute inverse of Jacobian
 
928
    
 
929
    // Compute constants
 
930
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
931
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
932
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
933
    
 
934
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
935
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
936
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
937
    
 
938
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
939
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
940
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
941
    
 
942
    // Get coordinates and map to the UFC reference element
 
943
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
944
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
945
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
946
    
 
947
    // Map coordinates to the reference cube
 
948
    if (std::abs(y + z - 1.0) < 1e-14)
 
949
      x = 1.0;
 
950
    else
 
951
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
952
    if (std::abs(z - 1.0) < 1e-14)
 
953
      y = -1.0;
 
954
    else
 
955
      y = 2.0 * y/(1.0 - z) - 1.0;
 
956
    z = 2.0 * z - 1.0;
 
957
    
 
958
    // Reset values
 
959
    *values = 0;
 
960
    
 
961
    // Map degree of freedom to element degree of freedom
 
962
    const unsigned int dof = i;
 
963
    
 
964
    // Generate scalings
 
965
    const double scalings_y_0 = 1;
 
966
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
 
967
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
 
968
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
 
969
    const double scalings_z_0 = 1;
 
970
    const double scalings_z_1 = scalings_z_0*(0.5 - 0.5*z);
 
971
    const double scalings_z_2 = scalings_z_1*(0.5 - 0.5*z);
 
972
    const double scalings_z_3 = scalings_z_2*(0.5 - 0.5*z);
 
973
    
 
974
    // Compute psitilde_a
 
975
    const double psitilde_a_0 = 1;
 
976
    const double psitilde_a_1 = x;
 
977
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
 
978
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
 
979
    
 
980
    // Compute psitilde_bs
 
981
    const double psitilde_bs_0_0 = 1;
 
982
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
 
983
    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;
 
984
    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;
 
985
    const double psitilde_bs_1_0 = 1;
 
986
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
 
987
    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;
 
988
    const double psitilde_bs_2_0 = 1;
 
989
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
 
990
    const double psitilde_bs_3_0 = 1;
 
991
    
 
992
    // Compute psitilde_cs
 
993
    const double psitilde_cs_00_0 = 1;
 
994
    const double psitilde_cs_00_1 = 2*z + 1;
 
995
    const double psitilde_cs_00_2 = 0.3125*psitilde_cs_00_1 + 1.875*z*psitilde_cs_00_1 - 0.5625*psitilde_cs_00_0;
 
996
    const double psitilde_cs_00_3 = 0.155555555555556*psitilde_cs_00_2 + 1.86666666666667*z*psitilde_cs_00_2 - 0.711111111111111*psitilde_cs_00_1;
 
997
    const double psitilde_cs_01_0 = 1;
 
998
    const double psitilde_cs_01_1 = 3*z + 2;
 
999
    const double psitilde_cs_01_2 = 0.777777777777778*psitilde_cs_01_1 + 2.33333333333333*z*psitilde_cs_01_1 - 0.555555555555556*psitilde_cs_01_0;
 
1000
    const double psitilde_cs_02_0 = 1;
 
1001
    const double psitilde_cs_02_1 = 4*z + 3;
 
1002
    const double psitilde_cs_03_0 = 1;
 
1003
    const double psitilde_cs_10_0 = 1;
 
1004
    const double psitilde_cs_10_1 = 3*z + 2;
 
1005
    const double psitilde_cs_10_2 = 0.777777777777778*psitilde_cs_10_1 + 2.33333333333333*z*psitilde_cs_10_1 - 0.555555555555556*psitilde_cs_10_0;
 
1006
    const double psitilde_cs_11_0 = 1;
 
1007
    const double psitilde_cs_11_1 = 4*z + 3;
 
1008
    const double psitilde_cs_12_0 = 1;
 
1009
    const double psitilde_cs_20_0 = 1;
 
1010
    const double psitilde_cs_20_1 = 4*z + 3;
 
1011
    const double psitilde_cs_21_0 = 1;
 
1012
    const double psitilde_cs_30_0 = 1;
 
1013
    
 
1014
    // Compute basisvalues
 
1015
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
1016
    const double basisvalue1 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_0;
 
1017
    const double basisvalue2 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_0;
 
1018
    const double basisvalue3 = 1.11803398874989*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_1;
 
1019
    const double basisvalue4 = 5.1234753829798*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_0;
 
1020
    const double basisvalue5 = 3.96862696659689*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_0;
 
1021
    const double basisvalue6 = 2.29128784747792*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_0;
 
1022
    const double basisvalue7 = 3.24037034920393*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_1;
 
1023
    const double basisvalue8 = 1.87082869338697*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_1;
 
1024
    const double basisvalue9 = 1.3228756555323*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_2;
 
1025
    const double basisvalue10 = 7.93725393319377*psitilde_a_3*scalings_y_3*psitilde_bs_3_0*scalings_z_3*psitilde_cs_30_0;
 
1026
    const double basisvalue11 = 6.70820393249937*psitilde_a_2*scalings_y_2*psitilde_bs_2_1*scalings_z_3*psitilde_cs_21_0;
 
1027
    const double basisvalue12 = 5.19615242270663*psitilde_a_1*scalings_y_1*psitilde_bs_1_2*scalings_z_3*psitilde_cs_12_0;
 
1028
    const double basisvalue13 = 3*psitilde_a_0*scalings_y_0*psitilde_bs_0_3*scalings_z_3*psitilde_cs_03_0;
 
1029
    const double basisvalue14 = 5.80947501931113*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_1;
 
1030
    const double basisvalue15 = 4.5*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_1;
 
1031
    const double basisvalue16 = 2.59807621135332*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_1;
 
1032
    const double basisvalue17 = 3.67423461417477*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_2;
 
1033
    const double basisvalue18 = 2.12132034355964*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_2;
 
1034
    const double basisvalue19 = 1.5*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_3;
 
1035
    
 
1036
    // Table(s) of coefficients
 
1037
    const static double coefficients0[20][20] = \
 
1038
    {{0.0288675134594813, 0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, 0.014173667737846, 0.00818317088384971, 0.0115727512471569, 0.0066815310478106, 0.00472455591261534, -0.028347335475692, -0.0239578711874978, -0.0185576872239523, -0.0107142857142857, -0.0207481250689683, -0.0160714285714286, -0.00927884361197613, -0.0131222664791956, -0.00757614408414158, -0.00535714285714285},
 
1039
    {0.0288675134594813, -0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, -0.014173667737846, 0.00818317088384972, -0.0115727512471569, 0.00668153104781061, 0.00472455591261535, 0.028347335475692, -0.0239578711874977, 0.0185576872239523, -0.0107142857142857, -0.0207481250689683, 0.0160714285714286, -0.00927884361197613, 0.0131222664791956, -0.00757614408414158, -0.00535714285714286},
 
1040
    {0.0288675134594813, 0, -0.0150584650484208, 0.00532397137499948, 0, 0, 0.0245495126515492, 0, -0.0133630620956212, 0.00472455591261535, 0, 0, 0, 0.0428571428571429, 0, 0, -0.0278365308359284, 0, 0.0151522881682832, -0.00535714285714286},
 
1041
    {0.0288675134594812, 0, 0, -0.0159719141249985, 0, 0, 0, 0, 0, 0.0283473354756921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0535714285714286},
 
1042
    {0, 0, 0.112938487863156, -0.063887656499994, 0, 0, 0.0736485379546474, 0, 0.0267261241912424, -0.0236227795630767, 0, 0, 0, 0, 0, 0, 0.0649519052838329, 0, -0.0606091526731327, 0.0267857142857143},
 
1043
    {0, 0, -0.0225876975726313, 0.127775312999988, 0, 0, 0, 0, 0.0668153104781061, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0, 0.0757614408414158, -0.0535714285714286},
 
1044
    {0, 0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, -0.0425210032135381, 0.0245495126515492, 0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, -0.0375, 0.021650635094611, -0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
1045
    {0, -0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, 0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
1046
    {0, 0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, 0.014173667737846, -0.0245495126515492, -0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, -0.0618589574131742, 0.0428571428571429, -0.0069160416896561, -0.0160714285714286, 0.0154647393532936, 0.00874817765279706, 0, -0.00535714285714286},
 
1047
    {0, -0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, 0.0566946709513841, 0.0245495126515492, -0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, 0.0618589574131742, -0.0642857142857143, 0, -0.0214285714285714, 0.00927884361197612, 0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
1048
    {0, -0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, 0.0425210032135381, 0.0245495126515492, -0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, 0.0375, 0.021650635094611, 0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
1049
    {0, 0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, -0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, -0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
1050
    {0, -0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, -0.014173667737846, -0.0245495126515491, 0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, 0.0618589574131742, 0.0428571428571429, -0.0069160416896561, 0.0160714285714286, 0.0154647393532935, -0.00874817765279706, 0, -0.00535714285714285},
 
1051
    {0, 0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, -0.0566946709513841, 0.0245495126515491, 0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, -0.0618589574131742, -0.0642857142857143, 0, 0.0214285714285714, 0.00927884361197613, -0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
1052
    {0, -0.117369119465393, -0.0451753951452625, -0.031943828249997, -0.018298126367785, 0.042521003213538, 0.0409158544192486, 0.0347182537414707, 0.033407655239053, 0.0236227795630767, 0.0850420064270761, 0.0239578711874978, -0.00618589574131742, -0.0107142857142857, 0.0207481250689683, -0.00535714285714286, -0.00927884361197612, -0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
1053
    {0, 0.117369119465393, -0.0451753951452626, -0.031943828249997, -0.018298126367785, -0.0425210032135381, 0.0409158544192486, -0.0347182537414707, 0.033407655239053, 0.0236227795630767, -0.0850420064270761, 0.0239578711874977, 0.00618589574131741, -0.0107142857142857, 0.0207481250689683, 0.00535714285714286, -0.00927884361197612, 0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
1054
    {0.259807621135332, 0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, 0.0850420064270761, -0.0736485379546474, 0.0694365074829413, 0.0400891862868637, -0.0992156741649221, 0, 0, 0, 0, 0, 0.075, -0.0649519052838329, -0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
1055
    {0.259807621135332, -0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, -0.0850420064270761, -0.0736485379546474, -0.0694365074829414, 0.0400891862868637, -0.0992156741649222, 0, 0, 0, 0, 0, -0.075, -0.0649519052838329, 0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
1056
    {0.259807621135332, 0, -0.135526185435788, 0.0479157423749955, -0.10978875820671, 0, 0.0245495126515491, 0, -0.0801783725737273, -0.0992156741649221, 0, 0, 0, 0, -0.0968245836551854, 0, 0.021650635094611, 0, 0.0303045763365663, 0.0267857142857143},
 
1057
    {0.259807621135332, 0, 0, -0.143747227124986, -0.10978875820671, 0, -0.122747563257746, 0, 0, 0.0425210032135381, 0, -0.095831484749991, 0, 0.0428571428571429, 0.0138320833793122, 0, 0.0154647393532935, 0, 0, -0.00535714285714285}};
 
1058
    
 
1059
    // Extract relevant coefficients
 
1060
    const double coeff0_0 = coefficients0[dof][0];
 
1061
    const double coeff0_1 = coefficients0[dof][1];
 
1062
    const double coeff0_2 = coefficients0[dof][2];
 
1063
    const double coeff0_3 = coefficients0[dof][3];
 
1064
    const double coeff0_4 = coefficients0[dof][4];
 
1065
    const double coeff0_5 = coefficients0[dof][5];
 
1066
    const double coeff0_6 = coefficients0[dof][6];
 
1067
    const double coeff0_7 = coefficients0[dof][7];
 
1068
    const double coeff0_8 = coefficients0[dof][8];
 
1069
    const double coeff0_9 = coefficients0[dof][9];
 
1070
    const double coeff0_10 = coefficients0[dof][10];
 
1071
    const double coeff0_11 = coefficients0[dof][11];
 
1072
    const double coeff0_12 = coefficients0[dof][12];
 
1073
    const double coeff0_13 = coefficients0[dof][13];
 
1074
    const double coeff0_14 = coefficients0[dof][14];
 
1075
    const double coeff0_15 = coefficients0[dof][15];
 
1076
    const double coeff0_16 = coefficients0[dof][16];
 
1077
    const double coeff0_17 = coefficients0[dof][17];
 
1078
    const double coeff0_18 = coefficients0[dof][18];
 
1079
    const double coeff0_19 = coefficients0[dof][19];
 
1080
    
 
1081
    // Compute value(s)
 
1082
    *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 + coeff0_15*basisvalue15 + coeff0_16*basisvalue16 + coeff0_17*basisvalue17 + coeff0_18*basisvalue18 + coeff0_19*basisvalue19;
 
1083
  }
 
1084
 
 
1085
  /// Evaluate all basis functions at given point in cell
 
1086
  virtual void evaluate_basis_all(double* values,
 
1087
                                  const double* coordinates,
 
1088
                                  const ufc::cell& c) const
 
1089
  {
 
1090
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
 
1091
  }
 
1092
 
 
1093
  /// Evaluate order n derivatives of basis function i at given point in cell
 
1094
  virtual void evaluate_basis_derivatives(unsigned int i,
 
1095
                                          unsigned int n,
 
1096
                                          double* values,
 
1097
                                          const double* coordinates,
 
1098
                                          const ufc::cell& c) const
 
1099
  {
 
1100
    // Extract vertex coordinates
 
1101
    const double * const * element_coordinates = c.coordinates;
 
1102
    
 
1103
    // Compute Jacobian of affine map from reference cell
 
1104
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
1105
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
1106
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
1107
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
1108
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
1109
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
1110
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
1111
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
1112
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
1113
      
 
1114
    // Compute sub determinants
 
1115
    const double d00 = J_11*J_22 - J_12*J_21;
 
1116
    const double d01 = J_12*J_20 - J_10*J_22;
 
1117
    const double d02 = J_10*J_21 - J_11*J_20;
 
1118
    
 
1119
    const double d10 = J_02*J_21 - J_01*J_22;
 
1120
    const double d11 = J_00*J_22 - J_02*J_20;
 
1121
    const double d12 = J_01*J_20 - J_00*J_21;
 
1122
    
 
1123
    const double d20 = J_01*J_12 - J_02*J_11;
 
1124
    const double d21 = J_02*J_10 - J_00*J_12;
 
1125
    const double d22 = J_00*J_11 - J_01*J_10;
 
1126
      
 
1127
    // Compute determinant of Jacobian
 
1128
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
1129
    
 
1130
    // Compute inverse of Jacobian
 
1131
    
 
1132
    // Compute constants
 
1133
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
1134
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
1135
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
1136
    
 
1137
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
1138
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
1139
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
1140
    
 
1141
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
1142
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
1143
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
1144
    
 
1145
    // Get coordinates and map to the UFC reference element
 
1146
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
1147
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
1148
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
1149
    
 
1150
    // Map coordinates to the reference cube
 
1151
    if (std::abs(y + z - 1.0) < 1e-14)
 
1152
      x = 1.0;
 
1153
    else
 
1154
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
1155
    if (std::abs(z - 1.0) < 1e-14)
 
1156
      y = -1.0;
 
1157
    else
 
1158
      y = 2.0 * y/(1.0 - z) - 1.0;
 
1159
    z = 2.0 * z - 1.0;
 
1160
    
 
1161
    // Compute number of derivatives
 
1162
    unsigned int num_derivatives = 1;
 
1163
    
 
1164
    for (unsigned int j = 0; j < n; j++)
 
1165
      num_derivatives *= 3;
 
1166
    
 
1167
    
 
1168
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
 
1169
    unsigned int **combinations = new unsigned int *[num_derivatives];
 
1170
        
 
1171
    for (unsigned int j = 0; j < num_derivatives; j++)
 
1172
    {
 
1173
      combinations[j] = new unsigned int [n];
 
1174
      for (unsigned int k = 0; k < n; k++)
 
1175
        combinations[j][k] = 0;
 
1176
    }
 
1177
        
 
1178
    // Generate combinations of derivatives
 
1179
    for (unsigned int row = 1; row < num_derivatives; row++)
 
1180
    {
 
1181
      for (unsigned int num = 0; num < row; num++)
 
1182
      {
 
1183
        for (unsigned int col = n-1; col+1 > 0; col--)
 
1184
        {
 
1185
          if (combinations[row][col] + 1 > 2)
 
1186
            combinations[row][col] = 0;
 
1187
          else
 
1188
          {
 
1189
            combinations[row][col] += 1;
 
1190
            break;
 
1191
          }
 
1192
        }
 
1193
      }
 
1194
    }
 
1195
    
 
1196
    // Compute inverse of Jacobian
 
1197
    const double Jinv[3][3] ={{d00 / detJ, d10 / detJ, d20 / detJ}, {d01 / detJ, d11 / detJ, d21 / detJ}, {d02 / detJ, d12 / detJ, d22 / detJ}};
 
1198
    
 
1199
    // Declare transformation matrix
 
1200
    // Declare pointer to two dimensional array and initialise
 
1201
    double **transform = new double *[num_derivatives];
 
1202
        
 
1203
    for (unsigned int j = 0; j < num_derivatives; j++)
 
1204
    {
 
1205
      transform[j] = new double [num_derivatives];
 
1206
      for (unsigned int k = 0; k < num_derivatives; k++)
 
1207
        transform[j][k] = 1;
 
1208
    }
 
1209
    
 
1210
    // Construct transformation matrix
 
1211
    for (unsigned int row = 0; row < num_derivatives; row++)
 
1212
    {
 
1213
      for (unsigned int col = 0; col < num_derivatives; col++)
 
1214
      {
 
1215
        for (unsigned int k = 0; k < n; k++)
 
1216
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
 
1217
      }
 
1218
    }
 
1219
    
 
1220
    // Reset values
 
1221
    for (unsigned int j = 0; j < 1*num_derivatives; j++)
 
1222
      values[j] = 0;
 
1223
    
 
1224
    // Map degree of freedom to element degree of freedom
 
1225
    const unsigned int dof = i;
 
1226
    
 
1227
    // Generate scalings
 
1228
    const double scalings_y_0 = 1;
 
1229
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
 
1230
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
 
1231
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
 
1232
    const double scalings_z_0 = 1;
 
1233
    const double scalings_z_1 = scalings_z_0*(0.5 - 0.5*z);
 
1234
    const double scalings_z_2 = scalings_z_1*(0.5 - 0.5*z);
 
1235
    const double scalings_z_3 = scalings_z_2*(0.5 - 0.5*z);
 
1236
    
 
1237
    // Compute psitilde_a
 
1238
    const double psitilde_a_0 = 1;
 
1239
    const double psitilde_a_1 = x;
 
1240
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
 
1241
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
 
1242
    
 
1243
    // Compute psitilde_bs
 
1244
    const double psitilde_bs_0_0 = 1;
 
1245
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
 
1246
    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;
 
1247
    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;
 
1248
    const double psitilde_bs_1_0 = 1;
 
1249
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
 
1250
    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;
 
1251
    const double psitilde_bs_2_0 = 1;
 
1252
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
 
1253
    const double psitilde_bs_3_0 = 1;
 
1254
    
 
1255
    // Compute psitilde_cs
 
1256
    const double psitilde_cs_00_0 = 1;
 
1257
    const double psitilde_cs_00_1 = 2*z + 1;
 
1258
    const double psitilde_cs_00_2 = 0.3125*psitilde_cs_00_1 + 1.875*z*psitilde_cs_00_1 - 0.5625*psitilde_cs_00_0;
 
1259
    const double psitilde_cs_00_3 = 0.155555555555556*psitilde_cs_00_2 + 1.86666666666667*z*psitilde_cs_00_2 - 0.711111111111111*psitilde_cs_00_1;
 
1260
    const double psitilde_cs_01_0 = 1;
 
1261
    const double psitilde_cs_01_1 = 3*z + 2;
 
1262
    const double psitilde_cs_01_2 = 0.777777777777778*psitilde_cs_01_1 + 2.33333333333333*z*psitilde_cs_01_1 - 0.555555555555556*psitilde_cs_01_0;
 
1263
    const double psitilde_cs_02_0 = 1;
 
1264
    const double psitilde_cs_02_1 = 4*z + 3;
 
1265
    const double psitilde_cs_03_0 = 1;
 
1266
    const double psitilde_cs_10_0 = 1;
 
1267
    const double psitilde_cs_10_1 = 3*z + 2;
 
1268
    const double psitilde_cs_10_2 = 0.777777777777778*psitilde_cs_10_1 + 2.33333333333333*z*psitilde_cs_10_1 - 0.555555555555556*psitilde_cs_10_0;
 
1269
    const double psitilde_cs_11_0 = 1;
 
1270
    const double psitilde_cs_11_1 = 4*z + 3;
 
1271
    const double psitilde_cs_12_0 = 1;
 
1272
    const double psitilde_cs_20_0 = 1;
 
1273
    const double psitilde_cs_20_1 = 4*z + 3;
 
1274
    const double psitilde_cs_21_0 = 1;
 
1275
    const double psitilde_cs_30_0 = 1;
 
1276
    
 
1277
    // Compute basisvalues
 
1278
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
1279
    const double basisvalue1 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_0;
 
1280
    const double basisvalue2 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_0;
 
1281
    const double basisvalue3 = 1.11803398874989*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_1;
 
1282
    const double basisvalue4 = 5.1234753829798*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_0;
 
1283
    const double basisvalue5 = 3.96862696659689*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_0;
 
1284
    const double basisvalue6 = 2.29128784747792*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_0;
 
1285
    const double basisvalue7 = 3.24037034920393*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_1;
 
1286
    const double basisvalue8 = 1.87082869338697*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_1;
 
1287
    const double basisvalue9 = 1.3228756555323*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_2;
 
1288
    const double basisvalue10 = 7.93725393319377*psitilde_a_3*scalings_y_3*psitilde_bs_3_0*scalings_z_3*psitilde_cs_30_0;
 
1289
    const double basisvalue11 = 6.70820393249937*psitilde_a_2*scalings_y_2*psitilde_bs_2_1*scalings_z_3*psitilde_cs_21_0;
 
1290
    const double basisvalue12 = 5.19615242270663*psitilde_a_1*scalings_y_1*psitilde_bs_1_2*scalings_z_3*psitilde_cs_12_0;
 
1291
    const double basisvalue13 = 3*psitilde_a_0*scalings_y_0*psitilde_bs_0_3*scalings_z_3*psitilde_cs_03_0;
 
1292
    const double basisvalue14 = 5.80947501931113*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_1;
 
1293
    const double basisvalue15 = 4.5*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_1;
 
1294
    const double basisvalue16 = 2.59807621135332*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_1;
 
1295
    const double basisvalue17 = 3.67423461417477*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_2;
 
1296
    const double basisvalue18 = 2.12132034355964*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_2;
 
1297
    const double basisvalue19 = 1.5*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_3;
 
1298
    
 
1299
    // Table(s) of coefficients
 
1300
    const static double coefficients0[20][20] = \
 
1301
    {{0.0288675134594813, 0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, 0.014173667737846, 0.00818317088384971, 0.0115727512471569, 0.0066815310478106, 0.00472455591261534, -0.028347335475692, -0.0239578711874978, -0.0185576872239523, -0.0107142857142857, -0.0207481250689683, -0.0160714285714286, -0.00927884361197613, -0.0131222664791956, -0.00757614408414158, -0.00535714285714285},
 
1302
    {0.0288675134594813, -0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, -0.014173667737846, 0.00818317088384972, -0.0115727512471569, 0.00668153104781061, 0.00472455591261535, 0.028347335475692, -0.0239578711874977, 0.0185576872239523, -0.0107142857142857, -0.0207481250689683, 0.0160714285714286, -0.00927884361197613, 0.0131222664791956, -0.00757614408414158, -0.00535714285714286},
 
1303
    {0.0288675134594813, 0, -0.0150584650484208, 0.00532397137499948, 0, 0, 0.0245495126515492, 0, -0.0133630620956212, 0.00472455591261535, 0, 0, 0, 0.0428571428571429, 0, 0, -0.0278365308359284, 0, 0.0151522881682832, -0.00535714285714286},
 
1304
    {0.0288675134594812, 0, 0, -0.0159719141249985, 0, 0, 0, 0, 0, 0.0283473354756921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0535714285714286},
 
1305
    {0, 0, 0.112938487863156, -0.063887656499994, 0, 0, 0.0736485379546474, 0, 0.0267261241912424, -0.0236227795630767, 0, 0, 0, 0, 0, 0, 0.0649519052838329, 0, -0.0606091526731327, 0.0267857142857143},
 
1306
    {0, 0, -0.0225876975726313, 0.127775312999988, 0, 0, 0, 0, 0.0668153104781061, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0, 0.0757614408414158, -0.0535714285714286},
 
1307
    {0, 0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, -0.0425210032135381, 0.0245495126515492, 0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, -0.0375, 0.021650635094611, -0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
1308
    {0, -0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, 0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
1309
    {0, 0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, 0.014173667737846, -0.0245495126515492, -0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, -0.0618589574131742, 0.0428571428571429, -0.0069160416896561, -0.0160714285714286, 0.0154647393532936, 0.00874817765279706, 0, -0.00535714285714286},
 
1310
    {0, -0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, 0.0566946709513841, 0.0245495126515492, -0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, 0.0618589574131742, -0.0642857142857143, 0, -0.0214285714285714, 0.00927884361197612, 0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
1311
    {0, -0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, 0.0425210032135381, 0.0245495126515492, -0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, 0.0375, 0.021650635094611, 0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
1312
    {0, 0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, -0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, -0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
1313
    {0, -0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, -0.014173667737846, -0.0245495126515491, 0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, 0.0618589574131742, 0.0428571428571429, -0.0069160416896561, 0.0160714285714286, 0.0154647393532935, -0.00874817765279706, 0, -0.00535714285714285},
 
1314
    {0, 0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, -0.0566946709513841, 0.0245495126515491, 0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, -0.0618589574131742, -0.0642857142857143, 0, 0.0214285714285714, 0.00927884361197613, -0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
1315
    {0, -0.117369119465393, -0.0451753951452625, -0.031943828249997, -0.018298126367785, 0.042521003213538, 0.0409158544192486, 0.0347182537414707, 0.033407655239053, 0.0236227795630767, 0.0850420064270761, 0.0239578711874978, -0.00618589574131742, -0.0107142857142857, 0.0207481250689683, -0.00535714285714286, -0.00927884361197612, -0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
1316
    {0, 0.117369119465393, -0.0451753951452626, -0.031943828249997, -0.018298126367785, -0.0425210032135381, 0.0409158544192486, -0.0347182537414707, 0.033407655239053, 0.0236227795630767, -0.0850420064270761, 0.0239578711874977, 0.00618589574131741, -0.0107142857142857, 0.0207481250689683, 0.00535714285714286, -0.00927884361197612, 0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
1317
    {0.259807621135332, 0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, 0.0850420064270761, -0.0736485379546474, 0.0694365074829413, 0.0400891862868637, -0.0992156741649221, 0, 0, 0, 0, 0, 0.075, -0.0649519052838329, -0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
1318
    {0.259807621135332, -0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, -0.0850420064270761, -0.0736485379546474, -0.0694365074829414, 0.0400891862868637, -0.0992156741649222, 0, 0, 0, 0, 0, -0.075, -0.0649519052838329, 0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
1319
    {0.259807621135332, 0, -0.135526185435788, 0.0479157423749955, -0.10978875820671, 0, 0.0245495126515491, 0, -0.0801783725737273, -0.0992156741649221, 0, 0, 0, 0, -0.0968245836551854, 0, 0.021650635094611, 0, 0.0303045763365663, 0.0267857142857143},
 
1320
    {0.259807621135332, 0, 0, -0.143747227124986, -0.10978875820671, 0, -0.122747563257746, 0, 0, 0.0425210032135381, 0, -0.095831484749991, 0, 0.0428571428571429, 0.0138320833793122, 0, 0.0154647393532935, 0, 0, -0.00535714285714285}};
 
1321
    
 
1322
    // Interesting (new) part
 
1323
    // Tables of derivatives of the polynomial base (transpose)
 
1324
    const static double dmats0[20][20] = \
 
1325
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1326
    {6.32455532033676, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1327
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1328
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1329
    {0, 11.2249721603218, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1330
    {4.58257569495584, 0, 8.36660026534076, -1.18321595661992, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1331
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1332
    {3.74165738677394, 0, 0, 8.69482604771366, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1333
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1334
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1335
    {5.49909083394701, 0, -3.3466401061363, -2.36643191323985, 15.4919333848297, 0, 0.692820323027551, 0, 0.565685424949239, 0.400000000000001, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1336
    {0, 4.89897948556636, 0, 0, 0, 14.1985914794391, 0, -0.82807867121083, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1337
    {3.6, 0, 8.76356092008266, -1.54919333848297, 0, 0, 9.52470471983253, 0, -1.48131215963608, 0.261861468283192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1338
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1339
    {0, 4.24264068711928, 0, 0, 0, 0, 0, 14.3427433120127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1340
    {3.11769145362398, 0, 3.16227766016838, 4.91934955049954, 0, 0, 0, 0, 10.690449676497, -2.41897262725906, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1341
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1342
    {2.54558441227157, 0, 0, 7.66811580507233, 0, 0, 0, 0, 0, 10.3691851174526, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1343
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1344
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
1345
    
 
1346
    const static double dmats1[20][20] = \
 
1347
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1348
    {3.16227766016838, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1349
    {5.47722557505166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1350
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1351
    {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1352
    {2.29128784747792, 7.24568837309472, 4.18330013267038, -0.591607978309959, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1353
    {-2.64575131106459, 0, 9.66091783079296, 0.683130051063973, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1354
    {1.87082869338697, 0, 0, 4.34741302385683, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1355
    {3.24037034920393, 0, 0, 7.52994023880668, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1356
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1357
    {2.74954541697351, 5.79655069847577, -1.67332005306815, -1.18321595661992, 7.74596669241483, -1.2, 0.346410161513776, -0.979795897113271, 0.28284271247462, 0.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1358
    {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 9.16515138991168, 7.09929573971954, -2.04939015319192, -0.414039335605415, -0.478091443733757, 0.169030850945704, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1359
    {1.8, -5.69209978830308, 4.38178046004133, -0.774596669241487, 0, 10.998181667894, 4.76235235991626, 0.962140470884726, -0.740656079818041, 0.130930734141596, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1360
    {5.19615242270664, 0, -3.16227766016838, -2.23606797749979, 0, 0, 13.7477270848675, 0, 0.534522483824849, 0.37796447300923, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1361
    {2.01246117974981, 2.12132034355964, -0.408248290463864, 3.17542648054294, 0, 0, 0, 7.17137165600636, -1.38013111868471, -1.56144011671765, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1362
    {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0, 0, 0, 9.25820099772551, 5.34522483824849, -1.20948631362953, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1363
    {-1.8, 0, 3.65148371670111, -2.84018778721878, 0, 0, 0, 0, 12.3442679969674, 1.39659449751035, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1364
    {1.27279220613579, 0, 0, 3.83405790253616, 0, 0, 0, 0, 0, 5.18459255872629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1365
    {2.20454076850486, 0, 0, 6.6407830863536, 0, 0, 0, 0, 0, 8.97997772825746, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1366
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
1367
    
 
1368
    const static double dmats2[20][20] = \
 
1369
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1370
    {3.16227766016838, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1371
    {1.82574185835055, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1372
    {5.16397779494322, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1373
    {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1374
    {2.29128784747792, 1.44913767461895, 4.18330013267038, -0.59160797830996, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1375
    {1.32287565553229, 0, 3.86436713231718, -0.341565025531987, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1376
    {1.87082869338697, 7.09929573971954, 0, 4.34741302385683, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1377
    {1.08012344973464, 0, 7.09929573971954, 2.50998007960222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1378
    {-3.81881307912986, 0, 0, 8.87411967464942, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1379
    {2.74954541697351, 5.79655069847577, -1.67332005306815, -1.18321595661992, 7.74596669241483, -1.2, 0.346410161513776, -0.979795897113271, 0.282842712474619, 0.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1380
    {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141595, 7.09929573971954, -2.04939015319192, -0.414039335605415, -0.478091443733757, 0.169030850945704, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1381
    {1.8, 0.632455532033675, 4.38178046004133, -0.774596669241484, 0, 3.14233761939829, 4.76235235991626, -0.10690449676497, -0.740656079818042, 0.130930734141596, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1382
    {1.03923048454133, 0, 3.16227766016838, -0.447213595499959, 0, 0, 5.8918830363718, 0, -0.53452248382485, 0.0755928946018459, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1383
    {2.01246117974981, 2.12132034355964, -0.408248290463863, 3.17542648054294, 9.07114735222145, 0, 0, 7.17137165600636, -1.38013111868471, -1.56144011671765, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1384
    {1.55884572681199, 0.547722557505165, 1.58113883008419, 2.45967477524977, 0, 9.07114735222145, 0, 1.8516401995451, 5.34522483824849, -1.20948631362953, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1385
    {0.900000000000001, 0, 1.46059348668045, 1.42009389360939, 0, 0, 9.07114735222145, 0, 4.93770719878694, -0.698297248755175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1386
    {1.27279220613578, -6.26099033699941, 0, 3.83405790253616, 0, 0, 0, 10.5830052442584, 0, 5.18459255872629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1387
    {0.734846922834954, 0, -6.26099033699941, 2.21359436211787, 0, 0, 0, 0, 10.5830052442584, 2.99332590941915, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
1388
    {5.7157676649773, 0, 0, -4.69574275274955, 0, 0, 0, 0, 0, 12.69960629311, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
1389
    
 
1390
    // Compute reference derivatives
 
1391
    // Declare pointer to array of derivatives on FIAT element
 
1392
    double *derivatives = new double [num_derivatives];
 
1393
    
 
1394
    // Declare coefficients
 
1395
    double coeff0_0 = 0;
 
1396
    double coeff0_1 = 0;
 
1397
    double coeff0_2 = 0;
 
1398
    double coeff0_3 = 0;
 
1399
    double coeff0_4 = 0;
 
1400
    double coeff0_5 = 0;
 
1401
    double coeff0_6 = 0;
 
1402
    double coeff0_7 = 0;
 
1403
    double coeff0_8 = 0;
 
1404
    double coeff0_9 = 0;
 
1405
    double coeff0_10 = 0;
 
1406
    double coeff0_11 = 0;
 
1407
    double coeff0_12 = 0;
 
1408
    double coeff0_13 = 0;
 
1409
    double coeff0_14 = 0;
 
1410
    double coeff0_15 = 0;
 
1411
    double coeff0_16 = 0;
 
1412
    double coeff0_17 = 0;
 
1413
    double coeff0_18 = 0;
 
1414
    double coeff0_19 = 0;
 
1415
    
 
1416
    // Declare new coefficients
 
1417
    double new_coeff0_0 = 0;
 
1418
    double new_coeff0_1 = 0;
 
1419
    double new_coeff0_2 = 0;
 
1420
    double new_coeff0_3 = 0;
 
1421
    double new_coeff0_4 = 0;
 
1422
    double new_coeff0_5 = 0;
 
1423
    double new_coeff0_6 = 0;
 
1424
    double new_coeff0_7 = 0;
 
1425
    double new_coeff0_8 = 0;
 
1426
    double new_coeff0_9 = 0;
 
1427
    double new_coeff0_10 = 0;
 
1428
    double new_coeff0_11 = 0;
 
1429
    double new_coeff0_12 = 0;
 
1430
    double new_coeff0_13 = 0;
 
1431
    double new_coeff0_14 = 0;
 
1432
    double new_coeff0_15 = 0;
 
1433
    double new_coeff0_16 = 0;
 
1434
    double new_coeff0_17 = 0;
 
1435
    double new_coeff0_18 = 0;
 
1436
    double new_coeff0_19 = 0;
 
1437
    
 
1438
    // Loop possible derivatives
 
1439
    for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
1440
    {
 
1441
      // Get values from coefficients array
 
1442
      new_coeff0_0 = coefficients0[dof][0];
 
1443
      new_coeff0_1 = coefficients0[dof][1];
 
1444
      new_coeff0_2 = coefficients0[dof][2];
 
1445
      new_coeff0_3 = coefficients0[dof][3];
 
1446
      new_coeff0_4 = coefficients0[dof][4];
 
1447
      new_coeff0_5 = coefficients0[dof][5];
 
1448
      new_coeff0_6 = coefficients0[dof][6];
 
1449
      new_coeff0_7 = coefficients0[dof][7];
 
1450
      new_coeff0_8 = coefficients0[dof][8];
 
1451
      new_coeff0_9 = coefficients0[dof][9];
 
1452
      new_coeff0_10 = coefficients0[dof][10];
 
1453
      new_coeff0_11 = coefficients0[dof][11];
 
1454
      new_coeff0_12 = coefficients0[dof][12];
 
1455
      new_coeff0_13 = coefficients0[dof][13];
 
1456
      new_coeff0_14 = coefficients0[dof][14];
 
1457
      new_coeff0_15 = coefficients0[dof][15];
 
1458
      new_coeff0_16 = coefficients0[dof][16];
 
1459
      new_coeff0_17 = coefficients0[dof][17];
 
1460
      new_coeff0_18 = coefficients0[dof][18];
 
1461
      new_coeff0_19 = coefficients0[dof][19];
 
1462
    
 
1463
      // Loop derivative order
 
1464
      for (unsigned int j = 0; j < n; j++)
 
1465
      {
 
1466
        // Update old coefficients
 
1467
        coeff0_0 = new_coeff0_0;
 
1468
        coeff0_1 = new_coeff0_1;
 
1469
        coeff0_2 = new_coeff0_2;
 
1470
        coeff0_3 = new_coeff0_3;
 
1471
        coeff0_4 = new_coeff0_4;
 
1472
        coeff0_5 = new_coeff0_5;
 
1473
        coeff0_6 = new_coeff0_6;
 
1474
        coeff0_7 = new_coeff0_7;
 
1475
        coeff0_8 = new_coeff0_8;
 
1476
        coeff0_9 = new_coeff0_9;
 
1477
        coeff0_10 = new_coeff0_10;
 
1478
        coeff0_11 = new_coeff0_11;
 
1479
        coeff0_12 = new_coeff0_12;
 
1480
        coeff0_13 = new_coeff0_13;
 
1481
        coeff0_14 = new_coeff0_14;
 
1482
        coeff0_15 = new_coeff0_15;
 
1483
        coeff0_16 = new_coeff0_16;
 
1484
        coeff0_17 = new_coeff0_17;
 
1485
        coeff0_18 = new_coeff0_18;
 
1486
        coeff0_19 = new_coeff0_19;
 
1487
    
 
1488
        if(combinations[deriv_num][j] == 0)
 
1489
        {
 
1490
          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] + coeff0_15*dmats0[15][0] + coeff0_16*dmats0[16][0] + coeff0_17*dmats0[17][0] + coeff0_18*dmats0[18][0] + coeff0_19*dmats0[19][0];
 
1491
          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] + coeff0_15*dmats0[15][1] + coeff0_16*dmats0[16][1] + coeff0_17*dmats0[17][1] + coeff0_18*dmats0[18][1] + coeff0_19*dmats0[19][1];
 
1492
          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] + coeff0_15*dmats0[15][2] + coeff0_16*dmats0[16][2] + coeff0_17*dmats0[17][2] + coeff0_18*dmats0[18][2] + coeff0_19*dmats0[19][2];
 
1493
          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] + coeff0_15*dmats0[15][3] + coeff0_16*dmats0[16][3] + coeff0_17*dmats0[17][3] + coeff0_18*dmats0[18][3] + coeff0_19*dmats0[19][3];
 
1494
          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] + coeff0_15*dmats0[15][4] + coeff0_16*dmats0[16][4] + coeff0_17*dmats0[17][4] + coeff0_18*dmats0[18][4] + coeff0_19*dmats0[19][4];
 
1495
          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] + coeff0_15*dmats0[15][5] + coeff0_16*dmats0[16][5] + coeff0_17*dmats0[17][5] + coeff0_18*dmats0[18][5] + coeff0_19*dmats0[19][5];
 
1496
          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] + coeff0_15*dmats0[15][6] + coeff0_16*dmats0[16][6] + coeff0_17*dmats0[17][6] + coeff0_18*dmats0[18][6] + coeff0_19*dmats0[19][6];
 
1497
          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] + coeff0_15*dmats0[15][7] + coeff0_16*dmats0[16][7] + coeff0_17*dmats0[17][7] + coeff0_18*dmats0[18][7] + coeff0_19*dmats0[19][7];
 
1498
          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] + coeff0_15*dmats0[15][8] + coeff0_16*dmats0[16][8] + coeff0_17*dmats0[17][8] + coeff0_18*dmats0[18][8] + coeff0_19*dmats0[19][8];
 
1499
          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] + coeff0_15*dmats0[15][9] + coeff0_16*dmats0[16][9] + coeff0_17*dmats0[17][9] + coeff0_18*dmats0[18][9] + coeff0_19*dmats0[19][9];
 
1500
          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] + coeff0_15*dmats0[15][10] + coeff0_16*dmats0[16][10] + coeff0_17*dmats0[17][10] + coeff0_18*dmats0[18][10] + coeff0_19*dmats0[19][10];
 
1501
          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] + coeff0_15*dmats0[15][11] + coeff0_16*dmats0[16][11] + coeff0_17*dmats0[17][11] + coeff0_18*dmats0[18][11] + coeff0_19*dmats0[19][11];
 
1502
          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] + coeff0_15*dmats0[15][12] + coeff0_16*dmats0[16][12] + coeff0_17*dmats0[17][12] + coeff0_18*dmats0[18][12] + coeff0_19*dmats0[19][12];
 
1503
          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] + coeff0_15*dmats0[15][13] + coeff0_16*dmats0[16][13] + coeff0_17*dmats0[17][13] + coeff0_18*dmats0[18][13] + coeff0_19*dmats0[19][13];
 
1504
          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] + coeff0_15*dmats0[15][14] + coeff0_16*dmats0[16][14] + coeff0_17*dmats0[17][14] + coeff0_18*dmats0[18][14] + coeff0_19*dmats0[19][14];
 
1505
          new_coeff0_15 = coeff0_0*dmats0[0][15] + coeff0_1*dmats0[1][15] + coeff0_2*dmats0[2][15] + coeff0_3*dmats0[3][15] + coeff0_4*dmats0[4][15] + coeff0_5*dmats0[5][15] + coeff0_6*dmats0[6][15] + coeff0_7*dmats0[7][15] + coeff0_8*dmats0[8][15] + coeff0_9*dmats0[9][15] + coeff0_10*dmats0[10][15] + coeff0_11*dmats0[11][15] + coeff0_12*dmats0[12][15] + coeff0_13*dmats0[13][15] + coeff0_14*dmats0[14][15] + coeff0_15*dmats0[15][15] + coeff0_16*dmats0[16][15] + coeff0_17*dmats0[17][15] + coeff0_18*dmats0[18][15] + coeff0_19*dmats0[19][15];
 
1506
          new_coeff0_16 = coeff0_0*dmats0[0][16] + coeff0_1*dmats0[1][16] + coeff0_2*dmats0[2][16] + coeff0_3*dmats0[3][16] + coeff0_4*dmats0[4][16] + coeff0_5*dmats0[5][16] + coeff0_6*dmats0[6][16] + coeff0_7*dmats0[7][16] + coeff0_8*dmats0[8][16] + coeff0_9*dmats0[9][16] + coeff0_10*dmats0[10][16] + coeff0_11*dmats0[11][16] + coeff0_12*dmats0[12][16] + coeff0_13*dmats0[13][16] + coeff0_14*dmats0[14][16] + coeff0_15*dmats0[15][16] + coeff0_16*dmats0[16][16] + coeff0_17*dmats0[17][16] + coeff0_18*dmats0[18][16] + coeff0_19*dmats0[19][16];
 
1507
          new_coeff0_17 = coeff0_0*dmats0[0][17] + coeff0_1*dmats0[1][17] + coeff0_2*dmats0[2][17] + coeff0_3*dmats0[3][17] + coeff0_4*dmats0[4][17] + coeff0_5*dmats0[5][17] + coeff0_6*dmats0[6][17] + coeff0_7*dmats0[7][17] + coeff0_8*dmats0[8][17] + coeff0_9*dmats0[9][17] + coeff0_10*dmats0[10][17] + coeff0_11*dmats0[11][17] + coeff0_12*dmats0[12][17] + coeff0_13*dmats0[13][17] + coeff0_14*dmats0[14][17] + coeff0_15*dmats0[15][17] + coeff0_16*dmats0[16][17] + coeff0_17*dmats0[17][17] + coeff0_18*dmats0[18][17] + coeff0_19*dmats0[19][17];
 
1508
          new_coeff0_18 = coeff0_0*dmats0[0][18] + coeff0_1*dmats0[1][18] + coeff0_2*dmats0[2][18] + coeff0_3*dmats0[3][18] + coeff0_4*dmats0[4][18] + coeff0_5*dmats0[5][18] + coeff0_6*dmats0[6][18] + coeff0_7*dmats0[7][18] + coeff0_8*dmats0[8][18] + coeff0_9*dmats0[9][18] + coeff0_10*dmats0[10][18] + coeff0_11*dmats0[11][18] + coeff0_12*dmats0[12][18] + coeff0_13*dmats0[13][18] + coeff0_14*dmats0[14][18] + coeff0_15*dmats0[15][18] + coeff0_16*dmats0[16][18] + coeff0_17*dmats0[17][18] + coeff0_18*dmats0[18][18] + coeff0_19*dmats0[19][18];
 
1509
          new_coeff0_19 = coeff0_0*dmats0[0][19] + coeff0_1*dmats0[1][19] + coeff0_2*dmats0[2][19] + coeff0_3*dmats0[3][19] + coeff0_4*dmats0[4][19] + coeff0_5*dmats0[5][19] + coeff0_6*dmats0[6][19] + coeff0_7*dmats0[7][19] + coeff0_8*dmats0[8][19] + coeff0_9*dmats0[9][19] + coeff0_10*dmats0[10][19] + coeff0_11*dmats0[11][19] + coeff0_12*dmats0[12][19] + coeff0_13*dmats0[13][19] + coeff0_14*dmats0[14][19] + coeff0_15*dmats0[15][19] + coeff0_16*dmats0[16][19] + coeff0_17*dmats0[17][19] + coeff0_18*dmats0[18][19] + coeff0_19*dmats0[19][19];
 
1510
        }
 
1511
        if(combinations[deriv_num][j] == 1)
 
1512
        {
 
1513
          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] + coeff0_15*dmats1[15][0] + coeff0_16*dmats1[16][0] + coeff0_17*dmats1[17][0] + coeff0_18*dmats1[18][0] + coeff0_19*dmats1[19][0];
 
1514
          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] + coeff0_15*dmats1[15][1] + coeff0_16*dmats1[16][1] + coeff0_17*dmats1[17][1] + coeff0_18*dmats1[18][1] + coeff0_19*dmats1[19][1];
 
1515
          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] + coeff0_15*dmats1[15][2] + coeff0_16*dmats1[16][2] + coeff0_17*dmats1[17][2] + coeff0_18*dmats1[18][2] + coeff0_19*dmats1[19][2];
 
1516
          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] + coeff0_15*dmats1[15][3] + coeff0_16*dmats1[16][3] + coeff0_17*dmats1[17][3] + coeff0_18*dmats1[18][3] + coeff0_19*dmats1[19][3];
 
1517
          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] + coeff0_15*dmats1[15][4] + coeff0_16*dmats1[16][4] + coeff0_17*dmats1[17][4] + coeff0_18*dmats1[18][4] + coeff0_19*dmats1[19][4];
 
1518
          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] + coeff0_15*dmats1[15][5] + coeff0_16*dmats1[16][5] + coeff0_17*dmats1[17][5] + coeff0_18*dmats1[18][5] + coeff0_19*dmats1[19][5];
 
1519
          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] + coeff0_15*dmats1[15][6] + coeff0_16*dmats1[16][6] + coeff0_17*dmats1[17][6] + coeff0_18*dmats1[18][6] + coeff0_19*dmats1[19][6];
 
1520
          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] + coeff0_15*dmats1[15][7] + coeff0_16*dmats1[16][7] + coeff0_17*dmats1[17][7] + coeff0_18*dmats1[18][7] + coeff0_19*dmats1[19][7];
 
1521
          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] + coeff0_15*dmats1[15][8] + coeff0_16*dmats1[16][8] + coeff0_17*dmats1[17][8] + coeff0_18*dmats1[18][8] + coeff0_19*dmats1[19][8];
 
1522
          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] + coeff0_15*dmats1[15][9] + coeff0_16*dmats1[16][9] + coeff0_17*dmats1[17][9] + coeff0_18*dmats1[18][9] + coeff0_19*dmats1[19][9];
 
1523
          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] + coeff0_15*dmats1[15][10] + coeff0_16*dmats1[16][10] + coeff0_17*dmats1[17][10] + coeff0_18*dmats1[18][10] + coeff0_19*dmats1[19][10];
 
1524
          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] + coeff0_15*dmats1[15][11] + coeff0_16*dmats1[16][11] + coeff0_17*dmats1[17][11] + coeff0_18*dmats1[18][11] + coeff0_19*dmats1[19][11];
 
1525
          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] + coeff0_15*dmats1[15][12] + coeff0_16*dmats1[16][12] + coeff0_17*dmats1[17][12] + coeff0_18*dmats1[18][12] + coeff0_19*dmats1[19][12];
 
1526
          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] + coeff0_15*dmats1[15][13] + coeff0_16*dmats1[16][13] + coeff0_17*dmats1[17][13] + coeff0_18*dmats1[18][13] + coeff0_19*dmats1[19][13];
 
1527
          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] + coeff0_15*dmats1[15][14] + coeff0_16*dmats1[16][14] + coeff0_17*dmats1[17][14] + coeff0_18*dmats1[18][14] + coeff0_19*dmats1[19][14];
 
1528
          new_coeff0_15 = coeff0_0*dmats1[0][15] + coeff0_1*dmats1[1][15] + coeff0_2*dmats1[2][15] + coeff0_3*dmats1[3][15] + coeff0_4*dmats1[4][15] + coeff0_5*dmats1[5][15] + coeff0_6*dmats1[6][15] + coeff0_7*dmats1[7][15] + coeff0_8*dmats1[8][15] + coeff0_9*dmats1[9][15] + coeff0_10*dmats1[10][15] + coeff0_11*dmats1[11][15] + coeff0_12*dmats1[12][15] + coeff0_13*dmats1[13][15] + coeff0_14*dmats1[14][15] + coeff0_15*dmats1[15][15] + coeff0_16*dmats1[16][15] + coeff0_17*dmats1[17][15] + coeff0_18*dmats1[18][15] + coeff0_19*dmats1[19][15];
 
1529
          new_coeff0_16 = coeff0_0*dmats1[0][16] + coeff0_1*dmats1[1][16] + coeff0_2*dmats1[2][16] + coeff0_3*dmats1[3][16] + coeff0_4*dmats1[4][16] + coeff0_5*dmats1[5][16] + coeff0_6*dmats1[6][16] + coeff0_7*dmats1[7][16] + coeff0_8*dmats1[8][16] + coeff0_9*dmats1[9][16] + coeff0_10*dmats1[10][16] + coeff0_11*dmats1[11][16] + coeff0_12*dmats1[12][16] + coeff0_13*dmats1[13][16] + coeff0_14*dmats1[14][16] + coeff0_15*dmats1[15][16] + coeff0_16*dmats1[16][16] + coeff0_17*dmats1[17][16] + coeff0_18*dmats1[18][16] + coeff0_19*dmats1[19][16];
 
1530
          new_coeff0_17 = coeff0_0*dmats1[0][17] + coeff0_1*dmats1[1][17] + coeff0_2*dmats1[2][17] + coeff0_3*dmats1[3][17] + coeff0_4*dmats1[4][17] + coeff0_5*dmats1[5][17] + coeff0_6*dmats1[6][17] + coeff0_7*dmats1[7][17] + coeff0_8*dmats1[8][17] + coeff0_9*dmats1[9][17] + coeff0_10*dmats1[10][17] + coeff0_11*dmats1[11][17] + coeff0_12*dmats1[12][17] + coeff0_13*dmats1[13][17] + coeff0_14*dmats1[14][17] + coeff0_15*dmats1[15][17] + coeff0_16*dmats1[16][17] + coeff0_17*dmats1[17][17] + coeff0_18*dmats1[18][17] + coeff0_19*dmats1[19][17];
 
1531
          new_coeff0_18 = coeff0_0*dmats1[0][18] + coeff0_1*dmats1[1][18] + coeff0_2*dmats1[2][18] + coeff0_3*dmats1[3][18] + coeff0_4*dmats1[4][18] + coeff0_5*dmats1[5][18] + coeff0_6*dmats1[6][18] + coeff0_7*dmats1[7][18] + coeff0_8*dmats1[8][18] + coeff0_9*dmats1[9][18] + coeff0_10*dmats1[10][18] + coeff0_11*dmats1[11][18] + coeff0_12*dmats1[12][18] + coeff0_13*dmats1[13][18] + coeff0_14*dmats1[14][18] + coeff0_15*dmats1[15][18] + coeff0_16*dmats1[16][18] + coeff0_17*dmats1[17][18] + coeff0_18*dmats1[18][18] + coeff0_19*dmats1[19][18];
 
1532
          new_coeff0_19 = coeff0_0*dmats1[0][19] + coeff0_1*dmats1[1][19] + coeff0_2*dmats1[2][19] + coeff0_3*dmats1[3][19] + coeff0_4*dmats1[4][19] + coeff0_5*dmats1[5][19] + coeff0_6*dmats1[6][19] + coeff0_7*dmats1[7][19] + coeff0_8*dmats1[8][19] + coeff0_9*dmats1[9][19] + coeff0_10*dmats1[10][19] + coeff0_11*dmats1[11][19] + coeff0_12*dmats1[12][19] + coeff0_13*dmats1[13][19] + coeff0_14*dmats1[14][19] + coeff0_15*dmats1[15][19] + coeff0_16*dmats1[16][19] + coeff0_17*dmats1[17][19] + coeff0_18*dmats1[18][19] + coeff0_19*dmats1[19][19];
 
1533
        }
 
1534
        if(combinations[deriv_num][j] == 2)
 
1535
        {
 
1536
          new_coeff0_0 = coeff0_0*dmats2[0][0] + coeff0_1*dmats2[1][0] + coeff0_2*dmats2[2][0] + coeff0_3*dmats2[3][0] + coeff0_4*dmats2[4][0] + coeff0_5*dmats2[5][0] + coeff0_6*dmats2[6][0] + coeff0_7*dmats2[7][0] + coeff0_8*dmats2[8][0] + coeff0_9*dmats2[9][0] + coeff0_10*dmats2[10][0] + coeff0_11*dmats2[11][0] + coeff0_12*dmats2[12][0] + coeff0_13*dmats2[13][0] + coeff0_14*dmats2[14][0] + coeff0_15*dmats2[15][0] + coeff0_16*dmats2[16][0] + coeff0_17*dmats2[17][0] + coeff0_18*dmats2[18][0] + coeff0_19*dmats2[19][0];
 
1537
          new_coeff0_1 = coeff0_0*dmats2[0][1] + coeff0_1*dmats2[1][1] + coeff0_2*dmats2[2][1] + coeff0_3*dmats2[3][1] + coeff0_4*dmats2[4][1] + coeff0_5*dmats2[5][1] + coeff0_6*dmats2[6][1] + coeff0_7*dmats2[7][1] + coeff0_8*dmats2[8][1] + coeff0_9*dmats2[9][1] + coeff0_10*dmats2[10][1] + coeff0_11*dmats2[11][1] + coeff0_12*dmats2[12][1] + coeff0_13*dmats2[13][1] + coeff0_14*dmats2[14][1] + coeff0_15*dmats2[15][1] + coeff0_16*dmats2[16][1] + coeff0_17*dmats2[17][1] + coeff0_18*dmats2[18][1] + coeff0_19*dmats2[19][1];
 
1538
          new_coeff0_2 = coeff0_0*dmats2[0][2] + coeff0_1*dmats2[1][2] + coeff0_2*dmats2[2][2] + coeff0_3*dmats2[3][2] + coeff0_4*dmats2[4][2] + coeff0_5*dmats2[5][2] + coeff0_6*dmats2[6][2] + coeff0_7*dmats2[7][2] + coeff0_8*dmats2[8][2] + coeff0_9*dmats2[9][2] + coeff0_10*dmats2[10][2] + coeff0_11*dmats2[11][2] + coeff0_12*dmats2[12][2] + coeff0_13*dmats2[13][2] + coeff0_14*dmats2[14][2] + coeff0_15*dmats2[15][2] + coeff0_16*dmats2[16][2] + coeff0_17*dmats2[17][2] + coeff0_18*dmats2[18][2] + coeff0_19*dmats2[19][2];
 
1539
          new_coeff0_3 = coeff0_0*dmats2[0][3] + coeff0_1*dmats2[1][3] + coeff0_2*dmats2[2][3] + coeff0_3*dmats2[3][3] + coeff0_4*dmats2[4][3] + coeff0_5*dmats2[5][3] + coeff0_6*dmats2[6][3] + coeff0_7*dmats2[7][3] + coeff0_8*dmats2[8][3] + coeff0_9*dmats2[9][3] + coeff0_10*dmats2[10][3] + coeff0_11*dmats2[11][3] + coeff0_12*dmats2[12][3] + coeff0_13*dmats2[13][3] + coeff0_14*dmats2[14][3] + coeff0_15*dmats2[15][3] + coeff0_16*dmats2[16][3] + coeff0_17*dmats2[17][3] + coeff0_18*dmats2[18][3] + coeff0_19*dmats2[19][3];
 
1540
          new_coeff0_4 = coeff0_0*dmats2[0][4] + coeff0_1*dmats2[1][4] + coeff0_2*dmats2[2][4] + coeff0_3*dmats2[3][4] + coeff0_4*dmats2[4][4] + coeff0_5*dmats2[5][4] + coeff0_6*dmats2[6][4] + coeff0_7*dmats2[7][4] + coeff0_8*dmats2[8][4] + coeff0_9*dmats2[9][4] + coeff0_10*dmats2[10][4] + coeff0_11*dmats2[11][4] + coeff0_12*dmats2[12][4] + coeff0_13*dmats2[13][4] + coeff0_14*dmats2[14][4] + coeff0_15*dmats2[15][4] + coeff0_16*dmats2[16][4] + coeff0_17*dmats2[17][4] + coeff0_18*dmats2[18][4] + coeff0_19*dmats2[19][4];
 
1541
          new_coeff0_5 = coeff0_0*dmats2[0][5] + coeff0_1*dmats2[1][5] + coeff0_2*dmats2[2][5] + coeff0_3*dmats2[3][5] + coeff0_4*dmats2[4][5] + coeff0_5*dmats2[5][5] + coeff0_6*dmats2[6][5] + coeff0_7*dmats2[7][5] + coeff0_8*dmats2[8][5] + coeff0_9*dmats2[9][5] + coeff0_10*dmats2[10][5] + coeff0_11*dmats2[11][5] + coeff0_12*dmats2[12][5] + coeff0_13*dmats2[13][5] + coeff0_14*dmats2[14][5] + coeff0_15*dmats2[15][5] + coeff0_16*dmats2[16][5] + coeff0_17*dmats2[17][5] + coeff0_18*dmats2[18][5] + coeff0_19*dmats2[19][5];
 
1542
          new_coeff0_6 = coeff0_0*dmats2[0][6] + coeff0_1*dmats2[1][6] + coeff0_2*dmats2[2][6] + coeff0_3*dmats2[3][6] + coeff0_4*dmats2[4][6] + coeff0_5*dmats2[5][6] + coeff0_6*dmats2[6][6] + coeff0_7*dmats2[7][6] + coeff0_8*dmats2[8][6] + coeff0_9*dmats2[9][6] + coeff0_10*dmats2[10][6] + coeff0_11*dmats2[11][6] + coeff0_12*dmats2[12][6] + coeff0_13*dmats2[13][6] + coeff0_14*dmats2[14][6] + coeff0_15*dmats2[15][6] + coeff0_16*dmats2[16][6] + coeff0_17*dmats2[17][6] + coeff0_18*dmats2[18][6] + coeff0_19*dmats2[19][6];
 
1543
          new_coeff0_7 = coeff0_0*dmats2[0][7] + coeff0_1*dmats2[1][7] + coeff0_2*dmats2[2][7] + coeff0_3*dmats2[3][7] + coeff0_4*dmats2[4][7] + coeff0_5*dmats2[5][7] + coeff0_6*dmats2[6][7] + coeff0_7*dmats2[7][7] + coeff0_8*dmats2[8][7] + coeff0_9*dmats2[9][7] + coeff0_10*dmats2[10][7] + coeff0_11*dmats2[11][7] + coeff0_12*dmats2[12][7] + coeff0_13*dmats2[13][7] + coeff0_14*dmats2[14][7] + coeff0_15*dmats2[15][7] + coeff0_16*dmats2[16][7] + coeff0_17*dmats2[17][7] + coeff0_18*dmats2[18][7] + coeff0_19*dmats2[19][7];
 
1544
          new_coeff0_8 = coeff0_0*dmats2[0][8] + coeff0_1*dmats2[1][8] + coeff0_2*dmats2[2][8] + coeff0_3*dmats2[3][8] + coeff0_4*dmats2[4][8] + coeff0_5*dmats2[5][8] + coeff0_6*dmats2[6][8] + coeff0_7*dmats2[7][8] + coeff0_8*dmats2[8][8] + coeff0_9*dmats2[9][8] + coeff0_10*dmats2[10][8] + coeff0_11*dmats2[11][8] + coeff0_12*dmats2[12][8] + coeff0_13*dmats2[13][8] + coeff0_14*dmats2[14][8] + coeff0_15*dmats2[15][8] + coeff0_16*dmats2[16][8] + coeff0_17*dmats2[17][8] + coeff0_18*dmats2[18][8] + coeff0_19*dmats2[19][8];
 
1545
          new_coeff0_9 = coeff0_0*dmats2[0][9] + coeff0_1*dmats2[1][9] + coeff0_2*dmats2[2][9] + coeff0_3*dmats2[3][9] + coeff0_4*dmats2[4][9] + coeff0_5*dmats2[5][9] + coeff0_6*dmats2[6][9] + coeff0_7*dmats2[7][9] + coeff0_8*dmats2[8][9] + coeff0_9*dmats2[9][9] + coeff0_10*dmats2[10][9] + coeff0_11*dmats2[11][9] + coeff0_12*dmats2[12][9] + coeff0_13*dmats2[13][9] + coeff0_14*dmats2[14][9] + coeff0_15*dmats2[15][9] + coeff0_16*dmats2[16][9] + coeff0_17*dmats2[17][9] + coeff0_18*dmats2[18][9] + coeff0_19*dmats2[19][9];
 
1546
          new_coeff0_10 = coeff0_0*dmats2[0][10] + coeff0_1*dmats2[1][10] + coeff0_2*dmats2[2][10] + coeff0_3*dmats2[3][10] + coeff0_4*dmats2[4][10] + coeff0_5*dmats2[5][10] + coeff0_6*dmats2[6][10] + coeff0_7*dmats2[7][10] + coeff0_8*dmats2[8][10] + coeff0_9*dmats2[9][10] + coeff0_10*dmats2[10][10] + coeff0_11*dmats2[11][10] + coeff0_12*dmats2[12][10] + coeff0_13*dmats2[13][10] + coeff0_14*dmats2[14][10] + coeff0_15*dmats2[15][10] + coeff0_16*dmats2[16][10] + coeff0_17*dmats2[17][10] + coeff0_18*dmats2[18][10] + coeff0_19*dmats2[19][10];
 
1547
          new_coeff0_11 = coeff0_0*dmats2[0][11] + coeff0_1*dmats2[1][11] + coeff0_2*dmats2[2][11] + coeff0_3*dmats2[3][11] + coeff0_4*dmats2[4][11] + coeff0_5*dmats2[5][11] + coeff0_6*dmats2[6][11] + coeff0_7*dmats2[7][11] + coeff0_8*dmats2[8][11] + coeff0_9*dmats2[9][11] + coeff0_10*dmats2[10][11] + coeff0_11*dmats2[11][11] + coeff0_12*dmats2[12][11] + coeff0_13*dmats2[13][11] + coeff0_14*dmats2[14][11] + coeff0_15*dmats2[15][11] + coeff0_16*dmats2[16][11] + coeff0_17*dmats2[17][11] + coeff0_18*dmats2[18][11] + coeff0_19*dmats2[19][11];
 
1548
          new_coeff0_12 = coeff0_0*dmats2[0][12] + coeff0_1*dmats2[1][12] + coeff0_2*dmats2[2][12] + coeff0_3*dmats2[3][12] + coeff0_4*dmats2[4][12] + coeff0_5*dmats2[5][12] + coeff0_6*dmats2[6][12] + coeff0_7*dmats2[7][12] + coeff0_8*dmats2[8][12] + coeff0_9*dmats2[9][12] + coeff0_10*dmats2[10][12] + coeff0_11*dmats2[11][12] + coeff0_12*dmats2[12][12] + coeff0_13*dmats2[13][12] + coeff0_14*dmats2[14][12] + coeff0_15*dmats2[15][12] + coeff0_16*dmats2[16][12] + coeff0_17*dmats2[17][12] + coeff0_18*dmats2[18][12] + coeff0_19*dmats2[19][12];
 
1549
          new_coeff0_13 = coeff0_0*dmats2[0][13] + coeff0_1*dmats2[1][13] + coeff0_2*dmats2[2][13] + coeff0_3*dmats2[3][13] + coeff0_4*dmats2[4][13] + coeff0_5*dmats2[5][13] + coeff0_6*dmats2[6][13] + coeff0_7*dmats2[7][13] + coeff0_8*dmats2[8][13] + coeff0_9*dmats2[9][13] + coeff0_10*dmats2[10][13] + coeff0_11*dmats2[11][13] + coeff0_12*dmats2[12][13] + coeff0_13*dmats2[13][13] + coeff0_14*dmats2[14][13] + coeff0_15*dmats2[15][13] + coeff0_16*dmats2[16][13] + coeff0_17*dmats2[17][13] + coeff0_18*dmats2[18][13] + coeff0_19*dmats2[19][13];
 
1550
          new_coeff0_14 = coeff0_0*dmats2[0][14] + coeff0_1*dmats2[1][14] + coeff0_2*dmats2[2][14] + coeff0_3*dmats2[3][14] + coeff0_4*dmats2[4][14] + coeff0_5*dmats2[5][14] + coeff0_6*dmats2[6][14] + coeff0_7*dmats2[7][14] + coeff0_8*dmats2[8][14] + coeff0_9*dmats2[9][14] + coeff0_10*dmats2[10][14] + coeff0_11*dmats2[11][14] + coeff0_12*dmats2[12][14] + coeff0_13*dmats2[13][14] + coeff0_14*dmats2[14][14] + coeff0_15*dmats2[15][14] + coeff0_16*dmats2[16][14] + coeff0_17*dmats2[17][14] + coeff0_18*dmats2[18][14] + coeff0_19*dmats2[19][14];
 
1551
          new_coeff0_15 = coeff0_0*dmats2[0][15] + coeff0_1*dmats2[1][15] + coeff0_2*dmats2[2][15] + coeff0_3*dmats2[3][15] + coeff0_4*dmats2[4][15] + coeff0_5*dmats2[5][15] + coeff0_6*dmats2[6][15] + coeff0_7*dmats2[7][15] + coeff0_8*dmats2[8][15] + coeff0_9*dmats2[9][15] + coeff0_10*dmats2[10][15] + coeff0_11*dmats2[11][15] + coeff0_12*dmats2[12][15] + coeff0_13*dmats2[13][15] + coeff0_14*dmats2[14][15] + coeff0_15*dmats2[15][15] + coeff0_16*dmats2[16][15] + coeff0_17*dmats2[17][15] + coeff0_18*dmats2[18][15] + coeff0_19*dmats2[19][15];
 
1552
          new_coeff0_16 = coeff0_0*dmats2[0][16] + coeff0_1*dmats2[1][16] + coeff0_2*dmats2[2][16] + coeff0_3*dmats2[3][16] + coeff0_4*dmats2[4][16] + coeff0_5*dmats2[5][16] + coeff0_6*dmats2[6][16] + coeff0_7*dmats2[7][16] + coeff0_8*dmats2[8][16] + coeff0_9*dmats2[9][16] + coeff0_10*dmats2[10][16] + coeff0_11*dmats2[11][16] + coeff0_12*dmats2[12][16] + coeff0_13*dmats2[13][16] + coeff0_14*dmats2[14][16] + coeff0_15*dmats2[15][16] + coeff0_16*dmats2[16][16] + coeff0_17*dmats2[17][16] + coeff0_18*dmats2[18][16] + coeff0_19*dmats2[19][16];
 
1553
          new_coeff0_17 = coeff0_0*dmats2[0][17] + coeff0_1*dmats2[1][17] + coeff0_2*dmats2[2][17] + coeff0_3*dmats2[3][17] + coeff0_4*dmats2[4][17] + coeff0_5*dmats2[5][17] + coeff0_6*dmats2[6][17] + coeff0_7*dmats2[7][17] + coeff0_8*dmats2[8][17] + coeff0_9*dmats2[9][17] + coeff0_10*dmats2[10][17] + coeff0_11*dmats2[11][17] + coeff0_12*dmats2[12][17] + coeff0_13*dmats2[13][17] + coeff0_14*dmats2[14][17] + coeff0_15*dmats2[15][17] + coeff0_16*dmats2[16][17] + coeff0_17*dmats2[17][17] + coeff0_18*dmats2[18][17] + coeff0_19*dmats2[19][17];
 
1554
          new_coeff0_18 = coeff0_0*dmats2[0][18] + coeff0_1*dmats2[1][18] + coeff0_2*dmats2[2][18] + coeff0_3*dmats2[3][18] + coeff0_4*dmats2[4][18] + coeff0_5*dmats2[5][18] + coeff0_6*dmats2[6][18] + coeff0_7*dmats2[7][18] + coeff0_8*dmats2[8][18] + coeff0_9*dmats2[9][18] + coeff0_10*dmats2[10][18] + coeff0_11*dmats2[11][18] + coeff0_12*dmats2[12][18] + coeff0_13*dmats2[13][18] + coeff0_14*dmats2[14][18] + coeff0_15*dmats2[15][18] + coeff0_16*dmats2[16][18] + coeff0_17*dmats2[17][18] + coeff0_18*dmats2[18][18] + coeff0_19*dmats2[19][18];
 
1555
          new_coeff0_19 = coeff0_0*dmats2[0][19] + coeff0_1*dmats2[1][19] + coeff0_2*dmats2[2][19] + coeff0_3*dmats2[3][19] + coeff0_4*dmats2[4][19] + coeff0_5*dmats2[5][19] + coeff0_6*dmats2[6][19] + coeff0_7*dmats2[7][19] + coeff0_8*dmats2[8][19] + coeff0_9*dmats2[9][19] + coeff0_10*dmats2[10][19] + coeff0_11*dmats2[11][19] + coeff0_12*dmats2[12][19] + coeff0_13*dmats2[13][19] + coeff0_14*dmats2[14][19] + coeff0_15*dmats2[15][19] + coeff0_16*dmats2[16][19] + coeff0_17*dmats2[17][19] + coeff0_18*dmats2[18][19] + coeff0_19*dmats2[19][19];
 
1556
        }
 
1557
    
 
1558
      }
 
1559
      // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
1560
      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 + new_coeff0_15*basisvalue15 + new_coeff0_16*basisvalue16 + new_coeff0_17*basisvalue17 + new_coeff0_18*basisvalue18 + new_coeff0_19*basisvalue19;
 
1561
    }
 
1562
    
 
1563
    // Transform derivatives back to physical element
 
1564
    for (unsigned int row = 0; row < num_derivatives; row++)
 
1565
    {
 
1566
      for (unsigned int col = 0; col < num_derivatives; col++)
 
1567
      {
 
1568
        values[row] += transform[row][col]*derivatives[col];
 
1569
      }
 
1570
    }
 
1571
    // Delete pointer to array of derivatives on FIAT element
 
1572
    delete [] derivatives;
 
1573
    
 
1574
    // Delete pointer to array of combinations of derivatives and transform
 
1575
    for (unsigned int row = 0; row < num_derivatives; row++)
 
1576
    {
 
1577
      delete [] combinations[row];
 
1578
      delete [] transform[row];
 
1579
    }
 
1580
    
 
1581
    delete [] combinations;
 
1582
    delete [] transform;
 
1583
  }
 
1584
 
 
1585
  /// Evaluate order n derivatives of all basis functions at given point in cell
 
1586
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
1587
                                              double* values,
 
1588
                                              const double* coordinates,
 
1589
                                              const ufc::cell& c) const
 
1590
  {
 
1591
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
 
1592
  }
 
1593
 
 
1594
  /// Evaluate linear functional for dof i on the function f
 
1595
  virtual double evaluate_dof(unsigned int i,
 
1596
                              const ufc::function& f,
 
1597
                              const ufc::cell& c) const
 
1598
  {
 
1599
    // The reference points, direction and weights:
 
1600
    const static double X[20][1][3] = {{{0, 0, 0}}, {{1, 0, 0}}, {{0, 1, 0}}, {{0, 0, 1}}, {{0, 0.666666666666667, 0.333333333333333}}, {{0, 0.333333333333333, 0.666666666666667}}, {{0.666666666666667, 0, 0.333333333333333}}, {{0.333333333333333, 0, 0.666666666666667}}, {{0.666666666666667, 0.333333333333333, 0}}, {{0.333333333333333, 0.666666666666667, 0}}, {{0, 0, 0.333333333333333}}, {{0, 0, 0.666666666666667}}, {{0, 0.333333333333333, 0}}, {{0, 0.666666666666667, 0}}, {{0.333333333333333, 0, 0}}, {{0.666666666666667, 0, 0}}, {{0.333333333333333, 0.333333333333333, 0.333333333333333}}, {{0, 0.333333333333333, 0.333333333333333}}, {{0.333333333333333, 0, 0.333333333333333}}, {{0.333333333333333, 0.333333333333333, 0}}};
 
1601
    const static double W[20][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
 
1602
    const static double D[20][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
 
1603
    
 
1604
    const double * const * x = c.coordinates;
 
1605
    double result = 0.0;
 
1606
    // Iterate over the points:
 
1607
    // Evaluate basis functions for affine mapping
 
1608
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1] - X[i][0][2];
 
1609
    const double w1 = X[i][0][0];
 
1610
    const double w2 = X[i][0][1];
 
1611
    const double w3 = X[i][0][2];
 
1612
    
 
1613
    // Compute affine mapping y = F(X)
 
1614
    double y[3];
 
1615
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0] + w3*x[3][0];
 
1616
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1] + w3*x[3][1];
 
1617
    y[2] = w0*x[0][2] + w1*x[1][2] + w2*x[2][2] + w3*x[3][2];
 
1618
    
 
1619
    // Evaluate function at physical points
 
1620
    double values[1];
 
1621
    f.evaluate(values, y, c);
 
1622
    
 
1623
    // Map function values using appropriate mapping
 
1624
    // Affine map: Do nothing
 
1625
    
 
1626
    // Note that we do not map the weights (yet).
 
1627
    
 
1628
    // Take directional components
 
1629
    for(int k = 0; k < 1; k++)
 
1630
      result += values[k]*D[i][0][k];
 
1631
    // Multiply by weights 
 
1632
    result *= W[i][0];
 
1633
    
 
1634
    return result;
 
1635
  }
 
1636
 
 
1637
  /// Evaluate linear functionals for all dofs on the function f
 
1638
  virtual void evaluate_dofs(double* values,
 
1639
                             const ufc::function& f,
 
1640
                             const ufc::cell& c) const
 
1641
  {
 
1642
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
1643
  }
 
1644
 
 
1645
  /// Interpolate vertex values from dof values
 
1646
  virtual void interpolate_vertex_values(double* vertex_values,
 
1647
                                         const double* dof_values,
 
1648
                                         const ufc::cell& c) const
 
1649
  {
 
1650
    // Evaluate at vertices and use affine mapping
 
1651
    vertex_values[0] = dof_values[0];
 
1652
    vertex_values[1] = dof_values[1];
 
1653
    vertex_values[2] = dof_values[2];
 
1654
    vertex_values[3] = dof_values[3];
 
1655
  }
 
1656
 
 
1657
  /// Return the number of sub elements (for a mixed element)
 
1658
  virtual unsigned int num_sub_elements() const
 
1659
  {
 
1660
    return 1;
 
1661
  }
 
1662
 
 
1663
  /// Create a new finite element for sub element i (for a mixed element)
 
1664
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
1665
  {
 
1666
    return new UFC_Poisson3D_3BilinearForm_finite_element_1();
 
1667
  }
 
1668
 
 
1669
};
 
1670
 
 
1671
/// This class defines the interface for a local-to-global mapping of
 
1672
/// degrees of freedom (dofs).
 
1673
 
 
1674
class UFC_Poisson3D_3BilinearForm_dof_map_0: public ufc::dof_map
 
1675
{
 
1676
private:
 
1677
 
 
1678
  unsigned int __global_dimension;
 
1679
 
 
1680
public:
 
1681
 
 
1682
  /// Constructor
 
1683
  UFC_Poisson3D_3BilinearForm_dof_map_0() : ufc::dof_map()
 
1684
  {
 
1685
    __global_dimension = 0;
 
1686
  }
 
1687
 
 
1688
  /// Destructor
 
1689
  virtual ~UFC_Poisson3D_3BilinearForm_dof_map_0()
 
1690
  {
 
1691
    // Do nothing
 
1692
  }
 
1693
 
 
1694
  /// Return a string identifying the dof map
 
1695
  virtual const char* signature() const
 
1696
  {
 
1697
    return "FFC dof map for Lagrange finite element of degree 3 on a tetrahedron";
 
1698
  }
 
1699
 
 
1700
  /// Return true iff mesh entities of topological dimension d are needed
 
1701
  virtual bool needs_mesh_entities(unsigned int d) const
 
1702
  {
 
1703
    switch ( d )
 
1704
    {
 
1705
    case 0:
 
1706
      return true;
 
1707
      break;
 
1708
    case 1:
 
1709
      return true;
 
1710
      break;
 
1711
    case 2:
 
1712
      return true;
 
1713
      break;
 
1714
    case 3:
 
1715
      return false;
 
1716
      break;
 
1717
    }
 
1718
    return false;
 
1719
  }
 
1720
 
 
1721
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
1722
  virtual bool init_mesh(const ufc::mesh& m)
 
1723
  {
 
1724
    __global_dimension = m.num_entities[0] + 2*m.num_entities[1] + m.num_entities[2];
 
1725
    return false;
 
1726
  }
 
1727
 
 
1728
  /// Initialize dof map for given cell
 
1729
  virtual void init_cell(const ufc::mesh& m,
 
1730
                         const ufc::cell& c)
 
1731
  {
 
1732
    // Do nothing
 
1733
  }
 
1734
 
 
1735
  /// Finish initialization of dof map for cells
 
1736
  virtual void init_cell_finalize()
 
1737
  {
 
1738
    // Do nothing
 
1739
  }
 
1740
 
 
1741
  /// Return the dimension of the global finite element function space
 
1742
  virtual unsigned int global_dimension() const
 
1743
  {
 
1744
    return __global_dimension;
 
1745
  }
 
1746
 
 
1747
  /// Return the dimension of the local finite element function space
 
1748
  virtual unsigned int local_dimension() const
 
1749
  {
 
1750
    return 20;
 
1751
  }
 
1752
 
 
1753
  // Return the geometric dimension of the coordinates this dof map provides
 
1754
  virtual unsigned int geometric_dimension() const
 
1755
  {
 
1756
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
1757
  }
 
1758
 
 
1759
  /// Return the number of dofs on each cell facet
 
1760
  virtual unsigned int num_facet_dofs() const
 
1761
  {
 
1762
    return 10;
 
1763
  }
 
1764
 
 
1765
  /// Return the number of dofs associated with each cell entity of dimension d
 
1766
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
1767
  {
 
1768
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
1769
  }
 
1770
 
 
1771
  /// Tabulate the local-to-global mapping of dofs on a cell
 
1772
  virtual void tabulate_dofs(unsigned int* dofs,
 
1773
                             const ufc::mesh& m,
 
1774
                             const ufc::cell& c) const
 
1775
  {
 
1776
    dofs[0] = c.entity_indices[0][0];
 
1777
    dofs[1] = c.entity_indices[0][1];
 
1778
    dofs[2] = c.entity_indices[0][2];
 
1779
    dofs[3] = c.entity_indices[0][3];
 
1780
    unsigned int offset = m.num_entities[0];
 
1781
    dofs[4] = offset + 2*c.entity_indices[1][0];
 
1782
    dofs[5] = offset + 2*c.entity_indices[1][0] + 1;
 
1783
    dofs[6] = offset + 2*c.entity_indices[1][1];
 
1784
    dofs[7] = offset + 2*c.entity_indices[1][1] + 1;
 
1785
    dofs[8] = offset + 2*c.entity_indices[1][2];
 
1786
    dofs[9] = offset + 2*c.entity_indices[1][2] + 1;
 
1787
    dofs[10] = offset + 2*c.entity_indices[1][3];
 
1788
    dofs[11] = offset + 2*c.entity_indices[1][3] + 1;
 
1789
    dofs[12] = offset + 2*c.entity_indices[1][4];
 
1790
    dofs[13] = offset + 2*c.entity_indices[1][4] + 1;
 
1791
    dofs[14] = offset + 2*c.entity_indices[1][5];
 
1792
    dofs[15] = offset + 2*c.entity_indices[1][5] + 1;
 
1793
    offset = offset + 2*m.num_entities[1];
 
1794
    dofs[16] = offset + c.entity_indices[2][0];
 
1795
    dofs[17] = offset + c.entity_indices[2][1];
 
1796
    dofs[18] = offset + c.entity_indices[2][2];
 
1797
    dofs[19] = offset + c.entity_indices[2][3];
 
1798
  }
 
1799
 
 
1800
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
1801
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
1802
                                   unsigned int facet) const
 
1803
  {
 
1804
    switch ( facet )
 
1805
    {
 
1806
    case 0:
 
1807
      dofs[0] = 1;
 
1808
      dofs[1] = 2;
 
1809
      dofs[2] = 3;
 
1810
      dofs[3] = 4;
 
1811
      dofs[4] = 5;
 
1812
      dofs[5] = 6;
 
1813
      dofs[6] = 7;
 
1814
      dofs[7] = 8;
 
1815
      dofs[8] = 9;
 
1816
      dofs[9] = 16;
 
1817
      break;
 
1818
    case 1:
 
1819
      dofs[0] = 0;
 
1820
      dofs[1] = 2;
 
1821
      dofs[2] = 3;
 
1822
      dofs[3] = 4;
 
1823
      dofs[4] = 5;
 
1824
      dofs[5] = 10;
 
1825
      dofs[6] = 11;
 
1826
      dofs[7] = 12;
 
1827
      dofs[8] = 13;
 
1828
      dofs[9] = 17;
 
1829
      break;
 
1830
    case 2:
 
1831
      dofs[0] = 0;
 
1832
      dofs[1] = 1;
 
1833
      dofs[2] = 3;
 
1834
      dofs[3] = 6;
 
1835
      dofs[4] = 7;
 
1836
      dofs[5] = 10;
 
1837
      dofs[6] = 11;
 
1838
      dofs[7] = 14;
 
1839
      dofs[8] = 15;
 
1840
      dofs[9] = 18;
 
1841
      break;
 
1842
    case 3:
 
1843
      dofs[0] = 0;
 
1844
      dofs[1] = 1;
 
1845
      dofs[2] = 2;
 
1846
      dofs[3] = 8;
 
1847
      dofs[4] = 9;
 
1848
      dofs[5] = 12;
 
1849
      dofs[6] = 13;
 
1850
      dofs[7] = 14;
 
1851
      dofs[8] = 15;
 
1852
      dofs[9] = 19;
 
1853
      break;
 
1854
    }
 
1855
  }
 
1856
 
 
1857
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
1858
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
1859
                                    unsigned int d, unsigned int i) const
 
1860
  {
 
1861
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
1862
  }
 
1863
 
 
1864
  /// Tabulate the coordinates of all dofs on a cell
 
1865
  virtual void tabulate_coordinates(double** coordinates,
 
1866
                                    const ufc::cell& c) const
 
1867
  {
 
1868
    const double * const * x = c.coordinates;
 
1869
    coordinates[0][0] = x[0][0];
 
1870
    coordinates[0][1] = x[0][1];
 
1871
    coordinates[0][2] = x[0][2];
 
1872
    coordinates[1][0] = x[1][0];
 
1873
    coordinates[1][1] = x[1][1];
 
1874
    coordinates[1][2] = x[1][2];
 
1875
    coordinates[2][0] = x[2][0];
 
1876
    coordinates[2][1] = x[2][1];
 
1877
    coordinates[2][2] = x[2][2];
 
1878
    coordinates[3][0] = x[3][0];
 
1879
    coordinates[3][1] = x[3][1];
 
1880
    coordinates[3][2] = x[3][2];
 
1881
    coordinates[4][0] = 0.666666666666667*x[2][0] + 0.333333333333333*x[3][0];
 
1882
    coordinates[4][1] = 0.666666666666667*x[2][1] + 0.333333333333333*x[3][1];
 
1883
    coordinates[4][2] = 0.666666666666667*x[2][2] + 0.333333333333333*x[3][2];
 
1884
    coordinates[5][0] = 0.333333333333333*x[2][0] + 0.666666666666667*x[3][0];
 
1885
    coordinates[5][1] = 0.333333333333333*x[2][1] + 0.666666666666667*x[3][1];
 
1886
    coordinates[5][2] = 0.333333333333333*x[2][2] + 0.666666666666667*x[3][2];
 
1887
    coordinates[6][0] = 0.666666666666667*x[1][0] + 0.333333333333333*x[3][0];
 
1888
    coordinates[6][1] = 0.666666666666667*x[1][1] + 0.333333333333333*x[3][1];
 
1889
    coordinates[6][2] = 0.666666666666667*x[1][2] + 0.333333333333333*x[3][2];
 
1890
    coordinates[7][0] = 0.333333333333333*x[1][0] + 0.666666666666667*x[3][0];
 
1891
    coordinates[7][1] = 0.333333333333333*x[1][1] + 0.666666666666667*x[3][1];
 
1892
    coordinates[7][2] = 0.333333333333333*x[1][2] + 0.666666666666667*x[3][2];
 
1893
    coordinates[8][0] = 0.666666666666667*x[1][0] + 0.333333333333333*x[2][0];
 
1894
    coordinates[8][1] = 0.666666666666667*x[1][1] + 0.333333333333333*x[2][1];
 
1895
    coordinates[8][2] = 0.666666666666667*x[1][2] + 0.333333333333333*x[2][2];
 
1896
    coordinates[9][0] = 0.333333333333333*x[1][0] + 0.666666666666667*x[2][0];
 
1897
    coordinates[9][1] = 0.333333333333333*x[1][1] + 0.666666666666667*x[2][1];
 
1898
    coordinates[9][2] = 0.333333333333333*x[1][2] + 0.666666666666667*x[2][2];
 
1899
    coordinates[10][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[3][0];
 
1900
    coordinates[10][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[3][1];
 
1901
    coordinates[10][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[3][2];
 
1902
    coordinates[11][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[3][0];
 
1903
    coordinates[11][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[3][1];
 
1904
    coordinates[11][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[3][2];
 
1905
    coordinates[12][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[2][0];
 
1906
    coordinates[12][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[2][1];
 
1907
    coordinates[12][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[2][2];
 
1908
    coordinates[13][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[2][0];
 
1909
    coordinates[13][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[2][1];
 
1910
    coordinates[13][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[2][2];
 
1911
    coordinates[14][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[1][0];
 
1912
    coordinates[14][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[1][1];
 
1913
    coordinates[14][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[1][2];
 
1914
    coordinates[15][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[1][0];
 
1915
    coordinates[15][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[1][1];
 
1916
    coordinates[15][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[1][2];
 
1917
    coordinates[16][0] = 0.333333333333333*x[1][0] + 0.333333333333333*x[2][0] + 0.333333333333333*x[3][0];
 
1918
    coordinates[16][1] = 0.333333333333333*x[1][1] + 0.333333333333333*x[2][1] + 0.333333333333333*x[3][1];
 
1919
    coordinates[16][2] = 0.333333333333333*x[1][2] + 0.333333333333333*x[2][2] + 0.333333333333333*x[3][2];
 
1920
    coordinates[17][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[2][0] + 0.333333333333333*x[3][0];
 
1921
    coordinates[17][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[2][1] + 0.333333333333333*x[3][1];
 
1922
    coordinates[17][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[2][2] + 0.333333333333333*x[3][2];
 
1923
    coordinates[18][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[1][0] + 0.333333333333333*x[3][0];
 
1924
    coordinates[18][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[1][1] + 0.333333333333333*x[3][1];
 
1925
    coordinates[18][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[1][2] + 0.333333333333333*x[3][2];
 
1926
    coordinates[19][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[1][0] + 0.333333333333333*x[2][0];
 
1927
    coordinates[19][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[1][1] + 0.333333333333333*x[2][1];
 
1928
    coordinates[19][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[1][2] + 0.333333333333333*x[2][2];
 
1929
  }
 
1930
 
 
1931
  /// Return the number of sub dof maps (for a mixed element)
 
1932
  virtual unsigned int num_sub_dof_maps() const
 
1933
  {
 
1934
    return 1;
 
1935
  }
 
1936
 
 
1937
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
1938
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
1939
  {
 
1940
    return new UFC_Poisson3D_3BilinearForm_dof_map_0();
 
1941
  }
 
1942
 
 
1943
};
 
1944
 
 
1945
/// This class defines the interface for a local-to-global mapping of
 
1946
/// degrees of freedom (dofs).
 
1947
 
 
1948
class UFC_Poisson3D_3BilinearForm_dof_map_1: public ufc::dof_map
 
1949
{
 
1950
private:
 
1951
 
 
1952
  unsigned int __global_dimension;
 
1953
 
 
1954
public:
 
1955
 
 
1956
  /// Constructor
 
1957
  UFC_Poisson3D_3BilinearForm_dof_map_1() : ufc::dof_map()
 
1958
  {
 
1959
    __global_dimension = 0;
 
1960
  }
 
1961
 
 
1962
  /// Destructor
 
1963
  virtual ~UFC_Poisson3D_3BilinearForm_dof_map_1()
 
1964
  {
 
1965
    // Do nothing
 
1966
  }
 
1967
 
 
1968
  /// Return a string identifying the dof map
 
1969
  virtual const char* signature() const
 
1970
  {
 
1971
    return "FFC dof map for Lagrange finite element of degree 3 on a tetrahedron";
 
1972
  }
 
1973
 
 
1974
  /// Return true iff mesh entities of topological dimension d are needed
 
1975
  virtual bool needs_mesh_entities(unsigned int d) const
 
1976
  {
 
1977
    switch ( d )
 
1978
    {
 
1979
    case 0:
 
1980
      return true;
 
1981
      break;
 
1982
    case 1:
 
1983
      return true;
 
1984
      break;
 
1985
    case 2:
 
1986
      return true;
 
1987
      break;
 
1988
    case 3:
 
1989
      return false;
 
1990
      break;
 
1991
    }
 
1992
    return false;
 
1993
  }
 
1994
 
 
1995
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
1996
  virtual bool init_mesh(const ufc::mesh& m)
 
1997
  {
 
1998
    __global_dimension = m.num_entities[0] + 2*m.num_entities[1] + m.num_entities[2];
 
1999
    return false;
 
2000
  }
 
2001
 
 
2002
  /// Initialize dof map for given cell
 
2003
  virtual void init_cell(const ufc::mesh& m,
 
2004
                         const ufc::cell& c)
 
2005
  {
 
2006
    // Do nothing
 
2007
  }
 
2008
 
 
2009
  /// Finish initialization of dof map for cells
 
2010
  virtual void init_cell_finalize()
 
2011
  {
 
2012
    // Do nothing
 
2013
  }
 
2014
 
 
2015
  /// Return the dimension of the global finite element function space
 
2016
  virtual unsigned int global_dimension() const
 
2017
  {
 
2018
    return __global_dimension;
 
2019
  }
 
2020
 
 
2021
  /// Return the dimension of the local finite element function space
 
2022
  virtual unsigned int local_dimension() const
 
2023
  {
 
2024
    return 20;
 
2025
  }
 
2026
 
 
2027
  // Return the geometric dimension of the coordinates this dof map provides
 
2028
  virtual unsigned int geometric_dimension() const
 
2029
  {
 
2030
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
2031
  }
 
2032
 
 
2033
  /// Return the number of dofs on each cell facet
 
2034
  virtual unsigned int num_facet_dofs() const
 
2035
  {
 
2036
    return 10;
 
2037
  }
 
2038
 
 
2039
  /// Return the number of dofs associated with each cell entity of dimension d
 
2040
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
2041
  {
 
2042
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
2043
  }
 
2044
 
 
2045
  /// Tabulate the local-to-global mapping of dofs on a cell
 
2046
  virtual void tabulate_dofs(unsigned int* dofs,
 
2047
                             const ufc::mesh& m,
 
2048
                             const ufc::cell& c) const
 
2049
  {
 
2050
    dofs[0] = c.entity_indices[0][0];
 
2051
    dofs[1] = c.entity_indices[0][1];
 
2052
    dofs[2] = c.entity_indices[0][2];
 
2053
    dofs[3] = c.entity_indices[0][3];
 
2054
    unsigned int offset = m.num_entities[0];
 
2055
    dofs[4] = offset + 2*c.entity_indices[1][0];
 
2056
    dofs[5] = offset + 2*c.entity_indices[1][0] + 1;
 
2057
    dofs[6] = offset + 2*c.entity_indices[1][1];
 
2058
    dofs[7] = offset + 2*c.entity_indices[1][1] + 1;
 
2059
    dofs[8] = offset + 2*c.entity_indices[1][2];
 
2060
    dofs[9] = offset + 2*c.entity_indices[1][2] + 1;
 
2061
    dofs[10] = offset + 2*c.entity_indices[1][3];
 
2062
    dofs[11] = offset + 2*c.entity_indices[1][3] + 1;
 
2063
    dofs[12] = offset + 2*c.entity_indices[1][4];
 
2064
    dofs[13] = offset + 2*c.entity_indices[1][4] + 1;
 
2065
    dofs[14] = offset + 2*c.entity_indices[1][5];
 
2066
    dofs[15] = offset + 2*c.entity_indices[1][5] + 1;
 
2067
    offset = offset + 2*m.num_entities[1];
 
2068
    dofs[16] = offset + c.entity_indices[2][0];
 
2069
    dofs[17] = offset + c.entity_indices[2][1];
 
2070
    dofs[18] = offset + c.entity_indices[2][2];
 
2071
    dofs[19] = offset + c.entity_indices[2][3];
 
2072
  }
 
2073
 
 
2074
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
2075
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
2076
                                   unsigned int facet) const
 
2077
  {
 
2078
    switch ( facet )
 
2079
    {
 
2080
    case 0:
 
2081
      dofs[0] = 1;
 
2082
      dofs[1] = 2;
 
2083
      dofs[2] = 3;
 
2084
      dofs[3] = 4;
 
2085
      dofs[4] = 5;
 
2086
      dofs[5] = 6;
 
2087
      dofs[6] = 7;
 
2088
      dofs[7] = 8;
 
2089
      dofs[8] = 9;
 
2090
      dofs[9] = 16;
 
2091
      break;
 
2092
    case 1:
 
2093
      dofs[0] = 0;
 
2094
      dofs[1] = 2;
 
2095
      dofs[2] = 3;
 
2096
      dofs[3] = 4;
 
2097
      dofs[4] = 5;
 
2098
      dofs[5] = 10;
 
2099
      dofs[6] = 11;
 
2100
      dofs[7] = 12;
 
2101
      dofs[8] = 13;
 
2102
      dofs[9] = 17;
 
2103
      break;
 
2104
    case 2:
 
2105
      dofs[0] = 0;
 
2106
      dofs[1] = 1;
 
2107
      dofs[2] = 3;
 
2108
      dofs[3] = 6;
 
2109
      dofs[4] = 7;
 
2110
      dofs[5] = 10;
 
2111
      dofs[6] = 11;
 
2112
      dofs[7] = 14;
 
2113
      dofs[8] = 15;
 
2114
      dofs[9] = 18;
 
2115
      break;
 
2116
    case 3:
 
2117
      dofs[0] = 0;
 
2118
      dofs[1] = 1;
 
2119
      dofs[2] = 2;
 
2120
      dofs[3] = 8;
 
2121
      dofs[4] = 9;
 
2122
      dofs[5] = 12;
 
2123
      dofs[6] = 13;
 
2124
      dofs[7] = 14;
 
2125
      dofs[8] = 15;
 
2126
      dofs[9] = 19;
 
2127
      break;
 
2128
    }
 
2129
  }
 
2130
 
 
2131
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
2132
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
2133
                                    unsigned int d, unsigned int i) const
 
2134
  {
 
2135
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
2136
  }
 
2137
 
 
2138
  /// Tabulate the coordinates of all dofs on a cell
 
2139
  virtual void tabulate_coordinates(double** coordinates,
 
2140
                                    const ufc::cell& c) const
 
2141
  {
 
2142
    const double * const * x = c.coordinates;
 
2143
    coordinates[0][0] = x[0][0];
 
2144
    coordinates[0][1] = x[0][1];
 
2145
    coordinates[0][2] = x[0][2];
 
2146
    coordinates[1][0] = x[1][0];
 
2147
    coordinates[1][1] = x[1][1];
 
2148
    coordinates[1][2] = x[1][2];
 
2149
    coordinates[2][0] = x[2][0];
 
2150
    coordinates[2][1] = x[2][1];
 
2151
    coordinates[2][2] = x[2][2];
 
2152
    coordinates[3][0] = x[3][0];
 
2153
    coordinates[3][1] = x[3][1];
 
2154
    coordinates[3][2] = x[3][2];
 
2155
    coordinates[4][0] = 0.666666666666667*x[2][0] + 0.333333333333333*x[3][0];
 
2156
    coordinates[4][1] = 0.666666666666667*x[2][1] + 0.333333333333333*x[3][1];
 
2157
    coordinates[4][2] = 0.666666666666667*x[2][2] + 0.333333333333333*x[3][2];
 
2158
    coordinates[5][0] = 0.333333333333333*x[2][0] + 0.666666666666667*x[3][0];
 
2159
    coordinates[5][1] = 0.333333333333333*x[2][1] + 0.666666666666667*x[3][1];
 
2160
    coordinates[5][2] = 0.333333333333333*x[2][2] + 0.666666666666667*x[3][2];
 
2161
    coordinates[6][0] = 0.666666666666667*x[1][0] + 0.333333333333333*x[3][0];
 
2162
    coordinates[6][1] = 0.666666666666667*x[1][1] + 0.333333333333333*x[3][1];
 
2163
    coordinates[6][2] = 0.666666666666667*x[1][2] + 0.333333333333333*x[3][2];
 
2164
    coordinates[7][0] = 0.333333333333333*x[1][0] + 0.666666666666667*x[3][0];
 
2165
    coordinates[7][1] = 0.333333333333333*x[1][1] + 0.666666666666667*x[3][1];
 
2166
    coordinates[7][2] = 0.333333333333333*x[1][2] + 0.666666666666667*x[3][2];
 
2167
    coordinates[8][0] = 0.666666666666667*x[1][0] + 0.333333333333333*x[2][0];
 
2168
    coordinates[8][1] = 0.666666666666667*x[1][1] + 0.333333333333333*x[2][1];
 
2169
    coordinates[8][2] = 0.666666666666667*x[1][2] + 0.333333333333333*x[2][2];
 
2170
    coordinates[9][0] = 0.333333333333333*x[1][0] + 0.666666666666667*x[2][0];
 
2171
    coordinates[9][1] = 0.333333333333333*x[1][1] + 0.666666666666667*x[2][1];
 
2172
    coordinates[9][2] = 0.333333333333333*x[1][2] + 0.666666666666667*x[2][2];
 
2173
    coordinates[10][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[3][0];
 
2174
    coordinates[10][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[3][1];
 
2175
    coordinates[10][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[3][2];
 
2176
    coordinates[11][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[3][0];
 
2177
    coordinates[11][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[3][1];
 
2178
    coordinates[11][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[3][2];
 
2179
    coordinates[12][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[2][0];
 
2180
    coordinates[12][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[2][1];
 
2181
    coordinates[12][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[2][2];
 
2182
    coordinates[13][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[2][0];
 
2183
    coordinates[13][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[2][1];
 
2184
    coordinates[13][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[2][2];
 
2185
    coordinates[14][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[1][0];
 
2186
    coordinates[14][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[1][1];
 
2187
    coordinates[14][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[1][2];
 
2188
    coordinates[15][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[1][0];
 
2189
    coordinates[15][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[1][1];
 
2190
    coordinates[15][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[1][2];
 
2191
    coordinates[16][0] = 0.333333333333333*x[1][0] + 0.333333333333333*x[2][0] + 0.333333333333333*x[3][0];
 
2192
    coordinates[16][1] = 0.333333333333333*x[1][1] + 0.333333333333333*x[2][1] + 0.333333333333333*x[3][1];
 
2193
    coordinates[16][2] = 0.333333333333333*x[1][2] + 0.333333333333333*x[2][2] + 0.333333333333333*x[3][2];
 
2194
    coordinates[17][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[2][0] + 0.333333333333333*x[3][0];
 
2195
    coordinates[17][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[2][1] + 0.333333333333333*x[3][1];
 
2196
    coordinates[17][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[2][2] + 0.333333333333333*x[3][2];
 
2197
    coordinates[18][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[1][0] + 0.333333333333333*x[3][0];
 
2198
    coordinates[18][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[1][1] + 0.333333333333333*x[3][1];
 
2199
    coordinates[18][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[1][2] + 0.333333333333333*x[3][2];
 
2200
    coordinates[19][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[1][0] + 0.333333333333333*x[2][0];
 
2201
    coordinates[19][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[1][1] + 0.333333333333333*x[2][1];
 
2202
    coordinates[19][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[1][2] + 0.333333333333333*x[2][2];
 
2203
  }
 
2204
 
 
2205
  /// Return the number of sub dof maps (for a mixed element)
 
2206
  virtual unsigned int num_sub_dof_maps() const
 
2207
  {
 
2208
    return 1;
 
2209
  }
 
2210
 
 
2211
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
2212
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
2213
  {
 
2214
    return new UFC_Poisson3D_3BilinearForm_dof_map_1();
 
2215
  }
 
2216
 
 
2217
};
 
2218
 
 
2219
/// This class defines the interface for the tabulation of the cell
 
2220
/// tensor corresponding to the local contribution to a form from
 
2221
/// the integral over a cell.
 
2222
 
 
2223
class UFC_Poisson3D_3BilinearForm_cell_integral_0: public ufc::cell_integral
 
2224
{
 
2225
public:
 
2226
 
 
2227
  /// Constructor
 
2228
  UFC_Poisson3D_3BilinearForm_cell_integral_0() : ufc::cell_integral()
 
2229
  {
 
2230
    // Do nothing
 
2231
  }
 
2232
 
 
2233
  /// Destructor
 
2234
  virtual ~UFC_Poisson3D_3BilinearForm_cell_integral_0()
 
2235
  {
 
2236
    // Do nothing
 
2237
  }
 
2238
 
 
2239
  /// Tabulate the tensor for the contribution from a local cell
 
2240
  virtual void tabulate_tensor(double* A,
 
2241
                               const double * const * w,
 
2242
                               const ufc::cell& c) const
 
2243
  {
 
2244
    // Extract vertex coordinates
 
2245
    const double * const * x = c.coordinates;
 
2246
    
 
2247
    // Compute Jacobian of affine map from reference cell
 
2248
    const double J_00 = x[1][0] - x[0][0];
 
2249
    const double J_01 = x[2][0] - x[0][0];
 
2250
    const double J_02 = x[3][0] - x[0][0];
 
2251
    const double J_10 = x[1][1] - x[0][1];
 
2252
    const double J_11 = x[2][1] - x[0][1];
 
2253
    const double J_12 = x[3][1] - x[0][1];
 
2254
    const double J_20 = x[1][2] - x[0][2];
 
2255
    const double J_21 = x[2][2] - x[0][2];
 
2256
    const double J_22 = x[3][2] - x[0][2];
 
2257
      
 
2258
    // Compute sub determinants
 
2259
    const double d_00 = J_11*J_22 - J_12*J_21;
 
2260
    const double d_01 = J_12*J_20 - J_10*J_22;
 
2261
    const double d_02 = J_10*J_21 - J_11*J_20;
 
2262
    
 
2263
    const double d_10 = J_02*J_21 - J_01*J_22;
 
2264
    const double d_11 = J_00*J_22 - J_02*J_20;
 
2265
    const double d_12 = J_01*J_20 - J_00*J_21;
 
2266
    
 
2267
    const double d_20 = J_01*J_12 - J_02*J_11;
 
2268
    const double d_21 = J_02*J_10 - J_00*J_12;
 
2269
    const double d_22 = J_00*J_11 - J_01*J_10;
 
2270
      
 
2271
    // Compute determinant of Jacobian
 
2272
    double detJ = J_00*d_00 + J_10*d_10 + J_20*d_20;
 
2273
      
 
2274
    // Compute inverse of Jacobian
 
2275
    const double Jinv_00 = d_00 / detJ;
 
2276
    const double Jinv_01 = d_10 / detJ;
 
2277
    const double Jinv_02 = d_20 / detJ;
 
2278
    const double Jinv_10 = d_01 / detJ;
 
2279
    const double Jinv_11 = d_11 / detJ;
 
2280
    const double Jinv_12 = d_21 / detJ;
 
2281
    const double Jinv_20 = d_02 / detJ;
 
2282
    const double Jinv_21 = d_12 / detJ;
 
2283
    const double Jinv_22 = d_22 / detJ;
 
2284
    
 
2285
    // Set scale factor
 
2286
    const double det = std::abs(detJ);
 
2287
    
 
2288
    // Compute geometry tensors
 
2289
    const double G0_0_0 = det*(Jinv_00*Jinv_00 + Jinv_01*Jinv_01 + Jinv_02*Jinv_02);
 
2290
    const double G0_0_1 = det*(Jinv_00*Jinv_10 + Jinv_01*Jinv_11 + Jinv_02*Jinv_12);
 
2291
    const double G0_0_2 = det*(Jinv_00*Jinv_20 + Jinv_01*Jinv_21 + Jinv_02*Jinv_22);
 
2292
    const double G0_1_0 = det*(Jinv_10*Jinv_00 + Jinv_11*Jinv_01 + Jinv_12*Jinv_02);
 
2293
    const double G0_1_1 = det*(Jinv_10*Jinv_10 + Jinv_11*Jinv_11 + Jinv_12*Jinv_12);
 
2294
    const double G0_1_2 = det*(Jinv_10*Jinv_20 + Jinv_11*Jinv_21 + Jinv_12*Jinv_22);
 
2295
    const double G0_2_0 = det*(Jinv_20*Jinv_00 + Jinv_21*Jinv_01 + Jinv_22*Jinv_02);
 
2296
    const double G0_2_1 = det*(Jinv_20*Jinv_10 + Jinv_21*Jinv_11 + Jinv_22*Jinv_12);
 
2297
    const double G0_2_2 = det*(Jinv_20*Jinv_20 + Jinv_21*Jinv_21 + Jinv_22*Jinv_22);
 
2298
    
 
2299
    // Compute element tensor
 
2300
    A[0] = 0.0595238095238095*G0_0_0 + 0.0595238095238095*G0_0_1 + 0.0595238095238095*G0_0_2 + 0.0595238095238095*G0_1_0 + 0.0595238095238095*G0_1_1 + 0.0595238095238095*G0_1_2 + 0.0595238095238094*G0_2_0 + 0.0595238095238095*G0_2_1 + 0.0595238095238094*G0_2_2;
 
2301
    A[1] = -0.0113095238095238*G0_0_0 - 0.0113095238095238*G0_1_0 - 0.0113095238095238*G0_2_0;
 
2302
    A[2] = -0.0113095238095238*G0_0_1 - 0.0113095238095238*G0_1_1 - 0.0113095238095238*G0_2_1;
 
2303
    A[3] = -0.0113095238095238*G0_0_2 - 0.0113095238095238*G0_1_2 - 0.0113095238095238*G0_2_2;
 
2304
    A[4] = -0.0133928571428572*G0_0_1 - 0.0133928571428572*G0_0_2 - 0.0133928571428572*G0_1_1 - 0.0133928571428572*G0_1_2 - 0.0133928571428572*G0_2_1 - 0.0133928571428572*G0_2_2;
 
2305
    A[5] = -0.0133928571428571*G0_0_1 - 0.0133928571428571*G0_0_2 - 0.0133928571428571*G0_1_1 - 0.0133928571428571*G0_1_2 - 0.0133928571428571*G0_2_1 - 0.0133928571428571*G0_2_2;
 
2306
    A[6] = -0.0133928571428572*G0_0_0 - 0.0133928571428572*G0_0_2 - 0.0133928571428572*G0_1_0 - 0.0133928571428572*G0_1_2 - 0.0133928571428572*G0_2_0 - 0.0133928571428572*G0_2_2;
 
2307
    A[7] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_0_2 - 0.0133928571428571*G0_1_0 - 0.0133928571428571*G0_1_2 - 0.0133928571428571*G0_2_0 - 0.0133928571428571*G0_2_2;
 
2308
    A[8] = -0.0133928571428572*G0_0_0 - 0.0133928571428572*G0_0_1 - 0.0133928571428572*G0_1_0 - 0.0133928571428572*G0_1_1 - 0.0133928571428572*G0_2_0 - 0.0133928571428572*G0_2_1;
 
2309
    A[9] = -0.0133928571428572*G0_0_0 - 0.0133928571428572*G0_0_1 - 0.0133928571428572*G0_1_0 - 0.0133928571428572*G0_1_1 - 0.0133928571428572*G0_2_0 - 0.0133928571428572*G0_2_1;
 
2310
    A[10] = -0.0348214285714286*G0_0_0 - 0.0348214285714286*G0_0_1 - 0.0964285714285713*G0_0_2 - 0.0348214285714286*G0_1_0 - 0.0348214285714286*G0_1_1 - 0.0964285714285713*G0_1_2 - 0.0348214285714286*G0_2_0 - 0.0348214285714286*G0_2_1 - 0.0964285714285713*G0_2_2;
 
2311
    A[11] = 0.0133928571428571*G0_0_0 + 0.0133928571428571*G0_0_1 + 0.0482142857142856*G0_0_2 + 0.0133928571428571*G0_1_0 + 0.0133928571428571*G0_1_1 + 0.0482142857142856*G0_1_2 + 0.0133928571428571*G0_2_0 + 0.0133928571428571*G0_2_1 + 0.0482142857142856*G0_2_2;
 
2312
    A[12] = -0.0348214285714286*G0_0_0 - 0.0964285714285713*G0_0_1 - 0.0348214285714286*G0_0_2 - 0.0348214285714286*G0_1_0 - 0.0964285714285713*G0_1_1 - 0.0348214285714286*G0_1_2 - 0.0348214285714286*G0_2_0 - 0.0964285714285713*G0_2_1 - 0.0348214285714286*G0_2_2;
 
2313
    A[13] = 0.0133928571428572*G0_0_0 + 0.0482142857142856*G0_0_1 + 0.0133928571428572*G0_0_2 + 0.0133928571428572*G0_1_0 + 0.0482142857142856*G0_1_1 + 0.0133928571428572*G0_1_2 + 0.0133928571428572*G0_2_0 + 0.0482142857142856*G0_2_1 + 0.0133928571428572*G0_2_2;
 
2314
    A[14] = -0.0964285714285713*G0_0_0 - 0.0348214285714287*G0_0_1 - 0.0348214285714287*G0_0_2 - 0.0964285714285714*G0_1_0 - 0.0348214285714287*G0_1_1 - 0.0348214285714287*G0_1_2 - 0.0964285714285713*G0_2_0 - 0.0348214285714287*G0_2_1 - 0.0348214285714287*G0_2_2;
 
2315
    A[15] = 0.0482142857142857*G0_0_0 + 0.0133928571428572*G0_0_1 + 0.0133928571428572*G0_0_2 + 0.0482142857142857*G0_1_0 + 0.0133928571428572*G0_1_1 + 0.0133928571428572*G0_1_2 + 0.0482142857142857*G0_2_0 + 0.0133928571428572*G0_2_1 + 0.0133928571428572*G0_2_2;
 
2316
    A[16] = -0.0321428571428572*G0_0_0 - 0.0321428571428572*G0_0_1 - 0.0321428571428573*G0_0_2 - 0.0321428571428572*G0_1_0 - 0.0321428571428572*G0_1_1 - 0.0321428571428573*G0_1_2 - 0.0321428571428572*G0_2_0 - 0.0321428571428572*G0_2_1 - 0.0321428571428573*G0_2_2;
 
2317
    A[17] = 0.0321428571428572*G0_0_0 + 0.0482142857142858*G0_0_1 + 0.0482142857142857*G0_0_2 + 0.0321428571428572*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.0482142857142857*G0_1_2 + 0.0321428571428572*G0_2_0 + 0.0482142857142858*G0_2_1 + 0.0482142857142857*G0_2_2;
 
2318
    A[18] = 0.0482142857142858*G0_0_0 + 0.0321428571428572*G0_0_1 + 0.0482142857142858*G0_0_2 + 0.0482142857142858*G0_1_0 + 0.0321428571428572*G0_1_1 + 0.0482142857142858*G0_1_2 + 0.0482142857142858*G0_2_0 + 0.0321428571428572*G0_2_1 + 0.0482142857142858*G0_2_2;
 
2319
    A[19] = 0.0482142857142858*G0_0_0 + 0.0482142857142858*G0_0_1 + 0.0321428571428573*G0_0_2 + 0.0482142857142858*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.0321428571428573*G0_1_2 + 0.0482142857142858*G0_2_0 + 0.0482142857142858*G0_2_1 + 0.0321428571428573*G0_2_2;
 
2320
    A[20] = -0.0113095238095238*G0_0_0 - 0.0113095238095238*G0_0_1 - 0.0113095238095238*G0_0_2;
 
2321
    A[21] = 0.0595238095238094*G0_0_0;
 
2322
    A[22] = 0.0113095238095238*G0_0_1;
 
2323
    A[23] = 0.0113095238095238*G0_0_2;
 
2324
    A[24] = 0.0133928571428571*G0_0_1 + 0.0133928571428571*G0_0_2;
 
2325
    A[25] = 0.0133928571428571*G0_0_1 + 0.0133928571428571*G0_0_2;
 
2326
    A[26] = -0.0348214285714285*G0_0_0 + 0.0616071428571428*G0_0_2;
 
2327
    A[27] = 0.0133928571428571*G0_0_0 - 0.0348214285714285*G0_0_2;
 
2328
    A[28] = -0.0348214285714285*G0_0_0 + 0.0616071428571428*G0_0_1;
 
2329
    A[29] = 0.0133928571428571*G0_0_0 - 0.0348214285714285*G0_0_1;
 
2330
    A[30] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_0_1;
 
2331
    A[31] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_0_1;
 
2332
    A[32] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_0_2;
 
2333
    A[33] = -0.0133928571428572*G0_0_0 - 0.0133928571428571*G0_0_2;
 
2334
    A[34] = 0.0482142857142857*G0_0_0 + 0.0348214285714286*G0_0_1 + 0.0348214285714286*G0_0_2;
 
2335
    A[35] = -0.0964285714285713*G0_0_0 - 0.0616071428571428*G0_0_1 - 0.0616071428571428*G0_0_2;
 
2336
    A[36] = 0.0321428571428571*G0_0_0 - 0.0160714285714285*G0_0_1 - 0.0160714285714285*G0_0_2;
 
2337
    A[37] = -0.0321428571428571*G0_0_0;
 
2338
    A[38] = 0.0482142857142856*G0_0_0 + 0.0160714285714285*G0_0_1;
 
2339
    A[39] = 0.0482142857142856*G0_0_0 + 0.0160714285714285*G0_0_2;
 
2340
    A[40] = -0.0113095238095238*G0_1_0 - 0.0113095238095238*G0_1_1 - 0.0113095238095238*G0_1_2;
 
2341
    A[41] = 0.0113095238095238*G0_1_0;
 
2342
    A[42] = 0.0595238095238094*G0_1_1;
 
2343
    A[43] = 0.0113095238095238*G0_1_2;
 
2344
    A[44] = -0.0348214285714285*G0_1_1 + 0.0616071428571428*G0_1_2;
 
2345
    A[45] = 0.0133928571428571*G0_1_1 - 0.0348214285714285*G0_1_2;
 
2346
    A[46] = 0.0133928571428571*G0_1_0 + 0.0133928571428571*G0_1_2;
 
2347
    A[47] = 0.0133928571428572*G0_1_0 + 0.0133928571428571*G0_1_2;
 
2348
    A[48] = -0.0348214285714286*G0_1_0 + 0.0133928571428571*G0_1_1;
 
2349
    A[49] = 0.0616071428571428*G0_1_0 - 0.0348214285714285*G0_1_1;
 
2350
    A[50] = -0.0133928571428571*G0_1_0 - 0.0133928571428571*G0_1_1;
 
2351
    A[51] = -0.0133928571428571*G0_1_0 - 0.0133928571428572*G0_1_1;
 
2352
    A[52] = 0.0348214285714286*G0_1_0 + 0.0482142857142856*G0_1_1 + 0.0348214285714286*G0_1_2;
 
2353
    A[53] = -0.0616071428571428*G0_1_0 - 0.0964285714285713*G0_1_1 - 0.0616071428571428*G0_1_2;
 
2354
    A[54] = -0.0133928571428571*G0_1_1 - 0.0133928571428571*G0_1_2;
 
2355
    A[55] = -0.0133928571428571*G0_1_1 - 0.0133928571428571*G0_1_2;
 
2356
    A[56] = -0.0160714285714285*G0_1_0 + 0.032142857142857*G0_1_1 - 0.0160714285714286*G0_1_2;
 
2357
    A[57] = 0.0160714285714286*G0_1_0 + 0.0482142857142856*G0_1_1;
 
2358
    A[58] = -0.032142857142857*G0_1_1;
 
2359
    A[59] = 0.0482142857142856*G0_1_1 + 0.0160714285714286*G0_1_2;
 
2360
    A[60] = -0.0113095238095238*G0_2_0 - 0.0113095238095238*G0_2_1 - 0.0113095238095238*G0_2_2;
 
2361
    A[61] = 0.0113095238095238*G0_2_0;
 
2362
    A[62] = 0.0113095238095238*G0_2_1;
 
2363
    A[63] = 0.0595238095238094*G0_2_2;
 
2364
    A[64] = -0.0348214285714286*G0_2_1 + 0.0133928571428571*G0_2_2;
 
2365
    A[65] = 0.0616071428571428*G0_2_1 - 0.0348214285714284*G0_2_2;
 
2366
    A[66] = -0.0348214285714285*G0_2_0 + 0.0133928571428571*G0_2_2;
 
2367
    A[67] = 0.0616071428571428*G0_2_0 - 0.0348214285714284*G0_2_2;
 
2368
    A[68] = 0.0133928571428571*G0_2_0 + 0.0133928571428571*G0_2_1;
 
2369
    A[69] = 0.0133928571428571*G0_2_0 + 0.0133928571428571*G0_2_1;
 
2370
    A[70] = 0.0348214285714285*G0_2_0 + 0.0348214285714285*G0_2_1 + 0.0482142857142856*G0_2_2;
 
2371
    A[71] = -0.0616071428571428*G0_2_0 - 0.0616071428571428*G0_2_1 - 0.0964285714285712*G0_2_2;
 
2372
    A[72] = -0.0133928571428571*G0_2_0 - 0.0133928571428571*G0_2_2;
 
2373
    A[73] = -0.0133928571428571*G0_2_0 - 0.0133928571428571*G0_2_2;
 
2374
    A[74] = -0.0133928571428571*G0_2_1 - 0.0133928571428571*G0_2_2;
 
2375
    A[75] = -0.0133928571428571*G0_2_1 - 0.0133928571428571*G0_2_2;
 
2376
    A[76] = -0.0160714285714285*G0_2_0 - 0.0160714285714285*G0_2_1 + 0.032142857142857*G0_2_2;
 
2377
    A[77] = 0.0160714285714285*G0_2_0 + 0.0482142857142855*G0_2_2;
 
2378
    A[78] = 0.0160714285714285*G0_2_1 + 0.0482142857142855*G0_2_2;
 
2379
    A[79] = -0.032142857142857*G0_2_2;
 
2380
    A[80] = -0.0133928571428572*G0_1_0 - 0.0133928571428572*G0_1_1 - 0.0133928571428572*G0_1_2 - 0.0133928571428572*G0_2_0 - 0.0133928571428572*G0_2_1 - 0.0133928571428572*G0_2_2;
 
2381
    A[81] = 0.0133928571428571*G0_1_0 + 0.0133928571428571*G0_2_0;
 
2382
    A[82] = -0.0348214285714285*G0_1_1 + 0.0616071428571428*G0_2_1;
 
2383
    A[83] = -0.0348214285714286*G0_1_2 + 0.0133928571428571*G0_2_2;
 
2384
    A[84] = 0.241071428571428*G0_1_1 + 0.0964285714285714*G0_1_2 + 0.0964285714285714*G0_2_1 + 0.192857142857143*G0_2_2;
 
2385
    A[85] = -0.0723214285714286*G0_1_1 + 0.0723214285714284*G0_1_2 - 0.0241071428571429*G0_2_1 - 0.0723214285714285*G0_2_2;
 
2386
    A[86] = -0.0482142857142856*G0_1_0 - 0.0241071428571428*G0_1_2 - 0.0241071428571428*G0_2_0 - 0.0241071428571428*G0_2_2;
 
2387
    A[87] = -0.0723214285714286*G0_1_0 - 0.0482142857142857*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.0241071428571429*G0_2_2;
 
2388
    A[88] = -0.0482142857142856*G0_1_0 - 0.0241071428571428*G0_1_1 - 0.0723214285714285*G0_2_0 - 0.0241071428571428*G0_2_1;
 
2389
    A[89] = 0.0964285714285714*G0_1_0 + 0.120535714285714*G0_1_1 + 0.192857142857143*G0_2_0 + 0.0964285714285714*G0_2_1;
 
2390
    A[90] = 0.0482142857142857*G0_1_0 + 0.0482142857142857*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571429*G0_2_1;
 
2391
    A[91] = 0.0723214285714286*G0_1_0 + 0.0723214285714286*G0_1_1 + 0.0241071428571429*G0_1_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571429*G0_2_1;
 
2392
    A[92] = 0.0482142857142858*G0_1_0 + 0.0241071428571429*G0_1_1 + 0.0482142857142858*G0_1_2 + 0.0723214285714286*G0_2_0 + 0.0482142857142858*G0_2_1 + 0.0723214285714287*G0_2_2;
 
2393
    A[93] = -0.0964285714285714*G0_1_0 + 0.0241071428571427*G0_1_1 - 0.0964285714285714*G0_1_2 - 0.192857142857143*G0_2_0 - 0.0964285714285714*G0_2_1 - 0.192857142857143*G0_2_2;
 
2394
    A[94] = 0.0241071428571429*G0_1_1 + 0.0241071428571429*G0_1_2 + 0.0241071428571429*G0_2_1 + 0.0241071428571429*G0_2_2;
 
2395
    A[95] = 0.0241071428571428*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.0241071428571428*G0_2_2;
 
2396
    A[96] = 0.241071428571428*G0_1_0 - 0.0482142857142856*G0_1_1 + 0.120535714285714*G0_1_2 + 0.0964285714285713*G0_2_0 - 0.0241071428571429*G0_2_1 + 0.0964285714285713*G0_2_2;
 
2397
    A[97] = -0.241071428571428*G0_1_0 - 0.289285714285714*G0_1_1 - 0.120535714285714*G0_1_2 - 0.0964285714285712*G0_2_0 - 0.120535714285714*G0_2_1;
 
2398
    A[98] = 0.0482142857142856*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571429*G0_2_1;
 
2399
    A[99] = -0.144642857142857*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.0964285714285713*G0_2_2;
 
2400
    A[100] = -0.0133928571428571*G0_1_0 - 0.0133928571428571*G0_1_1 - 0.0133928571428571*G0_1_2 - 0.0133928571428571*G0_2_0 - 0.0133928571428571*G0_2_1 - 0.0133928571428571*G0_2_2;
 
2401
    A[101] = 0.0133928571428571*G0_1_0 + 0.0133928571428571*G0_2_0;
 
2402
    A[102] = 0.0133928571428571*G0_1_1 - 0.0348214285714285*G0_2_1;
 
2403
    A[103] = 0.0616071428571428*G0_1_2 - 0.0348214285714284*G0_2_2;
 
2404
    A[104] = -0.0723214285714286*G0_1_1 - 0.0241071428571429*G0_1_2 + 0.0723214285714284*G0_2_1 - 0.0723214285714285*G0_2_2;
 
2405
    A[105] = 0.192857142857143*G0_1_1 + 0.0964285714285713*G0_1_2 + 0.0964285714285713*G0_2_1 + 0.241071428571428*G0_2_2;
 
2406
    A[106] = -0.0723214285714285*G0_1_0 - 0.0241071428571428*G0_1_2 - 0.0482142857142857*G0_2_0 - 0.0241071428571428*G0_2_2;
 
2407
    A[107] = 0.192857142857143*G0_1_0 + 0.0964285714285713*G0_1_2 + 0.0964285714285713*G0_2_0 + 0.120535714285714*G0_2_2;
 
2408
    A[108] = -0.0241071428571429*G0_1_0 - 0.0241071428571428*G0_1_1 - 0.0482142857142856*G0_2_0 - 0.0241071428571428*G0_2_1;
 
2409
    A[109] = -0.0241071428571428*G0_1_0 - 0.0241071428571428*G0_1_1 - 0.0723214285714284*G0_2_0 - 0.0482142857142856*G0_2_1;
 
2410
    A[110] = 0.0723214285714285*G0_1_0 + 0.0723214285714285*G0_1_1 + 0.0482142857142857*G0_1_2 + 0.0482142857142857*G0_2_0 + 0.0482142857142857*G0_2_1 + 0.0241071428571429*G0_2_2;
 
2411
    A[111] = -0.192857142857143*G0_1_0 - 0.192857142857143*G0_1_1 - 0.0964285714285713*G0_1_2 - 0.0964285714285713*G0_2_0 - 0.0964285714285713*G0_2_1 + 0.0241071428571428*G0_2_2;
 
2412
    A[112] = 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_2 + 0.0482142857142856*G0_2_0 + 0.0241071428571427*G0_2_1 + 0.0482142857142856*G0_2_2;
 
2413
    A[113] = 0.0241071428571428*G0_1_0 + 0.0241071428571428*G0_1_2 + 0.0723214285714284*G0_2_0 + 0.0241071428571429*G0_2_1 + 0.0723214285714284*G0_2_2;
 
2414
    A[114] = 0.0241071428571429*G0_1_1 + 0.0241071428571429*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.0241071428571428*G0_2_2;
 
2415
    A[115] = 0.0241071428571428*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.0241071428571428*G0_2_2;
 
2416
    A[116] = 0.0964285714285713*G0_1_0 + 0.0964285714285713*G0_1_1 - 0.0241071428571429*G0_1_2 + 0.241071428571428*G0_2_0 + 0.120535714285714*G0_2_1 - 0.0482142857142855*G0_2_2;
 
2417
    A[117] = -0.0964285714285713*G0_1_0 - 0.120535714285714*G0_1_2 - 0.241071428571428*G0_2_0 - 0.120535714285714*G0_2_1 - 0.289285714285714*G0_2_2;
 
2418
    A[118] = -0.0964285714285713*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.144642857142857*G0_2_2;
 
2419
    A[119] = 0.0241071428571429*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.0482142857142855*G0_2_2;
 
2420
    A[120] = -0.0133928571428572*G0_0_0 - 0.0133928571428572*G0_0_1 - 0.0133928571428572*G0_0_2 - 0.0133928571428572*G0_2_0 - 0.0133928571428572*G0_2_1 - 0.0133928571428572*G0_2_2;
 
2421
    A[121] = -0.0348214285714285*G0_0_0 + 0.0616071428571428*G0_2_0;
 
2422
    A[122] = 0.0133928571428571*G0_0_1 + 0.0133928571428571*G0_2_1;
 
2423
    A[123] = -0.0348214285714285*G0_0_2 + 0.0133928571428571*G0_2_2;
 
2424
    A[124] = -0.0482142857142856*G0_0_1 - 0.0241071428571428*G0_0_2 - 0.0241071428571428*G0_2_1 - 0.0241071428571428*G0_2_2;
 
2425
    A[125] = -0.0723214285714285*G0_0_1 - 0.0482142857142857*G0_0_2 - 0.0241071428571428*G0_2_1 - 0.0241071428571428*G0_2_2;
 
2426
    A[126] = 0.241071428571428*G0_0_0 + 0.0964285714285713*G0_0_2 + 0.0964285714285713*G0_2_0 + 0.192857142857143*G0_2_2;
 
2427
    A[127] = -0.0723214285714285*G0_0_0 + 0.0723214285714285*G0_0_2 - 0.0241071428571428*G0_2_0 - 0.0723214285714284*G0_2_2;
 
2428
    A[128] = 0.120535714285714*G0_0_0 + 0.0964285714285714*G0_0_1 + 0.0964285714285714*G0_2_0 + 0.192857142857143*G0_2_1;
 
2429
    A[129] = -0.0241071428571429*G0_0_0 - 0.0482142857142856*G0_0_1 - 0.0241071428571428*G0_2_0 - 0.0723214285714284*G0_2_1;
 
2430
    A[130] = 0.0482142857142857*G0_0_0 + 0.0482142857142856*G0_0_1 + 0.0241071428571429*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571429*G0_2_1;
 
2431
    A[131] = 0.0723214285714285*G0_0_0 + 0.0723214285714285*G0_0_1 + 0.0241071428571428*G0_0_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571428*G0_2_1;
 
2432
    A[132] = 0.0241071428571429*G0_0_0 + 0.0241071428571428*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571429*G0_2_2;
 
2433
    A[133] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571429*G0_2_2;
 
2434
    A[134] = 0.024107142857143*G0_0_0 + 0.0482142857142857*G0_0_1 + 0.0482142857142857*G0_0_2 + 0.0482142857142859*G0_2_0 + 0.0723214285714286*G0_2_1 + 0.0723214285714287*G0_2_2;
 
2435
    A[135] = 0.0241071428571427*G0_0_0 - 0.0964285714285714*G0_0_1 - 0.0964285714285714*G0_0_2 - 0.0964285714285714*G0_2_0 - 0.192857142857143*G0_2_1 - 0.192857142857143*G0_2_2;
 
2436
    A[136] = -0.0482142857142857*G0_0_0 + 0.241071428571428*G0_0_1 + 0.120535714285714*G0_0_2 - 0.0241071428571428*G0_2_0 + 0.0964285714285714*G0_2_1 + 0.0964285714285714*G0_2_2;
 
2437
    A[137] = 0.0482142857142856*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0241071428571428*G0_2_0;
 
2438
    A[138] = -0.289285714285714*G0_0_0 - 0.241071428571428*G0_0_1 - 0.120535714285714*G0_0_2 - 0.120535714285714*G0_2_0 - 0.0964285714285714*G0_2_1;
 
2439
    A[139] = -0.144642857142857*G0_0_0 - 0.120535714285714*G0_0_2 - 0.120535714285714*G0_2_0 - 0.0964285714285715*G0_2_2;
 
2440
    A[140] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_0_1 - 0.0133928571428571*G0_0_2 - 0.0133928571428571*G0_2_0 - 0.0133928571428571*G0_2_1 - 0.0133928571428571*G0_2_2;
 
2441
    A[141] = 0.0133928571428571*G0_0_0 - 0.0348214285714285*G0_2_0;
 
2442
    A[142] = 0.0133928571428571*G0_0_1 + 0.0133928571428571*G0_2_1;
 
2443
    A[143] = 0.0616071428571428*G0_0_2 - 0.0348214285714285*G0_2_2;
 
2444
    A[144] = -0.0723214285714286*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.0482142857142857*G0_2_1 - 0.0241071428571429*G0_2_2;
 
2445
    A[145] = 0.192857142857143*G0_0_1 + 0.0964285714285713*G0_0_2 + 0.0964285714285713*G0_2_1 + 0.120535714285714*G0_2_2;
 
2446
    A[146] = -0.0723214285714285*G0_0_0 - 0.0241071428571428*G0_0_2 + 0.0723214285714285*G0_2_0 - 0.0723214285714283*G0_2_2;
 
2447
    A[147] = 0.192857142857143*G0_0_0 + 0.0964285714285713*G0_0_2 + 0.0964285714285713*G0_2_0 + 0.241071428571428*G0_2_2;
 
2448
    A[148] = -0.0241071428571428*G0_0_0 - 0.0241071428571428*G0_0_1 - 0.0482142857142856*G0_2_0 - 0.0723214285714284*G0_2_1;
 
2449
    A[149] = -0.0241071428571428*G0_0_0 - 0.0241071428571428*G0_0_1 - 0.0241071428571428*G0_2_0 - 0.0482142857142857*G0_2_1;
 
2450
    A[150] = 0.0723214285714285*G0_0_0 + 0.0723214285714285*G0_0_1 + 0.0482142857142857*G0_0_2 + 0.0482142857142857*G0_2_0 + 0.0482142857142856*G0_2_1 + 0.0241071428571429*G0_2_2;
 
2451
    A[151] = -0.192857142857143*G0_0_0 - 0.192857142857143*G0_0_1 - 0.0964285714285713*G0_0_2 - 0.0964285714285712*G0_2_0 - 0.0964285714285713*G0_2_1 + 0.0241071428571428*G0_2_2;
 
2452
    A[152] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571428*G0_2_2;
 
2453
    A[153] = 0.0241071428571428*G0_0_0 + 0.0241071428571428*G0_0_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571428*G0_2_2;
 
2454
    A[154] = 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_0_2 + 0.0241071428571428*G0_2_0 + 0.0482142857142856*G0_2_1 + 0.0482142857142857*G0_2_2;
 
2455
    A[155] = 0.0241071428571428*G0_0_1 + 0.0241071428571428*G0_0_2 + 0.0241071428571428*G0_2_0 + 0.0723214285714283*G0_2_1 + 0.0723214285714283*G0_2_2;
 
2456
    A[156] = 0.0964285714285713*G0_0_0 + 0.0964285714285714*G0_0_1 - 0.0241071428571429*G0_0_2 + 0.120535714285714*G0_2_0 + 0.241071428571428*G0_2_1 - 0.0482142857142855*G0_2_2;
 
2457
    A[157] = -0.0964285714285713*G0_0_0 - 0.120535714285714*G0_0_2 - 0.120535714285714*G0_2_0 - 0.144642857142857*G0_2_2;
 
2458
    A[158] = -0.0964285714285713*G0_0_1 - 0.120535714285714*G0_0_2 - 0.120535714285714*G0_2_0 - 0.241071428571428*G0_2_1 - 0.289285714285714*G0_2_2;
 
2459
    A[159] = 0.0241071428571429*G0_0_2 + 0.0241071428571428*G0_2_0 + 0.0482142857142856*G0_2_2;
 
2460
    A[160] = -0.0133928571428572*G0_0_0 - 0.0133928571428572*G0_0_1 - 0.0133928571428572*G0_0_2 - 0.0133928571428572*G0_1_0 - 0.0133928571428572*G0_1_1 - 0.0133928571428572*G0_1_2;
 
2461
    A[161] = -0.0348214285714285*G0_0_0 + 0.0616071428571428*G0_1_0;
 
2462
    A[162] = -0.0348214285714286*G0_0_1 + 0.0133928571428571*G0_1_1;
 
2463
    A[163] = 0.0133928571428571*G0_0_2 + 0.0133928571428571*G0_1_2;
 
2464
    A[164] = -0.0482142857142856*G0_0_1 - 0.0723214285714285*G0_0_2 - 0.0241071428571428*G0_1_1 - 0.0241071428571428*G0_1_2;
 
2465
    A[165] = -0.0241071428571429*G0_0_1 - 0.0482142857142856*G0_0_2 - 0.0241071428571429*G0_1_1 - 0.0241071428571428*G0_1_2;
 
2466
    A[166] = 0.120535714285714*G0_0_0 + 0.0964285714285714*G0_0_2 + 0.0964285714285714*G0_1_0 + 0.192857142857143*G0_1_2;
 
2467
    A[167] = -0.0241071428571428*G0_0_0 - 0.0482142857142856*G0_0_2 - 0.0241071428571428*G0_1_0 - 0.0723214285714284*G0_1_2;
 
2468
    A[168] = 0.241071428571428*G0_0_0 + 0.0964285714285715*G0_0_1 + 0.0964285714285715*G0_1_0 + 0.192857142857143*G0_1_1;
 
2469
    A[169] = -0.0723214285714286*G0_0_0 + 0.0723214285714286*G0_0_1 - 0.0241071428571428*G0_1_0 - 0.0723214285714284*G0_1_1;
 
2470
    A[170] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_1;
 
2471
    A[171] = 0.0241071428571429*G0_0_0 + 0.0241071428571428*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0241071428571428*G0_1_1;
 
2472
    A[172] = 0.0482142857142858*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0482142857142857*G0_0_2 + 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_2;
 
2473
    A[173] = 0.0723214285714286*G0_0_0 + 0.0241071428571428*G0_0_1 + 0.0723214285714286*G0_0_2 + 0.0241071428571428*G0_1_0 + 0.0241071428571429*G0_1_2;
 
2474
    A[174] = 0.024107142857143*G0_0_0 + 0.0482142857142858*G0_0_1 + 0.0482142857142858*G0_0_2 + 0.0482142857142859*G0_1_0 + 0.0723214285714286*G0_1_1 + 0.0723214285714286*G0_1_2;
 
2475
    A[175] = 0.0241071428571427*G0_0_0 - 0.0964285714285715*G0_0_1 - 0.0964285714285715*G0_0_2 - 0.0964285714285714*G0_1_0 - 0.192857142857143*G0_1_1 - 0.192857142857143*G0_1_2;
 
2476
    A[176] = -0.0482142857142856*G0_0_0 + 0.120535714285714*G0_0_1 + 0.241071428571428*G0_0_2 - 0.0241071428571428*G0_1_0 + 0.0964285714285715*G0_1_1 + 0.0964285714285715*G0_1_2;
 
2477
    A[177] = 0.0482142857142856*G0_0_0 + 0.0241071428571428*G0_0_1 + 0.0241071428571427*G0_1_0;
 
2478
    A[178] = -0.144642857142857*G0_0_0 - 0.120535714285714*G0_0_1 - 0.120535714285714*G0_1_0 - 0.0964285714285715*G0_1_1;
 
2479
    A[179] = -0.289285714285714*G0_0_0 - 0.120535714285714*G0_0_1 - 0.241071428571429*G0_0_2 - 0.120535714285714*G0_1_0 - 0.0964285714285716*G0_1_2;
 
2480
    A[180] = -0.0133928571428572*G0_0_0 - 0.0133928571428572*G0_0_1 - 0.0133928571428572*G0_0_2 - 0.0133928571428572*G0_1_0 - 0.0133928571428572*G0_1_1 - 0.0133928571428572*G0_1_2;
 
2481
    A[181] = 0.0133928571428571*G0_0_0 - 0.0348214285714285*G0_1_0;
 
2482
    A[182] = 0.0616071428571428*G0_0_1 - 0.0348214285714285*G0_1_1;
 
2483
    A[183] = 0.0133928571428571*G0_0_2 + 0.0133928571428571*G0_1_2;
 
2484
    A[184] = 0.0964285714285714*G0_0_1 + 0.192857142857143*G0_0_2 + 0.120535714285714*G0_1_1 + 0.0964285714285714*G0_1_2;
 
2485
    A[185] = -0.0241071428571428*G0_0_1 - 0.0723214285714284*G0_0_2 - 0.0241071428571428*G0_1_1 - 0.0482142857142856*G0_1_2;
 
2486
    A[186] = -0.0241071428571429*G0_0_0 - 0.0241071428571428*G0_0_2 - 0.0482142857142856*G0_1_0 - 0.0723214285714284*G0_1_2;
 
2487
    A[187] = -0.0241071428571428*G0_0_0 - 0.0241071428571428*G0_0_2 - 0.0241071428571428*G0_1_0 - 0.0482142857142857*G0_1_2;
 
2488
    A[188] = -0.0723214285714286*G0_0_0 - 0.0241071428571428*G0_0_1 + 0.0723214285714286*G0_1_0 - 0.0723214285714284*G0_1_1;
 
2489
    A[189] = 0.192857142857143*G0_0_0 + 0.0964285714285713*G0_0_1 + 0.0964285714285713*G0_1_0 + 0.241071428571428*G0_1_1;
 
2490
    A[190] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_1;
 
2491
    A[191] = 0.0241071428571428*G0_0_0 + 0.0241071428571428*G0_0_1 + 0.0241071428571428*G0_1_0 + 0.0241071428571428*G0_1_1;
 
2492
    A[192] = 0.0723214285714287*G0_0_0 + 0.0482142857142858*G0_0_1 + 0.0723214285714287*G0_0_2 + 0.0482142857142859*G0_1_0 + 0.0241071428571429*G0_1_1 + 0.0482142857142859*G0_1_2;
 
2493
    A[193] = -0.192857142857143*G0_0_0 - 0.0964285714285714*G0_0_1 - 0.192857142857143*G0_0_2 - 0.0964285714285713*G0_1_0 + 0.0241071428571428*G0_1_1 - 0.0964285714285713*G0_1_2;
 
2494
    A[194] = 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_0_2 + 0.0241071428571429*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.0482142857142858*G0_1_2;
 
2495
    A[195] = 0.0241071428571428*G0_0_1 + 0.0241071428571428*G0_0_2 + 0.0241071428571428*G0_1_0 + 0.0723214285714284*G0_1_1 + 0.0723214285714283*G0_1_2;
 
2496
    A[196] = 0.0964285714285714*G0_0_0 - 0.0241071428571428*G0_0_1 + 0.0964285714285713*G0_0_2 + 0.120535714285714*G0_1_0 - 0.0482142857142856*G0_1_1 + 0.241071428571428*G0_1_2;
 
2497
    A[197] = -0.0964285714285713*G0_0_0 - 0.120535714285714*G0_0_1 - 0.120535714285714*G0_1_0 - 0.144642857142857*G0_1_1;
 
2498
    A[198] = 0.0241071428571429*G0_0_1 + 0.0241071428571427*G0_1_0 + 0.0482142857142856*G0_1_1;
 
2499
    A[199] = -0.120535714285714*G0_0_1 - 0.0964285714285713*G0_0_2 - 0.120535714285714*G0_1_0 - 0.289285714285714*G0_1_1 - 0.241071428571428*G0_1_2;
 
2500
    A[200] = -0.0348214285714286*G0_0_0 - 0.0348214285714286*G0_0_1 - 0.0348214285714286*G0_0_2 - 0.0348214285714286*G0_1_0 - 0.0348214285714286*G0_1_1 - 0.0348214285714286*G0_1_2 - 0.0964285714285713*G0_2_0 - 0.0964285714285713*G0_2_1 - 0.0964285714285713*G0_2_2;
 
2501
    A[201] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_1_0;
 
2502
    A[202] = -0.0133928571428571*G0_0_1 - 0.0133928571428571*G0_1_1;
 
2503
    A[203] = 0.0348214285714285*G0_0_2 + 0.0348214285714285*G0_1_2 + 0.0482142857142856*G0_2_2;
 
2504
    A[204] = 0.0482142857142857*G0_0_1 + 0.0241071428571429*G0_0_2 + 0.0482142857142857*G0_1_1 + 0.0241071428571429*G0_1_2 + 0.0241071428571428*G0_2_1;
 
2505
    A[205] = 0.0723214285714284*G0_0_1 + 0.0482142857142857*G0_0_2 + 0.0723214285714285*G0_1_1 + 0.0482142857142857*G0_1_2 + 0.0482142857142857*G0_2_1 + 0.0241071428571429*G0_2_2;
 
2506
    A[206] = 0.0482142857142857*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0482142857142856*G0_1_0 + 0.0241071428571429*G0_1_2 + 0.0241071428571429*G0_2_0;
 
2507
    A[207] = 0.0723214285714285*G0_0_0 + 0.0482142857142857*G0_0_2 + 0.0723214285714285*G0_1_0 + 0.0482142857142856*G0_1_2 + 0.0482142857142857*G0_2_0 + 0.0241071428571429*G0_2_2;
 
2508
    A[208] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_1;
 
2509
    A[209] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_1;
 
2510
    A[210] = 0.241071428571428*G0_0_0 + 0.241071428571428*G0_0_1 + 0.144642857142857*G0_0_2 + 0.241071428571428*G0_1_0 + 0.241071428571428*G0_1_1 + 0.144642857142857*G0_1_2 + 0.144642857142857*G0_2_0 + 0.144642857142857*G0_2_1 + 0.241071428571428*G0_2_2;
 
2511
    A[211] = -0.0723214285714284*G0_0_0 - 0.0723214285714284*G0_0_1 - 0.144642857142857*G0_0_2 - 0.0723214285714285*G0_1_0 - 0.0723214285714285*G0_1_1 - 0.144642857142857*G0_1_2 - 0.0482142857142857*G0_2_0 - 0.0482142857142857*G0_2_1 - 0.192857142857142*G0_2_2;
 
2512
    A[212] = 0.120535714285714*G0_0_0 + 0.024107142857143*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285714*G0_1_0 + 0.024107142857143*G0_1_1 + 0.120535714285714*G0_1_2 + 0.024107142857143*G0_2_0 + 0.120535714285714*G0_2_1 + 0.024107142857143*G0_2_2;
 
2513
    A[213] = -0.0241071428571429*G0_0_0 + 0.0241071428571427*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.024107142857143*G0_1_0 + 0.0241071428571427*G0_1_1 - 0.0241071428571429*G0_1_2 - 0.0241071428571428*G0_2_1;
 
2514
    A[214] = 0.024107142857143*G0_0_0 + 0.120535714285714*G0_0_1 + 0.120535714285714*G0_0_2 + 0.024107142857143*G0_1_0 + 0.120535714285714*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.024107142857143*G0_2_1 + 0.024107142857143*G0_2_2;
 
2515
    A[215] = 0.0241071428571427*G0_0_0 - 0.0241071428571429*G0_0_1 - 0.0241071428571429*G0_0_2 + 0.0241071428571427*G0_1_0 - 0.0241071428571429*G0_1_1 - 0.0241071428571429*G0_1_2 - 0.0241071428571429*G0_2_0;
 
2516
    A[216] = 0.0482142857142858*G0_0_0 + 0.0482142857142857*G0_0_1 + 0.024107142857143*G0_0_2 + 0.0482142857142858*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.024107142857143*G0_1_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571429*G0_2_1;
 
2517
    A[217] = -0.0482142857142858*G0_0_0 - 0.289285714285714*G0_0_1 - 0.16875*G0_0_2 - 0.0482142857142858*G0_1_0 - 0.289285714285714*G0_1_1 - 0.16875*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.16875*G0_2_1 - 0.0482142857142859*G0_2_2;
 
2518
    A[218] = -0.289285714285714*G0_0_0 - 0.0482142857142857*G0_0_1 - 0.16875*G0_0_2 - 0.289285714285714*G0_1_0 - 0.0482142857142858*G0_1_1 - 0.16875*G0_1_2 - 0.16875*G0_2_0 - 0.0241071428571429*G0_2_1 - 0.0482142857142859*G0_2_2;
 
2519
    A[219] = -0.144642857142857*G0_0_0 - 0.144642857142857*G0_0_1 - 0.024107142857143*G0_0_2 - 0.144642857142857*G0_1_0 - 0.144642857142857*G0_1_1 - 0.024107142857143*G0_1_2 - 0.024107142857143*G0_2_0 - 0.024107142857143*G0_2_1;
 
2520
    A[220] = 0.0133928571428571*G0_0_0 + 0.0133928571428571*G0_0_1 + 0.0133928571428571*G0_0_2 + 0.0133928571428571*G0_1_0 + 0.0133928571428571*G0_1_1 + 0.0133928571428571*G0_1_2 + 0.0482142857142856*G0_2_0 + 0.0482142857142856*G0_2_1 + 0.0482142857142856*G0_2_2;
 
2521
    A[221] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_1_0;
 
2522
    A[222] = -0.0133928571428571*G0_0_1 - 0.0133928571428572*G0_1_1;
 
2523
    A[223] = -0.0616071428571428*G0_0_2 - 0.0616071428571428*G0_1_2 - 0.0964285714285712*G0_2_2;
 
2524
    A[224] = 0.0723214285714286*G0_0_1 + 0.0241071428571429*G0_0_2 + 0.0723214285714286*G0_1_1 + 0.0241071428571429*G0_1_2 + 0.0241071428571429*G0_2_1;
 
2525
    A[225] = -0.192857142857143*G0_0_1 - 0.0964285714285713*G0_0_2 - 0.192857142857143*G0_1_1 - 0.0964285714285713*G0_1_2 - 0.0964285714285713*G0_2_1 + 0.0241071428571428*G0_2_2;
 
2526
    A[226] = 0.0723214285714285*G0_0_0 + 0.0241071428571428*G0_0_2 + 0.0723214285714285*G0_1_0 + 0.0241071428571428*G0_1_2 + 0.0241071428571428*G0_2_0;
 
2527
    A[227] = -0.192857142857143*G0_0_0 - 0.0964285714285712*G0_0_2 - 0.192857142857143*G0_1_0 - 0.0964285714285713*G0_1_2 - 0.0964285714285713*G0_2_0 + 0.0241071428571428*G0_2_2;
 
2528
    A[228] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0241071428571428*G0_1_1;
 
2529
    A[229] = 0.0241071428571428*G0_0_0 + 0.0241071428571428*G0_0_1 + 0.0241071428571428*G0_1_0 + 0.0241071428571428*G0_1_1;
 
2530
    A[230] = -0.0723214285714284*G0_0_0 - 0.0723214285714285*G0_0_1 - 0.0482142857142857*G0_0_2 - 0.0723214285714285*G0_1_0 - 0.0723214285714285*G0_1_1 - 0.0482142857142857*G0_1_2 - 0.144642857142857*G0_2_0 - 0.144642857142857*G0_2_1 - 0.192857142857142*G0_2_2;
 
2531
    A[231] = 0.192857142857143*G0_0_0 + 0.192857142857143*G0_0_1 + 0.0964285714285713*G0_0_2 + 0.192857142857143*G0_1_0 + 0.192857142857143*G0_1_1 + 0.0964285714285713*G0_1_2 + 0.0964285714285713*G0_2_0 + 0.0964285714285713*G0_2_1 + 0.241071428571428*G0_2_2;
 
2532
    A[232] = -0.0241071428571428*G0_0_0 - 0.0241071428571428*G0_0_2 - 0.0241071428571429*G0_1_0 - 0.0241071428571429*G0_1_2 + 0.0241071428571427*G0_2_0 - 0.0241071428571428*G0_2_1 + 0.0241071428571427*G0_2_2;
 
2533
    A[233] = -0.0241071428571428*G0_0_0 - 0.0241071428571428*G0_0_2 - 0.0241071428571428*G0_1_0 - 0.0241071428571428*G0_1_2 - 0.0241071428571428*G0_2_1;
 
2534
    A[234] = -0.0241071428571428*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.0241071428571429*G0_1_1 - 0.0241071428571429*G0_1_2 - 0.0241071428571428*G0_2_0 + 0.0241071428571427*G0_2_1 + 0.0241071428571427*G0_2_2;
 
2535
    A[235] = -0.0241071428571428*G0_0_1 - 0.0241071428571428*G0_0_2 - 0.0241071428571428*G0_1_1 - 0.0241071428571428*G0_1_2 - 0.0241071428571428*G0_2_0;
 
2536
    A[236] = -0.0964285714285712*G0_0_0 - 0.0964285714285713*G0_0_1 + 0.0241071428571429*G0_0_2 - 0.0964285714285713*G0_1_0 - 0.0964285714285713*G0_1_1 + 0.0241071428571429*G0_1_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571429*G0_2_1;
 
2537
    A[237] = 0.0964285714285712*G0_0_0 + 0.120535714285714*G0_0_2 + 0.0964285714285712*G0_1_0 + 0.120535714285714*G0_1_2 - 0.0241071428571429*G0_2_0 + 0.120535714285714*G0_2_1 - 0.0482142857142855*G0_2_2;
 
2538
    A[238] = 0.0964285714285712*G0_0_1 + 0.120535714285714*G0_0_2 + 0.0964285714285713*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 - 0.0241071428571428*G0_2_1 - 0.0482142857142855*G0_2_2;
 
2539
    A[239] = -0.0241071428571429*G0_0_2 - 0.0241071428571429*G0_1_2 - 0.0241071428571428*G0_2_0 - 0.0241071428571427*G0_2_1;
 
2540
    A[240] = -0.0348214285714286*G0_0_0 - 0.0348214285714286*G0_0_1 - 0.0348214285714286*G0_0_2 - 0.0964285714285713*G0_1_0 - 0.0964285714285713*G0_1_1 - 0.0964285714285713*G0_1_2 - 0.0348214285714286*G0_2_0 - 0.0348214285714286*G0_2_1 - 0.0348214285714286*G0_2_2;
 
2541
    A[241] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_2_0;
 
2542
    A[242] = 0.0348214285714286*G0_0_1 + 0.0482142857142856*G0_1_1 + 0.0348214285714286*G0_2_1;
 
2543
    A[243] = -0.0133928571428571*G0_0_2 - 0.0133928571428571*G0_2_2;
 
2544
    A[244] = 0.0482142857142858*G0_0_1 + 0.0723214285714286*G0_0_2 + 0.0241071428571429*G0_1_1 + 0.0482142857142858*G0_1_2 + 0.0482142857142858*G0_2_1 + 0.0723214285714287*G0_2_2;
 
2545
    A[245] = 0.0241071428571429*G0_0_1 + 0.0482142857142856*G0_0_2 + 0.0241071428571427*G0_1_2 + 0.0241071428571429*G0_2_1 + 0.0482142857142856*G0_2_2;
 
2546
    A[246] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571429*G0_2_2;
 
2547
    A[247] = 0.0241071428571429*G0_0_0 + 0.0241071428571428*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571428*G0_2_2;
 
2548
    A[248] = 0.0482142857142858*G0_0_0 + 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0482142857142857*G0_2_0 + 0.0241071428571429*G0_2_1;
 
2549
    A[249] = 0.0723214285714287*G0_0_0 + 0.0482142857142859*G0_0_1 + 0.0482142857142858*G0_1_0 + 0.0241071428571429*G0_1_1 + 0.0723214285714287*G0_2_0 + 0.0482142857142859*G0_2_1;
 
2550
    A[250] = 0.120535714285714*G0_0_0 + 0.120535714285714*G0_0_1 + 0.024107142857143*G0_0_2 + 0.024107142857143*G0_1_0 + 0.024107142857143*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.120535714285714*G0_2_1 + 0.024107142857143*G0_2_2;
 
2551
    A[251] = -0.0241071428571428*G0_0_0 - 0.0241071428571429*G0_0_1 + 0.0241071428571427*G0_0_2 - 0.0241071428571428*G0_1_2 - 0.0241071428571428*G0_2_0 - 0.0241071428571429*G0_2_1 + 0.0241071428571427*G0_2_2;
 
2552
    A[252] = 0.241071428571428*G0_0_0 + 0.144642857142857*G0_0_1 + 0.241071428571428*G0_0_2 + 0.144642857142857*G0_1_0 + 0.241071428571428*G0_1_1 + 0.144642857142857*G0_1_2 + 0.241071428571428*G0_2_0 + 0.144642857142857*G0_2_1 + 0.241071428571428*G0_2_2;
 
2553
    A[253] = -0.0723214285714287*G0_0_0 - 0.144642857142857*G0_0_1 - 0.0723214285714287*G0_0_2 - 0.0482142857142858*G0_1_0 - 0.192857142857143*G0_1_1 - 0.0482142857142858*G0_1_2 - 0.0723214285714287*G0_2_0 - 0.144642857142857*G0_2_1 - 0.0723214285714287*G0_2_2;
 
2554
    A[254] = 0.024107142857143*G0_0_0 + 0.120535714285714*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285714*G0_1_0 + 0.024107142857143*G0_1_1 + 0.024107142857143*G0_1_2 + 0.024107142857143*G0_2_0 + 0.120535714285714*G0_2_1 + 0.120535714285714*G0_2_2;
 
2555
    A[255] = 0.0241071428571427*G0_0_0 - 0.0241071428571429*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.0241071428571429*G0_1_0 + 0.0241071428571427*G0_2_0 - 0.0241071428571429*G0_2_1 - 0.0241071428571429*G0_2_2;
 
2556
    A[256] = 0.0482142857142859*G0_0_0 + 0.024107142857143*G0_0_1 + 0.0482142857142861*G0_0_2 + 0.024107142857143*G0_1_0 + 0.0241071428571432*G0_1_2 + 0.0482142857142859*G0_2_0 + 0.024107142857143*G0_2_1 + 0.0482142857142861*G0_2_2;
 
2557
    A[257] = -0.0482142857142859*G0_0_0 - 0.16875*G0_0_1 - 0.289285714285714*G0_0_2 - 0.024107142857143*G0_1_0 - 0.0482142857142859*G0_1_1 - 0.16875*G0_1_2 - 0.0482142857142859*G0_2_0 - 0.16875*G0_2_1 - 0.289285714285714*G0_2_2;
 
2558
    A[258] = -0.144642857142857*G0_0_0 - 0.024107142857143*G0_0_1 - 0.144642857142857*G0_0_2 - 0.024107142857143*G0_1_0 - 0.0241071428571429*G0_1_2 - 0.144642857142857*G0_2_0 - 0.024107142857143*G0_2_1 - 0.144642857142857*G0_2_2;
 
2559
    A[259] = -0.289285714285714*G0_0_0 - 0.16875*G0_0_1 - 0.0482142857142861*G0_0_2 - 0.16875*G0_1_0 - 0.0482142857142859*G0_1_1 - 0.0241071428571432*G0_1_2 - 0.289285714285714*G0_2_0 - 0.16875*G0_2_1 - 0.0482142857142861*G0_2_2;
 
2560
    A[260] = 0.0133928571428572*G0_0_0 + 0.0133928571428572*G0_0_1 + 0.0133928571428572*G0_0_2 + 0.0482142857142856*G0_1_0 + 0.0482142857142856*G0_1_1 + 0.0482142857142856*G0_1_2 + 0.0133928571428572*G0_2_0 + 0.0133928571428572*G0_2_1 + 0.0133928571428572*G0_2_2;
 
2561
    A[261] = -0.0133928571428571*G0_0_0 - 0.0133928571428571*G0_2_0;
 
2562
    A[262] = -0.0616071428571428*G0_0_1 - 0.0964285714285713*G0_1_1 - 0.0616071428571428*G0_2_1;
 
2563
    A[263] = -0.0133928571428571*G0_0_2 - 0.0133928571428571*G0_2_2;
 
2564
    A[264] = -0.0964285714285714*G0_0_1 - 0.192857142857143*G0_0_2 + 0.0241071428571427*G0_1_1 - 0.0964285714285714*G0_1_2 - 0.0964285714285714*G0_2_1 - 0.192857142857143*G0_2_2;
 
2565
    A[265] = 0.0241071428571428*G0_0_1 + 0.0723214285714284*G0_0_2 + 0.0241071428571429*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.0723214285714285*G0_2_2;
 
2566
    A[266] = 0.0241071428571429*G0_0_0 + 0.0241071428571429*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571429*G0_2_2;
 
2567
    A[267] = 0.0241071428571428*G0_0_0 + 0.0241071428571428*G0_0_2 + 0.0241071428571428*G0_2_0 + 0.0241071428571428*G0_2_2;
 
2568
    A[268] = 0.0723214285714286*G0_0_0 + 0.0241071428571428*G0_0_1 + 0.0241071428571428*G0_1_0 + 0.0723214285714286*G0_2_0 + 0.0241071428571428*G0_2_1;
 
2569
    A[269] = -0.192857142857143*G0_0_0 - 0.0964285714285713*G0_0_1 - 0.0964285714285714*G0_1_0 + 0.0241071428571427*G0_1_1 - 0.192857142857143*G0_2_0 - 0.0964285714285713*G0_2_1;
 
2570
    A[270] = -0.0241071428571429*G0_0_0 - 0.024107142857143*G0_0_1 + 0.0241071428571427*G0_1_0 + 0.0241071428571427*G0_1_1 - 0.0241071428571428*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.0241071428571429*G0_2_1;
 
2571
    A[271] = -0.0241071428571428*G0_0_0 - 0.0241071428571428*G0_0_1 - 0.0241071428571428*G0_1_2 - 0.0241071428571428*G0_2_0 - 0.0241071428571428*G0_2_1;
 
2572
    A[272] = -0.0723214285714287*G0_0_0 - 0.0482142857142858*G0_0_1 - 0.0723214285714287*G0_0_2 - 0.144642857142857*G0_1_0 - 0.192857142857143*G0_1_1 - 0.144642857142857*G0_1_2 - 0.0723214285714287*G0_2_0 - 0.0482142857142858*G0_2_1 - 0.0723214285714287*G0_2_2;
 
2573
    A[273] = 0.192857142857143*G0_0_0 + 0.0964285714285714*G0_0_1 + 0.192857142857143*G0_0_2 + 0.0964285714285714*G0_1_0 + 0.241071428571428*G0_1_1 + 0.0964285714285714*G0_1_2 + 0.192857142857143*G0_2_0 + 0.0964285714285714*G0_2_1 + 0.192857142857143*G0_2_2;
 
2574
    A[274] = -0.0241071428571429*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.0241071428571428*G0_1_0 + 0.0241071428571428*G0_1_1 + 0.0241071428571427*G0_1_2 - 0.0241071428571429*G0_2_1 - 0.0241071428571429*G0_2_2;
 
2575
    A[275] = -0.0241071428571429*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.0241071428571428*G0_1_0 - 0.0241071428571429*G0_2_1 - 0.0241071428571429*G0_2_2;
 
2576
    A[276] = -0.0964285714285714*G0_0_0 + 0.0241071428571429*G0_0_1 - 0.0964285714285713*G0_0_2 + 0.0241071428571427*G0_1_0 + 0.0241071428571427*G0_1_2 - 0.0964285714285713*G0_2_0 + 0.0241071428571429*G0_2_1 - 0.0964285714285713*G0_2_2;
 
2577
    A[277] = 0.0964285714285713*G0_0_0 + 0.120535714285714*G0_0_1 - 0.0241071428571427*G0_1_0 - 0.0482142857142855*G0_1_1 + 0.120535714285714*G0_1_2 + 0.0964285714285713*G0_2_0 + 0.120535714285714*G0_2_1;
 
2578
    A[278] = -0.0241071428571429*G0_0_1 - 0.0241071428571428*G0_1_0 - 0.0241071428571428*G0_1_2 - 0.0241071428571429*G0_2_1;
 
2579
    A[279] = 0.120535714285714*G0_0_1 + 0.0964285714285713*G0_0_2 + 0.120535714285714*G0_1_0 - 0.0482142857142855*G0_1_1 - 0.0241071428571427*G0_1_2 + 0.120535714285714*G0_2_1 + 0.0964285714285713*G0_2_2;
 
2580
    A[280] = -0.0964285714285713*G0_0_0 - 0.0964285714285714*G0_0_1 - 0.0964285714285713*G0_0_2 - 0.0348214285714287*G0_1_0 - 0.0348214285714287*G0_1_1 - 0.0348214285714287*G0_1_2 - 0.0348214285714287*G0_2_0 - 0.0348214285714287*G0_2_1 - 0.0348214285714287*G0_2_2;
 
2581
    A[281] = 0.0482142857142857*G0_0_0 + 0.0348214285714286*G0_1_0 + 0.0348214285714286*G0_2_0;
 
2582
    A[282] = -0.0133928571428571*G0_1_1 - 0.0133928571428571*G0_2_1;
 
2583
    A[283] = -0.0133928571428571*G0_1_2 - 0.0133928571428571*G0_2_2;
 
2584
    A[284] = 0.0241071428571429*G0_1_1 + 0.0241071428571429*G0_1_2 + 0.0241071428571429*G0_2_1 + 0.0241071428571429*G0_2_2;
 
2585
    A[285] = 0.0241071428571429*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571429*G0_2_1 + 0.0241071428571428*G0_2_2;
 
2586
    A[286] = 0.024107142857143*G0_0_0 + 0.0482142857142859*G0_0_2 + 0.0482142857142857*G0_1_0 + 0.0723214285714286*G0_1_2 + 0.0482142857142857*G0_2_0 + 0.0723214285714287*G0_2_2;
 
2587
    A[287] = 0.0241071428571428*G0_0_2 + 0.0241071428571429*G0_1_0 + 0.0482142857142856*G0_1_2 + 0.0241071428571429*G0_2_0 + 0.0482142857142857*G0_2_2;
 
2588
    A[288] = 0.024107142857143*G0_0_0 + 0.0482142857142859*G0_0_1 + 0.0482142857142858*G0_1_0 + 0.0723214285714286*G0_1_1 + 0.0482142857142858*G0_2_0 + 0.0723214285714286*G0_2_1;
 
2589
    A[289] = 0.0241071428571429*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.0241071428571429*G0_2_0 + 0.0482142857142858*G0_2_1;
 
2590
    A[290] = 0.024107142857143*G0_0_0 + 0.024107142857143*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285714*G0_1_0 + 0.120535714285714*G0_1_1 + 0.024107142857143*G0_1_2 + 0.120535714285714*G0_2_0 + 0.120535714285714*G0_2_1 + 0.024107142857143*G0_2_2;
 
2591
    A[291] = -0.0241071428571428*G0_0_2 - 0.0241071428571428*G0_1_0 - 0.0241071428571429*G0_1_1 + 0.0241071428571427*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.0241071428571429*G0_2_1 + 0.0241071428571427*G0_2_2;
 
2592
    A[292] = 0.024107142857143*G0_0_0 + 0.120535714285714*G0_0_1 + 0.024107142857143*G0_0_2 + 0.120535714285714*G0_1_0 + 0.024107142857143*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.024107142857143*G0_2_1 + 0.120535714285714*G0_2_2;
 
2593
    A[293] = -0.0241071428571428*G0_0_1 - 0.0241071428571429*G0_1_0 + 0.0241071428571428*G0_1_1 - 0.0241071428571429*G0_1_2 - 0.0241071428571429*G0_2_0 + 0.0241071428571427*G0_2_1 - 0.0241071428571429*G0_2_2;
 
2594
    A[294] = 0.241071428571428*G0_0_0 + 0.144642857142857*G0_0_1 + 0.144642857142857*G0_0_2 + 0.144642857142857*G0_1_0 + 0.241071428571428*G0_1_1 + 0.241071428571428*G0_1_2 + 0.144642857142857*G0_2_0 + 0.241071428571428*G0_2_1 + 0.241071428571428*G0_2_2;
 
2595
    A[295] = -0.192857142857143*G0_0_0 - 0.0482142857142859*G0_0_1 - 0.0482142857142859*G0_0_2 - 0.144642857142857*G0_1_0 - 0.0723214285714287*G0_1_1 - 0.0723214285714287*G0_1_2 - 0.144642857142857*G0_2_0 - 0.0723214285714287*G0_2_1 - 0.0723214285714287*G0_2_2;
 
2596
    A[296] = 0.024107142857143*G0_0_1 + 0.0241071428571431*G0_0_2 + 0.024107142857143*G0_1_0 + 0.0482142857142859*G0_1_1 + 0.048214285714286*G0_1_2 + 0.024107142857143*G0_2_0 + 0.0482142857142859*G0_2_1 + 0.048214285714286*G0_2_2;
 
2597
    A[297] = -0.024107142857143*G0_0_1 - 0.024107142857143*G0_0_2 - 0.024107142857143*G0_1_0 - 0.144642857142857*G0_1_1 - 0.144642857142857*G0_1_2 - 0.024107142857143*G0_2_0 - 0.144642857142857*G0_2_1 - 0.144642857142857*G0_2_2;
 
2598
    A[298] = -0.048214285714286*G0_0_0 - 0.024107142857143*G0_0_1 - 0.16875*G0_0_2 - 0.16875*G0_1_0 - 0.0482142857142858*G0_1_1 - 0.289285714285714*G0_1_2 - 0.16875*G0_2_0 - 0.0482142857142859*G0_2_1 - 0.289285714285714*G0_2_2;
 
2599
    A[299] = -0.048214285714286*G0_0_0 - 0.16875*G0_0_1 - 0.0241071428571431*G0_0_2 - 0.16875*G0_1_0 - 0.289285714285714*G0_1_1 - 0.048214285714286*G0_1_2 - 0.16875*G0_2_0 - 0.289285714285714*G0_2_1 - 0.048214285714286*G0_2_2;
 
2600
    A[300] = 0.0482142857142857*G0_0_0 + 0.0482142857142857*G0_0_1 + 0.0482142857142857*G0_0_2 + 0.0133928571428572*G0_1_0 + 0.0133928571428572*G0_1_1 + 0.0133928571428572*G0_1_2 + 0.0133928571428572*G0_2_0 + 0.0133928571428572*G0_2_1 + 0.0133928571428572*G0_2_2;
 
2601
    A[301] = -0.0964285714285713*G0_0_0 - 0.0616071428571428*G0_1_0 - 0.0616071428571428*G0_2_0;
 
2602
    A[302] = -0.0133928571428571*G0_1_1 - 0.0133928571428571*G0_2_1;
 
2603
    A[303] = -0.0133928571428571*G0_1_2 - 0.0133928571428571*G0_2_2;
 
2604
    A[304] = 0.0241071428571428*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.0241071428571428*G0_2_2;
 
2605
    A[305] = 0.0241071428571428*G0_1_1 + 0.0241071428571428*G0_1_2 + 0.0241071428571428*G0_2_1 + 0.0241071428571428*G0_2_2;
 
2606
    A[306] = 0.0241071428571427*G0_0_0 - 0.0964285714285714*G0_0_2 - 0.0964285714285714*G0_1_0 - 0.192857142857143*G0_1_2 - 0.0964285714285714*G0_2_0 - 0.192857142857143*G0_2_2;
 
2607
    A[307] = 0.0241071428571428*G0_0_2 + 0.0241071428571428*G0_1_0 + 0.0723214285714283*G0_1_2 + 0.0241071428571428*G0_2_0 + 0.0723214285714283*G0_2_2;
 
2608
    A[308] = 0.0241071428571427*G0_0_0 - 0.0964285714285714*G0_0_1 - 0.0964285714285715*G0_1_0 - 0.192857142857143*G0_1_1 - 0.0964285714285715*G0_2_0 - 0.192857142857143*G0_2_1;
 
2609
    A[309] = 0.0241071428571428*G0_0_1 + 0.0241071428571428*G0_1_0 + 0.0723214285714284*G0_1_1 + 0.0241071428571428*G0_2_0 + 0.0723214285714283*G0_2_1;
 
2610
    A[310] = 0.0241071428571427*G0_0_0 + 0.0241071428571427*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.0241071428571429*G0_1_0 - 0.0241071428571429*G0_1_1 - 0.0241071428571429*G0_2_0 - 0.024107142857143*G0_2_1;
 
2611
    A[311] = -0.0241071428571428*G0_0_2 - 0.0241071428571428*G0_1_0 - 0.0241071428571428*G0_1_1 - 0.0241071428571428*G0_2_0 - 0.0241071428571428*G0_2_1;
 
2612
    A[312] = 0.0241071428571427*G0_0_0 - 0.0241071428571429*G0_0_1 + 0.0241071428571427*G0_0_2 - 0.0241071428571429*G0_1_0 - 0.0241071428571429*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.0241071428571429*G0_2_2;
 
2613
    A[313] = -0.0241071428571428*G0_0_1 - 0.0241071428571429*G0_1_0 - 0.0241071428571429*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.0241071428571429*G0_2_2;
 
2614
    A[314] = -0.192857142857143*G0_0_0 - 0.144642857142857*G0_0_1 - 0.144642857142857*G0_0_2 - 0.0482142857142859*G0_1_0 - 0.0723214285714287*G0_1_1 - 0.0723214285714287*G0_1_2 - 0.0482142857142859*G0_2_0 - 0.0723214285714287*G0_2_1 - 0.0723214285714287*G0_2_2;
 
2615
    A[315] = 0.241071428571428*G0_0_0 + 0.0964285714285714*G0_0_1 + 0.0964285714285714*G0_0_2 + 0.0964285714285714*G0_1_0 + 0.192857142857143*G0_1_1 + 0.192857142857143*G0_1_2 + 0.0964285714285714*G0_2_0 + 0.192857142857143*G0_2_1 + 0.192857142857143*G0_2_2;
 
2616
    A[316] = 0.0241071428571427*G0_0_1 + 0.0241071428571427*G0_0_2 + 0.0241071428571427*G0_1_0 - 0.0964285714285715*G0_1_1 - 0.0964285714285715*G0_1_2 + 0.0241071428571427*G0_2_0 - 0.0964285714285715*G0_2_1 - 0.0964285714285716*G0_2_2;
 
2617
    A[317] = -0.0241071428571427*G0_0_1 - 0.0241071428571427*G0_0_2 - 0.0241071428571427*G0_1_0 - 0.0241071428571427*G0_2_0;
 
2618
    A[318] = -0.0482142857142854*G0_0_0 - 0.0241071428571427*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285714*G0_1_0 + 0.0964285714285716*G0_1_1 + 0.120535714285714*G0_2_0 + 0.0964285714285715*G0_2_1;
 
2619
    A[319] = -0.0482142857142854*G0_0_0 + 0.120535714285714*G0_0_1 - 0.0241071428571427*G0_0_2 + 0.120535714285714*G0_1_0 + 0.0964285714285716*G0_1_2 + 0.120535714285714*G0_2_0 + 0.0964285714285716*G0_2_2;
 
2620
    A[320] = -0.0321428571428572*G0_0_0 - 0.0321428571428572*G0_0_1 - 0.0321428571428572*G0_0_2 - 0.0321428571428572*G0_1_0 - 0.0321428571428572*G0_1_1 - 0.0321428571428572*G0_1_2 - 0.0321428571428573*G0_2_0 - 0.0321428571428573*G0_2_1 - 0.0321428571428573*G0_2_2;
 
2621
    A[321] = 0.0321428571428571*G0_0_0 - 0.0160714285714285*G0_1_0 - 0.0160714285714285*G0_2_0;
 
2622
    A[322] = -0.0160714285714286*G0_0_1 + 0.032142857142857*G0_1_1 - 0.0160714285714286*G0_2_1;
 
2623
    A[323] = -0.0160714285714285*G0_0_2 - 0.0160714285714285*G0_1_2 + 0.032142857142857*G0_2_2;
 
2624
    A[324] = 0.241071428571428*G0_0_1 + 0.0964285714285713*G0_0_2 - 0.0482142857142856*G0_1_1 - 0.0241071428571429*G0_1_2 + 0.120535714285714*G0_2_1 + 0.0964285714285713*G0_2_2;
 
2625
    A[325] = 0.0964285714285713*G0_0_1 + 0.241071428571428*G0_0_2 + 0.0964285714285713*G0_1_1 + 0.120535714285714*G0_1_2 - 0.0241071428571429*G0_2_1 - 0.0482142857142855*G0_2_2;
 
2626
    A[326] = -0.0482142857142857*G0_0_0 - 0.0241071428571428*G0_0_2 + 0.241071428571428*G0_1_0 + 0.0964285714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.0964285714285714*G0_2_2;
 
2627
    A[327] = 0.0964285714285713*G0_0_0 + 0.120535714285714*G0_0_2 + 0.0964285714285714*G0_1_0 + 0.241071428571428*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.0482142857142855*G0_2_2;
 
2628
    A[328] = -0.0482142857142856*G0_0_0 - 0.0241071428571428*G0_0_1 + 0.120535714285714*G0_1_0 + 0.0964285714285715*G0_1_1 + 0.241071428571428*G0_2_0 + 0.0964285714285715*G0_2_1;
 
2629
    A[329] = 0.0964285714285714*G0_0_0 + 0.120535714285714*G0_0_1 - 0.0241071428571428*G0_1_0 - 0.0482142857142856*G0_1_1 + 0.0964285714285713*G0_2_0 + 0.241071428571428*G0_2_1;
 
2630
    A[330] = 0.0482142857142858*G0_0_0 + 0.0482142857142858*G0_0_1 + 0.0241071428571429*G0_0_2 + 0.0482142857142858*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.0241071428571429*G0_1_2 + 0.024107142857143*G0_2_0 + 0.024107142857143*G0_2_1;
 
2631
    A[331] = -0.0964285714285712*G0_0_0 - 0.0964285714285713*G0_0_1 + 0.0241071428571428*G0_0_2 - 0.0964285714285713*G0_1_0 - 0.0964285714285713*G0_1_1 + 0.0241071428571429*G0_1_2 + 0.0241071428571429*G0_2_0 + 0.0241071428571429*G0_2_1;
 
2632
    A[332] = 0.0482142857142859*G0_0_0 + 0.024107142857143*G0_0_1 + 0.0482142857142859*G0_0_2 + 0.024107142857143*G0_1_0 + 0.024107142857143*G0_1_2 + 0.0482142857142861*G0_2_0 + 0.0241071428571432*G0_2_1 + 0.0482142857142861*G0_2_2;
 
2633
    A[333] = -0.0964285714285713*G0_0_0 + 0.0241071428571427*G0_0_1 - 0.0964285714285713*G0_0_2 + 0.0241071428571429*G0_1_0 + 0.0241071428571429*G0_1_2 - 0.0964285714285713*G0_2_0 + 0.0241071428571427*G0_2_1 - 0.0964285714285713*G0_2_2;
 
2634
    A[334] = 0.024107142857143*G0_0_1 + 0.024107142857143*G0_0_2 + 0.024107142857143*G0_1_0 + 0.0482142857142859*G0_1_1 + 0.0482142857142859*G0_1_2 + 0.0241071428571431*G0_2_0 + 0.048214285714286*G0_2_1 + 0.048214285714286*G0_2_2;
 
2635
    A[335] = 0.0241071428571427*G0_0_1 + 0.0241071428571427*G0_0_2 + 0.0241071428571427*G0_1_0 - 0.0964285714285715*G0_1_1 - 0.0964285714285715*G0_1_2 + 0.0241071428571427*G0_2_0 - 0.0964285714285715*G0_2_1 - 0.0964285714285716*G0_2_2;
 
2636
    A[336] = 0.578571428571427*G0_0_0 + 0.289285714285714*G0_0_1 + 0.289285714285714*G0_0_2 + 0.289285714285714*G0_1_0 + 0.578571428571428*G0_1_1 + 0.289285714285714*G0_1_2 + 0.289285714285714*G0_2_0 + 0.289285714285714*G0_2_1 + 0.578571428571428*G0_2_2;
 
2637
    A[337] = -0.578571428571427*G0_0_0 - 0.289285714285714*G0_0_1 - 0.289285714285714*G0_0_2 - 0.289285714285714*G0_1_0 - 0.144642857142857*G0_1_2 - 0.289285714285714*G0_2_0 - 0.144642857142857*G0_2_1;
 
2638
    A[338] = -0.289285714285714*G0_0_1 - 0.144642857142857*G0_0_2 - 0.289285714285714*G0_1_0 - 0.578571428571428*G0_1_1 - 0.289285714285714*G0_1_2 - 0.144642857142857*G0_2_0 - 0.289285714285714*G0_2_1;
 
2639
    A[339] = -0.144642857142857*G0_0_1 - 0.289285714285714*G0_0_2 - 0.144642857142857*G0_1_0 - 0.289285714285714*G0_1_2 - 0.289285714285714*G0_2_0 - 0.289285714285714*G0_2_1 - 0.578571428571428*G0_2_2;
 
2640
    A[340] = 0.0321428571428572*G0_0_0 + 0.0321428571428572*G0_0_1 + 0.0321428571428572*G0_0_2 + 0.0482142857142858*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.0482142857142858*G0_1_2 + 0.0482142857142857*G0_2_0 + 0.0482142857142857*G0_2_1 + 0.0482142857142857*G0_2_2;
 
2641
    A[341] = -0.0321428571428571*G0_0_0;
 
2642
    A[342] = 0.0160714285714286*G0_0_1 + 0.0482142857142856*G0_1_1;
 
2643
    A[343] = 0.0160714285714285*G0_0_2 + 0.0482142857142855*G0_2_2;
 
2644
    A[344] = -0.241071428571428*G0_0_1 - 0.0964285714285712*G0_0_2 - 0.289285714285714*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1;
 
2645
    A[345] = -0.0964285714285713*G0_0_1 - 0.241071428571428*G0_0_2 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.289285714285714*G0_2_2;
 
2646
    A[346] = 0.0482142857142856*G0_0_0 + 0.0241071428571428*G0_0_2 + 0.0241071428571429*G0_2_0;
 
2647
    A[347] = -0.0964285714285713*G0_0_0 - 0.120535714285714*G0_0_2 - 0.120535714285714*G0_2_0 - 0.144642857142857*G0_2_2;
 
2648
    A[348] = 0.0482142857142856*G0_0_0 + 0.0241071428571427*G0_0_1 + 0.0241071428571428*G0_1_0;
 
2649
    A[349] = -0.0964285714285713*G0_0_0 - 0.120535714285714*G0_0_1 - 0.120535714285714*G0_1_0 - 0.144642857142857*G0_1_1;
 
2650
    A[350] = -0.0482142857142858*G0_0_0 - 0.0482142857142858*G0_0_1 - 0.0241071428571429*G0_0_2 - 0.289285714285714*G0_1_0 - 0.289285714285714*G0_1_1 - 0.16875*G0_1_2 - 0.16875*G0_2_0 - 0.16875*G0_2_1 - 0.0482142857142859*G0_2_2;
 
2651
    A[351] = 0.0964285714285712*G0_0_0 + 0.0964285714285712*G0_0_1 - 0.0241071428571428*G0_0_2 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_0 + 0.120535714285714*G0_2_1 - 0.0482142857142855*G0_2_2;
 
2652
    A[352] = -0.0482142857142859*G0_0_0 - 0.024107142857143*G0_0_1 - 0.0482142857142859*G0_0_2 - 0.16875*G0_1_0 - 0.0482142857142859*G0_1_1 - 0.16875*G0_1_2 - 0.289285714285714*G0_2_0 - 0.16875*G0_2_1 - 0.289285714285714*G0_2_2;
 
2653
    A[353] = 0.0964285714285713*G0_0_0 - 0.0241071428571427*G0_0_1 + 0.0964285714285713*G0_0_2 + 0.120535714285714*G0_1_0 - 0.0482142857142855*G0_1_1 + 0.120535714285714*G0_1_2 + 0.120535714285714*G0_2_1;
 
2654
    A[354] = -0.024107142857143*G0_0_1 - 0.024107142857143*G0_0_2 - 0.024107142857143*G0_1_0 - 0.144642857142857*G0_1_1 - 0.144642857142857*G0_1_2 - 0.024107142857143*G0_2_0 - 0.144642857142857*G0_2_1 - 0.144642857142857*G0_2_2;
 
2655
    A[355] = -0.0241071428571427*G0_0_1 - 0.0241071428571427*G0_0_2 - 0.0241071428571427*G0_1_0 - 0.0241071428571427*G0_2_0;
 
2656
    A[356] = -0.578571428571427*G0_0_0 - 0.289285714285714*G0_0_1 - 0.289285714285714*G0_0_2 - 0.289285714285714*G0_1_0 - 0.144642857142857*G0_1_2 - 0.289285714285714*G0_2_0 - 0.144642857142857*G0_2_1;
 
2657
    A[357] = 0.578571428571427*G0_0_0 + 0.289285714285714*G0_0_1 + 0.289285714285714*G0_0_2 + 0.289285714285714*G0_1_0 + 0.578571428571428*G0_1_1 + 0.289285714285714*G0_1_2 + 0.289285714285714*G0_2_0 + 0.289285714285714*G0_2_1 + 0.578571428571428*G0_2_2;
 
2658
    A[358] = 0.289285714285714*G0_0_1 + 0.144642857142857*G0_0_2 + 0.289285714285714*G0_1_0 + 0.144642857142857*G0_1_2 + 0.144642857142857*G0_2_0 + 0.144642857142857*G0_2_1 + 0.289285714285714*G0_2_2;
 
2659
    A[359] = 0.144642857142857*G0_0_1 + 0.289285714285714*G0_0_2 + 0.144642857142857*G0_1_0 + 0.289285714285714*G0_1_1 + 0.144642857142857*G0_1_2 + 0.289285714285714*G0_2_0 + 0.144642857142857*G0_2_1;
 
2660
    A[360] = 0.0482142857142858*G0_0_0 + 0.0482142857142858*G0_0_1 + 0.0482142857142858*G0_0_2 + 0.0321428571428572*G0_1_0 + 0.0321428571428572*G0_1_1 + 0.0321428571428572*G0_1_2 + 0.0482142857142857*G0_2_0 + 0.0482142857142857*G0_2_1 + 0.0482142857142858*G0_2_2;
 
2661
    A[361] = 0.0482142857142856*G0_0_0 + 0.0160714285714285*G0_1_0;
 
2662
    A[362] = -0.032142857142857*G0_1_1;
 
2663
    A[363] = 0.0160714285714285*G0_1_2 + 0.0482142857142855*G0_2_2;
 
2664
    A[364] = 0.0482142857142856*G0_1_1 + 0.0241071428571429*G0_1_2 + 0.0241071428571428*G0_2_1;
 
2665
    A[365] = -0.0964285714285713*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.144642857142857*G0_2_2;
 
2666
    A[366] = -0.289285714285714*G0_0_0 - 0.120535714285714*G0_0_2 - 0.241071428571428*G0_1_0 - 0.0964285714285714*G0_1_2 - 0.120535714285714*G0_2_0;
 
2667
    A[367] = -0.120535714285714*G0_0_2 - 0.0964285714285713*G0_1_0 - 0.241071428571428*G0_1_2 - 0.120535714285714*G0_2_0 - 0.289285714285714*G0_2_2;
 
2668
    A[368] = -0.144642857142857*G0_0_0 - 0.120535714285714*G0_0_1 - 0.120535714285714*G0_1_0 - 0.0964285714285715*G0_1_1;
 
2669
    A[369] = 0.0241071428571427*G0_0_1 + 0.0241071428571429*G0_1_0 + 0.0482142857142856*G0_1_1;
 
2670
    A[370] = -0.289285714285714*G0_0_0 - 0.289285714285714*G0_0_1 - 0.16875*G0_0_2 - 0.0482142857142857*G0_1_0 - 0.0482142857142858*G0_1_1 - 0.0241071428571429*G0_1_2 - 0.16875*G0_2_0 - 0.16875*G0_2_1 - 0.0482142857142859*G0_2_2;
 
2671
    A[371] = 0.120535714285714*G0_0_2 + 0.0964285714285712*G0_1_0 + 0.0964285714285713*G0_1_1 - 0.0241071428571428*G0_1_2 + 0.120535714285714*G0_2_0 + 0.120535714285714*G0_2_1 - 0.0482142857142855*G0_2_2;
 
2672
    A[372] = -0.144642857142857*G0_0_0 - 0.024107142857143*G0_0_1 - 0.144642857142857*G0_0_2 - 0.024107142857143*G0_1_0 - 0.024107142857143*G0_1_2 - 0.144642857142857*G0_2_0 - 0.0241071428571429*G0_2_1 - 0.144642857142857*G0_2_2;
 
2673
    A[373] = -0.0241071428571428*G0_0_1 - 0.0241071428571429*G0_1_0 - 0.0241071428571429*G0_1_2 - 0.0241071428571428*G0_2_1;
 
2674
    A[374] = -0.048214285714286*G0_0_0 - 0.16875*G0_0_1 - 0.16875*G0_0_2 - 0.024107142857143*G0_1_0 - 0.0482142857142859*G0_1_1 - 0.0482142857142859*G0_1_2 - 0.16875*G0_2_0 - 0.289285714285714*G0_2_1 - 0.289285714285714*G0_2_2;
 
2675
    A[375] = -0.0482142857142854*G0_0_0 + 0.120535714285714*G0_0_1 + 0.120535714285714*G0_0_2 - 0.0241071428571427*G0_1_0 + 0.0964285714285716*G0_1_1 + 0.0964285714285715*G0_1_2 + 0.120535714285714*G0_2_0;
 
2676
    A[376] = -0.289285714285714*G0_0_1 - 0.144642857142857*G0_0_2 - 0.289285714285714*G0_1_0 - 0.578571428571428*G0_1_1 - 0.289285714285714*G0_1_2 - 0.144642857142857*G0_2_0 - 0.289285714285714*G0_2_1;
 
2677
    A[377] = 0.289285714285714*G0_0_1 + 0.144642857142857*G0_0_2 + 0.289285714285714*G0_1_0 + 0.144642857142857*G0_1_2 + 0.144642857142857*G0_2_0 + 0.144642857142857*G0_2_1 + 0.289285714285714*G0_2_2;
 
2678
    A[378] = 0.578571428571428*G0_0_0 + 0.289285714285714*G0_0_1 + 0.289285714285714*G0_0_2 + 0.289285714285714*G0_1_0 + 0.578571428571428*G0_1_1 + 0.289285714285714*G0_1_2 + 0.289285714285714*G0_2_0 + 0.289285714285714*G0_2_1 + 0.578571428571428*G0_2_2;
 
2679
    A[379] = 0.289285714285714*G0_0_0 + 0.144642857142857*G0_0_1 + 0.144642857142857*G0_0_2 + 0.144642857142857*G0_1_0 + 0.289285714285714*G0_1_2 + 0.144642857142857*G0_2_0 + 0.289285714285714*G0_2_1;
 
2680
    A[380] = 0.0482142857142858*G0_0_0 + 0.0482142857142858*G0_0_1 + 0.0482142857142858*G0_0_2 + 0.0482142857142858*G0_1_0 + 0.0482142857142858*G0_1_1 + 0.0482142857142858*G0_1_2 + 0.0321428571428573*G0_2_0 + 0.0321428571428573*G0_2_1 + 0.0321428571428573*G0_2_2;
 
2681
    A[381] = 0.0482142857142856*G0_0_0 + 0.0160714285714285*G0_2_0;
 
2682
    A[382] = 0.0482142857142856*G0_1_1 + 0.0160714285714286*G0_2_1;
 
2683
    A[383] = -0.032142857142857*G0_2_2;
 
2684
    A[384] = -0.144642857142857*G0_1_1 - 0.120535714285714*G0_1_2 - 0.120535714285714*G0_2_1 - 0.0964285714285713*G0_2_2;
 
2685
    A[385] = 0.0241071428571428*G0_1_2 + 0.0241071428571429*G0_2_1 + 0.0482142857142855*G0_2_2;
 
2686
    A[386] = -0.144642857142857*G0_0_0 - 0.120535714285714*G0_0_2 - 0.120535714285714*G0_2_0 - 0.0964285714285715*G0_2_2;
 
2687
    A[387] = 0.0241071428571428*G0_0_2 + 0.0241071428571429*G0_2_0 + 0.0482142857142856*G0_2_2;
 
2688
    A[388] = -0.289285714285714*G0_0_0 - 0.120535714285714*G0_0_1 - 0.120535714285714*G0_1_0 - 0.241071428571429*G0_2_0 - 0.0964285714285716*G0_2_1;
 
2689
    A[389] = -0.120535714285714*G0_0_1 - 0.120535714285714*G0_1_0 - 0.289285714285714*G0_1_1 - 0.0964285714285713*G0_2_0 - 0.241071428571428*G0_2_1;
 
2690
    A[390] = -0.144642857142857*G0_0_0 - 0.144642857142857*G0_0_1 - 0.024107142857143*G0_0_2 - 0.144642857142857*G0_1_0 - 0.144642857142857*G0_1_1 - 0.024107142857143*G0_1_2 - 0.024107142857143*G0_2_0 - 0.024107142857143*G0_2_1;
 
2691
    A[391] = -0.0241071428571428*G0_0_2 - 0.0241071428571428*G0_1_2 - 0.0241071428571429*G0_2_0 - 0.0241071428571429*G0_2_1;
 
2692
    A[392] = -0.289285714285714*G0_0_0 - 0.16875*G0_0_1 - 0.289285714285714*G0_0_2 - 0.16875*G0_1_0 - 0.0482142857142859*G0_1_1 - 0.16875*G0_1_2 - 0.0482142857142861*G0_2_0 - 0.0241071428571432*G0_2_1 - 0.0482142857142861*G0_2_2;
 
2693
    A[393] = 0.120535714285714*G0_0_1 + 0.120535714285714*G0_1_0 - 0.0482142857142855*G0_1_1 + 0.120535714285714*G0_1_2 + 0.0964285714285713*G0_2_0 - 0.0241071428571427*G0_2_1 + 0.0964285714285713*G0_2_2;
 
2694
    A[394] = -0.048214285714286*G0_0_0 - 0.16875*G0_0_1 - 0.16875*G0_0_2 - 0.16875*G0_1_0 - 0.289285714285714*G0_1_1 - 0.289285714285714*G0_1_2 - 0.0241071428571431*G0_2_0 - 0.048214285714286*G0_2_1 - 0.048214285714286*G0_2_2;
 
2695
    A[395] = -0.0482142857142854*G0_0_0 + 0.120535714285714*G0_0_1 + 0.120535714285714*G0_0_2 + 0.120535714285714*G0_1_0 - 0.0241071428571427*G0_2_0 + 0.0964285714285716*G0_2_1 + 0.0964285714285716*G0_2_2;
 
2696
    A[396] = -0.144642857142857*G0_0_1 - 0.289285714285714*G0_0_2 - 0.144642857142857*G0_1_0 - 0.289285714285714*G0_1_2 - 0.289285714285714*G0_2_0 - 0.289285714285714*G0_2_1 - 0.578571428571428*G0_2_2;
 
2697
    A[397] = 0.144642857142857*G0_0_1 + 0.289285714285714*G0_0_2 + 0.144642857142857*G0_1_0 + 0.289285714285714*G0_1_1 + 0.144642857142857*G0_1_2 + 0.289285714285714*G0_2_0 + 0.144642857142857*G0_2_1;
 
2698
    A[398] = 0.289285714285714*G0_0_0 + 0.144642857142857*G0_0_1 + 0.144642857142857*G0_0_2 + 0.144642857142857*G0_1_0 + 0.289285714285714*G0_1_2 + 0.144642857142857*G0_2_0 + 0.289285714285714*G0_2_1;
 
2699
    A[399] = 0.578571428571428*G0_0_0 + 0.289285714285715*G0_0_1 + 0.289285714285715*G0_0_2 + 0.289285714285715*G0_1_0 + 0.578571428571428*G0_1_1 + 0.289285714285714*G0_1_2 + 0.289285714285715*G0_2_0 + 0.289285714285714*G0_2_1 + 0.578571428571429*G0_2_2;
 
2700
  }
 
2701
 
 
2702
};
 
2703
 
 
2704
/// This class defines the interface for the assembly of the global
 
2705
/// tensor corresponding to a form with r + n arguments, that is, a
 
2706
/// mapping
 
2707
///
 
2708
///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
 
2709
///
 
2710
/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
 
2711
/// global tensor A is defined by
 
2712
///
 
2713
///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
 
2714
///
 
2715
/// where each argument Vj represents the application to the
 
2716
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
 
2717
/// fixed functions (coefficients).
 
2718
 
 
2719
class UFC_Poisson3D_3BilinearForm: public ufc::form
 
2720
{
 
2721
public:
 
2722
 
 
2723
  /// Constructor
 
2724
  UFC_Poisson3D_3BilinearForm() : ufc::form()
 
2725
  {
 
2726
    // Do nothing
 
2727
  }
 
2728
 
 
2729
  /// Destructor
 
2730
  virtual ~UFC_Poisson3D_3BilinearForm()
 
2731
  {
 
2732
    // Do nothing
 
2733
  }
 
2734
 
 
2735
  /// Return a string identifying the form
 
2736
  virtual const char* signature() const
 
2737
  {
 
2738
    return "(dXa0/dxb0)(dXa1/dxb0) | ((d/dXa0)vi0)*((d/dXa1)vi1)*dX(0)";
 
2739
  }
 
2740
 
 
2741
  /// Return the rank of the global tensor (r)
 
2742
  virtual unsigned int rank() const
 
2743
  {
 
2744
    return 2;
 
2745
  }
 
2746
 
 
2747
  /// Return the number of coefficients (n)
 
2748
  virtual unsigned int num_coefficients() const
 
2749
  {
 
2750
    return 0;
 
2751
  }
 
2752
 
 
2753
  /// Return the number of cell integrals
 
2754
  virtual unsigned int num_cell_integrals() const
 
2755
  {
 
2756
    return 1;
 
2757
  }
 
2758
  
 
2759
  /// Return the number of exterior facet integrals
 
2760
  virtual unsigned int num_exterior_facet_integrals() const
 
2761
  {
 
2762
    return 0;
 
2763
  }
 
2764
  
 
2765
  /// Return the number of interior facet integrals
 
2766
  virtual unsigned int num_interior_facet_integrals() const
 
2767
  {
 
2768
    return 0;
 
2769
  }
 
2770
    
 
2771
  /// Create a new finite element for argument function i
 
2772
  virtual ufc::finite_element* create_finite_element(unsigned int i) const
 
2773
  {
 
2774
    switch ( i )
 
2775
    {
 
2776
    case 0:
 
2777
      return new UFC_Poisson3D_3BilinearForm_finite_element_0();
 
2778
      break;
 
2779
    case 1:
 
2780
      return new UFC_Poisson3D_3BilinearForm_finite_element_1();
 
2781
      break;
 
2782
    }
 
2783
    return 0;
 
2784
  }
 
2785
  
 
2786
  /// Create a new dof map for argument function i
 
2787
  virtual ufc::dof_map* create_dof_map(unsigned int i) const
 
2788
  {
 
2789
    switch ( i )
 
2790
    {
 
2791
    case 0:
 
2792
      return new UFC_Poisson3D_3BilinearForm_dof_map_0();
 
2793
      break;
 
2794
    case 1:
 
2795
      return new UFC_Poisson3D_3BilinearForm_dof_map_1();
 
2796
      break;
 
2797
    }
 
2798
    return 0;
 
2799
  }
 
2800
 
 
2801
  /// Create a new cell integral on sub domain i
 
2802
  virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
 
2803
  {
 
2804
    return new UFC_Poisson3D_3BilinearForm_cell_integral_0();
 
2805
  }
 
2806
 
 
2807
  /// Create a new exterior facet integral on sub domain i
 
2808
  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(unsigned int i) const
 
2809
  {
 
2810
    return 0;
 
2811
  }
 
2812
 
 
2813
  /// Create a new interior facet integral on sub domain i
 
2814
  virtual ufc::interior_facet_integral* create_interior_facet_integral(unsigned int i) const
 
2815
  {
 
2816
    return 0;
 
2817
  }
 
2818
 
 
2819
};
 
2820
 
 
2821
/// This class defines the interface for a finite element.
 
2822
 
 
2823
class UFC_Poisson3D_3LinearForm_finite_element_0: public ufc::finite_element
 
2824
{
 
2825
public:
 
2826
 
 
2827
  /// Constructor
 
2828
  UFC_Poisson3D_3LinearForm_finite_element_0() : ufc::finite_element()
 
2829
  {
 
2830
    // Do nothing
 
2831
  }
 
2832
 
 
2833
  /// Destructor
 
2834
  virtual ~UFC_Poisson3D_3LinearForm_finite_element_0()
 
2835
  {
 
2836
    // Do nothing
 
2837
  }
 
2838
 
 
2839
  /// Return a string identifying the finite element
 
2840
  virtual const char* signature() const
 
2841
  {
 
2842
    return "Lagrange finite element of degree 3 on a tetrahedron";
 
2843
  }
 
2844
 
 
2845
  /// Return the cell shape
 
2846
  virtual ufc::shape cell_shape() const
 
2847
  {
 
2848
    return ufc::tetrahedron;
 
2849
  }
 
2850
 
 
2851
  /// Return the dimension of the finite element function space
 
2852
  virtual unsigned int space_dimension() const
 
2853
  {
 
2854
    return 20;
 
2855
  }
 
2856
 
 
2857
  /// Return the rank of the value space
 
2858
  virtual unsigned int value_rank() const
 
2859
  {
 
2860
    return 0;
 
2861
  }
 
2862
 
 
2863
  /// Return the dimension of the value space for axis i
 
2864
  virtual unsigned int value_dimension(unsigned int i) const
 
2865
  {
 
2866
    return 1;
 
2867
  }
 
2868
 
 
2869
  /// Evaluate basis function i at given point in cell
 
2870
  virtual void evaluate_basis(unsigned int i,
 
2871
                              double* values,
 
2872
                              const double* coordinates,
 
2873
                              const ufc::cell& c) const
 
2874
  {
 
2875
    // Extract vertex coordinates
 
2876
    const double * const * element_coordinates = c.coordinates;
 
2877
    
 
2878
    // Compute Jacobian of affine map from reference cell
 
2879
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
2880
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
2881
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
2882
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
2883
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
2884
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
2885
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
2886
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
2887
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
2888
      
 
2889
    // Compute sub determinants
 
2890
    const double d00 = J_11*J_22 - J_12*J_21;
 
2891
    const double d01 = J_12*J_20 - J_10*J_22;
 
2892
    const double d02 = J_10*J_21 - J_11*J_20;
 
2893
    
 
2894
    const double d10 = J_02*J_21 - J_01*J_22;
 
2895
    const double d11 = J_00*J_22 - J_02*J_20;
 
2896
    const double d12 = J_01*J_20 - J_00*J_21;
 
2897
    
 
2898
    const double d20 = J_01*J_12 - J_02*J_11;
 
2899
    const double d21 = J_02*J_10 - J_00*J_12;
 
2900
    const double d22 = J_00*J_11 - J_01*J_10;
 
2901
      
 
2902
    // Compute determinant of Jacobian
 
2903
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
2904
    
 
2905
    // Compute inverse of Jacobian
 
2906
    
 
2907
    // Compute constants
 
2908
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
2909
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
2910
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
2911
    
 
2912
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
2913
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
2914
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
2915
    
 
2916
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
2917
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
2918
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
2919
    
 
2920
    // Get coordinates and map to the UFC reference element
 
2921
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
2922
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
2923
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
2924
    
 
2925
    // Map coordinates to the reference cube
 
2926
    if (std::abs(y + z - 1.0) < 1e-14)
 
2927
      x = 1.0;
 
2928
    else
 
2929
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
2930
    if (std::abs(z - 1.0) < 1e-14)
 
2931
      y = -1.0;
 
2932
    else
 
2933
      y = 2.0 * y/(1.0 - z) - 1.0;
 
2934
    z = 2.0 * z - 1.0;
 
2935
    
 
2936
    // Reset values
 
2937
    *values = 0;
 
2938
    
 
2939
    // Map degree of freedom to element degree of freedom
 
2940
    const unsigned int dof = i;
 
2941
    
 
2942
    // Generate scalings
 
2943
    const double scalings_y_0 = 1;
 
2944
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
 
2945
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
 
2946
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
 
2947
    const double scalings_z_0 = 1;
 
2948
    const double scalings_z_1 = scalings_z_0*(0.5 - 0.5*z);
 
2949
    const double scalings_z_2 = scalings_z_1*(0.5 - 0.5*z);
 
2950
    const double scalings_z_3 = scalings_z_2*(0.5 - 0.5*z);
 
2951
    
 
2952
    // Compute psitilde_a
 
2953
    const double psitilde_a_0 = 1;
 
2954
    const double psitilde_a_1 = x;
 
2955
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
 
2956
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
 
2957
    
 
2958
    // Compute psitilde_bs
 
2959
    const double psitilde_bs_0_0 = 1;
 
2960
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
 
2961
    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;
 
2962
    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;
 
2963
    const double psitilde_bs_1_0 = 1;
 
2964
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
 
2965
    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;
 
2966
    const double psitilde_bs_2_0 = 1;
 
2967
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
 
2968
    const double psitilde_bs_3_0 = 1;
 
2969
    
 
2970
    // Compute psitilde_cs
 
2971
    const double psitilde_cs_00_0 = 1;
 
2972
    const double psitilde_cs_00_1 = 2*z + 1;
 
2973
    const double psitilde_cs_00_2 = 0.3125*psitilde_cs_00_1 + 1.875*z*psitilde_cs_00_1 - 0.5625*psitilde_cs_00_0;
 
2974
    const double psitilde_cs_00_3 = 0.155555555555556*psitilde_cs_00_2 + 1.86666666666667*z*psitilde_cs_00_2 - 0.711111111111111*psitilde_cs_00_1;
 
2975
    const double psitilde_cs_01_0 = 1;
 
2976
    const double psitilde_cs_01_1 = 3*z + 2;
 
2977
    const double psitilde_cs_01_2 = 0.777777777777778*psitilde_cs_01_1 + 2.33333333333333*z*psitilde_cs_01_1 - 0.555555555555556*psitilde_cs_01_0;
 
2978
    const double psitilde_cs_02_0 = 1;
 
2979
    const double psitilde_cs_02_1 = 4*z + 3;
 
2980
    const double psitilde_cs_03_0 = 1;
 
2981
    const double psitilde_cs_10_0 = 1;
 
2982
    const double psitilde_cs_10_1 = 3*z + 2;
 
2983
    const double psitilde_cs_10_2 = 0.777777777777778*psitilde_cs_10_1 + 2.33333333333333*z*psitilde_cs_10_1 - 0.555555555555556*psitilde_cs_10_0;
 
2984
    const double psitilde_cs_11_0 = 1;
 
2985
    const double psitilde_cs_11_1 = 4*z + 3;
 
2986
    const double psitilde_cs_12_0 = 1;
 
2987
    const double psitilde_cs_20_0 = 1;
 
2988
    const double psitilde_cs_20_1 = 4*z + 3;
 
2989
    const double psitilde_cs_21_0 = 1;
 
2990
    const double psitilde_cs_30_0 = 1;
 
2991
    
 
2992
    // Compute basisvalues
 
2993
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
2994
    const double basisvalue1 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_0;
 
2995
    const double basisvalue2 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_0;
 
2996
    const double basisvalue3 = 1.11803398874989*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_1;
 
2997
    const double basisvalue4 = 5.1234753829798*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_0;
 
2998
    const double basisvalue5 = 3.96862696659689*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_0;
 
2999
    const double basisvalue6 = 2.29128784747792*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_0;
 
3000
    const double basisvalue7 = 3.24037034920393*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_1;
 
3001
    const double basisvalue8 = 1.87082869338697*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_1;
 
3002
    const double basisvalue9 = 1.3228756555323*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_2;
 
3003
    const double basisvalue10 = 7.93725393319377*psitilde_a_3*scalings_y_3*psitilde_bs_3_0*scalings_z_3*psitilde_cs_30_0;
 
3004
    const double basisvalue11 = 6.70820393249937*psitilde_a_2*scalings_y_2*psitilde_bs_2_1*scalings_z_3*psitilde_cs_21_0;
 
3005
    const double basisvalue12 = 5.19615242270663*psitilde_a_1*scalings_y_1*psitilde_bs_1_2*scalings_z_3*psitilde_cs_12_0;
 
3006
    const double basisvalue13 = 3*psitilde_a_0*scalings_y_0*psitilde_bs_0_3*scalings_z_3*psitilde_cs_03_0;
 
3007
    const double basisvalue14 = 5.80947501931113*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_1;
 
3008
    const double basisvalue15 = 4.5*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_1;
 
3009
    const double basisvalue16 = 2.59807621135332*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_1;
 
3010
    const double basisvalue17 = 3.67423461417477*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_2;
 
3011
    const double basisvalue18 = 2.12132034355964*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_2;
 
3012
    const double basisvalue19 = 1.5*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_3;
 
3013
    
 
3014
    // Table(s) of coefficients
 
3015
    const static double coefficients0[20][20] = \
 
3016
    {{0.0288675134594813, 0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, 0.014173667737846, 0.00818317088384971, 0.0115727512471569, 0.0066815310478106, 0.00472455591261534, -0.028347335475692, -0.0239578711874978, -0.0185576872239523, -0.0107142857142857, -0.0207481250689683, -0.0160714285714286, -0.00927884361197613, -0.0131222664791956, -0.00757614408414158, -0.00535714285714285},
 
3017
    {0.0288675134594813, -0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, -0.014173667737846, 0.00818317088384972, -0.0115727512471569, 0.00668153104781061, 0.00472455591261535, 0.028347335475692, -0.0239578711874977, 0.0185576872239523, -0.0107142857142857, -0.0207481250689683, 0.0160714285714286, -0.00927884361197613, 0.0131222664791956, -0.00757614408414158, -0.00535714285714286},
 
3018
    {0.0288675134594813, 0, -0.0150584650484208, 0.00532397137499948, 0, 0, 0.0245495126515492, 0, -0.0133630620956212, 0.00472455591261535, 0, 0, 0, 0.0428571428571429, 0, 0, -0.0278365308359284, 0, 0.0151522881682832, -0.00535714285714286},
 
3019
    {0.0288675134594812, 0, 0, -0.0159719141249985, 0, 0, 0, 0, 0, 0.0283473354756921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0535714285714286},
 
3020
    {0, 0, 0.112938487863156, -0.063887656499994, 0, 0, 0.0736485379546474, 0, 0.0267261241912424, -0.0236227795630767, 0, 0, 0, 0, 0, 0, 0.0649519052838329, 0, -0.0606091526731327, 0.0267857142857143},
 
3021
    {0, 0, -0.0225876975726313, 0.127775312999988, 0, 0, 0, 0, 0.0668153104781061, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0, 0.0757614408414158, -0.0535714285714286},
 
3022
    {0, 0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, -0.0425210032135381, 0.0245495126515492, 0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, -0.0375, 0.021650635094611, -0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
3023
    {0, -0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, 0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
3024
    {0, 0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, 0.014173667737846, -0.0245495126515492, -0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, -0.0618589574131742, 0.0428571428571429, -0.0069160416896561, -0.0160714285714286, 0.0154647393532936, 0.00874817765279706, 0, -0.00535714285714286},
 
3025
    {0, -0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, 0.0566946709513841, 0.0245495126515492, -0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, 0.0618589574131742, -0.0642857142857143, 0, -0.0214285714285714, 0.00927884361197612, 0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
3026
    {0, -0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, 0.0425210032135381, 0.0245495126515492, -0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, 0.0375, 0.021650635094611, 0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
3027
    {0, 0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, -0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, -0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
3028
    {0, -0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, -0.014173667737846, -0.0245495126515491, 0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, 0.0618589574131742, 0.0428571428571429, -0.0069160416896561, 0.0160714285714286, 0.0154647393532935, -0.00874817765279706, 0, -0.00535714285714285},
 
3029
    {0, 0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, -0.0566946709513841, 0.0245495126515491, 0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, -0.0618589574131742, -0.0642857142857143, 0, 0.0214285714285714, 0.00927884361197613, -0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
3030
    {0, -0.117369119465393, -0.0451753951452625, -0.031943828249997, -0.018298126367785, 0.042521003213538, 0.0409158544192486, 0.0347182537414707, 0.033407655239053, 0.0236227795630767, 0.0850420064270761, 0.0239578711874978, -0.00618589574131742, -0.0107142857142857, 0.0207481250689683, -0.00535714285714286, -0.00927884361197612, -0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
3031
    {0, 0.117369119465393, -0.0451753951452626, -0.031943828249997, -0.018298126367785, -0.0425210032135381, 0.0409158544192486, -0.0347182537414707, 0.033407655239053, 0.0236227795630767, -0.0850420064270761, 0.0239578711874977, 0.00618589574131741, -0.0107142857142857, 0.0207481250689683, 0.00535714285714286, -0.00927884361197612, 0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
3032
    {0.259807621135332, 0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, 0.0850420064270761, -0.0736485379546474, 0.0694365074829413, 0.0400891862868637, -0.0992156741649221, 0, 0, 0, 0, 0, 0.075, -0.0649519052838329, -0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
3033
    {0.259807621135332, -0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, -0.0850420064270761, -0.0736485379546474, -0.0694365074829414, 0.0400891862868637, -0.0992156741649222, 0, 0, 0, 0, 0, -0.075, -0.0649519052838329, 0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
3034
    {0.259807621135332, 0, -0.135526185435788, 0.0479157423749955, -0.10978875820671, 0, 0.0245495126515491, 0, -0.0801783725737273, -0.0992156741649221, 0, 0, 0, 0, -0.0968245836551854, 0, 0.021650635094611, 0, 0.0303045763365663, 0.0267857142857143},
 
3035
    {0.259807621135332, 0, 0, -0.143747227124986, -0.10978875820671, 0, -0.122747563257746, 0, 0, 0.0425210032135381, 0, -0.095831484749991, 0, 0.0428571428571429, 0.0138320833793122, 0, 0.0154647393532935, 0, 0, -0.00535714285714285}};
 
3036
    
 
3037
    // Extract relevant coefficients
 
3038
    const double coeff0_0 = coefficients0[dof][0];
 
3039
    const double coeff0_1 = coefficients0[dof][1];
 
3040
    const double coeff0_2 = coefficients0[dof][2];
 
3041
    const double coeff0_3 = coefficients0[dof][3];
 
3042
    const double coeff0_4 = coefficients0[dof][4];
 
3043
    const double coeff0_5 = coefficients0[dof][5];
 
3044
    const double coeff0_6 = coefficients0[dof][6];
 
3045
    const double coeff0_7 = coefficients0[dof][7];
 
3046
    const double coeff0_8 = coefficients0[dof][8];
 
3047
    const double coeff0_9 = coefficients0[dof][9];
 
3048
    const double coeff0_10 = coefficients0[dof][10];
 
3049
    const double coeff0_11 = coefficients0[dof][11];
 
3050
    const double coeff0_12 = coefficients0[dof][12];
 
3051
    const double coeff0_13 = coefficients0[dof][13];
 
3052
    const double coeff0_14 = coefficients0[dof][14];
 
3053
    const double coeff0_15 = coefficients0[dof][15];
 
3054
    const double coeff0_16 = coefficients0[dof][16];
 
3055
    const double coeff0_17 = coefficients0[dof][17];
 
3056
    const double coeff0_18 = coefficients0[dof][18];
 
3057
    const double coeff0_19 = coefficients0[dof][19];
 
3058
    
 
3059
    // Compute value(s)
 
3060
    *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 + coeff0_15*basisvalue15 + coeff0_16*basisvalue16 + coeff0_17*basisvalue17 + coeff0_18*basisvalue18 + coeff0_19*basisvalue19;
 
3061
  }
 
3062
 
 
3063
  /// Evaluate all basis functions at given point in cell
 
3064
  virtual void evaluate_basis_all(double* values,
 
3065
                                  const double* coordinates,
 
3066
                                  const ufc::cell& c) const
 
3067
  {
 
3068
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
 
3069
  }
 
3070
 
 
3071
  /// Evaluate order n derivatives of basis function i at given point in cell
 
3072
  virtual void evaluate_basis_derivatives(unsigned int i,
 
3073
                                          unsigned int n,
 
3074
                                          double* values,
 
3075
                                          const double* coordinates,
 
3076
                                          const ufc::cell& c) const
 
3077
  {
 
3078
    // Extract vertex coordinates
 
3079
    const double * const * element_coordinates = c.coordinates;
 
3080
    
 
3081
    // Compute Jacobian of affine map from reference cell
 
3082
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
3083
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
3084
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
3085
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
3086
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
3087
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
3088
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
3089
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
3090
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
3091
      
 
3092
    // Compute sub determinants
 
3093
    const double d00 = J_11*J_22 - J_12*J_21;
 
3094
    const double d01 = J_12*J_20 - J_10*J_22;
 
3095
    const double d02 = J_10*J_21 - J_11*J_20;
 
3096
    
 
3097
    const double d10 = J_02*J_21 - J_01*J_22;
 
3098
    const double d11 = J_00*J_22 - J_02*J_20;
 
3099
    const double d12 = J_01*J_20 - J_00*J_21;
 
3100
    
 
3101
    const double d20 = J_01*J_12 - J_02*J_11;
 
3102
    const double d21 = J_02*J_10 - J_00*J_12;
 
3103
    const double d22 = J_00*J_11 - J_01*J_10;
 
3104
      
 
3105
    // Compute determinant of Jacobian
 
3106
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
3107
    
 
3108
    // Compute inverse of Jacobian
 
3109
    
 
3110
    // Compute constants
 
3111
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
3112
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
3113
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
3114
    
 
3115
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
3116
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
3117
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
3118
    
 
3119
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
3120
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
3121
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
3122
    
 
3123
    // Get coordinates and map to the UFC reference element
 
3124
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
3125
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
3126
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
3127
    
 
3128
    // Map coordinates to the reference cube
 
3129
    if (std::abs(y + z - 1.0) < 1e-14)
 
3130
      x = 1.0;
 
3131
    else
 
3132
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
3133
    if (std::abs(z - 1.0) < 1e-14)
 
3134
      y = -1.0;
 
3135
    else
 
3136
      y = 2.0 * y/(1.0 - z) - 1.0;
 
3137
    z = 2.0 * z - 1.0;
 
3138
    
 
3139
    // Compute number of derivatives
 
3140
    unsigned int num_derivatives = 1;
 
3141
    
 
3142
    for (unsigned int j = 0; j < n; j++)
 
3143
      num_derivatives *= 3;
 
3144
    
 
3145
    
 
3146
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
 
3147
    unsigned int **combinations = new unsigned int *[num_derivatives];
 
3148
        
 
3149
    for (unsigned int j = 0; j < num_derivatives; j++)
 
3150
    {
 
3151
      combinations[j] = new unsigned int [n];
 
3152
      for (unsigned int k = 0; k < n; k++)
 
3153
        combinations[j][k] = 0;
 
3154
    }
 
3155
        
 
3156
    // Generate combinations of derivatives
 
3157
    for (unsigned int row = 1; row < num_derivatives; row++)
 
3158
    {
 
3159
      for (unsigned int num = 0; num < row; num++)
 
3160
      {
 
3161
        for (unsigned int col = n-1; col+1 > 0; col--)
 
3162
        {
 
3163
          if (combinations[row][col] + 1 > 2)
 
3164
            combinations[row][col] = 0;
 
3165
          else
 
3166
          {
 
3167
            combinations[row][col] += 1;
 
3168
            break;
 
3169
          }
 
3170
        }
 
3171
      }
 
3172
    }
 
3173
    
 
3174
    // Compute inverse of Jacobian
 
3175
    const double Jinv[3][3] ={{d00 / detJ, d10 / detJ, d20 / detJ}, {d01 / detJ, d11 / detJ, d21 / detJ}, {d02 / detJ, d12 / detJ, d22 / detJ}};
 
3176
    
 
3177
    // Declare transformation matrix
 
3178
    // Declare pointer to two dimensional array and initialise
 
3179
    double **transform = new double *[num_derivatives];
 
3180
        
 
3181
    for (unsigned int j = 0; j < num_derivatives; j++)
 
3182
    {
 
3183
      transform[j] = new double [num_derivatives];
 
3184
      for (unsigned int k = 0; k < num_derivatives; k++)
 
3185
        transform[j][k] = 1;
 
3186
    }
 
3187
    
 
3188
    // Construct transformation matrix
 
3189
    for (unsigned int row = 0; row < num_derivatives; row++)
 
3190
    {
 
3191
      for (unsigned int col = 0; col < num_derivatives; col++)
 
3192
      {
 
3193
        for (unsigned int k = 0; k < n; k++)
 
3194
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
 
3195
      }
 
3196
    }
 
3197
    
 
3198
    // Reset values
 
3199
    for (unsigned int j = 0; j < 1*num_derivatives; j++)
 
3200
      values[j] = 0;
 
3201
    
 
3202
    // Map degree of freedom to element degree of freedom
 
3203
    const unsigned int dof = i;
 
3204
    
 
3205
    // Generate scalings
 
3206
    const double scalings_y_0 = 1;
 
3207
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
 
3208
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
 
3209
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
 
3210
    const double scalings_z_0 = 1;
 
3211
    const double scalings_z_1 = scalings_z_0*(0.5 - 0.5*z);
 
3212
    const double scalings_z_2 = scalings_z_1*(0.5 - 0.5*z);
 
3213
    const double scalings_z_3 = scalings_z_2*(0.5 - 0.5*z);
 
3214
    
 
3215
    // Compute psitilde_a
 
3216
    const double psitilde_a_0 = 1;
 
3217
    const double psitilde_a_1 = x;
 
3218
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
 
3219
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
 
3220
    
 
3221
    // Compute psitilde_bs
 
3222
    const double psitilde_bs_0_0 = 1;
 
3223
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
 
3224
    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;
 
3225
    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;
 
3226
    const double psitilde_bs_1_0 = 1;
 
3227
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
 
3228
    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;
 
3229
    const double psitilde_bs_2_0 = 1;
 
3230
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
 
3231
    const double psitilde_bs_3_0 = 1;
 
3232
    
 
3233
    // Compute psitilde_cs
 
3234
    const double psitilde_cs_00_0 = 1;
 
3235
    const double psitilde_cs_00_1 = 2*z + 1;
 
3236
    const double psitilde_cs_00_2 = 0.3125*psitilde_cs_00_1 + 1.875*z*psitilde_cs_00_1 - 0.5625*psitilde_cs_00_0;
 
3237
    const double psitilde_cs_00_3 = 0.155555555555556*psitilde_cs_00_2 + 1.86666666666667*z*psitilde_cs_00_2 - 0.711111111111111*psitilde_cs_00_1;
 
3238
    const double psitilde_cs_01_0 = 1;
 
3239
    const double psitilde_cs_01_1 = 3*z + 2;
 
3240
    const double psitilde_cs_01_2 = 0.777777777777778*psitilde_cs_01_1 + 2.33333333333333*z*psitilde_cs_01_1 - 0.555555555555556*psitilde_cs_01_0;
 
3241
    const double psitilde_cs_02_0 = 1;
 
3242
    const double psitilde_cs_02_1 = 4*z + 3;
 
3243
    const double psitilde_cs_03_0 = 1;
 
3244
    const double psitilde_cs_10_0 = 1;
 
3245
    const double psitilde_cs_10_1 = 3*z + 2;
 
3246
    const double psitilde_cs_10_2 = 0.777777777777778*psitilde_cs_10_1 + 2.33333333333333*z*psitilde_cs_10_1 - 0.555555555555556*psitilde_cs_10_0;
 
3247
    const double psitilde_cs_11_0 = 1;
 
3248
    const double psitilde_cs_11_1 = 4*z + 3;
 
3249
    const double psitilde_cs_12_0 = 1;
 
3250
    const double psitilde_cs_20_0 = 1;
 
3251
    const double psitilde_cs_20_1 = 4*z + 3;
 
3252
    const double psitilde_cs_21_0 = 1;
 
3253
    const double psitilde_cs_30_0 = 1;
 
3254
    
 
3255
    // Compute basisvalues
 
3256
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
3257
    const double basisvalue1 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_0;
 
3258
    const double basisvalue2 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_0;
 
3259
    const double basisvalue3 = 1.11803398874989*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_1;
 
3260
    const double basisvalue4 = 5.1234753829798*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_0;
 
3261
    const double basisvalue5 = 3.96862696659689*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_0;
 
3262
    const double basisvalue6 = 2.29128784747792*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_0;
 
3263
    const double basisvalue7 = 3.24037034920393*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_1;
 
3264
    const double basisvalue8 = 1.87082869338697*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_1;
 
3265
    const double basisvalue9 = 1.3228756555323*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_2;
 
3266
    const double basisvalue10 = 7.93725393319377*psitilde_a_3*scalings_y_3*psitilde_bs_3_0*scalings_z_3*psitilde_cs_30_0;
 
3267
    const double basisvalue11 = 6.70820393249937*psitilde_a_2*scalings_y_2*psitilde_bs_2_1*scalings_z_3*psitilde_cs_21_0;
 
3268
    const double basisvalue12 = 5.19615242270663*psitilde_a_1*scalings_y_1*psitilde_bs_1_2*scalings_z_3*psitilde_cs_12_0;
 
3269
    const double basisvalue13 = 3*psitilde_a_0*scalings_y_0*psitilde_bs_0_3*scalings_z_3*psitilde_cs_03_0;
 
3270
    const double basisvalue14 = 5.80947501931113*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_1;
 
3271
    const double basisvalue15 = 4.5*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_1;
 
3272
    const double basisvalue16 = 2.59807621135332*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_1;
 
3273
    const double basisvalue17 = 3.67423461417477*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_2;
 
3274
    const double basisvalue18 = 2.12132034355964*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_2;
 
3275
    const double basisvalue19 = 1.5*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_3;
 
3276
    
 
3277
    // Table(s) of coefficients
 
3278
    const static double coefficients0[20][20] = \
 
3279
    {{0.0288675134594813, 0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, 0.014173667737846, 0.00818317088384971, 0.0115727512471569, 0.0066815310478106, 0.00472455591261534, -0.028347335475692, -0.0239578711874978, -0.0185576872239523, -0.0107142857142857, -0.0207481250689683, -0.0160714285714286, -0.00927884361197613, -0.0131222664791956, -0.00757614408414158, -0.00535714285714285},
 
3280
    {0.0288675134594813, -0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, -0.014173667737846, 0.00818317088384972, -0.0115727512471569, 0.00668153104781061, 0.00472455591261535, 0.028347335475692, -0.0239578711874977, 0.0185576872239523, -0.0107142857142857, -0.0207481250689683, 0.0160714285714286, -0.00927884361197613, 0.0131222664791956, -0.00757614408414158, -0.00535714285714286},
 
3281
    {0.0288675134594813, 0, -0.0150584650484208, 0.00532397137499948, 0, 0, 0.0245495126515492, 0, -0.0133630620956212, 0.00472455591261535, 0, 0, 0, 0.0428571428571429, 0, 0, -0.0278365308359284, 0, 0.0151522881682832, -0.00535714285714286},
 
3282
    {0.0288675134594812, 0, 0, -0.0159719141249985, 0, 0, 0, 0, 0, 0.0283473354756921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0535714285714286},
 
3283
    {0, 0, 0.112938487863156, -0.063887656499994, 0, 0, 0.0736485379546474, 0, 0.0267261241912424, -0.0236227795630767, 0, 0, 0, 0, 0, 0, 0.0649519052838329, 0, -0.0606091526731327, 0.0267857142857143},
 
3284
    {0, 0, -0.0225876975726313, 0.127775312999988, 0, 0, 0, 0, 0.0668153104781061, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0, 0.0757614408414158, -0.0535714285714286},
 
3285
    {0, 0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, -0.0425210032135381, 0.0245495126515492, 0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, -0.0375, 0.021650635094611, -0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
3286
    {0, -0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, 0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
3287
    {0, 0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, 0.014173667737846, -0.0245495126515492, -0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, -0.0618589574131742, 0.0428571428571429, -0.0069160416896561, -0.0160714285714286, 0.0154647393532936, 0.00874817765279706, 0, -0.00535714285714286},
 
3288
    {0, -0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, 0.0566946709513841, 0.0245495126515492, -0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, 0.0618589574131742, -0.0642857142857143, 0, -0.0214285714285714, 0.00927884361197612, 0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
3289
    {0, -0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, 0.0425210032135381, 0.0245495126515492, -0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, 0.0375, 0.021650635094611, 0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
3290
    {0, 0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, -0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, -0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
3291
    {0, -0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, -0.014173667737846, -0.0245495126515491, 0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, 0.0618589574131742, 0.0428571428571429, -0.0069160416896561, 0.0160714285714286, 0.0154647393532935, -0.00874817765279706, 0, -0.00535714285714285},
 
3292
    {0, 0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, -0.0566946709513841, 0.0245495126515491, 0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, -0.0618589574131742, -0.0642857142857143, 0, 0.0214285714285714, 0.00927884361197613, -0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
3293
    {0, -0.117369119465393, -0.0451753951452625, -0.031943828249997, -0.018298126367785, 0.042521003213538, 0.0409158544192486, 0.0347182537414707, 0.033407655239053, 0.0236227795630767, 0.0850420064270761, 0.0239578711874978, -0.00618589574131742, -0.0107142857142857, 0.0207481250689683, -0.00535714285714286, -0.00927884361197612, -0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
3294
    {0, 0.117369119465393, -0.0451753951452626, -0.031943828249997, -0.018298126367785, -0.0425210032135381, 0.0409158544192486, -0.0347182537414707, 0.033407655239053, 0.0236227795630767, -0.0850420064270761, 0.0239578711874977, 0.00618589574131741, -0.0107142857142857, 0.0207481250689683, 0.00535714285714286, -0.00927884361197612, 0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
3295
    {0.259807621135332, 0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, 0.0850420064270761, -0.0736485379546474, 0.0694365074829413, 0.0400891862868637, -0.0992156741649221, 0, 0, 0, 0, 0, 0.075, -0.0649519052838329, -0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
3296
    {0.259807621135332, -0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, -0.0850420064270761, -0.0736485379546474, -0.0694365074829414, 0.0400891862868637, -0.0992156741649222, 0, 0, 0, 0, 0, -0.075, -0.0649519052838329, 0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
3297
    {0.259807621135332, 0, -0.135526185435788, 0.0479157423749955, -0.10978875820671, 0, 0.0245495126515491, 0, -0.0801783725737273, -0.0992156741649221, 0, 0, 0, 0, -0.0968245836551854, 0, 0.021650635094611, 0, 0.0303045763365663, 0.0267857142857143},
 
3298
    {0.259807621135332, 0, 0, -0.143747227124986, -0.10978875820671, 0, -0.122747563257746, 0, 0, 0.0425210032135381, 0, -0.095831484749991, 0, 0.0428571428571429, 0.0138320833793122, 0, 0.0154647393532935, 0, 0, -0.00535714285714285}};
 
3299
    
 
3300
    // Interesting (new) part
 
3301
    // Tables of derivatives of the polynomial base (transpose)
 
3302
    const static double dmats0[20][20] = \
 
3303
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3304
    {6.32455532033676, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3305
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3306
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3307
    {0, 11.2249721603218, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3308
    {4.58257569495584, 0, 8.36660026534076, -1.18321595661992, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3309
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3310
    {3.74165738677394, 0, 0, 8.69482604771366, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3311
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3312
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3313
    {5.49909083394701, 0, -3.3466401061363, -2.36643191323985, 15.4919333848297, 0, 0.692820323027551, 0, 0.565685424949239, 0.400000000000001, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3314
    {0, 4.89897948556636, 0, 0, 0, 14.1985914794391, 0, -0.82807867121083, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3315
    {3.6, 0, 8.76356092008266, -1.54919333848297, 0, 0, 9.52470471983253, 0, -1.48131215963608, 0.261861468283192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3316
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3317
    {0, 4.24264068711928, 0, 0, 0, 0, 0, 14.3427433120127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3318
    {3.11769145362398, 0, 3.16227766016838, 4.91934955049954, 0, 0, 0, 0, 10.690449676497, -2.41897262725906, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3319
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3320
    {2.54558441227157, 0, 0, 7.66811580507233, 0, 0, 0, 0, 0, 10.3691851174526, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3321
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3322
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
3323
    
 
3324
    const static double dmats1[20][20] = \
 
3325
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3326
    {3.16227766016838, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3327
    {5.47722557505166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3328
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3329
    {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3330
    {2.29128784747792, 7.24568837309472, 4.18330013267038, -0.591607978309959, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3331
    {-2.64575131106459, 0, 9.66091783079296, 0.683130051063973, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3332
    {1.87082869338697, 0, 0, 4.34741302385683, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3333
    {3.24037034920393, 0, 0, 7.52994023880668, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3334
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3335
    {2.74954541697351, 5.79655069847577, -1.67332005306815, -1.18321595661992, 7.74596669241483, -1.2, 0.346410161513776, -0.979795897113271, 0.28284271247462, 0.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3336
    {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 9.16515138991168, 7.09929573971954, -2.04939015319192, -0.414039335605415, -0.478091443733757, 0.169030850945704, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3337
    {1.8, -5.69209978830308, 4.38178046004133, -0.774596669241487, 0, 10.998181667894, 4.76235235991626, 0.962140470884726, -0.740656079818041, 0.130930734141596, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3338
    {5.19615242270664, 0, -3.16227766016838, -2.23606797749979, 0, 0, 13.7477270848675, 0, 0.534522483824849, 0.37796447300923, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3339
    {2.01246117974981, 2.12132034355964, -0.408248290463864, 3.17542648054294, 0, 0, 0, 7.17137165600636, -1.38013111868471, -1.56144011671765, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3340
    {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0, 0, 0, 9.25820099772551, 5.34522483824849, -1.20948631362953, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3341
    {-1.8, 0, 3.65148371670111, -2.84018778721878, 0, 0, 0, 0, 12.3442679969674, 1.39659449751035, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3342
    {1.27279220613579, 0, 0, 3.83405790253616, 0, 0, 0, 0, 0, 5.18459255872629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3343
    {2.20454076850486, 0, 0, 6.6407830863536, 0, 0, 0, 0, 0, 8.97997772825746, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3344
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
3345
    
 
3346
    const static double dmats2[20][20] = \
 
3347
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3348
    {3.16227766016838, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3349
    {1.82574185835055, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3350
    {5.16397779494322, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3351
    {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3352
    {2.29128784747792, 1.44913767461895, 4.18330013267038, -0.59160797830996, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3353
    {1.32287565553229, 0, 3.86436713231718, -0.341565025531987, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3354
    {1.87082869338697, 7.09929573971954, 0, 4.34741302385683, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3355
    {1.08012344973464, 0, 7.09929573971954, 2.50998007960222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3356
    {-3.81881307912986, 0, 0, 8.87411967464942, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3357
    {2.74954541697351, 5.79655069847577, -1.67332005306815, -1.18321595661992, 7.74596669241483, -1.2, 0.346410161513776, -0.979795897113271, 0.282842712474619, 0.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3358
    {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141595, 7.09929573971954, -2.04939015319192, -0.414039335605415, -0.478091443733757, 0.169030850945704, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3359
    {1.8, 0.632455532033675, 4.38178046004133, -0.774596669241484, 0, 3.14233761939829, 4.76235235991626, -0.10690449676497, -0.740656079818042, 0.130930734141596, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3360
    {1.03923048454133, 0, 3.16227766016838, -0.447213595499959, 0, 0, 5.8918830363718, 0, -0.53452248382485, 0.0755928946018459, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3361
    {2.01246117974981, 2.12132034355964, -0.408248290463863, 3.17542648054294, 9.07114735222145, 0, 0, 7.17137165600636, -1.38013111868471, -1.56144011671765, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3362
    {1.55884572681199, 0.547722557505165, 1.58113883008419, 2.45967477524977, 0, 9.07114735222145, 0, 1.8516401995451, 5.34522483824849, -1.20948631362953, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3363
    {0.900000000000001, 0, 1.46059348668045, 1.42009389360939, 0, 0, 9.07114735222145, 0, 4.93770719878694, -0.698297248755175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3364
    {1.27279220613578, -6.26099033699941, 0, 3.83405790253616, 0, 0, 0, 10.5830052442584, 0, 5.18459255872629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3365
    {0.734846922834954, 0, -6.26099033699941, 2.21359436211787, 0, 0, 0, 0, 10.5830052442584, 2.99332590941915, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
3366
    {5.7157676649773, 0, 0, -4.69574275274955, 0, 0, 0, 0, 0, 12.69960629311, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
3367
    
 
3368
    // Compute reference derivatives
 
3369
    // Declare pointer to array of derivatives on FIAT element
 
3370
    double *derivatives = new double [num_derivatives];
 
3371
    
 
3372
    // Declare coefficients
 
3373
    double coeff0_0 = 0;
 
3374
    double coeff0_1 = 0;
 
3375
    double coeff0_2 = 0;
 
3376
    double coeff0_3 = 0;
 
3377
    double coeff0_4 = 0;
 
3378
    double coeff0_5 = 0;
 
3379
    double coeff0_6 = 0;
 
3380
    double coeff0_7 = 0;
 
3381
    double coeff0_8 = 0;
 
3382
    double coeff0_9 = 0;
 
3383
    double coeff0_10 = 0;
 
3384
    double coeff0_11 = 0;
 
3385
    double coeff0_12 = 0;
 
3386
    double coeff0_13 = 0;
 
3387
    double coeff0_14 = 0;
 
3388
    double coeff0_15 = 0;
 
3389
    double coeff0_16 = 0;
 
3390
    double coeff0_17 = 0;
 
3391
    double coeff0_18 = 0;
 
3392
    double coeff0_19 = 0;
 
3393
    
 
3394
    // Declare new coefficients
 
3395
    double new_coeff0_0 = 0;
 
3396
    double new_coeff0_1 = 0;
 
3397
    double new_coeff0_2 = 0;
 
3398
    double new_coeff0_3 = 0;
 
3399
    double new_coeff0_4 = 0;
 
3400
    double new_coeff0_5 = 0;
 
3401
    double new_coeff0_6 = 0;
 
3402
    double new_coeff0_7 = 0;
 
3403
    double new_coeff0_8 = 0;
 
3404
    double new_coeff0_9 = 0;
 
3405
    double new_coeff0_10 = 0;
 
3406
    double new_coeff0_11 = 0;
 
3407
    double new_coeff0_12 = 0;
 
3408
    double new_coeff0_13 = 0;
 
3409
    double new_coeff0_14 = 0;
 
3410
    double new_coeff0_15 = 0;
 
3411
    double new_coeff0_16 = 0;
 
3412
    double new_coeff0_17 = 0;
 
3413
    double new_coeff0_18 = 0;
 
3414
    double new_coeff0_19 = 0;
 
3415
    
 
3416
    // Loop possible derivatives
 
3417
    for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
3418
    {
 
3419
      // Get values from coefficients array
 
3420
      new_coeff0_0 = coefficients0[dof][0];
 
3421
      new_coeff0_1 = coefficients0[dof][1];
 
3422
      new_coeff0_2 = coefficients0[dof][2];
 
3423
      new_coeff0_3 = coefficients0[dof][3];
 
3424
      new_coeff0_4 = coefficients0[dof][4];
 
3425
      new_coeff0_5 = coefficients0[dof][5];
 
3426
      new_coeff0_6 = coefficients0[dof][6];
 
3427
      new_coeff0_7 = coefficients0[dof][7];
 
3428
      new_coeff0_8 = coefficients0[dof][8];
 
3429
      new_coeff0_9 = coefficients0[dof][9];
 
3430
      new_coeff0_10 = coefficients0[dof][10];
 
3431
      new_coeff0_11 = coefficients0[dof][11];
 
3432
      new_coeff0_12 = coefficients0[dof][12];
 
3433
      new_coeff0_13 = coefficients0[dof][13];
 
3434
      new_coeff0_14 = coefficients0[dof][14];
 
3435
      new_coeff0_15 = coefficients0[dof][15];
 
3436
      new_coeff0_16 = coefficients0[dof][16];
 
3437
      new_coeff0_17 = coefficients0[dof][17];
 
3438
      new_coeff0_18 = coefficients0[dof][18];
 
3439
      new_coeff0_19 = coefficients0[dof][19];
 
3440
    
 
3441
      // Loop derivative order
 
3442
      for (unsigned int j = 0; j < n; j++)
 
3443
      {
 
3444
        // Update old coefficients
 
3445
        coeff0_0 = new_coeff0_0;
 
3446
        coeff0_1 = new_coeff0_1;
 
3447
        coeff0_2 = new_coeff0_2;
 
3448
        coeff0_3 = new_coeff0_3;
 
3449
        coeff0_4 = new_coeff0_4;
 
3450
        coeff0_5 = new_coeff0_5;
 
3451
        coeff0_6 = new_coeff0_6;
 
3452
        coeff0_7 = new_coeff0_7;
 
3453
        coeff0_8 = new_coeff0_8;
 
3454
        coeff0_9 = new_coeff0_9;
 
3455
        coeff0_10 = new_coeff0_10;
 
3456
        coeff0_11 = new_coeff0_11;
 
3457
        coeff0_12 = new_coeff0_12;
 
3458
        coeff0_13 = new_coeff0_13;
 
3459
        coeff0_14 = new_coeff0_14;
 
3460
        coeff0_15 = new_coeff0_15;
 
3461
        coeff0_16 = new_coeff0_16;
 
3462
        coeff0_17 = new_coeff0_17;
 
3463
        coeff0_18 = new_coeff0_18;
 
3464
        coeff0_19 = new_coeff0_19;
 
3465
    
 
3466
        if(combinations[deriv_num][j] == 0)
 
3467
        {
 
3468
          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] + coeff0_15*dmats0[15][0] + coeff0_16*dmats0[16][0] + coeff0_17*dmats0[17][0] + coeff0_18*dmats0[18][0] + coeff0_19*dmats0[19][0];
 
3469
          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] + coeff0_15*dmats0[15][1] + coeff0_16*dmats0[16][1] + coeff0_17*dmats0[17][1] + coeff0_18*dmats0[18][1] + coeff0_19*dmats0[19][1];
 
3470
          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] + coeff0_15*dmats0[15][2] + coeff0_16*dmats0[16][2] + coeff0_17*dmats0[17][2] + coeff0_18*dmats0[18][2] + coeff0_19*dmats0[19][2];
 
3471
          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] + coeff0_15*dmats0[15][3] + coeff0_16*dmats0[16][3] + coeff0_17*dmats0[17][3] + coeff0_18*dmats0[18][3] + coeff0_19*dmats0[19][3];
 
3472
          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] + coeff0_15*dmats0[15][4] + coeff0_16*dmats0[16][4] + coeff0_17*dmats0[17][4] + coeff0_18*dmats0[18][4] + coeff0_19*dmats0[19][4];
 
3473
          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] + coeff0_15*dmats0[15][5] + coeff0_16*dmats0[16][5] + coeff0_17*dmats0[17][5] + coeff0_18*dmats0[18][5] + coeff0_19*dmats0[19][5];
 
3474
          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] + coeff0_15*dmats0[15][6] + coeff0_16*dmats0[16][6] + coeff0_17*dmats0[17][6] + coeff0_18*dmats0[18][6] + coeff0_19*dmats0[19][6];
 
3475
          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] + coeff0_15*dmats0[15][7] + coeff0_16*dmats0[16][7] + coeff0_17*dmats0[17][7] + coeff0_18*dmats0[18][7] + coeff0_19*dmats0[19][7];
 
3476
          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] + coeff0_15*dmats0[15][8] + coeff0_16*dmats0[16][8] + coeff0_17*dmats0[17][8] + coeff0_18*dmats0[18][8] + coeff0_19*dmats0[19][8];
 
3477
          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] + coeff0_15*dmats0[15][9] + coeff0_16*dmats0[16][9] + coeff0_17*dmats0[17][9] + coeff0_18*dmats0[18][9] + coeff0_19*dmats0[19][9];
 
3478
          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] + coeff0_15*dmats0[15][10] + coeff0_16*dmats0[16][10] + coeff0_17*dmats0[17][10] + coeff0_18*dmats0[18][10] + coeff0_19*dmats0[19][10];
 
3479
          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] + coeff0_15*dmats0[15][11] + coeff0_16*dmats0[16][11] + coeff0_17*dmats0[17][11] + coeff0_18*dmats0[18][11] + coeff0_19*dmats0[19][11];
 
3480
          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] + coeff0_15*dmats0[15][12] + coeff0_16*dmats0[16][12] + coeff0_17*dmats0[17][12] + coeff0_18*dmats0[18][12] + coeff0_19*dmats0[19][12];
 
3481
          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] + coeff0_15*dmats0[15][13] + coeff0_16*dmats0[16][13] + coeff0_17*dmats0[17][13] + coeff0_18*dmats0[18][13] + coeff0_19*dmats0[19][13];
 
3482
          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] + coeff0_15*dmats0[15][14] + coeff0_16*dmats0[16][14] + coeff0_17*dmats0[17][14] + coeff0_18*dmats0[18][14] + coeff0_19*dmats0[19][14];
 
3483
          new_coeff0_15 = coeff0_0*dmats0[0][15] + coeff0_1*dmats0[1][15] + coeff0_2*dmats0[2][15] + coeff0_3*dmats0[3][15] + coeff0_4*dmats0[4][15] + coeff0_5*dmats0[5][15] + coeff0_6*dmats0[6][15] + coeff0_7*dmats0[7][15] + coeff0_8*dmats0[8][15] + coeff0_9*dmats0[9][15] + coeff0_10*dmats0[10][15] + coeff0_11*dmats0[11][15] + coeff0_12*dmats0[12][15] + coeff0_13*dmats0[13][15] + coeff0_14*dmats0[14][15] + coeff0_15*dmats0[15][15] + coeff0_16*dmats0[16][15] + coeff0_17*dmats0[17][15] + coeff0_18*dmats0[18][15] + coeff0_19*dmats0[19][15];
 
3484
          new_coeff0_16 = coeff0_0*dmats0[0][16] + coeff0_1*dmats0[1][16] + coeff0_2*dmats0[2][16] + coeff0_3*dmats0[3][16] + coeff0_4*dmats0[4][16] + coeff0_5*dmats0[5][16] + coeff0_6*dmats0[6][16] + coeff0_7*dmats0[7][16] + coeff0_8*dmats0[8][16] + coeff0_9*dmats0[9][16] + coeff0_10*dmats0[10][16] + coeff0_11*dmats0[11][16] + coeff0_12*dmats0[12][16] + coeff0_13*dmats0[13][16] + coeff0_14*dmats0[14][16] + coeff0_15*dmats0[15][16] + coeff0_16*dmats0[16][16] + coeff0_17*dmats0[17][16] + coeff0_18*dmats0[18][16] + coeff0_19*dmats0[19][16];
 
3485
          new_coeff0_17 = coeff0_0*dmats0[0][17] + coeff0_1*dmats0[1][17] + coeff0_2*dmats0[2][17] + coeff0_3*dmats0[3][17] + coeff0_4*dmats0[4][17] + coeff0_5*dmats0[5][17] + coeff0_6*dmats0[6][17] + coeff0_7*dmats0[7][17] + coeff0_8*dmats0[8][17] + coeff0_9*dmats0[9][17] + coeff0_10*dmats0[10][17] + coeff0_11*dmats0[11][17] + coeff0_12*dmats0[12][17] + coeff0_13*dmats0[13][17] + coeff0_14*dmats0[14][17] + coeff0_15*dmats0[15][17] + coeff0_16*dmats0[16][17] + coeff0_17*dmats0[17][17] + coeff0_18*dmats0[18][17] + coeff0_19*dmats0[19][17];
 
3486
          new_coeff0_18 = coeff0_0*dmats0[0][18] + coeff0_1*dmats0[1][18] + coeff0_2*dmats0[2][18] + coeff0_3*dmats0[3][18] + coeff0_4*dmats0[4][18] + coeff0_5*dmats0[5][18] + coeff0_6*dmats0[6][18] + coeff0_7*dmats0[7][18] + coeff0_8*dmats0[8][18] + coeff0_9*dmats0[9][18] + coeff0_10*dmats0[10][18] + coeff0_11*dmats0[11][18] + coeff0_12*dmats0[12][18] + coeff0_13*dmats0[13][18] + coeff0_14*dmats0[14][18] + coeff0_15*dmats0[15][18] + coeff0_16*dmats0[16][18] + coeff0_17*dmats0[17][18] + coeff0_18*dmats0[18][18] + coeff0_19*dmats0[19][18];
 
3487
          new_coeff0_19 = coeff0_0*dmats0[0][19] + coeff0_1*dmats0[1][19] + coeff0_2*dmats0[2][19] + coeff0_3*dmats0[3][19] + coeff0_4*dmats0[4][19] + coeff0_5*dmats0[5][19] + coeff0_6*dmats0[6][19] + coeff0_7*dmats0[7][19] + coeff0_8*dmats0[8][19] + coeff0_9*dmats0[9][19] + coeff0_10*dmats0[10][19] + coeff0_11*dmats0[11][19] + coeff0_12*dmats0[12][19] + coeff0_13*dmats0[13][19] + coeff0_14*dmats0[14][19] + coeff0_15*dmats0[15][19] + coeff0_16*dmats0[16][19] + coeff0_17*dmats0[17][19] + coeff0_18*dmats0[18][19] + coeff0_19*dmats0[19][19];
 
3488
        }
 
3489
        if(combinations[deriv_num][j] == 1)
 
3490
        {
 
3491
          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] + coeff0_15*dmats1[15][0] + coeff0_16*dmats1[16][0] + coeff0_17*dmats1[17][0] + coeff0_18*dmats1[18][0] + coeff0_19*dmats1[19][0];
 
3492
          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] + coeff0_15*dmats1[15][1] + coeff0_16*dmats1[16][1] + coeff0_17*dmats1[17][1] + coeff0_18*dmats1[18][1] + coeff0_19*dmats1[19][1];
 
3493
          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] + coeff0_15*dmats1[15][2] + coeff0_16*dmats1[16][2] + coeff0_17*dmats1[17][2] + coeff0_18*dmats1[18][2] + coeff0_19*dmats1[19][2];
 
3494
          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] + coeff0_15*dmats1[15][3] + coeff0_16*dmats1[16][3] + coeff0_17*dmats1[17][3] + coeff0_18*dmats1[18][3] + coeff0_19*dmats1[19][3];
 
3495
          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] + coeff0_15*dmats1[15][4] + coeff0_16*dmats1[16][4] + coeff0_17*dmats1[17][4] + coeff0_18*dmats1[18][4] + coeff0_19*dmats1[19][4];
 
3496
          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] + coeff0_15*dmats1[15][5] + coeff0_16*dmats1[16][5] + coeff0_17*dmats1[17][5] + coeff0_18*dmats1[18][5] + coeff0_19*dmats1[19][5];
 
3497
          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] + coeff0_15*dmats1[15][6] + coeff0_16*dmats1[16][6] + coeff0_17*dmats1[17][6] + coeff0_18*dmats1[18][6] + coeff0_19*dmats1[19][6];
 
3498
          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] + coeff0_15*dmats1[15][7] + coeff0_16*dmats1[16][7] + coeff0_17*dmats1[17][7] + coeff0_18*dmats1[18][7] + coeff0_19*dmats1[19][7];
 
3499
          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] + coeff0_15*dmats1[15][8] + coeff0_16*dmats1[16][8] + coeff0_17*dmats1[17][8] + coeff0_18*dmats1[18][8] + coeff0_19*dmats1[19][8];
 
3500
          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] + coeff0_15*dmats1[15][9] + coeff0_16*dmats1[16][9] + coeff0_17*dmats1[17][9] + coeff0_18*dmats1[18][9] + coeff0_19*dmats1[19][9];
 
3501
          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] + coeff0_15*dmats1[15][10] + coeff0_16*dmats1[16][10] + coeff0_17*dmats1[17][10] + coeff0_18*dmats1[18][10] + coeff0_19*dmats1[19][10];
 
3502
          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] + coeff0_15*dmats1[15][11] + coeff0_16*dmats1[16][11] + coeff0_17*dmats1[17][11] + coeff0_18*dmats1[18][11] + coeff0_19*dmats1[19][11];
 
3503
          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] + coeff0_15*dmats1[15][12] + coeff0_16*dmats1[16][12] + coeff0_17*dmats1[17][12] + coeff0_18*dmats1[18][12] + coeff0_19*dmats1[19][12];
 
3504
          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] + coeff0_15*dmats1[15][13] + coeff0_16*dmats1[16][13] + coeff0_17*dmats1[17][13] + coeff0_18*dmats1[18][13] + coeff0_19*dmats1[19][13];
 
3505
          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] + coeff0_15*dmats1[15][14] + coeff0_16*dmats1[16][14] + coeff0_17*dmats1[17][14] + coeff0_18*dmats1[18][14] + coeff0_19*dmats1[19][14];
 
3506
          new_coeff0_15 = coeff0_0*dmats1[0][15] + coeff0_1*dmats1[1][15] + coeff0_2*dmats1[2][15] + coeff0_3*dmats1[3][15] + coeff0_4*dmats1[4][15] + coeff0_5*dmats1[5][15] + coeff0_6*dmats1[6][15] + coeff0_7*dmats1[7][15] + coeff0_8*dmats1[8][15] + coeff0_9*dmats1[9][15] + coeff0_10*dmats1[10][15] + coeff0_11*dmats1[11][15] + coeff0_12*dmats1[12][15] + coeff0_13*dmats1[13][15] + coeff0_14*dmats1[14][15] + coeff0_15*dmats1[15][15] + coeff0_16*dmats1[16][15] + coeff0_17*dmats1[17][15] + coeff0_18*dmats1[18][15] + coeff0_19*dmats1[19][15];
 
3507
          new_coeff0_16 = coeff0_0*dmats1[0][16] + coeff0_1*dmats1[1][16] + coeff0_2*dmats1[2][16] + coeff0_3*dmats1[3][16] + coeff0_4*dmats1[4][16] + coeff0_5*dmats1[5][16] + coeff0_6*dmats1[6][16] + coeff0_7*dmats1[7][16] + coeff0_8*dmats1[8][16] + coeff0_9*dmats1[9][16] + coeff0_10*dmats1[10][16] + coeff0_11*dmats1[11][16] + coeff0_12*dmats1[12][16] + coeff0_13*dmats1[13][16] + coeff0_14*dmats1[14][16] + coeff0_15*dmats1[15][16] + coeff0_16*dmats1[16][16] + coeff0_17*dmats1[17][16] + coeff0_18*dmats1[18][16] + coeff0_19*dmats1[19][16];
 
3508
          new_coeff0_17 = coeff0_0*dmats1[0][17] + coeff0_1*dmats1[1][17] + coeff0_2*dmats1[2][17] + coeff0_3*dmats1[3][17] + coeff0_4*dmats1[4][17] + coeff0_5*dmats1[5][17] + coeff0_6*dmats1[6][17] + coeff0_7*dmats1[7][17] + coeff0_8*dmats1[8][17] + coeff0_9*dmats1[9][17] + coeff0_10*dmats1[10][17] + coeff0_11*dmats1[11][17] + coeff0_12*dmats1[12][17] + coeff0_13*dmats1[13][17] + coeff0_14*dmats1[14][17] + coeff0_15*dmats1[15][17] + coeff0_16*dmats1[16][17] + coeff0_17*dmats1[17][17] + coeff0_18*dmats1[18][17] + coeff0_19*dmats1[19][17];
 
3509
          new_coeff0_18 = coeff0_0*dmats1[0][18] + coeff0_1*dmats1[1][18] + coeff0_2*dmats1[2][18] + coeff0_3*dmats1[3][18] + coeff0_4*dmats1[4][18] + coeff0_5*dmats1[5][18] + coeff0_6*dmats1[6][18] + coeff0_7*dmats1[7][18] + coeff0_8*dmats1[8][18] + coeff0_9*dmats1[9][18] + coeff0_10*dmats1[10][18] + coeff0_11*dmats1[11][18] + coeff0_12*dmats1[12][18] + coeff0_13*dmats1[13][18] + coeff0_14*dmats1[14][18] + coeff0_15*dmats1[15][18] + coeff0_16*dmats1[16][18] + coeff0_17*dmats1[17][18] + coeff0_18*dmats1[18][18] + coeff0_19*dmats1[19][18];
 
3510
          new_coeff0_19 = coeff0_0*dmats1[0][19] + coeff0_1*dmats1[1][19] + coeff0_2*dmats1[2][19] + coeff0_3*dmats1[3][19] + coeff0_4*dmats1[4][19] + coeff0_5*dmats1[5][19] + coeff0_6*dmats1[6][19] + coeff0_7*dmats1[7][19] + coeff0_8*dmats1[8][19] + coeff0_9*dmats1[9][19] + coeff0_10*dmats1[10][19] + coeff0_11*dmats1[11][19] + coeff0_12*dmats1[12][19] + coeff0_13*dmats1[13][19] + coeff0_14*dmats1[14][19] + coeff0_15*dmats1[15][19] + coeff0_16*dmats1[16][19] + coeff0_17*dmats1[17][19] + coeff0_18*dmats1[18][19] + coeff0_19*dmats1[19][19];
 
3511
        }
 
3512
        if(combinations[deriv_num][j] == 2)
 
3513
        {
 
3514
          new_coeff0_0 = coeff0_0*dmats2[0][0] + coeff0_1*dmats2[1][0] + coeff0_2*dmats2[2][0] + coeff0_3*dmats2[3][0] + coeff0_4*dmats2[4][0] + coeff0_5*dmats2[5][0] + coeff0_6*dmats2[6][0] + coeff0_7*dmats2[7][0] + coeff0_8*dmats2[8][0] + coeff0_9*dmats2[9][0] + coeff0_10*dmats2[10][0] + coeff0_11*dmats2[11][0] + coeff0_12*dmats2[12][0] + coeff0_13*dmats2[13][0] + coeff0_14*dmats2[14][0] + coeff0_15*dmats2[15][0] + coeff0_16*dmats2[16][0] + coeff0_17*dmats2[17][0] + coeff0_18*dmats2[18][0] + coeff0_19*dmats2[19][0];
 
3515
          new_coeff0_1 = coeff0_0*dmats2[0][1] + coeff0_1*dmats2[1][1] + coeff0_2*dmats2[2][1] + coeff0_3*dmats2[3][1] + coeff0_4*dmats2[4][1] + coeff0_5*dmats2[5][1] + coeff0_6*dmats2[6][1] + coeff0_7*dmats2[7][1] + coeff0_8*dmats2[8][1] + coeff0_9*dmats2[9][1] + coeff0_10*dmats2[10][1] + coeff0_11*dmats2[11][1] + coeff0_12*dmats2[12][1] + coeff0_13*dmats2[13][1] + coeff0_14*dmats2[14][1] + coeff0_15*dmats2[15][1] + coeff0_16*dmats2[16][1] + coeff0_17*dmats2[17][1] + coeff0_18*dmats2[18][1] + coeff0_19*dmats2[19][1];
 
3516
          new_coeff0_2 = coeff0_0*dmats2[0][2] + coeff0_1*dmats2[1][2] + coeff0_2*dmats2[2][2] + coeff0_3*dmats2[3][2] + coeff0_4*dmats2[4][2] + coeff0_5*dmats2[5][2] + coeff0_6*dmats2[6][2] + coeff0_7*dmats2[7][2] + coeff0_8*dmats2[8][2] + coeff0_9*dmats2[9][2] + coeff0_10*dmats2[10][2] + coeff0_11*dmats2[11][2] + coeff0_12*dmats2[12][2] + coeff0_13*dmats2[13][2] + coeff0_14*dmats2[14][2] + coeff0_15*dmats2[15][2] + coeff0_16*dmats2[16][2] + coeff0_17*dmats2[17][2] + coeff0_18*dmats2[18][2] + coeff0_19*dmats2[19][2];
 
3517
          new_coeff0_3 = coeff0_0*dmats2[0][3] + coeff0_1*dmats2[1][3] + coeff0_2*dmats2[2][3] + coeff0_3*dmats2[3][3] + coeff0_4*dmats2[4][3] + coeff0_5*dmats2[5][3] + coeff0_6*dmats2[6][3] + coeff0_7*dmats2[7][3] + coeff0_8*dmats2[8][3] + coeff0_9*dmats2[9][3] + coeff0_10*dmats2[10][3] + coeff0_11*dmats2[11][3] + coeff0_12*dmats2[12][3] + coeff0_13*dmats2[13][3] + coeff0_14*dmats2[14][3] + coeff0_15*dmats2[15][3] + coeff0_16*dmats2[16][3] + coeff0_17*dmats2[17][3] + coeff0_18*dmats2[18][3] + coeff0_19*dmats2[19][3];
 
3518
          new_coeff0_4 = coeff0_0*dmats2[0][4] + coeff0_1*dmats2[1][4] + coeff0_2*dmats2[2][4] + coeff0_3*dmats2[3][4] + coeff0_4*dmats2[4][4] + coeff0_5*dmats2[5][4] + coeff0_6*dmats2[6][4] + coeff0_7*dmats2[7][4] + coeff0_8*dmats2[8][4] + coeff0_9*dmats2[9][4] + coeff0_10*dmats2[10][4] + coeff0_11*dmats2[11][4] + coeff0_12*dmats2[12][4] + coeff0_13*dmats2[13][4] + coeff0_14*dmats2[14][4] + coeff0_15*dmats2[15][4] + coeff0_16*dmats2[16][4] + coeff0_17*dmats2[17][4] + coeff0_18*dmats2[18][4] + coeff0_19*dmats2[19][4];
 
3519
          new_coeff0_5 = coeff0_0*dmats2[0][5] + coeff0_1*dmats2[1][5] + coeff0_2*dmats2[2][5] + coeff0_3*dmats2[3][5] + coeff0_4*dmats2[4][5] + coeff0_5*dmats2[5][5] + coeff0_6*dmats2[6][5] + coeff0_7*dmats2[7][5] + coeff0_8*dmats2[8][5] + coeff0_9*dmats2[9][5] + coeff0_10*dmats2[10][5] + coeff0_11*dmats2[11][5] + coeff0_12*dmats2[12][5] + coeff0_13*dmats2[13][5] + coeff0_14*dmats2[14][5] + coeff0_15*dmats2[15][5] + coeff0_16*dmats2[16][5] + coeff0_17*dmats2[17][5] + coeff0_18*dmats2[18][5] + coeff0_19*dmats2[19][5];
 
3520
          new_coeff0_6 = coeff0_0*dmats2[0][6] + coeff0_1*dmats2[1][6] + coeff0_2*dmats2[2][6] + coeff0_3*dmats2[3][6] + coeff0_4*dmats2[4][6] + coeff0_5*dmats2[5][6] + coeff0_6*dmats2[6][6] + coeff0_7*dmats2[7][6] + coeff0_8*dmats2[8][6] + coeff0_9*dmats2[9][6] + coeff0_10*dmats2[10][6] + coeff0_11*dmats2[11][6] + coeff0_12*dmats2[12][6] + coeff0_13*dmats2[13][6] + coeff0_14*dmats2[14][6] + coeff0_15*dmats2[15][6] + coeff0_16*dmats2[16][6] + coeff0_17*dmats2[17][6] + coeff0_18*dmats2[18][6] + coeff0_19*dmats2[19][6];
 
3521
          new_coeff0_7 = coeff0_0*dmats2[0][7] + coeff0_1*dmats2[1][7] + coeff0_2*dmats2[2][7] + coeff0_3*dmats2[3][7] + coeff0_4*dmats2[4][7] + coeff0_5*dmats2[5][7] + coeff0_6*dmats2[6][7] + coeff0_7*dmats2[7][7] + coeff0_8*dmats2[8][7] + coeff0_9*dmats2[9][7] + coeff0_10*dmats2[10][7] + coeff0_11*dmats2[11][7] + coeff0_12*dmats2[12][7] + coeff0_13*dmats2[13][7] + coeff0_14*dmats2[14][7] + coeff0_15*dmats2[15][7] + coeff0_16*dmats2[16][7] + coeff0_17*dmats2[17][7] + coeff0_18*dmats2[18][7] + coeff0_19*dmats2[19][7];
 
3522
          new_coeff0_8 = coeff0_0*dmats2[0][8] + coeff0_1*dmats2[1][8] + coeff0_2*dmats2[2][8] + coeff0_3*dmats2[3][8] + coeff0_4*dmats2[4][8] + coeff0_5*dmats2[5][8] + coeff0_6*dmats2[6][8] + coeff0_7*dmats2[7][8] + coeff0_8*dmats2[8][8] + coeff0_9*dmats2[9][8] + coeff0_10*dmats2[10][8] + coeff0_11*dmats2[11][8] + coeff0_12*dmats2[12][8] + coeff0_13*dmats2[13][8] + coeff0_14*dmats2[14][8] + coeff0_15*dmats2[15][8] + coeff0_16*dmats2[16][8] + coeff0_17*dmats2[17][8] + coeff0_18*dmats2[18][8] + coeff0_19*dmats2[19][8];
 
3523
          new_coeff0_9 = coeff0_0*dmats2[0][9] + coeff0_1*dmats2[1][9] + coeff0_2*dmats2[2][9] + coeff0_3*dmats2[3][9] + coeff0_4*dmats2[4][9] + coeff0_5*dmats2[5][9] + coeff0_6*dmats2[6][9] + coeff0_7*dmats2[7][9] + coeff0_8*dmats2[8][9] + coeff0_9*dmats2[9][9] + coeff0_10*dmats2[10][9] + coeff0_11*dmats2[11][9] + coeff0_12*dmats2[12][9] + coeff0_13*dmats2[13][9] + coeff0_14*dmats2[14][9] + coeff0_15*dmats2[15][9] + coeff0_16*dmats2[16][9] + coeff0_17*dmats2[17][9] + coeff0_18*dmats2[18][9] + coeff0_19*dmats2[19][9];
 
3524
          new_coeff0_10 = coeff0_0*dmats2[0][10] + coeff0_1*dmats2[1][10] + coeff0_2*dmats2[2][10] + coeff0_3*dmats2[3][10] + coeff0_4*dmats2[4][10] + coeff0_5*dmats2[5][10] + coeff0_6*dmats2[6][10] + coeff0_7*dmats2[7][10] + coeff0_8*dmats2[8][10] + coeff0_9*dmats2[9][10] + coeff0_10*dmats2[10][10] + coeff0_11*dmats2[11][10] + coeff0_12*dmats2[12][10] + coeff0_13*dmats2[13][10] + coeff0_14*dmats2[14][10] + coeff0_15*dmats2[15][10] + coeff0_16*dmats2[16][10] + coeff0_17*dmats2[17][10] + coeff0_18*dmats2[18][10] + coeff0_19*dmats2[19][10];
 
3525
          new_coeff0_11 = coeff0_0*dmats2[0][11] + coeff0_1*dmats2[1][11] + coeff0_2*dmats2[2][11] + coeff0_3*dmats2[3][11] + coeff0_4*dmats2[4][11] + coeff0_5*dmats2[5][11] + coeff0_6*dmats2[6][11] + coeff0_7*dmats2[7][11] + coeff0_8*dmats2[8][11] + coeff0_9*dmats2[9][11] + coeff0_10*dmats2[10][11] + coeff0_11*dmats2[11][11] + coeff0_12*dmats2[12][11] + coeff0_13*dmats2[13][11] + coeff0_14*dmats2[14][11] + coeff0_15*dmats2[15][11] + coeff0_16*dmats2[16][11] + coeff0_17*dmats2[17][11] + coeff0_18*dmats2[18][11] + coeff0_19*dmats2[19][11];
 
3526
          new_coeff0_12 = coeff0_0*dmats2[0][12] + coeff0_1*dmats2[1][12] + coeff0_2*dmats2[2][12] + coeff0_3*dmats2[3][12] + coeff0_4*dmats2[4][12] + coeff0_5*dmats2[5][12] + coeff0_6*dmats2[6][12] + coeff0_7*dmats2[7][12] + coeff0_8*dmats2[8][12] + coeff0_9*dmats2[9][12] + coeff0_10*dmats2[10][12] + coeff0_11*dmats2[11][12] + coeff0_12*dmats2[12][12] + coeff0_13*dmats2[13][12] + coeff0_14*dmats2[14][12] + coeff0_15*dmats2[15][12] + coeff0_16*dmats2[16][12] + coeff0_17*dmats2[17][12] + coeff0_18*dmats2[18][12] + coeff0_19*dmats2[19][12];
 
3527
          new_coeff0_13 = coeff0_0*dmats2[0][13] + coeff0_1*dmats2[1][13] + coeff0_2*dmats2[2][13] + coeff0_3*dmats2[3][13] + coeff0_4*dmats2[4][13] + coeff0_5*dmats2[5][13] + coeff0_6*dmats2[6][13] + coeff0_7*dmats2[7][13] + coeff0_8*dmats2[8][13] + coeff0_9*dmats2[9][13] + coeff0_10*dmats2[10][13] + coeff0_11*dmats2[11][13] + coeff0_12*dmats2[12][13] + coeff0_13*dmats2[13][13] + coeff0_14*dmats2[14][13] + coeff0_15*dmats2[15][13] + coeff0_16*dmats2[16][13] + coeff0_17*dmats2[17][13] + coeff0_18*dmats2[18][13] + coeff0_19*dmats2[19][13];
 
3528
          new_coeff0_14 = coeff0_0*dmats2[0][14] + coeff0_1*dmats2[1][14] + coeff0_2*dmats2[2][14] + coeff0_3*dmats2[3][14] + coeff0_4*dmats2[4][14] + coeff0_5*dmats2[5][14] + coeff0_6*dmats2[6][14] + coeff0_7*dmats2[7][14] + coeff0_8*dmats2[8][14] + coeff0_9*dmats2[9][14] + coeff0_10*dmats2[10][14] + coeff0_11*dmats2[11][14] + coeff0_12*dmats2[12][14] + coeff0_13*dmats2[13][14] + coeff0_14*dmats2[14][14] + coeff0_15*dmats2[15][14] + coeff0_16*dmats2[16][14] + coeff0_17*dmats2[17][14] + coeff0_18*dmats2[18][14] + coeff0_19*dmats2[19][14];
 
3529
          new_coeff0_15 = coeff0_0*dmats2[0][15] + coeff0_1*dmats2[1][15] + coeff0_2*dmats2[2][15] + coeff0_3*dmats2[3][15] + coeff0_4*dmats2[4][15] + coeff0_5*dmats2[5][15] + coeff0_6*dmats2[6][15] + coeff0_7*dmats2[7][15] + coeff0_8*dmats2[8][15] + coeff0_9*dmats2[9][15] + coeff0_10*dmats2[10][15] + coeff0_11*dmats2[11][15] + coeff0_12*dmats2[12][15] + coeff0_13*dmats2[13][15] + coeff0_14*dmats2[14][15] + coeff0_15*dmats2[15][15] + coeff0_16*dmats2[16][15] + coeff0_17*dmats2[17][15] + coeff0_18*dmats2[18][15] + coeff0_19*dmats2[19][15];
 
3530
          new_coeff0_16 = coeff0_0*dmats2[0][16] + coeff0_1*dmats2[1][16] + coeff0_2*dmats2[2][16] + coeff0_3*dmats2[3][16] + coeff0_4*dmats2[4][16] + coeff0_5*dmats2[5][16] + coeff0_6*dmats2[6][16] + coeff0_7*dmats2[7][16] + coeff0_8*dmats2[8][16] + coeff0_9*dmats2[9][16] + coeff0_10*dmats2[10][16] + coeff0_11*dmats2[11][16] + coeff0_12*dmats2[12][16] + coeff0_13*dmats2[13][16] + coeff0_14*dmats2[14][16] + coeff0_15*dmats2[15][16] + coeff0_16*dmats2[16][16] + coeff0_17*dmats2[17][16] + coeff0_18*dmats2[18][16] + coeff0_19*dmats2[19][16];
 
3531
          new_coeff0_17 = coeff0_0*dmats2[0][17] + coeff0_1*dmats2[1][17] + coeff0_2*dmats2[2][17] + coeff0_3*dmats2[3][17] + coeff0_4*dmats2[4][17] + coeff0_5*dmats2[5][17] + coeff0_6*dmats2[6][17] + coeff0_7*dmats2[7][17] + coeff0_8*dmats2[8][17] + coeff0_9*dmats2[9][17] + coeff0_10*dmats2[10][17] + coeff0_11*dmats2[11][17] + coeff0_12*dmats2[12][17] + coeff0_13*dmats2[13][17] + coeff0_14*dmats2[14][17] + coeff0_15*dmats2[15][17] + coeff0_16*dmats2[16][17] + coeff0_17*dmats2[17][17] + coeff0_18*dmats2[18][17] + coeff0_19*dmats2[19][17];
 
3532
          new_coeff0_18 = coeff0_0*dmats2[0][18] + coeff0_1*dmats2[1][18] + coeff0_2*dmats2[2][18] + coeff0_3*dmats2[3][18] + coeff0_4*dmats2[4][18] + coeff0_5*dmats2[5][18] + coeff0_6*dmats2[6][18] + coeff0_7*dmats2[7][18] + coeff0_8*dmats2[8][18] + coeff0_9*dmats2[9][18] + coeff0_10*dmats2[10][18] + coeff0_11*dmats2[11][18] + coeff0_12*dmats2[12][18] + coeff0_13*dmats2[13][18] + coeff0_14*dmats2[14][18] + coeff0_15*dmats2[15][18] + coeff0_16*dmats2[16][18] + coeff0_17*dmats2[17][18] + coeff0_18*dmats2[18][18] + coeff0_19*dmats2[19][18];
 
3533
          new_coeff0_19 = coeff0_0*dmats2[0][19] + coeff0_1*dmats2[1][19] + coeff0_2*dmats2[2][19] + coeff0_3*dmats2[3][19] + coeff0_4*dmats2[4][19] + coeff0_5*dmats2[5][19] + coeff0_6*dmats2[6][19] + coeff0_7*dmats2[7][19] + coeff0_8*dmats2[8][19] + coeff0_9*dmats2[9][19] + coeff0_10*dmats2[10][19] + coeff0_11*dmats2[11][19] + coeff0_12*dmats2[12][19] + coeff0_13*dmats2[13][19] + coeff0_14*dmats2[14][19] + coeff0_15*dmats2[15][19] + coeff0_16*dmats2[16][19] + coeff0_17*dmats2[17][19] + coeff0_18*dmats2[18][19] + coeff0_19*dmats2[19][19];
 
3534
        }
 
3535
    
 
3536
      }
 
3537
      // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
3538
      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 + new_coeff0_15*basisvalue15 + new_coeff0_16*basisvalue16 + new_coeff0_17*basisvalue17 + new_coeff0_18*basisvalue18 + new_coeff0_19*basisvalue19;
 
3539
    }
 
3540
    
 
3541
    // Transform derivatives back to physical element
 
3542
    for (unsigned int row = 0; row < num_derivatives; row++)
 
3543
    {
 
3544
      for (unsigned int col = 0; col < num_derivatives; col++)
 
3545
      {
 
3546
        values[row] += transform[row][col]*derivatives[col];
 
3547
      }
 
3548
    }
 
3549
    // Delete pointer to array of derivatives on FIAT element
 
3550
    delete [] derivatives;
 
3551
    
 
3552
    // Delete pointer to array of combinations of derivatives and transform
 
3553
    for (unsigned int row = 0; row < num_derivatives; row++)
 
3554
    {
 
3555
      delete [] combinations[row];
 
3556
      delete [] transform[row];
 
3557
    }
 
3558
    
 
3559
    delete [] combinations;
 
3560
    delete [] transform;
 
3561
  }
 
3562
 
 
3563
  /// Evaluate order n derivatives of all basis functions at given point in cell
 
3564
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
3565
                                              double* values,
 
3566
                                              const double* coordinates,
 
3567
                                              const ufc::cell& c) const
 
3568
  {
 
3569
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
 
3570
  }
 
3571
 
 
3572
  /// Evaluate linear functional for dof i on the function f
 
3573
  virtual double evaluate_dof(unsigned int i,
 
3574
                              const ufc::function& f,
 
3575
                              const ufc::cell& c) const
 
3576
  {
 
3577
    // The reference points, direction and weights:
 
3578
    const static double X[20][1][3] = {{{0, 0, 0}}, {{1, 0, 0}}, {{0, 1, 0}}, {{0, 0, 1}}, {{0, 0.666666666666667, 0.333333333333333}}, {{0, 0.333333333333333, 0.666666666666667}}, {{0.666666666666667, 0, 0.333333333333333}}, {{0.333333333333333, 0, 0.666666666666667}}, {{0.666666666666667, 0.333333333333333, 0}}, {{0.333333333333333, 0.666666666666667, 0}}, {{0, 0, 0.333333333333333}}, {{0, 0, 0.666666666666667}}, {{0, 0.333333333333333, 0}}, {{0, 0.666666666666667, 0}}, {{0.333333333333333, 0, 0}}, {{0.666666666666667, 0, 0}}, {{0.333333333333333, 0.333333333333333, 0.333333333333333}}, {{0, 0.333333333333333, 0.333333333333333}}, {{0.333333333333333, 0, 0.333333333333333}}, {{0.333333333333333, 0.333333333333333, 0}}};
 
3579
    const static double W[20][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
 
3580
    const static double D[20][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
 
3581
    
 
3582
    const double * const * x = c.coordinates;
 
3583
    double result = 0.0;
 
3584
    // Iterate over the points:
 
3585
    // Evaluate basis functions for affine mapping
 
3586
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1] - X[i][0][2];
 
3587
    const double w1 = X[i][0][0];
 
3588
    const double w2 = X[i][0][1];
 
3589
    const double w3 = X[i][0][2];
 
3590
    
 
3591
    // Compute affine mapping y = F(X)
 
3592
    double y[3];
 
3593
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0] + w3*x[3][0];
 
3594
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1] + w3*x[3][1];
 
3595
    y[2] = w0*x[0][2] + w1*x[1][2] + w2*x[2][2] + w3*x[3][2];
 
3596
    
 
3597
    // Evaluate function at physical points
 
3598
    double values[1];
 
3599
    f.evaluate(values, y, c);
 
3600
    
 
3601
    // Map function values using appropriate mapping
 
3602
    // Affine map: Do nothing
 
3603
    
 
3604
    // Note that we do not map the weights (yet).
 
3605
    
 
3606
    // Take directional components
 
3607
    for(int k = 0; k < 1; k++)
 
3608
      result += values[k]*D[i][0][k];
 
3609
    // Multiply by weights 
 
3610
    result *= W[i][0];
 
3611
    
 
3612
    return result;
 
3613
  }
 
3614
 
 
3615
  /// Evaluate linear functionals for all dofs on the function f
 
3616
  virtual void evaluate_dofs(double* values,
 
3617
                             const ufc::function& f,
 
3618
                             const ufc::cell& c) const
 
3619
  {
 
3620
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
3621
  }
 
3622
 
 
3623
  /// Interpolate vertex values from dof values
 
3624
  virtual void interpolate_vertex_values(double* vertex_values,
 
3625
                                         const double* dof_values,
 
3626
                                         const ufc::cell& c) const
 
3627
  {
 
3628
    // Evaluate at vertices and use affine mapping
 
3629
    vertex_values[0] = dof_values[0];
 
3630
    vertex_values[1] = dof_values[1];
 
3631
    vertex_values[2] = dof_values[2];
 
3632
    vertex_values[3] = dof_values[3];
 
3633
  }
 
3634
 
 
3635
  /// Return the number of sub elements (for a mixed element)
 
3636
  virtual unsigned int num_sub_elements() const
 
3637
  {
 
3638
    return 1;
 
3639
  }
 
3640
 
 
3641
  /// Create a new finite element for sub element i (for a mixed element)
 
3642
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
3643
  {
 
3644
    return new UFC_Poisson3D_3LinearForm_finite_element_0();
 
3645
  }
 
3646
 
 
3647
};
 
3648
 
 
3649
/// This class defines the interface for a finite element.
 
3650
 
 
3651
class UFC_Poisson3D_3LinearForm_finite_element_1: public ufc::finite_element
 
3652
{
 
3653
public:
 
3654
 
 
3655
  /// Constructor
 
3656
  UFC_Poisson3D_3LinearForm_finite_element_1() : ufc::finite_element()
 
3657
  {
 
3658
    // Do nothing
 
3659
  }
 
3660
 
 
3661
  /// Destructor
 
3662
  virtual ~UFC_Poisson3D_3LinearForm_finite_element_1()
 
3663
  {
 
3664
    // Do nothing
 
3665
  }
 
3666
 
 
3667
  /// Return a string identifying the finite element
 
3668
  virtual const char* signature() const
 
3669
  {
 
3670
    return "Lagrange finite element of degree 3 on a tetrahedron";
 
3671
  }
 
3672
 
 
3673
  /// Return the cell shape
 
3674
  virtual ufc::shape cell_shape() const
 
3675
  {
 
3676
    return ufc::tetrahedron;
 
3677
  }
 
3678
 
 
3679
  /// Return the dimension of the finite element function space
 
3680
  virtual unsigned int space_dimension() const
 
3681
  {
 
3682
    return 20;
 
3683
  }
 
3684
 
 
3685
  /// Return the rank of the value space
 
3686
  virtual unsigned int value_rank() const
 
3687
  {
 
3688
    return 0;
 
3689
  }
 
3690
 
 
3691
  /// Return the dimension of the value space for axis i
 
3692
  virtual unsigned int value_dimension(unsigned int i) const
 
3693
  {
 
3694
    return 1;
 
3695
  }
 
3696
 
 
3697
  /// Evaluate basis function i at given point in cell
 
3698
  virtual void evaluate_basis(unsigned int i,
 
3699
                              double* values,
 
3700
                              const double* coordinates,
 
3701
                              const ufc::cell& c) const
 
3702
  {
 
3703
    // Extract vertex coordinates
 
3704
    const double * const * element_coordinates = c.coordinates;
 
3705
    
 
3706
    // Compute Jacobian of affine map from reference cell
 
3707
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
3708
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
3709
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
3710
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
3711
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
3712
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
3713
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
3714
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
3715
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
3716
      
 
3717
    // Compute sub determinants
 
3718
    const double d00 = J_11*J_22 - J_12*J_21;
 
3719
    const double d01 = J_12*J_20 - J_10*J_22;
 
3720
    const double d02 = J_10*J_21 - J_11*J_20;
 
3721
    
 
3722
    const double d10 = J_02*J_21 - J_01*J_22;
 
3723
    const double d11 = J_00*J_22 - J_02*J_20;
 
3724
    const double d12 = J_01*J_20 - J_00*J_21;
 
3725
    
 
3726
    const double d20 = J_01*J_12 - J_02*J_11;
 
3727
    const double d21 = J_02*J_10 - J_00*J_12;
 
3728
    const double d22 = J_00*J_11 - J_01*J_10;
 
3729
      
 
3730
    // Compute determinant of Jacobian
 
3731
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
3732
    
 
3733
    // Compute inverse of Jacobian
 
3734
    
 
3735
    // Compute constants
 
3736
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
3737
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
3738
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
3739
    
 
3740
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
3741
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
3742
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
3743
    
 
3744
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
3745
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
3746
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
3747
    
 
3748
    // Get coordinates and map to the UFC reference element
 
3749
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
3750
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
3751
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
3752
    
 
3753
    // Map coordinates to the reference cube
 
3754
    if (std::abs(y + z - 1.0) < 1e-14)
 
3755
      x = 1.0;
 
3756
    else
 
3757
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
3758
    if (std::abs(z - 1.0) < 1e-14)
 
3759
      y = -1.0;
 
3760
    else
 
3761
      y = 2.0 * y/(1.0 - z) - 1.0;
 
3762
    z = 2.0 * z - 1.0;
 
3763
    
 
3764
    // Reset values
 
3765
    *values = 0;
 
3766
    
 
3767
    // Map degree of freedom to element degree of freedom
 
3768
    const unsigned int dof = i;
 
3769
    
 
3770
    // Generate scalings
 
3771
    const double scalings_y_0 = 1;
 
3772
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
 
3773
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
 
3774
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
 
3775
    const double scalings_z_0 = 1;
 
3776
    const double scalings_z_1 = scalings_z_0*(0.5 - 0.5*z);
 
3777
    const double scalings_z_2 = scalings_z_1*(0.5 - 0.5*z);
 
3778
    const double scalings_z_3 = scalings_z_2*(0.5 - 0.5*z);
 
3779
    
 
3780
    // Compute psitilde_a
 
3781
    const double psitilde_a_0 = 1;
 
3782
    const double psitilde_a_1 = x;
 
3783
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
 
3784
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
 
3785
    
 
3786
    // Compute psitilde_bs
 
3787
    const double psitilde_bs_0_0 = 1;
 
3788
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
 
3789
    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;
 
3790
    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;
 
3791
    const double psitilde_bs_1_0 = 1;
 
3792
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
 
3793
    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;
 
3794
    const double psitilde_bs_2_0 = 1;
 
3795
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
 
3796
    const double psitilde_bs_3_0 = 1;
 
3797
    
 
3798
    // Compute psitilde_cs
 
3799
    const double psitilde_cs_00_0 = 1;
 
3800
    const double psitilde_cs_00_1 = 2*z + 1;
 
3801
    const double psitilde_cs_00_2 = 0.3125*psitilde_cs_00_1 + 1.875*z*psitilde_cs_00_1 - 0.5625*psitilde_cs_00_0;
 
3802
    const double psitilde_cs_00_3 = 0.155555555555556*psitilde_cs_00_2 + 1.86666666666667*z*psitilde_cs_00_2 - 0.711111111111111*psitilde_cs_00_1;
 
3803
    const double psitilde_cs_01_0 = 1;
 
3804
    const double psitilde_cs_01_1 = 3*z + 2;
 
3805
    const double psitilde_cs_01_2 = 0.777777777777778*psitilde_cs_01_1 + 2.33333333333333*z*psitilde_cs_01_1 - 0.555555555555556*psitilde_cs_01_0;
 
3806
    const double psitilde_cs_02_0 = 1;
 
3807
    const double psitilde_cs_02_1 = 4*z + 3;
 
3808
    const double psitilde_cs_03_0 = 1;
 
3809
    const double psitilde_cs_10_0 = 1;
 
3810
    const double psitilde_cs_10_1 = 3*z + 2;
 
3811
    const double psitilde_cs_10_2 = 0.777777777777778*psitilde_cs_10_1 + 2.33333333333333*z*psitilde_cs_10_1 - 0.555555555555556*psitilde_cs_10_0;
 
3812
    const double psitilde_cs_11_0 = 1;
 
3813
    const double psitilde_cs_11_1 = 4*z + 3;
 
3814
    const double psitilde_cs_12_0 = 1;
 
3815
    const double psitilde_cs_20_0 = 1;
 
3816
    const double psitilde_cs_20_1 = 4*z + 3;
 
3817
    const double psitilde_cs_21_0 = 1;
 
3818
    const double psitilde_cs_30_0 = 1;
 
3819
    
 
3820
    // Compute basisvalues
 
3821
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
3822
    const double basisvalue1 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_0;
 
3823
    const double basisvalue2 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_0;
 
3824
    const double basisvalue3 = 1.11803398874989*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_1;
 
3825
    const double basisvalue4 = 5.1234753829798*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_0;
 
3826
    const double basisvalue5 = 3.96862696659689*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_0;
 
3827
    const double basisvalue6 = 2.29128784747792*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_0;
 
3828
    const double basisvalue7 = 3.24037034920393*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_1;
 
3829
    const double basisvalue8 = 1.87082869338697*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_1;
 
3830
    const double basisvalue9 = 1.3228756555323*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_2;
 
3831
    const double basisvalue10 = 7.93725393319377*psitilde_a_3*scalings_y_3*psitilde_bs_3_0*scalings_z_3*psitilde_cs_30_0;
 
3832
    const double basisvalue11 = 6.70820393249937*psitilde_a_2*scalings_y_2*psitilde_bs_2_1*scalings_z_3*psitilde_cs_21_0;
 
3833
    const double basisvalue12 = 5.19615242270663*psitilde_a_1*scalings_y_1*psitilde_bs_1_2*scalings_z_3*psitilde_cs_12_0;
 
3834
    const double basisvalue13 = 3*psitilde_a_0*scalings_y_0*psitilde_bs_0_3*scalings_z_3*psitilde_cs_03_0;
 
3835
    const double basisvalue14 = 5.80947501931113*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_1;
 
3836
    const double basisvalue15 = 4.5*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_1;
 
3837
    const double basisvalue16 = 2.59807621135332*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_1;
 
3838
    const double basisvalue17 = 3.67423461417477*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_2;
 
3839
    const double basisvalue18 = 2.12132034355964*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_2;
 
3840
    const double basisvalue19 = 1.5*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_3;
 
3841
    
 
3842
    // Table(s) of coefficients
 
3843
    const static double coefficients0[20][20] = \
 
3844
    {{0.0288675134594813, 0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, 0.014173667737846, 0.00818317088384971, 0.0115727512471569, 0.0066815310478106, 0.00472455591261534, -0.028347335475692, -0.0239578711874978, -0.0185576872239523, -0.0107142857142857, -0.0207481250689683, -0.0160714285714286, -0.00927884361197613, -0.0131222664791956, -0.00757614408414158, -0.00535714285714285},
 
3845
    {0.0288675134594813, -0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, -0.014173667737846, 0.00818317088384972, -0.0115727512471569, 0.00668153104781061, 0.00472455591261535, 0.028347335475692, -0.0239578711874977, 0.0185576872239523, -0.0107142857142857, -0.0207481250689683, 0.0160714285714286, -0.00927884361197613, 0.0131222664791956, -0.00757614408414158, -0.00535714285714286},
 
3846
    {0.0288675134594813, 0, -0.0150584650484208, 0.00532397137499948, 0, 0, 0.0245495126515492, 0, -0.0133630620956212, 0.00472455591261535, 0, 0, 0, 0.0428571428571429, 0, 0, -0.0278365308359284, 0, 0.0151522881682832, -0.00535714285714286},
 
3847
    {0.0288675134594812, 0, 0, -0.0159719141249985, 0, 0, 0, 0, 0, 0.0283473354756921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0535714285714286},
 
3848
    {0, 0, 0.112938487863156, -0.063887656499994, 0, 0, 0.0736485379546474, 0, 0.0267261241912424, -0.0236227795630767, 0, 0, 0, 0, 0, 0, 0.0649519052838329, 0, -0.0606091526731327, 0.0267857142857143},
 
3849
    {0, 0, -0.0225876975726313, 0.127775312999988, 0, 0, 0, 0, 0.0668153104781061, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0, 0.0757614408414158, -0.0535714285714286},
 
3850
    {0, 0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, -0.0425210032135381, 0.0245495126515492, 0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, -0.0375, 0.021650635094611, -0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
3851
    {0, -0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, 0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
3852
    {0, 0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, 0.014173667737846, -0.0245495126515492, -0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, -0.0618589574131742, 0.0428571428571429, -0.0069160416896561, -0.0160714285714286, 0.0154647393532936, 0.00874817765279706, 0, -0.00535714285714286},
 
3853
    {0, -0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, 0.0566946709513841, 0.0245495126515492, -0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, 0.0618589574131742, -0.0642857142857143, 0, -0.0214285714285714, 0.00927884361197612, 0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
3854
    {0, -0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, 0.0425210032135381, 0.0245495126515492, -0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, 0.0375, 0.021650635094611, 0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
3855
    {0, 0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, -0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, -0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
3856
    {0, -0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, -0.014173667737846, -0.0245495126515491, 0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, 0.0618589574131742, 0.0428571428571429, -0.0069160416896561, 0.0160714285714286, 0.0154647393532935, -0.00874817765279706, 0, -0.00535714285714285},
 
3857
    {0, 0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, -0.0566946709513841, 0.0245495126515491, 0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, -0.0618589574131742, -0.0642857142857143, 0, 0.0214285714285714, 0.00927884361197613, -0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
3858
    {0, -0.117369119465393, -0.0451753951452625, -0.031943828249997, -0.018298126367785, 0.042521003213538, 0.0409158544192486, 0.0347182537414707, 0.033407655239053, 0.0236227795630767, 0.0850420064270761, 0.0239578711874978, -0.00618589574131742, -0.0107142857142857, 0.0207481250689683, -0.00535714285714286, -0.00927884361197612, -0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
3859
    {0, 0.117369119465393, -0.0451753951452626, -0.031943828249997, -0.018298126367785, -0.0425210032135381, 0.0409158544192486, -0.0347182537414707, 0.033407655239053, 0.0236227795630767, -0.0850420064270761, 0.0239578711874977, 0.00618589574131741, -0.0107142857142857, 0.0207481250689683, 0.00535714285714286, -0.00927884361197612, 0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
3860
    {0.259807621135332, 0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, 0.0850420064270761, -0.0736485379546474, 0.0694365074829413, 0.0400891862868637, -0.0992156741649221, 0, 0, 0, 0, 0, 0.075, -0.0649519052838329, -0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
3861
    {0.259807621135332, -0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, -0.0850420064270761, -0.0736485379546474, -0.0694365074829414, 0.0400891862868637, -0.0992156741649222, 0, 0, 0, 0, 0, -0.075, -0.0649519052838329, 0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
3862
    {0.259807621135332, 0, -0.135526185435788, 0.0479157423749955, -0.10978875820671, 0, 0.0245495126515491, 0, -0.0801783725737273, -0.0992156741649221, 0, 0, 0, 0, -0.0968245836551854, 0, 0.021650635094611, 0, 0.0303045763365663, 0.0267857142857143},
 
3863
    {0.259807621135332, 0, 0, -0.143747227124986, -0.10978875820671, 0, -0.122747563257746, 0, 0, 0.0425210032135381, 0, -0.095831484749991, 0, 0.0428571428571429, 0.0138320833793122, 0, 0.0154647393532935, 0, 0, -0.00535714285714285}};
 
3864
    
 
3865
    // Extract relevant coefficients
 
3866
    const double coeff0_0 = coefficients0[dof][0];
 
3867
    const double coeff0_1 = coefficients0[dof][1];
 
3868
    const double coeff0_2 = coefficients0[dof][2];
 
3869
    const double coeff0_3 = coefficients0[dof][3];
 
3870
    const double coeff0_4 = coefficients0[dof][4];
 
3871
    const double coeff0_5 = coefficients0[dof][5];
 
3872
    const double coeff0_6 = coefficients0[dof][6];
 
3873
    const double coeff0_7 = coefficients0[dof][7];
 
3874
    const double coeff0_8 = coefficients0[dof][8];
 
3875
    const double coeff0_9 = coefficients0[dof][9];
 
3876
    const double coeff0_10 = coefficients0[dof][10];
 
3877
    const double coeff0_11 = coefficients0[dof][11];
 
3878
    const double coeff0_12 = coefficients0[dof][12];
 
3879
    const double coeff0_13 = coefficients0[dof][13];
 
3880
    const double coeff0_14 = coefficients0[dof][14];
 
3881
    const double coeff0_15 = coefficients0[dof][15];
 
3882
    const double coeff0_16 = coefficients0[dof][16];
 
3883
    const double coeff0_17 = coefficients0[dof][17];
 
3884
    const double coeff0_18 = coefficients0[dof][18];
 
3885
    const double coeff0_19 = coefficients0[dof][19];
 
3886
    
 
3887
    // Compute value(s)
 
3888
    *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 + coeff0_15*basisvalue15 + coeff0_16*basisvalue16 + coeff0_17*basisvalue17 + coeff0_18*basisvalue18 + coeff0_19*basisvalue19;
 
3889
  }
 
3890
 
 
3891
  /// Evaluate all basis functions at given point in cell
 
3892
  virtual void evaluate_basis_all(double* values,
 
3893
                                  const double* coordinates,
 
3894
                                  const ufc::cell& c) const
 
3895
  {
 
3896
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
 
3897
  }
 
3898
 
 
3899
  /// Evaluate order n derivatives of basis function i at given point in cell
 
3900
  virtual void evaluate_basis_derivatives(unsigned int i,
 
3901
                                          unsigned int n,
 
3902
                                          double* values,
 
3903
                                          const double* coordinates,
 
3904
                                          const ufc::cell& c) const
 
3905
  {
 
3906
    // Extract vertex coordinates
 
3907
    const double * const * element_coordinates = c.coordinates;
 
3908
    
 
3909
    // Compute Jacobian of affine map from reference cell
 
3910
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
3911
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
3912
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
3913
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
3914
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
3915
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
3916
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
3917
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
3918
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
3919
      
 
3920
    // Compute sub determinants
 
3921
    const double d00 = J_11*J_22 - J_12*J_21;
 
3922
    const double d01 = J_12*J_20 - J_10*J_22;
 
3923
    const double d02 = J_10*J_21 - J_11*J_20;
 
3924
    
 
3925
    const double d10 = J_02*J_21 - J_01*J_22;
 
3926
    const double d11 = J_00*J_22 - J_02*J_20;
 
3927
    const double d12 = J_01*J_20 - J_00*J_21;
 
3928
    
 
3929
    const double d20 = J_01*J_12 - J_02*J_11;
 
3930
    const double d21 = J_02*J_10 - J_00*J_12;
 
3931
    const double d22 = J_00*J_11 - J_01*J_10;
 
3932
      
 
3933
    // Compute determinant of Jacobian
 
3934
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
3935
    
 
3936
    // Compute inverse of Jacobian
 
3937
    
 
3938
    // Compute constants
 
3939
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
3940
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
3941
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
3942
    
 
3943
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
3944
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
3945
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
3946
    
 
3947
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
3948
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
3949
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
3950
    
 
3951
    // Get coordinates and map to the UFC reference element
 
3952
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
3953
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
3954
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
3955
    
 
3956
    // Map coordinates to the reference cube
 
3957
    if (std::abs(y + z - 1.0) < 1e-14)
 
3958
      x = 1.0;
 
3959
    else
 
3960
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
3961
    if (std::abs(z - 1.0) < 1e-14)
 
3962
      y = -1.0;
 
3963
    else
 
3964
      y = 2.0 * y/(1.0 - z) - 1.0;
 
3965
    z = 2.0 * z - 1.0;
 
3966
    
 
3967
    // Compute number of derivatives
 
3968
    unsigned int num_derivatives = 1;
 
3969
    
 
3970
    for (unsigned int j = 0; j < n; j++)
 
3971
      num_derivatives *= 3;
 
3972
    
 
3973
    
 
3974
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
 
3975
    unsigned int **combinations = new unsigned int *[num_derivatives];
 
3976
        
 
3977
    for (unsigned int j = 0; j < num_derivatives; j++)
 
3978
    {
 
3979
      combinations[j] = new unsigned int [n];
 
3980
      for (unsigned int k = 0; k < n; k++)
 
3981
        combinations[j][k] = 0;
 
3982
    }
 
3983
        
 
3984
    // Generate combinations of derivatives
 
3985
    for (unsigned int row = 1; row < num_derivatives; row++)
 
3986
    {
 
3987
      for (unsigned int num = 0; num < row; num++)
 
3988
      {
 
3989
        for (unsigned int col = n-1; col+1 > 0; col--)
 
3990
        {
 
3991
          if (combinations[row][col] + 1 > 2)
 
3992
            combinations[row][col] = 0;
 
3993
          else
 
3994
          {
 
3995
            combinations[row][col] += 1;
 
3996
            break;
 
3997
          }
 
3998
        }
 
3999
      }
 
4000
    }
 
4001
    
 
4002
    // Compute inverse of Jacobian
 
4003
    const double Jinv[3][3] ={{d00 / detJ, d10 / detJ, d20 / detJ}, {d01 / detJ, d11 / detJ, d21 / detJ}, {d02 / detJ, d12 / detJ, d22 / detJ}};
 
4004
    
 
4005
    // Declare transformation matrix
 
4006
    // Declare pointer to two dimensional array and initialise
 
4007
    double **transform = new double *[num_derivatives];
 
4008
        
 
4009
    for (unsigned int j = 0; j < num_derivatives; j++)
 
4010
    {
 
4011
      transform[j] = new double [num_derivatives];
 
4012
      for (unsigned int k = 0; k < num_derivatives; k++)
 
4013
        transform[j][k] = 1;
 
4014
    }
 
4015
    
 
4016
    // Construct transformation matrix
 
4017
    for (unsigned int row = 0; row < num_derivatives; row++)
 
4018
    {
 
4019
      for (unsigned int col = 0; col < num_derivatives; col++)
 
4020
      {
 
4021
        for (unsigned int k = 0; k < n; k++)
 
4022
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
 
4023
      }
 
4024
    }
 
4025
    
 
4026
    // Reset values
 
4027
    for (unsigned int j = 0; j < 1*num_derivatives; j++)
 
4028
      values[j] = 0;
 
4029
    
 
4030
    // Map degree of freedom to element degree of freedom
 
4031
    const unsigned int dof = i;
 
4032
    
 
4033
    // Generate scalings
 
4034
    const double scalings_y_0 = 1;
 
4035
    const double scalings_y_1 = scalings_y_0*(0.5 - 0.5*y);
 
4036
    const double scalings_y_2 = scalings_y_1*(0.5 - 0.5*y);
 
4037
    const double scalings_y_3 = scalings_y_2*(0.5 - 0.5*y);
 
4038
    const double scalings_z_0 = 1;
 
4039
    const double scalings_z_1 = scalings_z_0*(0.5 - 0.5*z);
 
4040
    const double scalings_z_2 = scalings_z_1*(0.5 - 0.5*z);
 
4041
    const double scalings_z_3 = scalings_z_2*(0.5 - 0.5*z);
 
4042
    
 
4043
    // Compute psitilde_a
 
4044
    const double psitilde_a_0 = 1;
 
4045
    const double psitilde_a_1 = x;
 
4046
    const double psitilde_a_2 = 1.5*x*psitilde_a_1 - 0.5*psitilde_a_0;
 
4047
    const double psitilde_a_3 = 1.66666666666667*x*psitilde_a_2 - 0.666666666666667*psitilde_a_1;
 
4048
    
 
4049
    // Compute psitilde_bs
 
4050
    const double psitilde_bs_0_0 = 1;
 
4051
    const double psitilde_bs_0_1 = 1.5*y + 0.5;
 
4052
    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;
 
4053
    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;
 
4054
    const double psitilde_bs_1_0 = 1;
 
4055
    const double psitilde_bs_1_1 = 2.5*y + 1.5;
 
4056
    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;
 
4057
    const double psitilde_bs_2_0 = 1;
 
4058
    const double psitilde_bs_2_1 = 3.5*y + 2.5;
 
4059
    const double psitilde_bs_3_0 = 1;
 
4060
    
 
4061
    // Compute psitilde_cs
 
4062
    const double psitilde_cs_00_0 = 1;
 
4063
    const double psitilde_cs_00_1 = 2*z + 1;
 
4064
    const double psitilde_cs_00_2 = 0.3125*psitilde_cs_00_1 + 1.875*z*psitilde_cs_00_1 - 0.5625*psitilde_cs_00_0;
 
4065
    const double psitilde_cs_00_3 = 0.155555555555556*psitilde_cs_00_2 + 1.86666666666667*z*psitilde_cs_00_2 - 0.711111111111111*psitilde_cs_00_1;
 
4066
    const double psitilde_cs_01_0 = 1;
 
4067
    const double psitilde_cs_01_1 = 3*z + 2;
 
4068
    const double psitilde_cs_01_2 = 0.777777777777778*psitilde_cs_01_1 + 2.33333333333333*z*psitilde_cs_01_1 - 0.555555555555556*psitilde_cs_01_0;
 
4069
    const double psitilde_cs_02_0 = 1;
 
4070
    const double psitilde_cs_02_1 = 4*z + 3;
 
4071
    const double psitilde_cs_03_0 = 1;
 
4072
    const double psitilde_cs_10_0 = 1;
 
4073
    const double psitilde_cs_10_1 = 3*z + 2;
 
4074
    const double psitilde_cs_10_2 = 0.777777777777778*psitilde_cs_10_1 + 2.33333333333333*z*psitilde_cs_10_1 - 0.555555555555556*psitilde_cs_10_0;
 
4075
    const double psitilde_cs_11_0 = 1;
 
4076
    const double psitilde_cs_11_1 = 4*z + 3;
 
4077
    const double psitilde_cs_12_0 = 1;
 
4078
    const double psitilde_cs_20_0 = 1;
 
4079
    const double psitilde_cs_20_1 = 4*z + 3;
 
4080
    const double psitilde_cs_21_0 = 1;
 
4081
    const double psitilde_cs_30_0 = 1;
 
4082
    
 
4083
    // Compute basisvalues
 
4084
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
4085
    const double basisvalue1 = 2.73861278752583*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_0;
 
4086
    const double basisvalue2 = 1.58113883008419*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_0;
 
4087
    const double basisvalue3 = 1.11803398874989*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_1;
 
4088
    const double basisvalue4 = 5.1234753829798*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_0;
 
4089
    const double basisvalue5 = 3.96862696659689*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_0;
 
4090
    const double basisvalue6 = 2.29128784747792*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_0;
 
4091
    const double basisvalue7 = 3.24037034920393*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_1;
 
4092
    const double basisvalue8 = 1.87082869338697*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_1;
 
4093
    const double basisvalue9 = 1.3228756555323*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_2;
 
4094
    const double basisvalue10 = 7.93725393319377*psitilde_a_3*scalings_y_3*psitilde_bs_3_0*scalings_z_3*psitilde_cs_30_0;
 
4095
    const double basisvalue11 = 6.70820393249937*psitilde_a_2*scalings_y_2*psitilde_bs_2_1*scalings_z_3*psitilde_cs_21_0;
 
4096
    const double basisvalue12 = 5.19615242270663*psitilde_a_1*scalings_y_1*psitilde_bs_1_2*scalings_z_3*psitilde_cs_12_0;
 
4097
    const double basisvalue13 = 3*psitilde_a_0*scalings_y_0*psitilde_bs_0_3*scalings_z_3*psitilde_cs_03_0;
 
4098
    const double basisvalue14 = 5.80947501931113*psitilde_a_2*scalings_y_2*psitilde_bs_2_0*scalings_z_2*psitilde_cs_20_1;
 
4099
    const double basisvalue15 = 4.5*psitilde_a_1*scalings_y_1*psitilde_bs_1_1*scalings_z_2*psitilde_cs_11_1;
 
4100
    const double basisvalue16 = 2.59807621135332*psitilde_a_0*scalings_y_0*psitilde_bs_0_2*scalings_z_2*psitilde_cs_02_1;
 
4101
    const double basisvalue17 = 3.67423461417477*psitilde_a_1*scalings_y_1*psitilde_bs_1_0*scalings_z_1*psitilde_cs_10_2;
 
4102
    const double basisvalue18 = 2.12132034355964*psitilde_a_0*scalings_y_0*psitilde_bs_0_1*scalings_z_1*psitilde_cs_01_2;
 
4103
    const double basisvalue19 = 1.5*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_3;
 
4104
    
 
4105
    // Table(s) of coefficients
 
4106
    const static double coefficients0[20][20] = \
 
4107
    {{0.0288675134594813, 0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, 0.014173667737846, 0.00818317088384971, 0.0115727512471569, 0.0066815310478106, 0.00472455591261534, -0.028347335475692, -0.0239578711874978, -0.0185576872239523, -0.0107142857142857, -0.0207481250689683, -0.0160714285714286, -0.00927884361197613, -0.0131222664791956, -0.00757614408414158, -0.00535714285714285},
 
4108
    {0.0288675134594813, -0.0130410132739325, 0.00752923252421044, 0.0053239713749995, 0.018298126367785, -0.014173667737846, 0.00818317088384972, -0.0115727512471569, 0.00668153104781061, 0.00472455591261535, 0.028347335475692, -0.0239578711874977, 0.0185576872239523, -0.0107142857142857, -0.0207481250689683, 0.0160714285714286, -0.00927884361197613, 0.0131222664791956, -0.00757614408414158, -0.00535714285714286},
 
4109
    {0.0288675134594813, 0, -0.0150584650484208, 0.00532397137499948, 0, 0, 0.0245495126515492, 0, -0.0133630620956212, 0.00472455591261535, 0, 0, 0, 0.0428571428571429, 0, 0, -0.0278365308359284, 0, 0.0151522881682832, -0.00535714285714286},
 
4110
    {0.0288675134594812, 0, 0, -0.0159719141249985, 0, 0, 0, 0, 0, 0.0283473354756921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0535714285714286},
 
4111
    {0, 0, 0.112938487863156, -0.063887656499994, 0, 0, 0.0736485379546474, 0, 0.0267261241912424, -0.0236227795630767, 0, 0, 0, 0, 0, 0, 0.0649519052838329, 0, -0.0606091526731327, 0.0267857142857143},
 
4112
    {0, 0, -0.0225876975726313, 0.127775312999988, 0, 0, 0, 0, 0.0668153104781061, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0, 0.0757614408414158, -0.0535714285714286},
 
4113
    {0, 0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, -0.0425210032135381, 0.0245495126515492, 0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, -0.0375, 0.021650635094611, -0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
4114
    {0, -0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, 0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, 0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
4115
    {0, 0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, 0.014173667737846, -0.0245495126515492, -0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, -0.0618589574131742, 0.0428571428571429, -0.0069160416896561, -0.0160714285714286, 0.0154647393532936, 0.00874817765279706, 0, -0.00535714285714286},
 
4116
    {0, -0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, 0.0566946709513841, 0.0245495126515492, -0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, 0.0618589574131742, -0.0642857142857143, 0, -0.0214285714285714, 0.00927884361197612, 0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
4117
    {0, -0.0978075995544939, -0.0564692439315782, -0.063887656499994, 0.054894379103355, 0.0425210032135381, 0.0245495126515492, -0.0231455024943138, -0.0133630620956212, -0.0236227795630767, 0, 0, 0, 0, 0.0484122918275927, 0.0375, 0.021650635094611, 0.0524890659167824, 0.0303045763365663, 0.0267857142857143},
 
4118
    {0, 0.0195615199108988, 0.0112938487863156, 0.127775312999988, 0, 0, 0, -0.0578637562357845, -0.0334076552390531, 0.0472455591261534, 0, 0, 0, 0, 0, 0, 0, -0.065611332395978, -0.0378807204207079, -0.0535714285714286},
 
4119
    {0, -0.0978075995544939, -0.0790569415042095, -0.031943828249997, 0.054894379103355, -0.014173667737846, -0.0245495126515491, 0.0462910049886276, 0.0133630620956212, 0.0236227795630767, 0, 0.0479157423749955, 0.0618589574131742, 0.0428571428571429, -0.0069160416896561, 0.0160714285714286, 0.0154647393532935, -0.00874817765279706, 0, -0.00535714285714285},
 
4120
    {0, 0.0195615199108988, 0.124232336649472, -0.031943828249997, 0, -0.0566946709513841, 0.0245495126515491, 0.0115727512471569, -0.0467707173346743, 0.0236227795630767, 0, 0, -0.0618589574131742, -0.0642857142857143, 0, 0.0214285714285714, 0.00927884361197613, -0.00437408882639853, 0.00757614408414158, -0.00535714285714285},
 
4121
    {0, -0.117369119465393, -0.0451753951452625, -0.031943828249997, -0.018298126367785, 0.042521003213538, 0.0409158544192486, 0.0347182537414707, 0.033407655239053, 0.0236227795630767, 0.0850420064270761, 0.0239578711874978, -0.00618589574131742, -0.0107142857142857, 0.0207481250689683, -0.00535714285714286, -0.00927884361197612, -0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
4122
    {0, 0.117369119465393, -0.0451753951452626, -0.031943828249997, -0.018298126367785, -0.0425210032135381, 0.0409158544192486, -0.0347182537414707, 0.033407655239053, 0.0236227795630767, -0.0850420064270761, 0.0239578711874977, 0.00618589574131741, -0.0107142857142857, 0.0207481250689683, 0.00535714285714286, -0.00927884361197612, 0.00437408882639853, -0.00757614408414158, -0.00535714285714286},
 
4123
    {0.259807621135332, 0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, 0.0850420064270761, -0.0736485379546474, 0.0694365074829413, 0.0400891862868637, -0.0992156741649221, 0, 0, 0, 0, 0, 0.075, -0.0649519052838329, -0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
4124
    {0.259807621135332, -0.117369119465393, 0.0677630927178938, 0.0479157423749955, 0, -0.0850420064270761, -0.0736485379546474, -0.0694365074829414, 0.0400891862868637, -0.0992156741649222, 0, 0, 0, 0, 0, -0.075, -0.0649519052838329, 0.0262445329583912, -0.0151522881682832, 0.0267857142857143},
 
4125
    {0.259807621135332, 0, -0.135526185435788, 0.0479157423749955, -0.10978875820671, 0, 0.0245495126515491, 0, -0.0801783725737273, -0.0992156741649221, 0, 0, 0, 0, -0.0968245836551854, 0, 0.021650635094611, 0, 0.0303045763365663, 0.0267857142857143},
 
4126
    {0.259807621135332, 0, 0, -0.143747227124986, -0.10978875820671, 0, -0.122747563257746, 0, 0, 0.0425210032135381, 0, -0.095831484749991, 0, 0.0428571428571429, 0.0138320833793122, 0, 0.0154647393532935, 0, 0, -0.00535714285714285}};
 
4127
    
 
4128
    // Interesting (new) part
 
4129
    // Tables of derivatives of the polynomial base (transpose)
 
4130
    const static double dmats0[20][20] = \
 
4131
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4132
    {6.32455532033676, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4133
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4134
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4135
    {0, 11.2249721603218, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4136
    {4.58257569495584, 0, 8.36660026534076, -1.18321595661992, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4137
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4138
    {3.74165738677394, 0, 0, 8.69482604771366, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4139
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4140
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4141
    {5.49909083394701, 0, -3.3466401061363, -2.36643191323985, 15.4919333848297, 0, 0.692820323027551, 0, 0.565685424949239, 0.400000000000001, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4142
    {0, 4.89897948556636, 0, 0, 0, 14.1985914794391, 0, -0.82807867121083, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4143
    {3.6, 0, 8.76356092008266, -1.54919333848297, 0, 0, 9.52470471983253, 0, -1.48131215963608, 0.261861468283192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4144
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4145
    {0, 4.24264068711928, 0, 0, 0, 0, 0, 14.3427433120127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4146
    {3.11769145362398, 0, 3.16227766016838, 4.91934955049954, 0, 0, 0, 0, 10.690449676497, -2.41897262725906, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4147
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4148
    {2.54558441227157, 0, 0, 7.66811580507233, 0, 0, 0, 0, 0, 10.3691851174526, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4149
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4150
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
4151
    
 
4152
    const static double dmats1[20][20] = \
 
4153
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4154
    {3.16227766016838, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4155
    {5.47722557505166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4156
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4157
    {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4158
    {2.29128784747792, 7.24568837309472, 4.18330013267038, -0.591607978309959, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4159
    {-2.64575131106459, 0, 9.66091783079296, 0.683130051063973, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4160
    {1.87082869338697, 0, 0, 4.34741302385683, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4161
    {3.24037034920393, 0, 0, 7.52994023880668, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4162
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4163
    {2.74954541697351, 5.79655069847577, -1.67332005306815, -1.18321595661992, 7.74596669241483, -1.2, 0.346410161513776, -0.979795897113271, 0.28284271247462, 0.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4164
    {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 9.16515138991168, 7.09929573971954, -2.04939015319192, -0.414039335605415, -0.478091443733757, 0.169030850945704, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4165
    {1.8, -5.69209978830308, 4.38178046004133, -0.774596669241487, 0, 10.998181667894, 4.76235235991626, 0.962140470884726, -0.740656079818041, 0.130930734141596, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4166
    {5.19615242270664, 0, -3.16227766016838, -2.23606797749979, 0, 0, 13.7477270848675, 0, 0.534522483824849, 0.37796447300923, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4167
    {2.01246117974981, 2.12132034355964, -0.408248290463864, 3.17542648054294, 0, 0, 0, 7.17137165600636, -1.38013111868471, -1.56144011671765, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4168
    {1.55884572681199, 2.73861278752583, 1.58113883008419, 2.45967477524977, 0, 0, 0, 9.25820099772551, 5.34522483824849, -1.20948631362953, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4169
    {-1.8, 0, 3.65148371670111, -2.84018778721878, 0, 0, 0, 0, 12.3442679969674, 1.39659449751035, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4170
    {1.27279220613579, 0, 0, 3.83405790253616, 0, 0, 0, 0, 0, 5.18459255872629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4171
    {2.20454076850486, 0, 0, 6.6407830863536, 0, 0, 0, 0, 0, 8.97997772825746, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4172
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
4173
    
 
4174
    const static double dmats2[20][20] = \
 
4175
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4176
    {3.16227766016838, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4177
    {1.82574185835055, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4178
    {5.16397779494322, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4179
    {2.95803989154981, 5.61248608016091, -1.08012344973464, -0.763762615825972, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4180
    {2.29128784747792, 1.44913767461895, 4.18330013267038, -0.59160797830996, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4181
    {1.32287565553229, 0, 3.86436713231718, -0.341565025531987, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4182
    {1.87082869338697, 7.09929573971954, 0, 4.34741302385683, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4183
    {1.08012344973464, 0, 7.09929573971954, 2.50998007960222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4184
    {-3.81881307912986, 0, 0, 8.87411967464942, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4185
    {2.74954541697351, 5.79655069847577, -1.67332005306815, -1.18321595661992, 7.74596669241483, -1.2, 0.346410161513776, -0.979795897113271, 0.282842712474619, 0.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4186
    {2.32379000772445, 2.44948974278318, 2.82842712474619, -1, 1.30930734141595, 7.09929573971954, -2.04939015319192, -0.414039335605415, -0.478091443733757, 0.169030850945704, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4187
    {1.8, 0.632455532033675, 4.38178046004133, -0.774596669241484, 0, 3.14233761939829, 4.76235235991626, -0.10690449676497, -0.740656079818042, 0.130930734141596, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4188
    {1.03923048454133, 0, 3.16227766016838, -0.447213595499959, 0, 0, 5.8918830363718, 0, -0.53452248382485, 0.0755928946018459, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4189
    {2.01246117974981, 2.12132034355964, -0.408248290463863, 3.17542648054294, 9.07114735222145, 0, 0, 7.17137165600636, -1.38013111868471, -1.56144011671765, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4190
    {1.55884572681199, 0.547722557505165, 1.58113883008419, 2.45967477524977, 0, 9.07114735222145, 0, 1.8516401995451, 5.34522483824849, -1.20948631362953, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4191
    {0.900000000000001, 0, 1.46059348668045, 1.42009389360939, 0, 0, 9.07114735222145, 0, 4.93770719878694, -0.698297248755175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4192
    {1.27279220613578, -6.26099033699941, 0, 3.83405790253616, 0, 0, 0, 10.5830052442584, 0, 5.18459255872629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4193
    {0.734846922834954, 0, -6.26099033699941, 2.21359436211787, 0, 0, 0, 0, 10.5830052442584, 2.99332590941915, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
4194
    {5.7157676649773, 0, 0, -4.69574275274955, 0, 0, 0, 0, 0, 12.69960629311, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
4195
    
 
4196
    // Compute reference derivatives
 
4197
    // Declare pointer to array of derivatives on FIAT element
 
4198
    double *derivatives = new double [num_derivatives];
 
4199
    
 
4200
    // Declare coefficients
 
4201
    double coeff0_0 = 0;
 
4202
    double coeff0_1 = 0;
 
4203
    double coeff0_2 = 0;
 
4204
    double coeff0_3 = 0;
 
4205
    double coeff0_4 = 0;
 
4206
    double coeff0_5 = 0;
 
4207
    double coeff0_6 = 0;
 
4208
    double coeff0_7 = 0;
 
4209
    double coeff0_8 = 0;
 
4210
    double coeff0_9 = 0;
 
4211
    double coeff0_10 = 0;
 
4212
    double coeff0_11 = 0;
 
4213
    double coeff0_12 = 0;
 
4214
    double coeff0_13 = 0;
 
4215
    double coeff0_14 = 0;
 
4216
    double coeff0_15 = 0;
 
4217
    double coeff0_16 = 0;
 
4218
    double coeff0_17 = 0;
 
4219
    double coeff0_18 = 0;
 
4220
    double coeff0_19 = 0;
 
4221
    
 
4222
    // Declare new coefficients
 
4223
    double new_coeff0_0 = 0;
 
4224
    double new_coeff0_1 = 0;
 
4225
    double new_coeff0_2 = 0;
 
4226
    double new_coeff0_3 = 0;
 
4227
    double new_coeff0_4 = 0;
 
4228
    double new_coeff0_5 = 0;
 
4229
    double new_coeff0_6 = 0;
 
4230
    double new_coeff0_7 = 0;
 
4231
    double new_coeff0_8 = 0;
 
4232
    double new_coeff0_9 = 0;
 
4233
    double new_coeff0_10 = 0;
 
4234
    double new_coeff0_11 = 0;
 
4235
    double new_coeff0_12 = 0;
 
4236
    double new_coeff0_13 = 0;
 
4237
    double new_coeff0_14 = 0;
 
4238
    double new_coeff0_15 = 0;
 
4239
    double new_coeff0_16 = 0;
 
4240
    double new_coeff0_17 = 0;
 
4241
    double new_coeff0_18 = 0;
 
4242
    double new_coeff0_19 = 0;
 
4243
    
 
4244
    // Loop possible derivatives
 
4245
    for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
4246
    {
 
4247
      // Get values from coefficients array
 
4248
      new_coeff0_0 = coefficients0[dof][0];
 
4249
      new_coeff0_1 = coefficients0[dof][1];
 
4250
      new_coeff0_2 = coefficients0[dof][2];
 
4251
      new_coeff0_3 = coefficients0[dof][3];
 
4252
      new_coeff0_4 = coefficients0[dof][4];
 
4253
      new_coeff0_5 = coefficients0[dof][5];
 
4254
      new_coeff0_6 = coefficients0[dof][6];
 
4255
      new_coeff0_7 = coefficients0[dof][7];
 
4256
      new_coeff0_8 = coefficients0[dof][8];
 
4257
      new_coeff0_9 = coefficients0[dof][9];
 
4258
      new_coeff0_10 = coefficients0[dof][10];
 
4259
      new_coeff0_11 = coefficients0[dof][11];
 
4260
      new_coeff0_12 = coefficients0[dof][12];
 
4261
      new_coeff0_13 = coefficients0[dof][13];
 
4262
      new_coeff0_14 = coefficients0[dof][14];
 
4263
      new_coeff0_15 = coefficients0[dof][15];
 
4264
      new_coeff0_16 = coefficients0[dof][16];
 
4265
      new_coeff0_17 = coefficients0[dof][17];
 
4266
      new_coeff0_18 = coefficients0[dof][18];
 
4267
      new_coeff0_19 = coefficients0[dof][19];
 
4268
    
 
4269
      // Loop derivative order
 
4270
      for (unsigned int j = 0; j < n; j++)
 
4271
      {
 
4272
        // Update old coefficients
 
4273
        coeff0_0 = new_coeff0_0;
 
4274
        coeff0_1 = new_coeff0_1;
 
4275
        coeff0_2 = new_coeff0_2;
 
4276
        coeff0_3 = new_coeff0_3;
 
4277
        coeff0_4 = new_coeff0_4;
 
4278
        coeff0_5 = new_coeff0_5;
 
4279
        coeff0_6 = new_coeff0_6;
 
4280
        coeff0_7 = new_coeff0_7;
 
4281
        coeff0_8 = new_coeff0_8;
 
4282
        coeff0_9 = new_coeff0_9;
 
4283
        coeff0_10 = new_coeff0_10;
 
4284
        coeff0_11 = new_coeff0_11;
 
4285
        coeff0_12 = new_coeff0_12;
 
4286
        coeff0_13 = new_coeff0_13;
 
4287
        coeff0_14 = new_coeff0_14;
 
4288
        coeff0_15 = new_coeff0_15;
 
4289
        coeff0_16 = new_coeff0_16;
 
4290
        coeff0_17 = new_coeff0_17;
 
4291
        coeff0_18 = new_coeff0_18;
 
4292
        coeff0_19 = new_coeff0_19;
 
4293
    
 
4294
        if(combinations[deriv_num][j] == 0)
 
4295
        {
 
4296
          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] + coeff0_15*dmats0[15][0] + coeff0_16*dmats0[16][0] + coeff0_17*dmats0[17][0] + coeff0_18*dmats0[18][0] + coeff0_19*dmats0[19][0];
 
4297
          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] + coeff0_15*dmats0[15][1] + coeff0_16*dmats0[16][1] + coeff0_17*dmats0[17][1] + coeff0_18*dmats0[18][1] + coeff0_19*dmats0[19][1];
 
4298
          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] + coeff0_15*dmats0[15][2] + coeff0_16*dmats0[16][2] + coeff0_17*dmats0[17][2] + coeff0_18*dmats0[18][2] + coeff0_19*dmats0[19][2];
 
4299
          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] + coeff0_15*dmats0[15][3] + coeff0_16*dmats0[16][3] + coeff0_17*dmats0[17][3] + coeff0_18*dmats0[18][3] + coeff0_19*dmats0[19][3];
 
4300
          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] + coeff0_15*dmats0[15][4] + coeff0_16*dmats0[16][4] + coeff0_17*dmats0[17][4] + coeff0_18*dmats0[18][4] + coeff0_19*dmats0[19][4];
 
4301
          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] + coeff0_15*dmats0[15][5] + coeff0_16*dmats0[16][5] + coeff0_17*dmats0[17][5] + coeff0_18*dmats0[18][5] + coeff0_19*dmats0[19][5];
 
4302
          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] + coeff0_15*dmats0[15][6] + coeff0_16*dmats0[16][6] + coeff0_17*dmats0[17][6] + coeff0_18*dmats0[18][6] + coeff0_19*dmats0[19][6];
 
4303
          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] + coeff0_15*dmats0[15][7] + coeff0_16*dmats0[16][7] + coeff0_17*dmats0[17][7] + coeff0_18*dmats0[18][7] + coeff0_19*dmats0[19][7];
 
4304
          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] + coeff0_15*dmats0[15][8] + coeff0_16*dmats0[16][8] + coeff0_17*dmats0[17][8] + coeff0_18*dmats0[18][8] + coeff0_19*dmats0[19][8];
 
4305
          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] + coeff0_15*dmats0[15][9] + coeff0_16*dmats0[16][9] + coeff0_17*dmats0[17][9] + coeff0_18*dmats0[18][9] + coeff0_19*dmats0[19][9];
 
4306
          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] + coeff0_15*dmats0[15][10] + coeff0_16*dmats0[16][10] + coeff0_17*dmats0[17][10] + coeff0_18*dmats0[18][10] + coeff0_19*dmats0[19][10];
 
4307
          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] + coeff0_15*dmats0[15][11] + coeff0_16*dmats0[16][11] + coeff0_17*dmats0[17][11] + coeff0_18*dmats0[18][11] + coeff0_19*dmats0[19][11];
 
4308
          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] + coeff0_15*dmats0[15][12] + coeff0_16*dmats0[16][12] + coeff0_17*dmats0[17][12] + coeff0_18*dmats0[18][12] + coeff0_19*dmats0[19][12];
 
4309
          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] + coeff0_15*dmats0[15][13] + coeff0_16*dmats0[16][13] + coeff0_17*dmats0[17][13] + coeff0_18*dmats0[18][13] + coeff0_19*dmats0[19][13];
 
4310
          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] + coeff0_15*dmats0[15][14] + coeff0_16*dmats0[16][14] + coeff0_17*dmats0[17][14] + coeff0_18*dmats0[18][14] + coeff0_19*dmats0[19][14];
 
4311
          new_coeff0_15 = coeff0_0*dmats0[0][15] + coeff0_1*dmats0[1][15] + coeff0_2*dmats0[2][15] + coeff0_3*dmats0[3][15] + coeff0_4*dmats0[4][15] + coeff0_5*dmats0[5][15] + coeff0_6*dmats0[6][15] + coeff0_7*dmats0[7][15] + coeff0_8*dmats0[8][15] + coeff0_9*dmats0[9][15] + coeff0_10*dmats0[10][15] + coeff0_11*dmats0[11][15] + coeff0_12*dmats0[12][15] + coeff0_13*dmats0[13][15] + coeff0_14*dmats0[14][15] + coeff0_15*dmats0[15][15] + coeff0_16*dmats0[16][15] + coeff0_17*dmats0[17][15] + coeff0_18*dmats0[18][15] + coeff0_19*dmats0[19][15];
 
4312
          new_coeff0_16 = coeff0_0*dmats0[0][16] + coeff0_1*dmats0[1][16] + coeff0_2*dmats0[2][16] + coeff0_3*dmats0[3][16] + coeff0_4*dmats0[4][16] + coeff0_5*dmats0[5][16] + coeff0_6*dmats0[6][16] + coeff0_7*dmats0[7][16] + coeff0_8*dmats0[8][16] + coeff0_9*dmats0[9][16] + coeff0_10*dmats0[10][16] + coeff0_11*dmats0[11][16] + coeff0_12*dmats0[12][16] + coeff0_13*dmats0[13][16] + coeff0_14*dmats0[14][16] + coeff0_15*dmats0[15][16] + coeff0_16*dmats0[16][16] + coeff0_17*dmats0[17][16] + coeff0_18*dmats0[18][16] + coeff0_19*dmats0[19][16];
 
4313
          new_coeff0_17 = coeff0_0*dmats0[0][17] + coeff0_1*dmats0[1][17] + coeff0_2*dmats0[2][17] + coeff0_3*dmats0[3][17] + coeff0_4*dmats0[4][17] + coeff0_5*dmats0[5][17] + coeff0_6*dmats0[6][17] + coeff0_7*dmats0[7][17] + coeff0_8*dmats0[8][17] + coeff0_9*dmats0[9][17] + coeff0_10*dmats0[10][17] + coeff0_11*dmats0[11][17] + coeff0_12*dmats0[12][17] + coeff0_13*dmats0[13][17] + coeff0_14*dmats0[14][17] + coeff0_15*dmats0[15][17] + coeff0_16*dmats0[16][17] + coeff0_17*dmats0[17][17] + coeff0_18*dmats0[18][17] + coeff0_19*dmats0[19][17];
 
4314
          new_coeff0_18 = coeff0_0*dmats0[0][18] + coeff0_1*dmats0[1][18] + coeff0_2*dmats0[2][18] + coeff0_3*dmats0[3][18] + coeff0_4*dmats0[4][18] + coeff0_5*dmats0[5][18] + coeff0_6*dmats0[6][18] + coeff0_7*dmats0[7][18] + coeff0_8*dmats0[8][18] + coeff0_9*dmats0[9][18] + coeff0_10*dmats0[10][18] + coeff0_11*dmats0[11][18] + coeff0_12*dmats0[12][18] + coeff0_13*dmats0[13][18] + coeff0_14*dmats0[14][18] + coeff0_15*dmats0[15][18] + coeff0_16*dmats0[16][18] + coeff0_17*dmats0[17][18] + coeff0_18*dmats0[18][18] + coeff0_19*dmats0[19][18];
 
4315
          new_coeff0_19 = coeff0_0*dmats0[0][19] + coeff0_1*dmats0[1][19] + coeff0_2*dmats0[2][19] + coeff0_3*dmats0[3][19] + coeff0_4*dmats0[4][19] + coeff0_5*dmats0[5][19] + coeff0_6*dmats0[6][19] + coeff0_7*dmats0[7][19] + coeff0_8*dmats0[8][19] + coeff0_9*dmats0[9][19] + coeff0_10*dmats0[10][19] + coeff0_11*dmats0[11][19] + coeff0_12*dmats0[12][19] + coeff0_13*dmats0[13][19] + coeff0_14*dmats0[14][19] + coeff0_15*dmats0[15][19] + coeff0_16*dmats0[16][19] + coeff0_17*dmats0[17][19] + coeff0_18*dmats0[18][19] + coeff0_19*dmats0[19][19];
 
4316
        }
 
4317
        if(combinations[deriv_num][j] == 1)
 
4318
        {
 
4319
          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] + coeff0_15*dmats1[15][0] + coeff0_16*dmats1[16][0] + coeff0_17*dmats1[17][0] + coeff0_18*dmats1[18][0] + coeff0_19*dmats1[19][0];
 
4320
          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] + coeff0_15*dmats1[15][1] + coeff0_16*dmats1[16][1] + coeff0_17*dmats1[17][1] + coeff0_18*dmats1[18][1] + coeff0_19*dmats1[19][1];
 
4321
          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] + coeff0_15*dmats1[15][2] + coeff0_16*dmats1[16][2] + coeff0_17*dmats1[17][2] + coeff0_18*dmats1[18][2] + coeff0_19*dmats1[19][2];
 
4322
          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] + coeff0_15*dmats1[15][3] + coeff0_16*dmats1[16][3] + coeff0_17*dmats1[17][3] + coeff0_18*dmats1[18][3] + coeff0_19*dmats1[19][3];
 
4323
          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] + coeff0_15*dmats1[15][4] + coeff0_16*dmats1[16][4] + coeff0_17*dmats1[17][4] + coeff0_18*dmats1[18][4] + coeff0_19*dmats1[19][4];
 
4324
          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] + coeff0_15*dmats1[15][5] + coeff0_16*dmats1[16][5] + coeff0_17*dmats1[17][5] + coeff0_18*dmats1[18][5] + coeff0_19*dmats1[19][5];
 
4325
          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] + coeff0_15*dmats1[15][6] + coeff0_16*dmats1[16][6] + coeff0_17*dmats1[17][6] + coeff0_18*dmats1[18][6] + coeff0_19*dmats1[19][6];
 
4326
          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] + coeff0_15*dmats1[15][7] + coeff0_16*dmats1[16][7] + coeff0_17*dmats1[17][7] + coeff0_18*dmats1[18][7] + coeff0_19*dmats1[19][7];
 
4327
          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] + coeff0_15*dmats1[15][8] + coeff0_16*dmats1[16][8] + coeff0_17*dmats1[17][8] + coeff0_18*dmats1[18][8] + coeff0_19*dmats1[19][8];
 
4328
          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] + coeff0_15*dmats1[15][9] + coeff0_16*dmats1[16][9] + coeff0_17*dmats1[17][9] + coeff0_18*dmats1[18][9] + coeff0_19*dmats1[19][9];
 
4329
          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] + coeff0_15*dmats1[15][10] + coeff0_16*dmats1[16][10] + coeff0_17*dmats1[17][10] + coeff0_18*dmats1[18][10] + coeff0_19*dmats1[19][10];
 
4330
          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] + coeff0_15*dmats1[15][11] + coeff0_16*dmats1[16][11] + coeff0_17*dmats1[17][11] + coeff0_18*dmats1[18][11] + coeff0_19*dmats1[19][11];
 
4331
          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] + coeff0_15*dmats1[15][12] + coeff0_16*dmats1[16][12] + coeff0_17*dmats1[17][12] + coeff0_18*dmats1[18][12] + coeff0_19*dmats1[19][12];
 
4332
          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] + coeff0_15*dmats1[15][13] + coeff0_16*dmats1[16][13] + coeff0_17*dmats1[17][13] + coeff0_18*dmats1[18][13] + coeff0_19*dmats1[19][13];
 
4333
          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] + coeff0_15*dmats1[15][14] + coeff0_16*dmats1[16][14] + coeff0_17*dmats1[17][14] + coeff0_18*dmats1[18][14] + coeff0_19*dmats1[19][14];
 
4334
          new_coeff0_15 = coeff0_0*dmats1[0][15] + coeff0_1*dmats1[1][15] + coeff0_2*dmats1[2][15] + coeff0_3*dmats1[3][15] + coeff0_4*dmats1[4][15] + coeff0_5*dmats1[5][15] + coeff0_6*dmats1[6][15] + coeff0_7*dmats1[7][15] + coeff0_8*dmats1[8][15] + coeff0_9*dmats1[9][15] + coeff0_10*dmats1[10][15] + coeff0_11*dmats1[11][15] + coeff0_12*dmats1[12][15] + coeff0_13*dmats1[13][15] + coeff0_14*dmats1[14][15] + coeff0_15*dmats1[15][15] + coeff0_16*dmats1[16][15] + coeff0_17*dmats1[17][15] + coeff0_18*dmats1[18][15] + coeff0_19*dmats1[19][15];
 
4335
          new_coeff0_16 = coeff0_0*dmats1[0][16] + coeff0_1*dmats1[1][16] + coeff0_2*dmats1[2][16] + coeff0_3*dmats1[3][16] + coeff0_4*dmats1[4][16] + coeff0_5*dmats1[5][16] + coeff0_6*dmats1[6][16] + coeff0_7*dmats1[7][16] + coeff0_8*dmats1[8][16] + coeff0_9*dmats1[9][16] + coeff0_10*dmats1[10][16] + coeff0_11*dmats1[11][16] + coeff0_12*dmats1[12][16] + coeff0_13*dmats1[13][16] + coeff0_14*dmats1[14][16] + coeff0_15*dmats1[15][16] + coeff0_16*dmats1[16][16] + coeff0_17*dmats1[17][16] + coeff0_18*dmats1[18][16] + coeff0_19*dmats1[19][16];
 
4336
          new_coeff0_17 = coeff0_0*dmats1[0][17] + coeff0_1*dmats1[1][17] + coeff0_2*dmats1[2][17] + coeff0_3*dmats1[3][17] + coeff0_4*dmats1[4][17] + coeff0_5*dmats1[5][17] + coeff0_6*dmats1[6][17] + coeff0_7*dmats1[7][17] + coeff0_8*dmats1[8][17] + coeff0_9*dmats1[9][17] + coeff0_10*dmats1[10][17] + coeff0_11*dmats1[11][17] + coeff0_12*dmats1[12][17] + coeff0_13*dmats1[13][17] + coeff0_14*dmats1[14][17] + coeff0_15*dmats1[15][17] + coeff0_16*dmats1[16][17] + coeff0_17*dmats1[17][17] + coeff0_18*dmats1[18][17] + coeff0_19*dmats1[19][17];
 
4337
          new_coeff0_18 = coeff0_0*dmats1[0][18] + coeff0_1*dmats1[1][18] + coeff0_2*dmats1[2][18] + coeff0_3*dmats1[3][18] + coeff0_4*dmats1[4][18] + coeff0_5*dmats1[5][18] + coeff0_6*dmats1[6][18] + coeff0_7*dmats1[7][18] + coeff0_8*dmats1[8][18] + coeff0_9*dmats1[9][18] + coeff0_10*dmats1[10][18] + coeff0_11*dmats1[11][18] + coeff0_12*dmats1[12][18] + coeff0_13*dmats1[13][18] + coeff0_14*dmats1[14][18] + coeff0_15*dmats1[15][18] + coeff0_16*dmats1[16][18] + coeff0_17*dmats1[17][18] + coeff0_18*dmats1[18][18] + coeff0_19*dmats1[19][18];
 
4338
          new_coeff0_19 = coeff0_0*dmats1[0][19] + coeff0_1*dmats1[1][19] + coeff0_2*dmats1[2][19] + coeff0_3*dmats1[3][19] + coeff0_4*dmats1[4][19] + coeff0_5*dmats1[5][19] + coeff0_6*dmats1[6][19] + coeff0_7*dmats1[7][19] + coeff0_8*dmats1[8][19] + coeff0_9*dmats1[9][19] + coeff0_10*dmats1[10][19] + coeff0_11*dmats1[11][19] + coeff0_12*dmats1[12][19] + coeff0_13*dmats1[13][19] + coeff0_14*dmats1[14][19] + coeff0_15*dmats1[15][19] + coeff0_16*dmats1[16][19] + coeff0_17*dmats1[17][19] + coeff0_18*dmats1[18][19] + coeff0_19*dmats1[19][19];
 
4339
        }
 
4340
        if(combinations[deriv_num][j] == 2)
 
4341
        {
 
4342
          new_coeff0_0 = coeff0_0*dmats2[0][0] + coeff0_1*dmats2[1][0] + coeff0_2*dmats2[2][0] + coeff0_3*dmats2[3][0] + coeff0_4*dmats2[4][0] + coeff0_5*dmats2[5][0] + coeff0_6*dmats2[6][0] + coeff0_7*dmats2[7][0] + coeff0_8*dmats2[8][0] + coeff0_9*dmats2[9][0] + coeff0_10*dmats2[10][0] + coeff0_11*dmats2[11][0] + coeff0_12*dmats2[12][0] + coeff0_13*dmats2[13][0] + coeff0_14*dmats2[14][0] + coeff0_15*dmats2[15][0] + coeff0_16*dmats2[16][0] + coeff0_17*dmats2[17][0] + coeff0_18*dmats2[18][0] + coeff0_19*dmats2[19][0];
 
4343
          new_coeff0_1 = coeff0_0*dmats2[0][1] + coeff0_1*dmats2[1][1] + coeff0_2*dmats2[2][1] + coeff0_3*dmats2[3][1] + coeff0_4*dmats2[4][1] + coeff0_5*dmats2[5][1] + coeff0_6*dmats2[6][1] + coeff0_7*dmats2[7][1] + coeff0_8*dmats2[8][1] + coeff0_9*dmats2[9][1] + coeff0_10*dmats2[10][1] + coeff0_11*dmats2[11][1] + coeff0_12*dmats2[12][1] + coeff0_13*dmats2[13][1] + coeff0_14*dmats2[14][1] + coeff0_15*dmats2[15][1] + coeff0_16*dmats2[16][1] + coeff0_17*dmats2[17][1] + coeff0_18*dmats2[18][1] + coeff0_19*dmats2[19][1];
 
4344
          new_coeff0_2 = coeff0_0*dmats2[0][2] + coeff0_1*dmats2[1][2] + coeff0_2*dmats2[2][2] + coeff0_3*dmats2[3][2] + coeff0_4*dmats2[4][2] + coeff0_5*dmats2[5][2] + coeff0_6*dmats2[6][2] + coeff0_7*dmats2[7][2] + coeff0_8*dmats2[8][2] + coeff0_9*dmats2[9][2] + coeff0_10*dmats2[10][2] + coeff0_11*dmats2[11][2] + coeff0_12*dmats2[12][2] + coeff0_13*dmats2[13][2] + coeff0_14*dmats2[14][2] + coeff0_15*dmats2[15][2] + coeff0_16*dmats2[16][2] + coeff0_17*dmats2[17][2] + coeff0_18*dmats2[18][2] + coeff0_19*dmats2[19][2];
 
4345
          new_coeff0_3 = coeff0_0*dmats2[0][3] + coeff0_1*dmats2[1][3] + coeff0_2*dmats2[2][3] + coeff0_3*dmats2[3][3] + coeff0_4*dmats2[4][3] + coeff0_5*dmats2[5][3] + coeff0_6*dmats2[6][3] + coeff0_7*dmats2[7][3] + coeff0_8*dmats2[8][3] + coeff0_9*dmats2[9][3] + coeff0_10*dmats2[10][3] + coeff0_11*dmats2[11][3] + coeff0_12*dmats2[12][3] + coeff0_13*dmats2[13][3] + coeff0_14*dmats2[14][3] + coeff0_15*dmats2[15][3] + coeff0_16*dmats2[16][3] + coeff0_17*dmats2[17][3] + coeff0_18*dmats2[18][3] + coeff0_19*dmats2[19][3];
 
4346
          new_coeff0_4 = coeff0_0*dmats2[0][4] + coeff0_1*dmats2[1][4] + coeff0_2*dmats2[2][4] + coeff0_3*dmats2[3][4] + coeff0_4*dmats2[4][4] + coeff0_5*dmats2[5][4] + coeff0_6*dmats2[6][4] + coeff0_7*dmats2[7][4] + coeff0_8*dmats2[8][4] + coeff0_9*dmats2[9][4] + coeff0_10*dmats2[10][4] + coeff0_11*dmats2[11][4] + coeff0_12*dmats2[12][4] + coeff0_13*dmats2[13][4] + coeff0_14*dmats2[14][4] + coeff0_15*dmats2[15][4] + coeff0_16*dmats2[16][4] + coeff0_17*dmats2[17][4] + coeff0_18*dmats2[18][4] + coeff0_19*dmats2[19][4];
 
4347
          new_coeff0_5 = coeff0_0*dmats2[0][5] + coeff0_1*dmats2[1][5] + coeff0_2*dmats2[2][5] + coeff0_3*dmats2[3][5] + coeff0_4*dmats2[4][5] + coeff0_5*dmats2[5][5] + coeff0_6*dmats2[6][5] + coeff0_7*dmats2[7][5] + coeff0_8*dmats2[8][5] + coeff0_9*dmats2[9][5] + coeff0_10*dmats2[10][5] + coeff0_11*dmats2[11][5] + coeff0_12*dmats2[12][5] + coeff0_13*dmats2[13][5] + coeff0_14*dmats2[14][5] + coeff0_15*dmats2[15][5] + coeff0_16*dmats2[16][5] + coeff0_17*dmats2[17][5] + coeff0_18*dmats2[18][5] + coeff0_19*dmats2[19][5];
 
4348
          new_coeff0_6 = coeff0_0*dmats2[0][6] + coeff0_1*dmats2[1][6] + coeff0_2*dmats2[2][6] + coeff0_3*dmats2[3][6] + coeff0_4*dmats2[4][6] + coeff0_5*dmats2[5][6] + coeff0_6*dmats2[6][6] + coeff0_7*dmats2[7][6] + coeff0_8*dmats2[8][6] + coeff0_9*dmats2[9][6] + coeff0_10*dmats2[10][6] + coeff0_11*dmats2[11][6] + coeff0_12*dmats2[12][6] + coeff0_13*dmats2[13][6] + coeff0_14*dmats2[14][6] + coeff0_15*dmats2[15][6] + coeff0_16*dmats2[16][6] + coeff0_17*dmats2[17][6] + coeff0_18*dmats2[18][6] + coeff0_19*dmats2[19][6];
 
4349
          new_coeff0_7 = coeff0_0*dmats2[0][7] + coeff0_1*dmats2[1][7] + coeff0_2*dmats2[2][7] + coeff0_3*dmats2[3][7] + coeff0_4*dmats2[4][7] + coeff0_5*dmats2[5][7] + coeff0_6*dmats2[6][7] + coeff0_7*dmats2[7][7] + coeff0_8*dmats2[8][7] + coeff0_9*dmats2[9][7] + coeff0_10*dmats2[10][7] + coeff0_11*dmats2[11][7] + coeff0_12*dmats2[12][7] + coeff0_13*dmats2[13][7] + coeff0_14*dmats2[14][7] + coeff0_15*dmats2[15][7] + coeff0_16*dmats2[16][7] + coeff0_17*dmats2[17][7] + coeff0_18*dmats2[18][7] + coeff0_19*dmats2[19][7];
 
4350
          new_coeff0_8 = coeff0_0*dmats2[0][8] + coeff0_1*dmats2[1][8] + coeff0_2*dmats2[2][8] + coeff0_3*dmats2[3][8] + coeff0_4*dmats2[4][8] + coeff0_5*dmats2[5][8] + coeff0_6*dmats2[6][8] + coeff0_7*dmats2[7][8] + coeff0_8*dmats2[8][8] + coeff0_9*dmats2[9][8] + coeff0_10*dmats2[10][8] + coeff0_11*dmats2[11][8] + coeff0_12*dmats2[12][8] + coeff0_13*dmats2[13][8] + coeff0_14*dmats2[14][8] + coeff0_15*dmats2[15][8] + coeff0_16*dmats2[16][8] + coeff0_17*dmats2[17][8] + coeff0_18*dmats2[18][8] + coeff0_19*dmats2[19][8];
 
4351
          new_coeff0_9 = coeff0_0*dmats2[0][9] + coeff0_1*dmats2[1][9] + coeff0_2*dmats2[2][9] + coeff0_3*dmats2[3][9] + coeff0_4*dmats2[4][9] + coeff0_5*dmats2[5][9] + coeff0_6*dmats2[6][9] + coeff0_7*dmats2[7][9] + coeff0_8*dmats2[8][9] + coeff0_9*dmats2[9][9] + coeff0_10*dmats2[10][9] + coeff0_11*dmats2[11][9] + coeff0_12*dmats2[12][9] + coeff0_13*dmats2[13][9] + coeff0_14*dmats2[14][9] + coeff0_15*dmats2[15][9] + coeff0_16*dmats2[16][9] + coeff0_17*dmats2[17][9] + coeff0_18*dmats2[18][9] + coeff0_19*dmats2[19][9];
 
4352
          new_coeff0_10 = coeff0_0*dmats2[0][10] + coeff0_1*dmats2[1][10] + coeff0_2*dmats2[2][10] + coeff0_3*dmats2[3][10] + coeff0_4*dmats2[4][10] + coeff0_5*dmats2[5][10] + coeff0_6*dmats2[6][10] + coeff0_7*dmats2[7][10] + coeff0_8*dmats2[8][10] + coeff0_9*dmats2[9][10] + coeff0_10*dmats2[10][10] + coeff0_11*dmats2[11][10] + coeff0_12*dmats2[12][10] + coeff0_13*dmats2[13][10] + coeff0_14*dmats2[14][10] + coeff0_15*dmats2[15][10] + coeff0_16*dmats2[16][10] + coeff0_17*dmats2[17][10] + coeff0_18*dmats2[18][10] + coeff0_19*dmats2[19][10];
 
4353
          new_coeff0_11 = coeff0_0*dmats2[0][11] + coeff0_1*dmats2[1][11] + coeff0_2*dmats2[2][11] + coeff0_3*dmats2[3][11] + coeff0_4*dmats2[4][11] + coeff0_5*dmats2[5][11] + coeff0_6*dmats2[6][11] + coeff0_7*dmats2[7][11] + coeff0_8*dmats2[8][11] + coeff0_9*dmats2[9][11] + coeff0_10*dmats2[10][11] + coeff0_11*dmats2[11][11] + coeff0_12*dmats2[12][11] + coeff0_13*dmats2[13][11] + coeff0_14*dmats2[14][11] + coeff0_15*dmats2[15][11] + coeff0_16*dmats2[16][11] + coeff0_17*dmats2[17][11] + coeff0_18*dmats2[18][11] + coeff0_19*dmats2[19][11];
 
4354
          new_coeff0_12 = coeff0_0*dmats2[0][12] + coeff0_1*dmats2[1][12] + coeff0_2*dmats2[2][12] + coeff0_3*dmats2[3][12] + coeff0_4*dmats2[4][12] + coeff0_5*dmats2[5][12] + coeff0_6*dmats2[6][12] + coeff0_7*dmats2[7][12] + coeff0_8*dmats2[8][12] + coeff0_9*dmats2[9][12] + coeff0_10*dmats2[10][12] + coeff0_11*dmats2[11][12] + coeff0_12*dmats2[12][12] + coeff0_13*dmats2[13][12] + coeff0_14*dmats2[14][12] + coeff0_15*dmats2[15][12] + coeff0_16*dmats2[16][12] + coeff0_17*dmats2[17][12] + coeff0_18*dmats2[18][12] + coeff0_19*dmats2[19][12];
 
4355
          new_coeff0_13 = coeff0_0*dmats2[0][13] + coeff0_1*dmats2[1][13] + coeff0_2*dmats2[2][13] + coeff0_3*dmats2[3][13] + coeff0_4*dmats2[4][13] + coeff0_5*dmats2[5][13] + coeff0_6*dmats2[6][13] + coeff0_7*dmats2[7][13] + coeff0_8*dmats2[8][13] + coeff0_9*dmats2[9][13] + coeff0_10*dmats2[10][13] + coeff0_11*dmats2[11][13] + coeff0_12*dmats2[12][13] + coeff0_13*dmats2[13][13] + coeff0_14*dmats2[14][13] + coeff0_15*dmats2[15][13] + coeff0_16*dmats2[16][13] + coeff0_17*dmats2[17][13] + coeff0_18*dmats2[18][13] + coeff0_19*dmats2[19][13];
 
4356
          new_coeff0_14 = coeff0_0*dmats2[0][14] + coeff0_1*dmats2[1][14] + coeff0_2*dmats2[2][14] + coeff0_3*dmats2[3][14] + coeff0_4*dmats2[4][14] + coeff0_5*dmats2[5][14] + coeff0_6*dmats2[6][14] + coeff0_7*dmats2[7][14] + coeff0_8*dmats2[8][14] + coeff0_9*dmats2[9][14] + coeff0_10*dmats2[10][14] + coeff0_11*dmats2[11][14] + coeff0_12*dmats2[12][14] + coeff0_13*dmats2[13][14] + coeff0_14*dmats2[14][14] + coeff0_15*dmats2[15][14] + coeff0_16*dmats2[16][14] + coeff0_17*dmats2[17][14] + coeff0_18*dmats2[18][14] + coeff0_19*dmats2[19][14];
 
4357
          new_coeff0_15 = coeff0_0*dmats2[0][15] + coeff0_1*dmats2[1][15] + coeff0_2*dmats2[2][15] + coeff0_3*dmats2[3][15] + coeff0_4*dmats2[4][15] + coeff0_5*dmats2[5][15] + coeff0_6*dmats2[6][15] + coeff0_7*dmats2[7][15] + coeff0_8*dmats2[8][15] + coeff0_9*dmats2[9][15] + coeff0_10*dmats2[10][15] + coeff0_11*dmats2[11][15] + coeff0_12*dmats2[12][15] + coeff0_13*dmats2[13][15] + coeff0_14*dmats2[14][15] + coeff0_15*dmats2[15][15] + coeff0_16*dmats2[16][15] + coeff0_17*dmats2[17][15] + coeff0_18*dmats2[18][15] + coeff0_19*dmats2[19][15];
 
4358
          new_coeff0_16 = coeff0_0*dmats2[0][16] + coeff0_1*dmats2[1][16] + coeff0_2*dmats2[2][16] + coeff0_3*dmats2[3][16] + coeff0_4*dmats2[4][16] + coeff0_5*dmats2[5][16] + coeff0_6*dmats2[6][16] + coeff0_7*dmats2[7][16] + coeff0_8*dmats2[8][16] + coeff0_9*dmats2[9][16] + coeff0_10*dmats2[10][16] + coeff0_11*dmats2[11][16] + coeff0_12*dmats2[12][16] + coeff0_13*dmats2[13][16] + coeff0_14*dmats2[14][16] + coeff0_15*dmats2[15][16] + coeff0_16*dmats2[16][16] + coeff0_17*dmats2[17][16] + coeff0_18*dmats2[18][16] + coeff0_19*dmats2[19][16];
 
4359
          new_coeff0_17 = coeff0_0*dmats2[0][17] + coeff0_1*dmats2[1][17] + coeff0_2*dmats2[2][17] + coeff0_3*dmats2[3][17] + coeff0_4*dmats2[4][17] + coeff0_5*dmats2[5][17] + coeff0_6*dmats2[6][17] + coeff0_7*dmats2[7][17] + coeff0_8*dmats2[8][17] + coeff0_9*dmats2[9][17] + coeff0_10*dmats2[10][17] + coeff0_11*dmats2[11][17] + coeff0_12*dmats2[12][17] + coeff0_13*dmats2[13][17] + coeff0_14*dmats2[14][17] + coeff0_15*dmats2[15][17] + coeff0_16*dmats2[16][17] + coeff0_17*dmats2[17][17] + coeff0_18*dmats2[18][17] + coeff0_19*dmats2[19][17];
 
4360
          new_coeff0_18 = coeff0_0*dmats2[0][18] + coeff0_1*dmats2[1][18] + coeff0_2*dmats2[2][18] + coeff0_3*dmats2[3][18] + coeff0_4*dmats2[4][18] + coeff0_5*dmats2[5][18] + coeff0_6*dmats2[6][18] + coeff0_7*dmats2[7][18] + coeff0_8*dmats2[8][18] + coeff0_9*dmats2[9][18] + coeff0_10*dmats2[10][18] + coeff0_11*dmats2[11][18] + coeff0_12*dmats2[12][18] + coeff0_13*dmats2[13][18] + coeff0_14*dmats2[14][18] + coeff0_15*dmats2[15][18] + coeff0_16*dmats2[16][18] + coeff0_17*dmats2[17][18] + coeff0_18*dmats2[18][18] + coeff0_19*dmats2[19][18];
 
4361
          new_coeff0_19 = coeff0_0*dmats2[0][19] + coeff0_1*dmats2[1][19] + coeff0_2*dmats2[2][19] + coeff0_3*dmats2[3][19] + coeff0_4*dmats2[4][19] + coeff0_5*dmats2[5][19] + coeff0_6*dmats2[6][19] + coeff0_7*dmats2[7][19] + coeff0_8*dmats2[8][19] + coeff0_9*dmats2[9][19] + coeff0_10*dmats2[10][19] + coeff0_11*dmats2[11][19] + coeff0_12*dmats2[12][19] + coeff0_13*dmats2[13][19] + coeff0_14*dmats2[14][19] + coeff0_15*dmats2[15][19] + coeff0_16*dmats2[16][19] + coeff0_17*dmats2[17][19] + coeff0_18*dmats2[18][19] + coeff0_19*dmats2[19][19];
 
4362
        }
 
4363
    
 
4364
      }
 
4365
      // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
4366
      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 + new_coeff0_15*basisvalue15 + new_coeff0_16*basisvalue16 + new_coeff0_17*basisvalue17 + new_coeff0_18*basisvalue18 + new_coeff0_19*basisvalue19;
 
4367
    }
 
4368
    
 
4369
    // Transform derivatives back to physical element
 
4370
    for (unsigned int row = 0; row < num_derivatives; row++)
 
4371
    {
 
4372
      for (unsigned int col = 0; col < num_derivatives; col++)
 
4373
      {
 
4374
        values[row] += transform[row][col]*derivatives[col];
 
4375
      }
 
4376
    }
 
4377
    // Delete pointer to array of derivatives on FIAT element
 
4378
    delete [] derivatives;
 
4379
    
 
4380
    // Delete pointer to array of combinations of derivatives and transform
 
4381
    for (unsigned int row = 0; row < num_derivatives; row++)
 
4382
    {
 
4383
      delete [] combinations[row];
 
4384
      delete [] transform[row];
 
4385
    }
 
4386
    
 
4387
    delete [] combinations;
 
4388
    delete [] transform;
 
4389
  }
 
4390
 
 
4391
  /// Evaluate order n derivatives of all basis functions at given point in cell
 
4392
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
4393
                                              double* values,
 
4394
                                              const double* coordinates,
 
4395
                                              const ufc::cell& c) const
 
4396
  {
 
4397
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
 
4398
  }
 
4399
 
 
4400
  /// Evaluate linear functional for dof i on the function f
 
4401
  virtual double evaluate_dof(unsigned int i,
 
4402
                              const ufc::function& f,
 
4403
                              const ufc::cell& c) const
 
4404
  {
 
4405
    // The reference points, direction and weights:
 
4406
    const static double X[20][1][3] = {{{0, 0, 0}}, {{1, 0, 0}}, {{0, 1, 0}}, {{0, 0, 1}}, {{0, 0.666666666666667, 0.333333333333333}}, {{0, 0.333333333333333, 0.666666666666667}}, {{0.666666666666667, 0, 0.333333333333333}}, {{0.333333333333333, 0, 0.666666666666667}}, {{0.666666666666667, 0.333333333333333, 0}}, {{0.333333333333333, 0.666666666666667, 0}}, {{0, 0, 0.333333333333333}}, {{0, 0, 0.666666666666667}}, {{0, 0.333333333333333, 0}}, {{0, 0.666666666666667, 0}}, {{0.333333333333333, 0, 0}}, {{0.666666666666667, 0, 0}}, {{0.333333333333333, 0.333333333333333, 0.333333333333333}}, {{0, 0.333333333333333, 0.333333333333333}}, {{0.333333333333333, 0, 0.333333333333333}}, {{0.333333333333333, 0.333333333333333, 0}}};
 
4407
    const static double W[20][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
 
4408
    const static double D[20][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
 
4409
    
 
4410
    const double * const * x = c.coordinates;
 
4411
    double result = 0.0;
 
4412
    // Iterate over the points:
 
4413
    // Evaluate basis functions for affine mapping
 
4414
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1] - X[i][0][2];
 
4415
    const double w1 = X[i][0][0];
 
4416
    const double w2 = X[i][0][1];
 
4417
    const double w3 = X[i][0][2];
 
4418
    
 
4419
    // Compute affine mapping y = F(X)
 
4420
    double y[3];
 
4421
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0] + w3*x[3][0];
 
4422
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1] + w3*x[3][1];
 
4423
    y[2] = w0*x[0][2] + w1*x[1][2] + w2*x[2][2] + w3*x[3][2];
 
4424
    
 
4425
    // Evaluate function at physical points
 
4426
    double values[1];
 
4427
    f.evaluate(values, y, c);
 
4428
    
 
4429
    // Map function values using appropriate mapping
 
4430
    // Affine map: Do nothing
 
4431
    
 
4432
    // Note that we do not map the weights (yet).
 
4433
    
 
4434
    // Take directional components
 
4435
    for(int k = 0; k < 1; k++)
 
4436
      result += values[k]*D[i][0][k];
 
4437
    // Multiply by weights 
 
4438
    result *= W[i][0];
 
4439
    
 
4440
    return result;
 
4441
  }
 
4442
 
 
4443
  /// Evaluate linear functionals for all dofs on the function f
 
4444
  virtual void evaluate_dofs(double* values,
 
4445
                             const ufc::function& f,
 
4446
                             const ufc::cell& c) const
 
4447
  {
 
4448
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4449
  }
 
4450
 
 
4451
  /// Interpolate vertex values from dof values
 
4452
  virtual void interpolate_vertex_values(double* vertex_values,
 
4453
                                         const double* dof_values,
 
4454
                                         const ufc::cell& c) const
 
4455
  {
 
4456
    // Evaluate at vertices and use affine mapping
 
4457
    vertex_values[0] = dof_values[0];
 
4458
    vertex_values[1] = dof_values[1];
 
4459
    vertex_values[2] = dof_values[2];
 
4460
    vertex_values[3] = dof_values[3];
 
4461
  }
 
4462
 
 
4463
  /// Return the number of sub elements (for a mixed element)
 
4464
  virtual unsigned int num_sub_elements() const
 
4465
  {
 
4466
    return 1;
 
4467
  }
 
4468
 
 
4469
  /// Create a new finite element for sub element i (for a mixed element)
 
4470
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
4471
  {
 
4472
    return new UFC_Poisson3D_3LinearForm_finite_element_1();
 
4473
  }
 
4474
 
 
4475
};
 
4476
 
 
4477
/// This class defines the interface for a local-to-global mapping of
 
4478
/// degrees of freedom (dofs).
 
4479
 
 
4480
class UFC_Poisson3D_3LinearForm_dof_map_0: public ufc::dof_map
 
4481
{
 
4482
private:
 
4483
 
 
4484
  unsigned int __global_dimension;
 
4485
 
 
4486
public:
 
4487
 
 
4488
  /// Constructor
 
4489
  UFC_Poisson3D_3LinearForm_dof_map_0() : ufc::dof_map()
 
4490
  {
 
4491
    __global_dimension = 0;
 
4492
  }
 
4493
 
 
4494
  /// Destructor
 
4495
  virtual ~UFC_Poisson3D_3LinearForm_dof_map_0()
 
4496
  {
 
4497
    // Do nothing
 
4498
  }
 
4499
 
 
4500
  /// Return a string identifying the dof map
 
4501
  virtual const char* signature() const
 
4502
  {
 
4503
    return "FFC dof map for Lagrange finite element of degree 3 on a tetrahedron";
 
4504
  }
 
4505
 
 
4506
  /// Return true iff mesh entities of topological dimension d are needed
 
4507
  virtual bool needs_mesh_entities(unsigned int d) const
 
4508
  {
 
4509
    switch ( d )
 
4510
    {
 
4511
    case 0:
 
4512
      return true;
 
4513
      break;
 
4514
    case 1:
 
4515
      return true;
 
4516
      break;
 
4517
    case 2:
 
4518
      return true;
 
4519
      break;
 
4520
    case 3:
 
4521
      return false;
 
4522
      break;
 
4523
    }
 
4524
    return false;
 
4525
  }
 
4526
 
 
4527
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
4528
  virtual bool init_mesh(const ufc::mesh& m)
 
4529
  {
 
4530
    __global_dimension = m.num_entities[0] + 2*m.num_entities[1] + m.num_entities[2];
 
4531
    return false;
 
4532
  }
 
4533
 
 
4534
  /// Initialize dof map for given cell
 
4535
  virtual void init_cell(const ufc::mesh& m,
 
4536
                         const ufc::cell& c)
 
4537
  {
 
4538
    // Do nothing
 
4539
  }
 
4540
 
 
4541
  /// Finish initialization of dof map for cells
 
4542
  virtual void init_cell_finalize()
 
4543
  {
 
4544
    // Do nothing
 
4545
  }
 
4546
 
 
4547
  /// Return the dimension of the global finite element function space
 
4548
  virtual unsigned int global_dimension() const
 
4549
  {
 
4550
    return __global_dimension;
 
4551
  }
 
4552
 
 
4553
  /// Return the dimension of the local finite element function space
 
4554
  virtual unsigned int local_dimension() const
 
4555
  {
 
4556
    return 20;
 
4557
  }
 
4558
 
 
4559
  // Return the geometric dimension of the coordinates this dof map provides
 
4560
  virtual unsigned int geometric_dimension() const
 
4561
  {
 
4562
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4563
  }
 
4564
 
 
4565
  /// Return the number of dofs on each cell facet
 
4566
  virtual unsigned int num_facet_dofs() const
 
4567
  {
 
4568
    return 10;
 
4569
  }
 
4570
 
 
4571
  /// Return the number of dofs associated with each cell entity of dimension d
 
4572
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
4573
  {
 
4574
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4575
  }
 
4576
 
 
4577
  /// Tabulate the local-to-global mapping of dofs on a cell
 
4578
  virtual void tabulate_dofs(unsigned int* dofs,
 
4579
                             const ufc::mesh& m,
 
4580
                             const ufc::cell& c) const
 
4581
  {
 
4582
    dofs[0] = c.entity_indices[0][0];
 
4583
    dofs[1] = c.entity_indices[0][1];
 
4584
    dofs[2] = c.entity_indices[0][2];
 
4585
    dofs[3] = c.entity_indices[0][3];
 
4586
    unsigned int offset = m.num_entities[0];
 
4587
    dofs[4] = offset + 2*c.entity_indices[1][0];
 
4588
    dofs[5] = offset + 2*c.entity_indices[1][0] + 1;
 
4589
    dofs[6] = offset + 2*c.entity_indices[1][1];
 
4590
    dofs[7] = offset + 2*c.entity_indices[1][1] + 1;
 
4591
    dofs[8] = offset + 2*c.entity_indices[1][2];
 
4592
    dofs[9] = offset + 2*c.entity_indices[1][2] + 1;
 
4593
    dofs[10] = offset + 2*c.entity_indices[1][3];
 
4594
    dofs[11] = offset + 2*c.entity_indices[1][3] + 1;
 
4595
    dofs[12] = offset + 2*c.entity_indices[1][4];
 
4596
    dofs[13] = offset + 2*c.entity_indices[1][4] + 1;
 
4597
    dofs[14] = offset + 2*c.entity_indices[1][5];
 
4598
    dofs[15] = offset + 2*c.entity_indices[1][5] + 1;
 
4599
    offset = offset + 2*m.num_entities[1];
 
4600
    dofs[16] = offset + c.entity_indices[2][0];
 
4601
    dofs[17] = offset + c.entity_indices[2][1];
 
4602
    dofs[18] = offset + c.entity_indices[2][2];
 
4603
    dofs[19] = offset + c.entity_indices[2][3];
 
4604
  }
 
4605
 
 
4606
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
4607
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
4608
                                   unsigned int facet) const
 
4609
  {
 
4610
    switch ( facet )
 
4611
    {
 
4612
    case 0:
 
4613
      dofs[0] = 1;
 
4614
      dofs[1] = 2;
 
4615
      dofs[2] = 3;
 
4616
      dofs[3] = 4;
 
4617
      dofs[4] = 5;
 
4618
      dofs[5] = 6;
 
4619
      dofs[6] = 7;
 
4620
      dofs[7] = 8;
 
4621
      dofs[8] = 9;
 
4622
      dofs[9] = 16;
 
4623
      break;
 
4624
    case 1:
 
4625
      dofs[0] = 0;
 
4626
      dofs[1] = 2;
 
4627
      dofs[2] = 3;
 
4628
      dofs[3] = 4;
 
4629
      dofs[4] = 5;
 
4630
      dofs[5] = 10;
 
4631
      dofs[6] = 11;
 
4632
      dofs[7] = 12;
 
4633
      dofs[8] = 13;
 
4634
      dofs[9] = 17;
 
4635
      break;
 
4636
    case 2:
 
4637
      dofs[0] = 0;
 
4638
      dofs[1] = 1;
 
4639
      dofs[2] = 3;
 
4640
      dofs[3] = 6;
 
4641
      dofs[4] = 7;
 
4642
      dofs[5] = 10;
 
4643
      dofs[6] = 11;
 
4644
      dofs[7] = 14;
 
4645
      dofs[8] = 15;
 
4646
      dofs[9] = 18;
 
4647
      break;
 
4648
    case 3:
 
4649
      dofs[0] = 0;
 
4650
      dofs[1] = 1;
 
4651
      dofs[2] = 2;
 
4652
      dofs[3] = 8;
 
4653
      dofs[4] = 9;
 
4654
      dofs[5] = 12;
 
4655
      dofs[6] = 13;
 
4656
      dofs[7] = 14;
 
4657
      dofs[8] = 15;
 
4658
      dofs[9] = 19;
 
4659
      break;
 
4660
    }
 
4661
  }
 
4662
 
 
4663
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
4664
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
4665
                                    unsigned int d, unsigned int i) const
 
4666
  {
 
4667
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4668
  }
 
4669
 
 
4670
  /// Tabulate the coordinates of all dofs on a cell
 
4671
  virtual void tabulate_coordinates(double** coordinates,
 
4672
                                    const ufc::cell& c) const
 
4673
  {
 
4674
    const double * const * x = c.coordinates;
 
4675
    coordinates[0][0] = x[0][0];
 
4676
    coordinates[0][1] = x[0][1];
 
4677
    coordinates[0][2] = x[0][2];
 
4678
    coordinates[1][0] = x[1][0];
 
4679
    coordinates[1][1] = x[1][1];
 
4680
    coordinates[1][2] = x[1][2];
 
4681
    coordinates[2][0] = x[2][0];
 
4682
    coordinates[2][1] = x[2][1];
 
4683
    coordinates[2][2] = x[2][2];
 
4684
    coordinates[3][0] = x[3][0];
 
4685
    coordinates[3][1] = x[3][1];
 
4686
    coordinates[3][2] = x[3][2];
 
4687
    coordinates[4][0] = 0.666666666666667*x[2][0] + 0.333333333333333*x[3][0];
 
4688
    coordinates[4][1] = 0.666666666666667*x[2][1] + 0.333333333333333*x[3][1];
 
4689
    coordinates[4][2] = 0.666666666666667*x[2][2] + 0.333333333333333*x[3][2];
 
4690
    coordinates[5][0] = 0.333333333333333*x[2][0] + 0.666666666666667*x[3][0];
 
4691
    coordinates[5][1] = 0.333333333333333*x[2][1] + 0.666666666666667*x[3][1];
 
4692
    coordinates[5][2] = 0.333333333333333*x[2][2] + 0.666666666666667*x[3][2];
 
4693
    coordinates[6][0] = 0.666666666666667*x[1][0] + 0.333333333333333*x[3][0];
 
4694
    coordinates[6][1] = 0.666666666666667*x[1][1] + 0.333333333333333*x[3][1];
 
4695
    coordinates[6][2] = 0.666666666666667*x[1][2] + 0.333333333333333*x[3][2];
 
4696
    coordinates[7][0] = 0.333333333333333*x[1][0] + 0.666666666666667*x[3][0];
 
4697
    coordinates[7][1] = 0.333333333333333*x[1][1] + 0.666666666666667*x[3][1];
 
4698
    coordinates[7][2] = 0.333333333333333*x[1][2] + 0.666666666666667*x[3][2];
 
4699
    coordinates[8][0] = 0.666666666666667*x[1][0] + 0.333333333333333*x[2][0];
 
4700
    coordinates[8][1] = 0.666666666666667*x[1][1] + 0.333333333333333*x[2][1];
 
4701
    coordinates[8][2] = 0.666666666666667*x[1][2] + 0.333333333333333*x[2][2];
 
4702
    coordinates[9][0] = 0.333333333333333*x[1][0] + 0.666666666666667*x[2][0];
 
4703
    coordinates[9][1] = 0.333333333333333*x[1][1] + 0.666666666666667*x[2][1];
 
4704
    coordinates[9][2] = 0.333333333333333*x[1][2] + 0.666666666666667*x[2][2];
 
4705
    coordinates[10][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[3][0];
 
4706
    coordinates[10][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[3][1];
 
4707
    coordinates[10][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[3][2];
 
4708
    coordinates[11][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[3][0];
 
4709
    coordinates[11][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[3][1];
 
4710
    coordinates[11][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[3][2];
 
4711
    coordinates[12][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[2][0];
 
4712
    coordinates[12][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[2][1];
 
4713
    coordinates[12][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[2][2];
 
4714
    coordinates[13][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[2][0];
 
4715
    coordinates[13][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[2][1];
 
4716
    coordinates[13][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[2][2];
 
4717
    coordinates[14][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[1][0];
 
4718
    coordinates[14][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[1][1];
 
4719
    coordinates[14][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[1][2];
 
4720
    coordinates[15][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[1][0];
 
4721
    coordinates[15][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[1][1];
 
4722
    coordinates[15][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[1][2];
 
4723
    coordinates[16][0] = 0.333333333333333*x[1][0] + 0.333333333333333*x[2][0] + 0.333333333333333*x[3][0];
 
4724
    coordinates[16][1] = 0.333333333333333*x[1][1] + 0.333333333333333*x[2][1] + 0.333333333333333*x[3][1];
 
4725
    coordinates[16][2] = 0.333333333333333*x[1][2] + 0.333333333333333*x[2][2] + 0.333333333333333*x[3][2];
 
4726
    coordinates[17][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[2][0] + 0.333333333333333*x[3][0];
 
4727
    coordinates[17][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[2][1] + 0.333333333333333*x[3][1];
 
4728
    coordinates[17][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[2][2] + 0.333333333333333*x[3][2];
 
4729
    coordinates[18][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[1][0] + 0.333333333333333*x[3][0];
 
4730
    coordinates[18][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[1][1] + 0.333333333333333*x[3][1];
 
4731
    coordinates[18][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[1][2] + 0.333333333333333*x[3][2];
 
4732
    coordinates[19][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[1][0] + 0.333333333333333*x[2][0];
 
4733
    coordinates[19][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[1][1] + 0.333333333333333*x[2][1];
 
4734
    coordinates[19][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[1][2] + 0.333333333333333*x[2][2];
 
4735
  }
 
4736
 
 
4737
  /// Return the number of sub dof maps (for a mixed element)
 
4738
  virtual unsigned int num_sub_dof_maps() const
 
4739
  {
 
4740
    return 1;
 
4741
  }
 
4742
 
 
4743
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
4744
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
4745
  {
 
4746
    return new UFC_Poisson3D_3LinearForm_dof_map_0();
 
4747
  }
 
4748
 
 
4749
};
 
4750
 
 
4751
/// This class defines the interface for a local-to-global mapping of
 
4752
/// degrees of freedom (dofs).
 
4753
 
 
4754
class UFC_Poisson3D_3LinearForm_dof_map_1: public ufc::dof_map
 
4755
{
 
4756
private:
 
4757
 
 
4758
  unsigned int __global_dimension;
 
4759
 
 
4760
public:
 
4761
 
 
4762
  /// Constructor
 
4763
  UFC_Poisson3D_3LinearForm_dof_map_1() : ufc::dof_map()
 
4764
  {
 
4765
    __global_dimension = 0;
 
4766
  }
 
4767
 
 
4768
  /// Destructor
 
4769
  virtual ~UFC_Poisson3D_3LinearForm_dof_map_1()
 
4770
  {
 
4771
    // Do nothing
 
4772
  }
 
4773
 
 
4774
  /// Return a string identifying the dof map
 
4775
  virtual const char* signature() const
 
4776
  {
 
4777
    return "FFC dof map for Lagrange finite element of degree 3 on a tetrahedron";
 
4778
  }
 
4779
 
 
4780
  /// Return true iff mesh entities of topological dimension d are needed
 
4781
  virtual bool needs_mesh_entities(unsigned int d) const
 
4782
  {
 
4783
    switch ( d )
 
4784
    {
 
4785
    case 0:
 
4786
      return true;
 
4787
      break;
 
4788
    case 1:
 
4789
      return true;
 
4790
      break;
 
4791
    case 2:
 
4792
      return true;
 
4793
      break;
 
4794
    case 3:
 
4795
      return false;
 
4796
      break;
 
4797
    }
 
4798
    return false;
 
4799
  }
 
4800
 
 
4801
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
4802
  virtual bool init_mesh(const ufc::mesh& m)
 
4803
  {
 
4804
    __global_dimension = m.num_entities[0] + 2*m.num_entities[1] + m.num_entities[2];
 
4805
    return false;
 
4806
  }
 
4807
 
 
4808
  /// Initialize dof map for given cell
 
4809
  virtual void init_cell(const ufc::mesh& m,
 
4810
                         const ufc::cell& c)
 
4811
  {
 
4812
    // Do nothing
 
4813
  }
 
4814
 
 
4815
  /// Finish initialization of dof map for cells
 
4816
  virtual void init_cell_finalize()
 
4817
  {
 
4818
    // Do nothing
 
4819
  }
 
4820
 
 
4821
  /// Return the dimension of the global finite element function space
 
4822
  virtual unsigned int global_dimension() const
 
4823
  {
 
4824
    return __global_dimension;
 
4825
  }
 
4826
 
 
4827
  /// Return the dimension of the local finite element function space
 
4828
  virtual unsigned int local_dimension() const
 
4829
  {
 
4830
    return 20;
 
4831
  }
 
4832
 
 
4833
  // Return the geometric dimension of the coordinates this dof map provides
 
4834
  virtual unsigned int geometric_dimension() const
 
4835
  {
 
4836
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4837
  }
 
4838
 
 
4839
  /// Return the number of dofs on each cell facet
 
4840
  virtual unsigned int num_facet_dofs() const
 
4841
  {
 
4842
    return 10;
 
4843
  }
 
4844
 
 
4845
  /// Return the number of dofs associated with each cell entity of dimension d
 
4846
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
4847
  {
 
4848
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4849
  }
 
4850
 
 
4851
  /// Tabulate the local-to-global mapping of dofs on a cell
 
4852
  virtual void tabulate_dofs(unsigned int* dofs,
 
4853
                             const ufc::mesh& m,
 
4854
                             const ufc::cell& c) const
 
4855
  {
 
4856
    dofs[0] = c.entity_indices[0][0];
 
4857
    dofs[1] = c.entity_indices[0][1];
 
4858
    dofs[2] = c.entity_indices[0][2];
 
4859
    dofs[3] = c.entity_indices[0][3];
 
4860
    unsigned int offset = m.num_entities[0];
 
4861
    dofs[4] = offset + 2*c.entity_indices[1][0];
 
4862
    dofs[5] = offset + 2*c.entity_indices[1][0] + 1;
 
4863
    dofs[6] = offset + 2*c.entity_indices[1][1];
 
4864
    dofs[7] = offset + 2*c.entity_indices[1][1] + 1;
 
4865
    dofs[8] = offset + 2*c.entity_indices[1][2];
 
4866
    dofs[9] = offset + 2*c.entity_indices[1][2] + 1;
 
4867
    dofs[10] = offset + 2*c.entity_indices[1][3];
 
4868
    dofs[11] = offset + 2*c.entity_indices[1][3] + 1;
 
4869
    dofs[12] = offset + 2*c.entity_indices[1][4];
 
4870
    dofs[13] = offset + 2*c.entity_indices[1][4] + 1;
 
4871
    dofs[14] = offset + 2*c.entity_indices[1][5];
 
4872
    dofs[15] = offset + 2*c.entity_indices[1][5] + 1;
 
4873
    offset = offset + 2*m.num_entities[1];
 
4874
    dofs[16] = offset + c.entity_indices[2][0];
 
4875
    dofs[17] = offset + c.entity_indices[2][1];
 
4876
    dofs[18] = offset + c.entity_indices[2][2];
 
4877
    dofs[19] = offset + c.entity_indices[2][3];
 
4878
  }
 
4879
 
 
4880
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
4881
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
4882
                                   unsigned int facet) const
 
4883
  {
 
4884
    switch ( facet )
 
4885
    {
 
4886
    case 0:
 
4887
      dofs[0] = 1;
 
4888
      dofs[1] = 2;
 
4889
      dofs[2] = 3;
 
4890
      dofs[3] = 4;
 
4891
      dofs[4] = 5;
 
4892
      dofs[5] = 6;
 
4893
      dofs[6] = 7;
 
4894
      dofs[7] = 8;
 
4895
      dofs[8] = 9;
 
4896
      dofs[9] = 16;
 
4897
      break;
 
4898
    case 1:
 
4899
      dofs[0] = 0;
 
4900
      dofs[1] = 2;
 
4901
      dofs[2] = 3;
 
4902
      dofs[3] = 4;
 
4903
      dofs[4] = 5;
 
4904
      dofs[5] = 10;
 
4905
      dofs[6] = 11;
 
4906
      dofs[7] = 12;
 
4907
      dofs[8] = 13;
 
4908
      dofs[9] = 17;
 
4909
      break;
 
4910
    case 2:
 
4911
      dofs[0] = 0;
 
4912
      dofs[1] = 1;
 
4913
      dofs[2] = 3;
 
4914
      dofs[3] = 6;
 
4915
      dofs[4] = 7;
 
4916
      dofs[5] = 10;
 
4917
      dofs[6] = 11;
 
4918
      dofs[7] = 14;
 
4919
      dofs[8] = 15;
 
4920
      dofs[9] = 18;
 
4921
      break;
 
4922
    case 3:
 
4923
      dofs[0] = 0;
 
4924
      dofs[1] = 1;
 
4925
      dofs[2] = 2;
 
4926
      dofs[3] = 8;
 
4927
      dofs[4] = 9;
 
4928
      dofs[5] = 12;
 
4929
      dofs[6] = 13;
 
4930
      dofs[7] = 14;
 
4931
      dofs[8] = 15;
 
4932
      dofs[9] = 19;
 
4933
      break;
 
4934
    }
 
4935
  }
 
4936
 
 
4937
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
4938
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
4939
                                    unsigned int d, unsigned int i) const
 
4940
  {
 
4941
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4942
  }
 
4943
 
 
4944
  /// Tabulate the coordinates of all dofs on a cell
 
4945
  virtual void tabulate_coordinates(double** coordinates,
 
4946
                                    const ufc::cell& c) const
 
4947
  {
 
4948
    const double * const * x = c.coordinates;
 
4949
    coordinates[0][0] = x[0][0];
 
4950
    coordinates[0][1] = x[0][1];
 
4951
    coordinates[0][2] = x[0][2];
 
4952
    coordinates[1][0] = x[1][0];
 
4953
    coordinates[1][1] = x[1][1];
 
4954
    coordinates[1][2] = x[1][2];
 
4955
    coordinates[2][0] = x[2][0];
 
4956
    coordinates[2][1] = x[2][1];
 
4957
    coordinates[2][2] = x[2][2];
 
4958
    coordinates[3][0] = x[3][0];
 
4959
    coordinates[3][1] = x[3][1];
 
4960
    coordinates[3][2] = x[3][2];
 
4961
    coordinates[4][0] = 0.666666666666667*x[2][0] + 0.333333333333333*x[3][0];
 
4962
    coordinates[4][1] = 0.666666666666667*x[2][1] + 0.333333333333333*x[3][1];
 
4963
    coordinates[4][2] = 0.666666666666667*x[2][2] + 0.333333333333333*x[3][2];
 
4964
    coordinates[5][0] = 0.333333333333333*x[2][0] + 0.666666666666667*x[3][0];
 
4965
    coordinates[5][1] = 0.333333333333333*x[2][1] + 0.666666666666667*x[3][1];
 
4966
    coordinates[5][2] = 0.333333333333333*x[2][2] + 0.666666666666667*x[3][2];
 
4967
    coordinates[6][0] = 0.666666666666667*x[1][0] + 0.333333333333333*x[3][0];
 
4968
    coordinates[6][1] = 0.666666666666667*x[1][1] + 0.333333333333333*x[3][1];
 
4969
    coordinates[6][2] = 0.666666666666667*x[1][2] + 0.333333333333333*x[3][2];
 
4970
    coordinates[7][0] = 0.333333333333333*x[1][0] + 0.666666666666667*x[3][0];
 
4971
    coordinates[7][1] = 0.333333333333333*x[1][1] + 0.666666666666667*x[3][1];
 
4972
    coordinates[7][2] = 0.333333333333333*x[1][2] + 0.666666666666667*x[3][2];
 
4973
    coordinates[8][0] = 0.666666666666667*x[1][0] + 0.333333333333333*x[2][0];
 
4974
    coordinates[8][1] = 0.666666666666667*x[1][1] + 0.333333333333333*x[2][1];
 
4975
    coordinates[8][2] = 0.666666666666667*x[1][2] + 0.333333333333333*x[2][2];
 
4976
    coordinates[9][0] = 0.333333333333333*x[1][0] + 0.666666666666667*x[2][0];
 
4977
    coordinates[9][1] = 0.333333333333333*x[1][1] + 0.666666666666667*x[2][1];
 
4978
    coordinates[9][2] = 0.333333333333333*x[1][2] + 0.666666666666667*x[2][2];
 
4979
    coordinates[10][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[3][0];
 
4980
    coordinates[10][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[3][1];
 
4981
    coordinates[10][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[3][2];
 
4982
    coordinates[11][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[3][0];
 
4983
    coordinates[11][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[3][1];
 
4984
    coordinates[11][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[3][2];
 
4985
    coordinates[12][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[2][0];
 
4986
    coordinates[12][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[2][1];
 
4987
    coordinates[12][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[2][2];
 
4988
    coordinates[13][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[2][0];
 
4989
    coordinates[13][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[2][1];
 
4990
    coordinates[13][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[2][2];
 
4991
    coordinates[14][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[1][0];
 
4992
    coordinates[14][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[1][1];
 
4993
    coordinates[14][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[1][2];
 
4994
    coordinates[15][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[1][0];
 
4995
    coordinates[15][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[1][1];
 
4996
    coordinates[15][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[1][2];
 
4997
    coordinates[16][0] = 0.333333333333333*x[1][0] + 0.333333333333333*x[2][0] + 0.333333333333333*x[3][0];
 
4998
    coordinates[16][1] = 0.333333333333333*x[1][1] + 0.333333333333333*x[2][1] + 0.333333333333333*x[3][1];
 
4999
    coordinates[16][2] = 0.333333333333333*x[1][2] + 0.333333333333333*x[2][2] + 0.333333333333333*x[3][2];
 
5000
    coordinates[17][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[2][0] + 0.333333333333333*x[3][0];
 
5001
    coordinates[17][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[2][1] + 0.333333333333333*x[3][1];
 
5002
    coordinates[17][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[2][2] + 0.333333333333333*x[3][2];
 
5003
    coordinates[18][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[1][0] + 0.333333333333333*x[3][0];
 
5004
    coordinates[18][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[1][1] + 0.333333333333333*x[3][1];
 
5005
    coordinates[18][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[1][2] + 0.333333333333333*x[3][2];
 
5006
    coordinates[19][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[1][0] + 0.333333333333333*x[2][0];
 
5007
    coordinates[19][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[1][1] + 0.333333333333333*x[2][1];
 
5008
    coordinates[19][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[1][2] + 0.333333333333333*x[2][2];
 
5009
  }
 
5010
 
 
5011
  /// Return the number of sub dof maps (for a mixed element)
 
5012
  virtual unsigned int num_sub_dof_maps() const
 
5013
  {
 
5014
    return 1;
 
5015
  }
 
5016
 
 
5017
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
5018
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
5019
  {
 
5020
    return new UFC_Poisson3D_3LinearForm_dof_map_1();
 
5021
  }
 
5022
 
 
5023
};
 
5024
 
 
5025
/// This class defines the interface for the tabulation of the cell
 
5026
/// tensor corresponding to the local contribution to a form from
 
5027
/// the integral over a cell.
 
5028
 
 
5029
class UFC_Poisson3D_3LinearForm_cell_integral_0: public ufc::cell_integral
 
5030
{
 
5031
public:
 
5032
 
 
5033
  /// Constructor
 
5034
  UFC_Poisson3D_3LinearForm_cell_integral_0() : ufc::cell_integral()
 
5035
  {
 
5036
    // Do nothing
 
5037
  }
 
5038
 
 
5039
  /// Destructor
 
5040
  virtual ~UFC_Poisson3D_3LinearForm_cell_integral_0()
 
5041
  {
 
5042
    // Do nothing
 
5043
  }
 
5044
 
 
5045
  /// Tabulate the tensor for the contribution from a local cell
 
5046
  virtual void tabulate_tensor(double* A,
 
5047
                               const double * const * w,
 
5048
                               const ufc::cell& c) const
 
5049
  {
 
5050
    // Extract vertex coordinates
 
5051
    const double * const * x = c.coordinates;
 
5052
    
 
5053
    // Compute Jacobian of affine map from reference cell
 
5054
    const double J_00 = x[1][0] - x[0][0];
 
5055
    const double J_01 = x[2][0] - x[0][0];
 
5056
    const double J_02 = x[3][0] - x[0][0];
 
5057
    const double J_10 = x[1][1] - x[0][1];
 
5058
    const double J_11 = x[2][1] - x[0][1];
 
5059
    const double J_12 = x[3][1] - x[0][1];
 
5060
    const double J_20 = x[1][2] - x[0][2];
 
5061
    const double J_21 = x[2][2] - x[0][2];
 
5062
    const double J_22 = x[3][2] - x[0][2];
 
5063
      
 
5064
    // Compute sub determinants
 
5065
    const double d_00 = J_11*J_22 - J_12*J_21;
 
5066
    
 
5067
    const double d_10 = J_02*J_21 - J_01*J_22;
 
5068
    
 
5069
    const double d_20 = J_01*J_12 - J_02*J_11;
 
5070
      
 
5071
    // Compute determinant of Jacobian
 
5072
    double detJ = J_00*d_00 + J_10*d_10 + J_20*d_20;
 
5073
      
 
5074
    // Compute inverse of Jacobian
 
5075
    
 
5076
    // Set scale factor
 
5077
    const double det = std::abs(detJ);
 
5078
    
 
5079
    // Compute coefficients
 
5080
    const double c0_0_0_0 = w[0][0];
 
5081
    const double c0_0_0_1 = w[0][1];
 
5082
    const double c0_0_0_2 = w[0][2];
 
5083
    const double c0_0_0_3 = w[0][3];
 
5084
    const double c0_0_0_4 = w[0][4];
 
5085
    const double c0_0_0_5 = w[0][5];
 
5086
    const double c0_0_0_6 = w[0][6];
 
5087
    const double c0_0_0_7 = w[0][7];
 
5088
    const double c0_0_0_8 = w[0][8];
 
5089
    const double c0_0_0_9 = w[0][9];
 
5090
    const double c0_0_0_10 = w[0][10];
 
5091
    const double c0_0_0_11 = w[0][11];
 
5092
    const double c0_0_0_12 = w[0][12];
 
5093
    const double c0_0_0_13 = w[0][13];
 
5094
    const double c0_0_0_14 = w[0][14];
 
5095
    const double c0_0_0_15 = w[0][15];
 
5096
    const double c0_0_0_16 = w[0][16];
 
5097
    const double c0_0_0_17 = w[0][17];
 
5098
    const double c0_0_0_18 = w[0][18];
 
5099
    const double c0_0_0_19 = w[0][19];
 
5100
    
 
5101
    // Compute geometry tensors
 
5102
    const double G0_0 = det*c0_0_0_0;
 
5103
    const double G0_1 = det*c0_0_0_1;
 
5104
    const double G0_2 = det*c0_0_0_2;
 
5105
    const double G0_3 = det*c0_0_0_3;
 
5106
    const double G0_4 = det*c0_0_0_4;
 
5107
    const double G0_5 = det*c0_0_0_5;
 
5108
    const double G0_6 = det*c0_0_0_6;
 
5109
    const double G0_7 = det*c0_0_0_7;
 
5110
    const double G0_8 = det*c0_0_0_8;
 
5111
    const double G0_9 = det*c0_0_0_9;
 
5112
    const double G0_10 = det*c0_0_0_10;
 
5113
    const double G0_11 = det*c0_0_0_11;
 
5114
    const double G0_12 = det*c0_0_0_12;
 
5115
    const double G0_13 = det*c0_0_0_13;
 
5116
    const double G0_14 = det*c0_0_0_14;
 
5117
    const double G0_15 = det*c0_0_0_15;
 
5118
    const double G0_16 = det*c0_0_0_16;
 
5119
    const double G0_17 = det*c0_0_0_17;
 
5120
    const double G0_18 = det*c0_0_0_18;
 
5121
    const double G0_19 = det*c0_0_0_19;
 
5122
    
 
5123
    // Compute element tensor
 
5124
    A[0] = 0.000595238095238095*G0_0 + 7.44047619047619e-05*G0_1 + 7.44047619047618e-05*G0_2 + 7.44047619047618e-05*G0_3 + 0.000111607142857143*G0_4 + 0.000111607142857143*G0_5 + 0.000111607142857142*G0_6 + 0.000111607142857143*G0_7 + 0.000111607142857142*G0_8 + 0.000111607142857143*G0_9 - 0.000446428571428571*G0_10 + 0.000223214285714286*G0_11 - 0.000446428571428571*G0_12 + 0.000223214285714286*G0_13 - 0.000446428571428572*G0_14 + 0.000223214285714286*G0_15 + 0.00133928571428571*G0_16 + 0.000669642857142858*G0_17 + 0.000669642857142858*G0_18 + 0.000669642857142858*G0_19;
 
5125
    A[1] = 7.44047619047619e-05*G0_0 + 0.000595238095238094*G0_1 + 7.44047619047616e-05*G0_2 + 7.44047619047616e-05*G0_3 + 0.000111607142857143*G0_4 + 0.000111607142857143*G0_5 - 0.000446428571428572*G0_6 + 0.000223214285714286*G0_7 - 0.000446428571428571*G0_8 + 0.000223214285714286*G0_9 + 0.000111607142857143*G0_10 + 0.000111607142857143*G0_11 + 0.000111607142857142*G0_12 + 0.000111607142857143*G0_13 + 0.000223214285714286*G0_14 - 0.000446428571428572*G0_15 + 0.000669642857142857*G0_16 + 0.00133928571428571*G0_17 + 0.000669642857142856*G0_18 + 0.000669642857142856*G0_19;
 
5126
    A[2] = 7.44047619047618e-05*G0_0 + 7.44047619047616e-05*G0_1 + 0.000595238095238094*G0_2 + 7.44047619047616e-05*G0_3 - 0.000446428571428571*G0_4 + 0.000223214285714285*G0_5 + 0.000111607142857142*G0_6 + 0.000111607142857143*G0_7 + 0.000223214285714285*G0_8 - 0.00044642857142857*G0_9 + 0.000111607142857143*G0_10 + 0.000111607142857143*G0_11 + 0.000223214285714285*G0_12 - 0.00044642857142857*G0_13 + 0.000111607142857142*G0_14 + 0.000111607142857143*G0_15 + 0.000669642857142856*G0_16 + 0.000669642857142856*G0_17 + 0.00133928571428571*G0_18 + 0.000669642857142857*G0_19;
 
5127
    A[3] = 7.44047619047618e-05*G0_0 + 7.44047619047616e-05*G0_1 + 7.44047619047616e-05*G0_2 + 0.000595238095238094*G0_3 + 0.000223214285714285*G0_4 - 0.00044642857142857*G0_5 + 0.000223214285714285*G0_6 - 0.00044642857142857*G0_7 + 0.000111607142857142*G0_8 + 0.000111607142857143*G0_9 + 0.000223214285714285*G0_10 - 0.00044642857142857*G0_11 + 0.000111607142857143*G0_12 + 0.000111607142857143*G0_13 + 0.000111607142857143*G0_14 + 0.000111607142857143*G0_15 + 0.000669642857142855*G0_16 + 0.000669642857142855*G0_17 + 0.000669642857142855*G0_18 + 0.00133928571428571*G0_19;
 
5128
    A[4] = 0.000111607142857143*G0_0 + 0.000111607142857143*G0_1 - 0.000446428571428571*G0_2 + 0.000223214285714285*G0_3 + 0.00401785714285714*G0_4 - 0.00200892857142857*G0_5 - 0.00100446428571429*G0_7 - 0.00100446428571428*G0_8 + 0.00200892857142857*G0_9 - 0.00100446428571429*G0_11 - 0.00100446428571428*G0_12 + 0.00200892857142857*G0_13 - 0.00200892857142857*G0_18;
 
5129
    A[5] = 0.000111607142857143*G0_0 + 0.000111607142857143*G0_1 + 0.000223214285714285*G0_2 - 0.00044642857142857*G0_3 - 0.00200892857142857*G0_4 + 0.00401785714285714*G0_5 - 0.00100446428571429*G0_6 + 0.00200892857142857*G0_7 - 0.00100446428571428*G0_9 - 0.00100446428571429*G0_10 + 0.00200892857142857*G0_11 - 0.00100446428571428*G0_13 - 0.00200892857142857*G0_19;
 
5130
    A[6] = 0.000111607142857142*G0_0 - 0.000446428571428572*G0_1 + 0.000111607142857142*G0_2 + 0.000223214285714285*G0_3 - 0.00100446428571429*G0_5 + 0.00401785714285713*G0_6 - 0.00200892857142857*G0_7 + 0.00200892857142857*G0_8 - 0.00100446428571428*G0_9 - 0.00100446428571429*G0_11 - 0.00100446428571428*G0_14 + 0.00200892857142857*G0_15 - 0.00200892857142857*G0_17;
 
5131
    A[7] = 0.000111607142857143*G0_0 + 0.000223214285714286*G0_1 + 0.000111607142857143*G0_2 - 0.00044642857142857*G0_3 - 0.00100446428571429*G0_4 + 0.00200892857142857*G0_5 - 0.00200892857142857*G0_6 + 0.00401785714285714*G0_7 - 0.00100446428571428*G0_8 - 0.00100446428571429*G0_10 + 0.00200892857142857*G0_11 - 0.00100446428571428*G0_15 - 0.00200892857142857*G0_19;
 
5132
    A[8] = 0.000111607142857142*G0_0 - 0.000446428571428571*G0_1 + 0.000223214285714285*G0_2 + 0.000111607142857142*G0_3 - 0.00100446428571428*G0_4 + 0.00200892857142856*G0_6 - 0.00100446428571428*G0_7 + 0.00401785714285713*G0_8 - 0.00200892857142857*G0_9 - 0.00100446428571428*G0_13 - 0.00100446428571428*G0_14 + 0.00200892857142857*G0_15 - 0.00200892857142857*G0_17;
 
5133
    A[9] = 0.000111607142857143*G0_0 + 0.000223214285714286*G0_1 - 0.00044642857142857*G0_2 + 0.000111607142857143*G0_3 + 0.00200892857142857*G0_4 - 0.00100446428571428*G0_5 - 0.00100446428571428*G0_6 - 0.00200892857142857*G0_8 + 0.00401785714285714*G0_9 - 0.00100446428571429*G0_12 + 0.00200892857142857*G0_13 - 0.00100446428571428*G0_15 - 0.00200892857142857*G0_18;
 
5134
    A[10] = -0.000446428571428571*G0_0 + 0.000111607142857143*G0_1 + 0.000111607142857143*G0_2 + 0.000223214285714285*G0_3 - 0.00100446428571429*G0_5 - 0.00100446428571429*G0_7 + 0.00401785714285714*G0_10 - 0.00200892857142857*G0_11 + 0.00200892857142857*G0_12 - 0.00100446428571428*G0_13 + 0.00200892857142857*G0_14 - 0.00100446428571428*G0_15 - 0.00200892857142857*G0_16;
 
5135
    A[11] = 0.000223214285714286*G0_0 + 0.000111607142857143*G0_1 + 0.000111607142857143*G0_2 - 0.00044642857142857*G0_3 - 0.00100446428571429*G0_4 + 0.00200892857142857*G0_5 - 0.00100446428571429*G0_6 + 0.00200892857142857*G0_7 - 0.00200892857142857*G0_10 + 0.00401785714285714*G0_11 - 0.00100446428571428*G0_12 - 0.00100446428571428*G0_14 - 0.00200892857142857*G0_19;
 
5136
    A[12] = -0.000446428571428571*G0_0 + 0.000111607142857142*G0_1 + 0.000223214285714285*G0_2 + 0.000111607142857143*G0_3 - 0.00100446428571428*G0_4 - 0.00100446428571429*G0_9 + 0.00200892857142857*G0_10 - 0.00100446428571428*G0_11 + 0.00401785714285713*G0_12 - 0.00200892857142857*G0_13 + 0.00200892857142857*G0_14 - 0.00100446428571428*G0_15 - 0.00200892857142857*G0_16;
 
5137
    A[13] = 0.000223214285714286*G0_0 + 0.000111607142857143*G0_1 - 0.00044642857142857*G0_2 + 0.000111607142857142*G0_3 + 0.00200892857142857*G0_4 - 0.00100446428571428*G0_5 - 0.00100446428571428*G0_8 + 0.00200892857142857*G0_9 - 0.00100446428571428*G0_10 - 0.00200892857142857*G0_12 + 0.00401785714285713*G0_13 - 0.00100446428571428*G0_14 - 0.00200892857142857*G0_18;
 
5138
    A[14] = -0.000446428571428572*G0_0 + 0.000223214285714286*G0_1 + 0.000111607142857142*G0_2 + 0.000111607142857143*G0_3 - 0.00100446428571428*G0_6 - 0.00100446428571428*G0_8 + 0.00200892857142857*G0_10 - 0.00100446428571428*G0_11 + 0.00200892857142857*G0_12 - 0.00100446428571428*G0_13 + 0.00401785714285714*G0_14 - 0.00200892857142857*G0_15 - 0.00200892857142857*G0_16;
 
5139
    A[15] = 0.000223214285714286*G0_0 - 0.000446428571428572*G0_1 + 0.000111607142857143*G0_2 + 0.000111607142857143*G0_3 + 0.00200892857142857*G0_6 - 0.00100446428571428*G0_7 + 0.00200892857142857*G0_8 - 0.00100446428571428*G0_9 - 0.00100446428571428*G0_10 - 0.00100446428571428*G0_12 - 0.00200892857142857*G0_14 + 0.00401785714285714*G0_15 - 0.00200892857142857*G0_17;
 
5140
    A[16] = 0.00133928571428572*G0_0 + 0.000669642857142857*G0_1 + 0.000669642857142856*G0_2 + 0.000669642857142855*G0_3 - 0.00200892857142857*G0_10 - 0.00200892857142857*G0_12 - 0.00200892857142857*G0_14 + 0.0160714285714286*G0_16 + 0.00803571428571428*G0_17 + 0.00803571428571428*G0_18 + 0.00803571428571429*G0_19;
 
5141
    A[17] = 0.000669642857142858*G0_0 + 0.00133928571428571*G0_1 + 0.000669642857142856*G0_2 + 0.000669642857142855*G0_3 - 0.00200892857142857*G0_6 - 0.00200892857142857*G0_8 - 0.00200892857142857*G0_15 + 0.00803571428571428*G0_16 + 0.0160714285714286*G0_17 + 0.00803571428571428*G0_18 + 0.00803571428571428*G0_19;
 
5142
    A[18] = 0.000669642857142858*G0_0 + 0.000669642857142856*G0_1 + 0.00133928571428571*G0_2 + 0.000669642857142855*G0_3 - 0.00200892857142857*G0_4 - 0.00200892857142857*G0_9 - 0.00200892857142857*G0_13 + 0.00803571428571428*G0_16 + 0.00803571428571428*G0_17 + 0.0160714285714286*G0_18 + 0.00803571428571428*G0_19;
 
5143
    A[19] = 0.000669642857142858*G0_0 + 0.000669642857142856*G0_1 + 0.000669642857142857*G0_2 + 0.00133928571428571*G0_3 - 0.00200892857142857*G0_5 - 0.00200892857142857*G0_7 - 0.00200892857142857*G0_11 + 0.00803571428571429*G0_16 + 0.00803571428571428*G0_17 + 0.00803571428571428*G0_18 + 0.0160714285714286*G0_19;
 
5144
  }
 
5145
 
 
5146
};
 
5147
 
 
5148
/// This class defines the interface for the assembly of the global
 
5149
/// tensor corresponding to a form with r + n arguments, that is, a
 
5150
/// mapping
 
5151
///
 
5152
///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
 
5153
///
 
5154
/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
 
5155
/// global tensor A is defined by
 
5156
///
 
5157
///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
 
5158
///
 
5159
/// where each argument Vj represents the application to the
 
5160
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
 
5161
/// fixed functions (coefficients).
 
5162
 
 
5163
class UFC_Poisson3D_3LinearForm: public ufc::form
 
5164
{
 
5165
public:
 
5166
 
 
5167
  /// Constructor
 
5168
  UFC_Poisson3D_3LinearForm() : ufc::form()
 
5169
  {
 
5170
    // Do nothing
 
5171
  }
 
5172
 
 
5173
  /// Destructor
 
5174
  virtual ~UFC_Poisson3D_3LinearForm()
 
5175
  {
 
5176
    // Do nothing
 
5177
  }
 
5178
 
 
5179
  /// Return a string identifying the form
 
5180
  virtual const char* signature() const
 
5181
  {
 
5182
    return "w0_a0 | vi0*va0*dX(0)";
 
5183
  }
 
5184
 
 
5185
  /// Return the rank of the global tensor (r)
 
5186
  virtual unsigned int rank() const
 
5187
  {
 
5188
    return 1;
 
5189
  }
 
5190
 
 
5191
  /// Return the number of coefficients (n)
 
5192
  virtual unsigned int num_coefficients() const
 
5193
  {
 
5194
    return 1;
 
5195
  }
 
5196
 
 
5197
  /// Return the number of cell integrals
 
5198
  virtual unsigned int num_cell_integrals() const
 
5199
  {
 
5200
    return 1;
 
5201
  }
 
5202
  
 
5203
  /// Return the number of exterior facet integrals
 
5204
  virtual unsigned int num_exterior_facet_integrals() const
 
5205
  {
 
5206
    return 0;
 
5207
  }
 
5208
  
 
5209
  /// Return the number of interior facet integrals
 
5210
  virtual unsigned int num_interior_facet_integrals() const
 
5211
  {
 
5212
    return 0;
 
5213
  }
 
5214
    
 
5215
  /// Create a new finite element for argument function i
 
5216
  virtual ufc::finite_element* create_finite_element(unsigned int i) const
 
5217
  {
 
5218
    switch ( i )
 
5219
    {
 
5220
    case 0:
 
5221
      return new UFC_Poisson3D_3LinearForm_finite_element_0();
 
5222
      break;
 
5223
    case 1:
 
5224
      return new UFC_Poisson3D_3LinearForm_finite_element_1();
 
5225
      break;
 
5226
    }
 
5227
    return 0;
 
5228
  }
 
5229
  
 
5230
  /// Create a new dof map for argument function i
 
5231
  virtual ufc::dof_map* create_dof_map(unsigned int i) const
 
5232
  {
 
5233
    switch ( i )
 
5234
    {
 
5235
    case 0:
 
5236
      return new UFC_Poisson3D_3LinearForm_dof_map_0();
 
5237
      break;
 
5238
    case 1:
 
5239
      return new UFC_Poisson3D_3LinearForm_dof_map_1();
 
5240
      break;
 
5241
    }
 
5242
    return 0;
 
5243
  }
 
5244
 
 
5245
  /// Create a new cell integral on sub domain i
 
5246
  virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
 
5247
  {
 
5248
    return new UFC_Poisson3D_3LinearForm_cell_integral_0();
 
5249
  }
 
5250
 
 
5251
  /// Create a new exterior facet integral on sub domain i
 
5252
  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(unsigned int i) const
 
5253
  {
 
5254
    return 0;
 
5255
  }
 
5256
 
 
5257
  /// Create a new interior facet integral on sub domain i
 
5258
  virtual ufc::interior_facet_integral* create_interior_facet_integral(unsigned int i) const
 
5259
  {
 
5260
    return 0;
 
5261
  }
 
5262
 
 
5263
};
 
5264
 
 
5265
// DOLFIN wrappers
 
5266
 
 
5267
#include <dolfin/Form.h>
 
5268
 
 
5269
class Poisson3D_3BilinearForm : public dolfin::Form
 
5270
{
 
5271
public:
 
5272
 
 
5273
  Poisson3D_3BilinearForm() : dolfin::Form()
 
5274
  {
 
5275
    // Do nothing
 
5276
  }
 
5277
 
 
5278
  /// Return UFC form
 
5279
  virtual const ufc::form& form() const
 
5280
  {
 
5281
    return __form;
 
5282
  }
 
5283
  
 
5284
  /// Return array of coefficients
 
5285
  virtual const dolfin::Array<dolfin::Function*>& coefficients() const
 
5286
  {
 
5287
    return __coefficients;
 
5288
  }
 
5289
 
 
5290
private:
 
5291
 
 
5292
  // UFC form
 
5293
  UFC_Poisson3D_3BilinearForm __form;
 
5294
 
 
5295
  /// Array of coefficients
 
5296
  dolfin::Array<dolfin::Function*> __coefficients;
 
5297
 
 
5298
};
 
5299
 
 
5300
class Poisson3D_3LinearForm : public dolfin::Form
 
5301
{
 
5302
public:
 
5303
 
 
5304
  Poisson3D_3LinearForm(dolfin::Function& w0) : dolfin::Form()
 
5305
  {
 
5306
    __coefficients.push_back(&w0);
 
5307
  }
 
5308
 
 
5309
  /// Return UFC form
 
5310
  virtual const ufc::form& form() const
 
5311
  {
 
5312
    return __form;
 
5313
  }
 
5314
  
 
5315
  /// Return array of coefficients
 
5316
  virtual const dolfin::Array<dolfin::Function*>& coefficients() const
 
5317
  {
 
5318
    return __coefficients;
 
5319
  }
 
5320
 
 
5321
private:
 
5322
 
 
5323
  // UFC form
 
5324
  UFC_Poisson3D_3LinearForm __form;
 
5325
 
 
5326
  /// Array of coefficients
 
5327
  dolfin::Array<dolfin::Function*> __coefficients;
 
5328
 
 
5329
};
 
5330
 
 
5331
#endif