~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to bench/fem/assembly/Advection.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 __ADVECTION_H
 
8
#define __ADVECTION_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_AdvectionBilinearForm_finite_element_0: public ufc::finite_element
 
18
{
 
19
public:
 
20
 
 
21
  /// Constructor
 
22
  UFC_AdvectionBilinearForm_finite_element_0() : ufc::finite_element()
 
23
  {
 
24
    // Do nothing
 
25
  }
 
26
 
 
27
  /// Destructor
 
28
  virtual ~UFC_AdvectionBilinearForm_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_AdvectionBilinearForm_finite_element_0();
 
839
  }
 
840
 
 
841
};
 
842
 
 
843
/// This class defines the interface for a finite element.
 
844
 
 
845
class UFC_AdvectionBilinearForm_finite_element_1: public ufc::finite_element
 
846
{
 
847
public:
 
848
 
 
849
  /// Constructor
 
850
  UFC_AdvectionBilinearForm_finite_element_1() : ufc::finite_element()
 
851
  {
 
852
    // Do nothing
 
853
  }
 
854
 
 
855
  /// Destructor
 
856
  virtual ~UFC_AdvectionBilinearForm_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_AdvectionBilinearForm_finite_element_1();
 
1667
  }
 
1668
 
 
1669
};
 
1670
 
 
1671
/// This class defines the interface for a finite element.
 
1672
 
 
1673
class UFC_AdvectionBilinearForm_finite_element_2_0: public ufc::finite_element
 
1674
{
 
1675
public:
 
1676
 
 
1677
  /// Constructor
 
1678
  UFC_AdvectionBilinearForm_finite_element_2_0() : ufc::finite_element()
 
1679
  {
 
1680
    // Do nothing
 
1681
  }
 
1682
 
 
1683
  /// Destructor
 
1684
  virtual ~UFC_AdvectionBilinearForm_finite_element_2_0()
 
1685
  {
 
1686
    // Do nothing
 
1687
  }
 
1688
 
 
1689
  /// Return a string identifying the finite element
 
1690
  virtual const char* signature() const
 
1691
  {
 
1692
    return "Discontinuous Lagrange finite element of degree 0 on a tetrahedron";
 
1693
  }
 
1694
 
 
1695
  /// Return the cell shape
 
1696
  virtual ufc::shape cell_shape() const
 
1697
  {
 
1698
    return ufc::tetrahedron;
 
1699
  }
 
1700
 
 
1701
  /// Return the dimension of the finite element function space
 
1702
  virtual unsigned int space_dimension() const
 
1703
  {
 
1704
    return 1;
 
1705
  }
 
1706
 
 
1707
  /// Return the rank of the value space
 
1708
  virtual unsigned int value_rank() const
 
1709
  {
 
1710
    return 0;
 
1711
  }
 
1712
 
 
1713
  /// Return the dimension of the value space for axis i
 
1714
  virtual unsigned int value_dimension(unsigned int i) const
 
1715
  {
 
1716
    return 1;
 
1717
  }
 
1718
 
 
1719
  /// Evaluate basis function i at given point in cell
 
1720
  virtual void evaluate_basis(unsigned int i,
 
1721
                              double* values,
 
1722
                              const double* coordinates,
 
1723
                              const ufc::cell& c) const
 
1724
  {
 
1725
    // Extract vertex coordinates
 
1726
    const double * const * element_coordinates = c.coordinates;
 
1727
    
 
1728
    // Compute Jacobian of affine map from reference cell
 
1729
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
1730
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
1731
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
1732
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
1733
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
1734
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
1735
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
1736
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
1737
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
1738
      
 
1739
    // Compute sub determinants
 
1740
    const double d00 = J_11*J_22 - J_12*J_21;
 
1741
    const double d01 = J_12*J_20 - J_10*J_22;
 
1742
    const double d02 = J_10*J_21 - J_11*J_20;
 
1743
    
 
1744
    const double d10 = J_02*J_21 - J_01*J_22;
 
1745
    const double d11 = J_00*J_22 - J_02*J_20;
 
1746
    const double d12 = J_01*J_20 - J_00*J_21;
 
1747
    
 
1748
    const double d20 = J_01*J_12 - J_02*J_11;
 
1749
    const double d21 = J_02*J_10 - J_00*J_12;
 
1750
    const double d22 = J_00*J_11 - J_01*J_10;
 
1751
      
 
1752
    // Compute determinant of Jacobian
 
1753
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
1754
    
 
1755
    // Compute inverse of Jacobian
 
1756
    
 
1757
    // Compute constants
 
1758
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
1759
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
1760
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
1761
    
 
1762
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
1763
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
1764
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
1765
    
 
1766
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
1767
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
1768
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
1769
    
 
1770
    // Get coordinates and map to the UFC reference element
 
1771
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
1772
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
1773
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
1774
    
 
1775
    // Map coordinates to the reference cube
 
1776
    if (std::abs(y + z - 1.0) < 1e-14)
 
1777
      x = 1.0;
 
1778
    else
 
1779
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
1780
    if (std::abs(z - 1.0) < 1e-14)
 
1781
      y = -1.0;
 
1782
    else
 
1783
      y = 2.0 * y/(1.0 - z) - 1.0;
 
1784
    z = 2.0 * z - 1.0;
 
1785
    
 
1786
    // Reset values
 
1787
    *values = 0;
 
1788
    
 
1789
    // Map degree of freedom to element degree of freedom
 
1790
    const unsigned int dof = i;
 
1791
    
 
1792
    // Generate scalings
 
1793
    const double scalings_y_0 = 1;
 
1794
    const double scalings_z_0 = 1;
 
1795
    
 
1796
    // Compute psitilde_a
 
1797
    const double psitilde_a_0 = 1;
 
1798
    
 
1799
    // Compute psitilde_bs
 
1800
    const double psitilde_bs_0_0 = 1;
 
1801
    
 
1802
    // Compute psitilde_cs
 
1803
    const double psitilde_cs_00_0 = 1;
 
1804
    
 
1805
    // Compute basisvalues
 
1806
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
1807
    
 
1808
    // Table(s) of coefficients
 
1809
    const static double coefficients0[1][1] = \
 
1810
    {{1.15470053837925}};
 
1811
    
 
1812
    // Extract relevant coefficients
 
1813
    const double coeff0_0 = coefficients0[dof][0];
 
1814
    
 
1815
    // Compute value(s)
 
1816
    *values = coeff0_0*basisvalue0;
 
1817
  }
 
1818
 
 
1819
  /// Evaluate all basis functions at given point in cell
 
1820
  virtual void evaluate_basis_all(double* values,
 
1821
                                  const double* coordinates,
 
1822
                                  const ufc::cell& c) const
 
1823
  {
 
1824
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
 
1825
  }
 
1826
 
 
1827
  /// Evaluate order n derivatives of basis function i at given point in cell
 
1828
  virtual void evaluate_basis_derivatives(unsigned int i,
 
1829
                                          unsigned int n,
 
1830
                                          double* values,
 
1831
                                          const double* coordinates,
 
1832
                                          const ufc::cell& c) const
 
1833
  {
 
1834
    // Extract vertex coordinates
 
1835
    const double * const * element_coordinates = c.coordinates;
 
1836
    
 
1837
    // Compute Jacobian of affine map from reference cell
 
1838
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
1839
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
1840
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
1841
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
1842
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
1843
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
1844
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
1845
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
1846
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
1847
      
 
1848
    // Compute sub determinants
 
1849
    const double d00 = J_11*J_22 - J_12*J_21;
 
1850
    const double d01 = J_12*J_20 - J_10*J_22;
 
1851
    const double d02 = J_10*J_21 - J_11*J_20;
 
1852
    
 
1853
    const double d10 = J_02*J_21 - J_01*J_22;
 
1854
    const double d11 = J_00*J_22 - J_02*J_20;
 
1855
    const double d12 = J_01*J_20 - J_00*J_21;
 
1856
    
 
1857
    const double d20 = J_01*J_12 - J_02*J_11;
 
1858
    const double d21 = J_02*J_10 - J_00*J_12;
 
1859
    const double d22 = J_00*J_11 - J_01*J_10;
 
1860
      
 
1861
    // Compute determinant of Jacobian
 
1862
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
1863
    
 
1864
    // Compute inverse of Jacobian
 
1865
    
 
1866
    // Compute constants
 
1867
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
1868
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
1869
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
1870
    
 
1871
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
1872
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
1873
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
1874
    
 
1875
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
1876
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
1877
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
1878
    
 
1879
    // Get coordinates and map to the UFC reference element
 
1880
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
1881
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
1882
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
1883
    
 
1884
    // Map coordinates to the reference cube
 
1885
    if (std::abs(y + z - 1.0) < 1e-14)
 
1886
      x = 1.0;
 
1887
    else
 
1888
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
1889
    if (std::abs(z - 1.0) < 1e-14)
 
1890
      y = -1.0;
 
1891
    else
 
1892
      y = 2.0 * y/(1.0 - z) - 1.0;
 
1893
    z = 2.0 * z - 1.0;
 
1894
    
 
1895
    // Compute number of derivatives
 
1896
    unsigned int num_derivatives = 1;
 
1897
    
 
1898
    for (unsigned int j = 0; j < n; j++)
 
1899
      num_derivatives *= 3;
 
1900
    
 
1901
    
 
1902
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
 
1903
    unsigned int **combinations = new unsigned int *[num_derivatives];
 
1904
        
 
1905
    for (unsigned int j = 0; j < num_derivatives; j++)
 
1906
    {
 
1907
      combinations[j] = new unsigned int [n];
 
1908
      for (unsigned int k = 0; k < n; k++)
 
1909
        combinations[j][k] = 0;
 
1910
    }
 
1911
        
 
1912
    // Generate combinations of derivatives
 
1913
    for (unsigned int row = 1; row < num_derivatives; row++)
 
1914
    {
 
1915
      for (unsigned int num = 0; num < row; num++)
 
1916
      {
 
1917
        for (unsigned int col = n-1; col+1 > 0; col--)
 
1918
        {
 
1919
          if (combinations[row][col] + 1 > 2)
 
1920
            combinations[row][col] = 0;
 
1921
          else
 
1922
          {
 
1923
            combinations[row][col] += 1;
 
1924
            break;
 
1925
          }
 
1926
        }
 
1927
      }
 
1928
    }
 
1929
    
 
1930
    // Compute inverse of Jacobian
 
1931
    const double Jinv[3][3] ={{d00 / detJ, d10 / detJ, d20 / detJ}, {d01 / detJ, d11 / detJ, d21 / detJ}, {d02 / detJ, d12 / detJ, d22 / detJ}};
 
1932
    
 
1933
    // Declare transformation matrix
 
1934
    // Declare pointer to two dimensional array and initialise
 
1935
    double **transform = new double *[num_derivatives];
 
1936
        
 
1937
    for (unsigned int j = 0; j < num_derivatives; j++)
 
1938
    {
 
1939
      transform[j] = new double [num_derivatives];
 
1940
      for (unsigned int k = 0; k < num_derivatives; k++)
 
1941
        transform[j][k] = 1;
 
1942
    }
 
1943
    
 
1944
    // Construct transformation matrix
 
1945
    for (unsigned int row = 0; row < num_derivatives; row++)
 
1946
    {
 
1947
      for (unsigned int col = 0; col < num_derivatives; col++)
 
1948
      {
 
1949
        for (unsigned int k = 0; k < n; k++)
 
1950
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
 
1951
      }
 
1952
    }
 
1953
    
 
1954
    // Reset values
 
1955
    for (unsigned int j = 0; j < 1*num_derivatives; j++)
 
1956
      values[j] = 0;
 
1957
    
 
1958
    // Map degree of freedom to element degree of freedom
 
1959
    const unsigned int dof = i;
 
1960
    
 
1961
    // Generate scalings
 
1962
    const double scalings_y_0 = 1;
 
1963
    const double scalings_z_0 = 1;
 
1964
    
 
1965
    // Compute psitilde_a
 
1966
    const double psitilde_a_0 = 1;
 
1967
    
 
1968
    // Compute psitilde_bs
 
1969
    const double psitilde_bs_0_0 = 1;
 
1970
    
 
1971
    // Compute psitilde_cs
 
1972
    const double psitilde_cs_00_0 = 1;
 
1973
    
 
1974
    // Compute basisvalues
 
1975
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
1976
    
 
1977
    // Table(s) of coefficients
 
1978
    const static double coefficients0[1][1] = \
 
1979
    {{1.15470053837925}};
 
1980
    
 
1981
    // Interesting (new) part
 
1982
    // Tables of derivatives of the polynomial base (transpose)
 
1983
    const static double dmats0[1][1] = \
 
1984
    {{0}};
 
1985
    
 
1986
    const static double dmats1[1][1] = \
 
1987
    {{0}};
 
1988
    
 
1989
    const static double dmats2[1][1] = \
 
1990
    {{0}};
 
1991
    
 
1992
    // Compute reference derivatives
 
1993
    // Declare pointer to array of derivatives on FIAT element
 
1994
    double *derivatives = new double [num_derivatives];
 
1995
    
 
1996
    // Declare coefficients
 
1997
    double coeff0_0 = 0;
 
1998
    
 
1999
    // Declare new coefficients
 
2000
    double new_coeff0_0 = 0;
 
2001
    
 
2002
    // Loop possible derivatives
 
2003
    for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
2004
    {
 
2005
      // Get values from coefficients array
 
2006
      new_coeff0_0 = coefficients0[dof][0];
 
2007
    
 
2008
      // Loop derivative order
 
2009
      for (unsigned int j = 0; j < n; j++)
 
2010
      {
 
2011
        // Update old coefficients
 
2012
        coeff0_0 = new_coeff0_0;
 
2013
    
 
2014
        if(combinations[deriv_num][j] == 0)
 
2015
        {
 
2016
          new_coeff0_0 = coeff0_0*dmats0[0][0];
 
2017
        }
 
2018
        if(combinations[deriv_num][j] == 1)
 
2019
        {
 
2020
          new_coeff0_0 = coeff0_0*dmats1[0][0];
 
2021
        }
 
2022
        if(combinations[deriv_num][j] == 2)
 
2023
        {
 
2024
          new_coeff0_0 = coeff0_0*dmats2[0][0];
 
2025
        }
 
2026
    
 
2027
      }
 
2028
      // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
2029
      derivatives[deriv_num] = new_coeff0_0*basisvalue0;
 
2030
    }
 
2031
    
 
2032
    // Transform derivatives back to physical element
 
2033
    for (unsigned int row = 0; row < num_derivatives; row++)
 
2034
    {
 
2035
      for (unsigned int col = 0; col < num_derivatives; col++)
 
2036
      {
 
2037
        values[row] += transform[row][col]*derivatives[col];
 
2038
      }
 
2039
    }
 
2040
    // Delete pointer to array of derivatives on FIAT element
 
2041
    delete [] derivatives;
 
2042
    
 
2043
    // Delete pointer to array of combinations of derivatives and transform
 
2044
    for (unsigned int row = 0; row < num_derivatives; row++)
 
2045
    {
 
2046
      delete [] combinations[row];
 
2047
      delete [] transform[row];
 
2048
    }
 
2049
    
 
2050
    delete [] combinations;
 
2051
    delete [] transform;
 
2052
  }
 
2053
 
 
2054
  /// Evaluate order n derivatives of all basis functions at given point in cell
 
2055
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
2056
                                              double* values,
 
2057
                                              const double* coordinates,
 
2058
                                              const ufc::cell& c) const
 
2059
  {
 
2060
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
 
2061
  }
 
2062
 
 
2063
  /// Evaluate linear functional for dof i on the function f
 
2064
  virtual double evaluate_dof(unsigned int i,
 
2065
                              const ufc::function& f,
 
2066
                              const ufc::cell& c) const
 
2067
  {
 
2068
    // The reference points, direction and weights:
 
2069
    const static double X[1][1][3] = {{{0.25, 0.25, 0.25}}};
 
2070
    const static double W[1][1] = {{1}};
 
2071
    const static double D[1][1][1] = {{{1}}};
 
2072
    
 
2073
    const double * const * x = c.coordinates;
 
2074
    double result = 0.0;
 
2075
    // Iterate over the points:
 
2076
    // Evaluate basis functions for affine mapping
 
2077
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1] - X[i][0][2];
 
2078
    const double w1 = X[i][0][0];
 
2079
    const double w2 = X[i][0][1];
 
2080
    const double w3 = X[i][0][2];
 
2081
    
 
2082
    // Compute affine mapping y = F(X)
 
2083
    double y[3];
 
2084
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0] + w3*x[3][0];
 
2085
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1] + w3*x[3][1];
 
2086
    y[2] = w0*x[0][2] + w1*x[1][2] + w2*x[2][2] + w3*x[3][2];
 
2087
    
 
2088
    // Evaluate function at physical points
 
2089
    double values[1];
 
2090
    f.evaluate(values, y, c);
 
2091
    
 
2092
    // Map function values using appropriate mapping
 
2093
    // Affine map: Do nothing
 
2094
    
 
2095
    // Note that we do not map the weights (yet).
 
2096
    
 
2097
    // Take directional components
 
2098
    for(int k = 0; k < 1; k++)
 
2099
      result += values[k]*D[i][0][k];
 
2100
    // Multiply by weights 
 
2101
    result *= W[i][0];
 
2102
    
 
2103
    return result;
 
2104
  }
 
2105
 
 
2106
  /// Evaluate linear functionals for all dofs on the function f
 
2107
  virtual void evaluate_dofs(double* values,
 
2108
                             const ufc::function& f,
 
2109
                             const ufc::cell& c) const
 
2110
  {
 
2111
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
2112
  }
 
2113
 
 
2114
  /// Interpolate vertex values from dof values
 
2115
  virtual void interpolate_vertex_values(double* vertex_values,
 
2116
                                         const double* dof_values,
 
2117
                                         const ufc::cell& c) const
 
2118
  {
 
2119
    // Evaluate at vertices and use affine mapping
 
2120
    vertex_values[0] = dof_values[0];
 
2121
    vertex_values[1] = dof_values[0];
 
2122
    vertex_values[2] = dof_values[0];
 
2123
    vertex_values[3] = dof_values[0];
 
2124
  }
 
2125
 
 
2126
  /// Return the number of sub elements (for a mixed element)
 
2127
  virtual unsigned int num_sub_elements() const
 
2128
  {
 
2129
    return 1;
 
2130
  }
 
2131
 
 
2132
  /// Create a new finite element for sub element i (for a mixed element)
 
2133
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
2134
  {
 
2135
    return new UFC_AdvectionBilinearForm_finite_element_2_0();
 
2136
  }
 
2137
 
 
2138
};
 
2139
 
 
2140
/// This class defines the interface for a finite element.
 
2141
 
 
2142
class UFC_AdvectionBilinearForm_finite_element_2_1: public ufc::finite_element
 
2143
{
 
2144
public:
 
2145
 
 
2146
  /// Constructor
 
2147
  UFC_AdvectionBilinearForm_finite_element_2_1() : ufc::finite_element()
 
2148
  {
 
2149
    // Do nothing
 
2150
  }
 
2151
 
 
2152
  /// Destructor
 
2153
  virtual ~UFC_AdvectionBilinearForm_finite_element_2_1()
 
2154
  {
 
2155
    // Do nothing
 
2156
  }
 
2157
 
 
2158
  /// Return a string identifying the finite element
 
2159
  virtual const char* signature() const
 
2160
  {
 
2161
    return "Discontinuous Lagrange finite element of degree 0 on a tetrahedron";
 
2162
  }
 
2163
 
 
2164
  /// Return the cell shape
 
2165
  virtual ufc::shape cell_shape() const
 
2166
  {
 
2167
    return ufc::tetrahedron;
 
2168
  }
 
2169
 
 
2170
  /// Return the dimension of the finite element function space
 
2171
  virtual unsigned int space_dimension() const
 
2172
  {
 
2173
    return 1;
 
2174
  }
 
2175
 
 
2176
  /// Return the rank of the value space
 
2177
  virtual unsigned int value_rank() const
 
2178
  {
 
2179
    return 0;
 
2180
  }
 
2181
 
 
2182
  /// Return the dimension of the value space for axis i
 
2183
  virtual unsigned int value_dimension(unsigned int i) const
 
2184
  {
 
2185
    return 1;
 
2186
  }
 
2187
 
 
2188
  /// Evaluate basis function i at given point in cell
 
2189
  virtual void evaluate_basis(unsigned int i,
 
2190
                              double* values,
 
2191
                              const double* coordinates,
 
2192
                              const ufc::cell& c) const
 
2193
  {
 
2194
    // Extract vertex coordinates
 
2195
    const double * const * element_coordinates = c.coordinates;
 
2196
    
 
2197
    // Compute Jacobian of affine map from reference cell
 
2198
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
2199
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
2200
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
2201
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
2202
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
2203
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
2204
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
2205
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
2206
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
2207
      
 
2208
    // Compute sub determinants
 
2209
    const double d00 = J_11*J_22 - J_12*J_21;
 
2210
    const double d01 = J_12*J_20 - J_10*J_22;
 
2211
    const double d02 = J_10*J_21 - J_11*J_20;
 
2212
    
 
2213
    const double d10 = J_02*J_21 - J_01*J_22;
 
2214
    const double d11 = J_00*J_22 - J_02*J_20;
 
2215
    const double d12 = J_01*J_20 - J_00*J_21;
 
2216
    
 
2217
    const double d20 = J_01*J_12 - J_02*J_11;
 
2218
    const double d21 = J_02*J_10 - J_00*J_12;
 
2219
    const double d22 = J_00*J_11 - J_01*J_10;
 
2220
      
 
2221
    // Compute determinant of Jacobian
 
2222
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
2223
    
 
2224
    // Compute inverse of Jacobian
 
2225
    
 
2226
    // Compute constants
 
2227
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
2228
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
2229
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
2230
    
 
2231
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
2232
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
2233
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
2234
    
 
2235
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
2236
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
2237
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
2238
    
 
2239
    // Get coordinates and map to the UFC reference element
 
2240
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
2241
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
2242
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
2243
    
 
2244
    // Map coordinates to the reference cube
 
2245
    if (std::abs(y + z - 1.0) < 1e-14)
 
2246
      x = 1.0;
 
2247
    else
 
2248
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
2249
    if (std::abs(z - 1.0) < 1e-14)
 
2250
      y = -1.0;
 
2251
    else
 
2252
      y = 2.0 * y/(1.0 - z) - 1.0;
 
2253
    z = 2.0 * z - 1.0;
 
2254
    
 
2255
    // Reset values
 
2256
    *values = 0;
 
2257
    
 
2258
    // Map degree of freedom to element degree of freedom
 
2259
    const unsigned int dof = i;
 
2260
    
 
2261
    // Generate scalings
 
2262
    const double scalings_y_0 = 1;
 
2263
    const double scalings_z_0 = 1;
 
2264
    
 
2265
    // Compute psitilde_a
 
2266
    const double psitilde_a_0 = 1;
 
2267
    
 
2268
    // Compute psitilde_bs
 
2269
    const double psitilde_bs_0_0 = 1;
 
2270
    
 
2271
    // Compute psitilde_cs
 
2272
    const double psitilde_cs_00_0 = 1;
 
2273
    
 
2274
    // Compute basisvalues
 
2275
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
2276
    
 
2277
    // Table(s) of coefficients
 
2278
    const static double coefficients0[1][1] = \
 
2279
    {{1.15470053837925}};
 
2280
    
 
2281
    // Extract relevant coefficients
 
2282
    const double coeff0_0 = coefficients0[dof][0];
 
2283
    
 
2284
    // Compute value(s)
 
2285
    *values = coeff0_0*basisvalue0;
 
2286
  }
 
2287
 
 
2288
  /// Evaluate all basis functions at given point in cell
 
2289
  virtual void evaluate_basis_all(double* values,
 
2290
                                  const double* coordinates,
 
2291
                                  const ufc::cell& c) const
 
2292
  {
 
2293
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
 
2294
  }
 
2295
 
 
2296
  /// Evaluate order n derivatives of basis function i at given point in cell
 
2297
  virtual void evaluate_basis_derivatives(unsigned int i,
 
2298
                                          unsigned int n,
 
2299
                                          double* values,
 
2300
                                          const double* coordinates,
 
2301
                                          const ufc::cell& c) const
 
2302
  {
 
2303
    // Extract vertex coordinates
 
2304
    const double * const * element_coordinates = c.coordinates;
 
2305
    
 
2306
    // Compute Jacobian of affine map from reference cell
 
2307
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
2308
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
2309
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
2310
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
2311
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
2312
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
2313
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
2314
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
2315
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
2316
      
 
2317
    // Compute sub determinants
 
2318
    const double d00 = J_11*J_22 - J_12*J_21;
 
2319
    const double d01 = J_12*J_20 - J_10*J_22;
 
2320
    const double d02 = J_10*J_21 - J_11*J_20;
 
2321
    
 
2322
    const double d10 = J_02*J_21 - J_01*J_22;
 
2323
    const double d11 = J_00*J_22 - J_02*J_20;
 
2324
    const double d12 = J_01*J_20 - J_00*J_21;
 
2325
    
 
2326
    const double d20 = J_01*J_12 - J_02*J_11;
 
2327
    const double d21 = J_02*J_10 - J_00*J_12;
 
2328
    const double d22 = J_00*J_11 - J_01*J_10;
 
2329
      
 
2330
    // Compute determinant of Jacobian
 
2331
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
2332
    
 
2333
    // Compute inverse of Jacobian
 
2334
    
 
2335
    // Compute constants
 
2336
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
2337
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
2338
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
2339
    
 
2340
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
2341
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
2342
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
2343
    
 
2344
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
2345
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
2346
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
2347
    
 
2348
    // Get coordinates and map to the UFC reference element
 
2349
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
2350
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
2351
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
2352
    
 
2353
    // Map coordinates to the reference cube
 
2354
    if (std::abs(y + z - 1.0) < 1e-14)
 
2355
      x = 1.0;
 
2356
    else
 
2357
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
2358
    if (std::abs(z - 1.0) < 1e-14)
 
2359
      y = -1.0;
 
2360
    else
 
2361
      y = 2.0 * y/(1.0 - z) - 1.0;
 
2362
    z = 2.0 * z - 1.0;
 
2363
    
 
2364
    // Compute number of derivatives
 
2365
    unsigned int num_derivatives = 1;
 
2366
    
 
2367
    for (unsigned int j = 0; j < n; j++)
 
2368
      num_derivatives *= 3;
 
2369
    
 
2370
    
 
2371
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
 
2372
    unsigned int **combinations = new unsigned int *[num_derivatives];
 
2373
        
 
2374
    for (unsigned int j = 0; j < num_derivatives; j++)
 
2375
    {
 
2376
      combinations[j] = new unsigned int [n];
 
2377
      for (unsigned int k = 0; k < n; k++)
 
2378
        combinations[j][k] = 0;
 
2379
    }
 
2380
        
 
2381
    // Generate combinations of derivatives
 
2382
    for (unsigned int row = 1; row < num_derivatives; row++)
 
2383
    {
 
2384
      for (unsigned int num = 0; num < row; num++)
 
2385
      {
 
2386
        for (unsigned int col = n-1; col+1 > 0; col--)
 
2387
        {
 
2388
          if (combinations[row][col] + 1 > 2)
 
2389
            combinations[row][col] = 0;
 
2390
          else
 
2391
          {
 
2392
            combinations[row][col] += 1;
 
2393
            break;
 
2394
          }
 
2395
        }
 
2396
      }
 
2397
    }
 
2398
    
 
2399
    // Compute inverse of Jacobian
 
2400
    const double Jinv[3][3] ={{d00 / detJ, d10 / detJ, d20 / detJ}, {d01 / detJ, d11 / detJ, d21 / detJ}, {d02 / detJ, d12 / detJ, d22 / detJ}};
 
2401
    
 
2402
    // Declare transformation matrix
 
2403
    // Declare pointer to two dimensional array and initialise
 
2404
    double **transform = new double *[num_derivatives];
 
2405
        
 
2406
    for (unsigned int j = 0; j < num_derivatives; j++)
 
2407
    {
 
2408
      transform[j] = new double [num_derivatives];
 
2409
      for (unsigned int k = 0; k < num_derivatives; k++)
 
2410
        transform[j][k] = 1;
 
2411
    }
 
2412
    
 
2413
    // Construct transformation matrix
 
2414
    for (unsigned int row = 0; row < num_derivatives; row++)
 
2415
    {
 
2416
      for (unsigned int col = 0; col < num_derivatives; col++)
 
2417
      {
 
2418
        for (unsigned int k = 0; k < n; k++)
 
2419
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
 
2420
      }
 
2421
    }
 
2422
    
 
2423
    // Reset values
 
2424
    for (unsigned int j = 0; j < 1*num_derivatives; j++)
 
2425
      values[j] = 0;
 
2426
    
 
2427
    // Map degree of freedom to element degree of freedom
 
2428
    const unsigned int dof = i;
 
2429
    
 
2430
    // Generate scalings
 
2431
    const double scalings_y_0 = 1;
 
2432
    const double scalings_z_0 = 1;
 
2433
    
 
2434
    // Compute psitilde_a
 
2435
    const double psitilde_a_0 = 1;
 
2436
    
 
2437
    // Compute psitilde_bs
 
2438
    const double psitilde_bs_0_0 = 1;
 
2439
    
 
2440
    // Compute psitilde_cs
 
2441
    const double psitilde_cs_00_0 = 1;
 
2442
    
 
2443
    // Compute basisvalues
 
2444
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
2445
    
 
2446
    // Table(s) of coefficients
 
2447
    const static double coefficients0[1][1] = \
 
2448
    {{1.15470053837925}};
 
2449
    
 
2450
    // Interesting (new) part
 
2451
    // Tables of derivatives of the polynomial base (transpose)
 
2452
    const static double dmats0[1][1] = \
 
2453
    {{0}};
 
2454
    
 
2455
    const static double dmats1[1][1] = \
 
2456
    {{0}};
 
2457
    
 
2458
    const static double dmats2[1][1] = \
 
2459
    {{0}};
 
2460
    
 
2461
    // Compute reference derivatives
 
2462
    // Declare pointer to array of derivatives on FIAT element
 
2463
    double *derivatives = new double [num_derivatives];
 
2464
    
 
2465
    // Declare coefficients
 
2466
    double coeff0_0 = 0;
 
2467
    
 
2468
    // Declare new coefficients
 
2469
    double new_coeff0_0 = 0;
 
2470
    
 
2471
    // Loop possible derivatives
 
2472
    for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
2473
    {
 
2474
      // Get values from coefficients array
 
2475
      new_coeff0_0 = coefficients0[dof][0];
 
2476
    
 
2477
      // Loop derivative order
 
2478
      for (unsigned int j = 0; j < n; j++)
 
2479
      {
 
2480
        // Update old coefficients
 
2481
        coeff0_0 = new_coeff0_0;
 
2482
    
 
2483
        if(combinations[deriv_num][j] == 0)
 
2484
        {
 
2485
          new_coeff0_0 = coeff0_0*dmats0[0][0];
 
2486
        }
 
2487
        if(combinations[deriv_num][j] == 1)
 
2488
        {
 
2489
          new_coeff0_0 = coeff0_0*dmats1[0][0];
 
2490
        }
 
2491
        if(combinations[deriv_num][j] == 2)
 
2492
        {
 
2493
          new_coeff0_0 = coeff0_0*dmats2[0][0];
 
2494
        }
 
2495
    
 
2496
      }
 
2497
      // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
2498
      derivatives[deriv_num] = new_coeff0_0*basisvalue0;
 
2499
    }
 
2500
    
 
2501
    // Transform derivatives back to physical element
 
2502
    for (unsigned int row = 0; row < num_derivatives; row++)
 
2503
    {
 
2504
      for (unsigned int col = 0; col < num_derivatives; col++)
 
2505
      {
 
2506
        values[row] += transform[row][col]*derivatives[col];
 
2507
      }
 
2508
    }
 
2509
    // Delete pointer to array of derivatives on FIAT element
 
2510
    delete [] derivatives;
 
2511
    
 
2512
    // Delete pointer to array of combinations of derivatives and transform
 
2513
    for (unsigned int row = 0; row < num_derivatives; row++)
 
2514
    {
 
2515
      delete [] combinations[row];
 
2516
      delete [] transform[row];
 
2517
    }
 
2518
    
 
2519
    delete [] combinations;
 
2520
    delete [] transform;
 
2521
  }
 
2522
 
 
2523
  /// Evaluate order n derivatives of all basis functions at given point in cell
 
2524
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
2525
                                              double* values,
 
2526
                                              const double* coordinates,
 
2527
                                              const ufc::cell& c) const
 
2528
  {
 
2529
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
 
2530
  }
 
2531
 
 
2532
  /// Evaluate linear functional for dof i on the function f
 
2533
  virtual double evaluate_dof(unsigned int i,
 
2534
                              const ufc::function& f,
 
2535
                              const ufc::cell& c) const
 
2536
  {
 
2537
    // The reference points, direction and weights:
 
2538
    const static double X[1][1][3] = {{{0.25, 0.25, 0.25}}};
 
2539
    const static double W[1][1] = {{1}};
 
2540
    const static double D[1][1][1] = {{{1}}};
 
2541
    
 
2542
    const double * const * x = c.coordinates;
 
2543
    double result = 0.0;
 
2544
    // Iterate over the points:
 
2545
    // Evaluate basis functions for affine mapping
 
2546
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1] - X[i][0][2];
 
2547
    const double w1 = X[i][0][0];
 
2548
    const double w2 = X[i][0][1];
 
2549
    const double w3 = X[i][0][2];
 
2550
    
 
2551
    // Compute affine mapping y = F(X)
 
2552
    double y[3];
 
2553
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0] + w3*x[3][0];
 
2554
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1] + w3*x[3][1];
 
2555
    y[2] = w0*x[0][2] + w1*x[1][2] + w2*x[2][2] + w3*x[3][2];
 
2556
    
 
2557
    // Evaluate function at physical points
 
2558
    double values[1];
 
2559
    f.evaluate(values, y, c);
 
2560
    
 
2561
    // Map function values using appropriate mapping
 
2562
    // Affine map: Do nothing
 
2563
    
 
2564
    // Note that we do not map the weights (yet).
 
2565
    
 
2566
    // Take directional components
 
2567
    for(int k = 0; k < 1; k++)
 
2568
      result += values[k]*D[i][0][k];
 
2569
    // Multiply by weights 
 
2570
    result *= W[i][0];
 
2571
    
 
2572
    return result;
 
2573
  }
 
2574
 
 
2575
  /// Evaluate linear functionals for all dofs on the function f
 
2576
  virtual void evaluate_dofs(double* values,
 
2577
                             const ufc::function& f,
 
2578
                             const ufc::cell& c) const
 
2579
  {
 
2580
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
2581
  }
 
2582
 
 
2583
  /// Interpolate vertex values from dof values
 
2584
  virtual void interpolate_vertex_values(double* vertex_values,
 
2585
                                         const double* dof_values,
 
2586
                                         const ufc::cell& c) const
 
2587
  {
 
2588
    // Evaluate at vertices and use affine mapping
 
2589
    vertex_values[0] = dof_values[0];
 
2590
    vertex_values[1] = dof_values[0];
 
2591
    vertex_values[2] = dof_values[0];
 
2592
    vertex_values[3] = dof_values[0];
 
2593
  }
 
2594
 
 
2595
  /// Return the number of sub elements (for a mixed element)
 
2596
  virtual unsigned int num_sub_elements() const
 
2597
  {
 
2598
    return 1;
 
2599
  }
 
2600
 
 
2601
  /// Create a new finite element for sub element i (for a mixed element)
 
2602
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
2603
  {
 
2604
    return new UFC_AdvectionBilinearForm_finite_element_2_1();
 
2605
  }
 
2606
 
 
2607
};
 
2608
 
 
2609
/// This class defines the interface for a finite element.
 
2610
 
 
2611
class UFC_AdvectionBilinearForm_finite_element_2_2: public ufc::finite_element
 
2612
{
 
2613
public:
 
2614
 
 
2615
  /// Constructor
 
2616
  UFC_AdvectionBilinearForm_finite_element_2_2() : ufc::finite_element()
 
2617
  {
 
2618
    // Do nothing
 
2619
  }
 
2620
 
 
2621
  /// Destructor
 
2622
  virtual ~UFC_AdvectionBilinearForm_finite_element_2_2()
 
2623
  {
 
2624
    // Do nothing
 
2625
  }
 
2626
 
 
2627
  /// Return a string identifying the finite element
 
2628
  virtual const char* signature() const
 
2629
  {
 
2630
    return "Discontinuous Lagrange finite element of degree 0 on a tetrahedron";
 
2631
  }
 
2632
 
 
2633
  /// Return the cell shape
 
2634
  virtual ufc::shape cell_shape() const
 
2635
  {
 
2636
    return ufc::tetrahedron;
 
2637
  }
 
2638
 
 
2639
  /// Return the dimension of the finite element function space
 
2640
  virtual unsigned int space_dimension() const
 
2641
  {
 
2642
    return 1;
 
2643
  }
 
2644
 
 
2645
  /// Return the rank of the value space
 
2646
  virtual unsigned int value_rank() const
 
2647
  {
 
2648
    return 0;
 
2649
  }
 
2650
 
 
2651
  /// Return the dimension of the value space for axis i
 
2652
  virtual unsigned int value_dimension(unsigned int i) const
 
2653
  {
 
2654
    return 1;
 
2655
  }
 
2656
 
 
2657
  /// Evaluate basis function i at given point in cell
 
2658
  virtual void evaluate_basis(unsigned int i,
 
2659
                              double* values,
 
2660
                              const double* coordinates,
 
2661
                              const ufc::cell& c) const
 
2662
  {
 
2663
    // Extract vertex coordinates
 
2664
    const double * const * element_coordinates = c.coordinates;
 
2665
    
 
2666
    // Compute Jacobian of affine map from reference cell
 
2667
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
2668
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
2669
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
2670
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
2671
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
2672
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
2673
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
2674
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
2675
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
2676
      
 
2677
    // Compute sub determinants
 
2678
    const double d00 = J_11*J_22 - J_12*J_21;
 
2679
    const double d01 = J_12*J_20 - J_10*J_22;
 
2680
    const double d02 = J_10*J_21 - J_11*J_20;
 
2681
    
 
2682
    const double d10 = J_02*J_21 - J_01*J_22;
 
2683
    const double d11 = J_00*J_22 - J_02*J_20;
 
2684
    const double d12 = J_01*J_20 - J_00*J_21;
 
2685
    
 
2686
    const double d20 = J_01*J_12 - J_02*J_11;
 
2687
    const double d21 = J_02*J_10 - J_00*J_12;
 
2688
    const double d22 = J_00*J_11 - J_01*J_10;
 
2689
      
 
2690
    // Compute determinant of Jacobian
 
2691
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
2692
    
 
2693
    // Compute inverse of Jacobian
 
2694
    
 
2695
    // Compute constants
 
2696
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
2697
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
2698
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
2699
    
 
2700
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
2701
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
2702
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
2703
    
 
2704
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
2705
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
2706
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
2707
    
 
2708
    // Get coordinates and map to the UFC reference element
 
2709
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
2710
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
2711
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
2712
    
 
2713
    // Map coordinates to the reference cube
 
2714
    if (std::abs(y + z - 1.0) < 1e-14)
 
2715
      x = 1.0;
 
2716
    else
 
2717
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
2718
    if (std::abs(z - 1.0) < 1e-14)
 
2719
      y = -1.0;
 
2720
    else
 
2721
      y = 2.0 * y/(1.0 - z) - 1.0;
 
2722
    z = 2.0 * z - 1.0;
 
2723
    
 
2724
    // Reset values
 
2725
    *values = 0;
 
2726
    
 
2727
    // Map degree of freedom to element degree of freedom
 
2728
    const unsigned int dof = i;
 
2729
    
 
2730
    // Generate scalings
 
2731
    const double scalings_y_0 = 1;
 
2732
    const double scalings_z_0 = 1;
 
2733
    
 
2734
    // Compute psitilde_a
 
2735
    const double psitilde_a_0 = 1;
 
2736
    
 
2737
    // Compute psitilde_bs
 
2738
    const double psitilde_bs_0_0 = 1;
 
2739
    
 
2740
    // Compute psitilde_cs
 
2741
    const double psitilde_cs_00_0 = 1;
 
2742
    
 
2743
    // Compute basisvalues
 
2744
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
2745
    
 
2746
    // Table(s) of coefficients
 
2747
    const static double coefficients0[1][1] = \
 
2748
    {{1.15470053837925}};
 
2749
    
 
2750
    // Extract relevant coefficients
 
2751
    const double coeff0_0 = coefficients0[dof][0];
 
2752
    
 
2753
    // Compute value(s)
 
2754
    *values = coeff0_0*basisvalue0;
 
2755
  }
 
2756
 
 
2757
  /// Evaluate all basis functions at given point in cell
 
2758
  virtual void evaluate_basis_all(double* values,
 
2759
                                  const double* coordinates,
 
2760
                                  const ufc::cell& c) const
 
2761
  {
 
2762
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
 
2763
  }
 
2764
 
 
2765
  /// Evaluate order n derivatives of basis function i at given point in cell
 
2766
  virtual void evaluate_basis_derivatives(unsigned int i,
 
2767
                                          unsigned int n,
 
2768
                                          double* values,
 
2769
                                          const double* coordinates,
 
2770
                                          const ufc::cell& c) const
 
2771
  {
 
2772
    // Extract vertex coordinates
 
2773
    const double * const * element_coordinates = c.coordinates;
 
2774
    
 
2775
    // Compute Jacobian of affine map from reference cell
 
2776
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
2777
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
2778
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
2779
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
2780
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
2781
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
2782
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
2783
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
2784
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
2785
      
 
2786
    // Compute sub determinants
 
2787
    const double d00 = J_11*J_22 - J_12*J_21;
 
2788
    const double d01 = J_12*J_20 - J_10*J_22;
 
2789
    const double d02 = J_10*J_21 - J_11*J_20;
 
2790
    
 
2791
    const double d10 = J_02*J_21 - J_01*J_22;
 
2792
    const double d11 = J_00*J_22 - J_02*J_20;
 
2793
    const double d12 = J_01*J_20 - J_00*J_21;
 
2794
    
 
2795
    const double d20 = J_01*J_12 - J_02*J_11;
 
2796
    const double d21 = J_02*J_10 - J_00*J_12;
 
2797
    const double d22 = J_00*J_11 - J_01*J_10;
 
2798
      
 
2799
    // Compute determinant of Jacobian
 
2800
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
2801
    
 
2802
    // Compute inverse of Jacobian
 
2803
    
 
2804
    // Compute constants
 
2805
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
2806
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
2807
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
2808
    
 
2809
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
2810
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
2811
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
2812
    
 
2813
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
2814
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
2815
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
2816
    
 
2817
    // Get coordinates and map to the UFC reference element
 
2818
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
2819
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
2820
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
2821
    
 
2822
    // Map coordinates to the reference cube
 
2823
    if (std::abs(y + z - 1.0) < 1e-14)
 
2824
      x = 1.0;
 
2825
    else
 
2826
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
2827
    if (std::abs(z - 1.0) < 1e-14)
 
2828
      y = -1.0;
 
2829
    else
 
2830
      y = 2.0 * y/(1.0 - z) - 1.0;
 
2831
    z = 2.0 * z - 1.0;
 
2832
    
 
2833
    // Compute number of derivatives
 
2834
    unsigned int num_derivatives = 1;
 
2835
    
 
2836
    for (unsigned int j = 0; j < n; j++)
 
2837
      num_derivatives *= 3;
 
2838
    
 
2839
    
 
2840
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
 
2841
    unsigned int **combinations = new unsigned int *[num_derivatives];
 
2842
        
 
2843
    for (unsigned int j = 0; j < num_derivatives; j++)
 
2844
    {
 
2845
      combinations[j] = new unsigned int [n];
 
2846
      for (unsigned int k = 0; k < n; k++)
 
2847
        combinations[j][k] = 0;
 
2848
    }
 
2849
        
 
2850
    // Generate combinations of derivatives
 
2851
    for (unsigned int row = 1; row < num_derivatives; row++)
 
2852
    {
 
2853
      for (unsigned int num = 0; num < row; num++)
 
2854
      {
 
2855
        for (unsigned int col = n-1; col+1 > 0; col--)
 
2856
        {
 
2857
          if (combinations[row][col] + 1 > 2)
 
2858
            combinations[row][col] = 0;
 
2859
          else
 
2860
          {
 
2861
            combinations[row][col] += 1;
 
2862
            break;
 
2863
          }
 
2864
        }
 
2865
      }
 
2866
    }
 
2867
    
 
2868
    // Compute inverse of Jacobian
 
2869
    const double Jinv[3][3] ={{d00 / detJ, d10 / detJ, d20 / detJ}, {d01 / detJ, d11 / detJ, d21 / detJ}, {d02 / detJ, d12 / detJ, d22 / detJ}};
 
2870
    
 
2871
    // Declare transformation matrix
 
2872
    // Declare pointer to two dimensional array and initialise
 
2873
    double **transform = new double *[num_derivatives];
 
2874
        
 
2875
    for (unsigned int j = 0; j < num_derivatives; j++)
 
2876
    {
 
2877
      transform[j] = new double [num_derivatives];
 
2878
      for (unsigned int k = 0; k < num_derivatives; k++)
 
2879
        transform[j][k] = 1;
 
2880
    }
 
2881
    
 
2882
    // Construct transformation matrix
 
2883
    for (unsigned int row = 0; row < num_derivatives; row++)
 
2884
    {
 
2885
      for (unsigned int col = 0; col < num_derivatives; col++)
 
2886
      {
 
2887
        for (unsigned int k = 0; k < n; k++)
 
2888
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
 
2889
      }
 
2890
    }
 
2891
    
 
2892
    // Reset values
 
2893
    for (unsigned int j = 0; j < 1*num_derivatives; j++)
 
2894
      values[j] = 0;
 
2895
    
 
2896
    // Map degree of freedom to element degree of freedom
 
2897
    const unsigned int dof = i;
 
2898
    
 
2899
    // Generate scalings
 
2900
    const double scalings_y_0 = 1;
 
2901
    const double scalings_z_0 = 1;
 
2902
    
 
2903
    // Compute psitilde_a
 
2904
    const double psitilde_a_0 = 1;
 
2905
    
 
2906
    // Compute psitilde_bs
 
2907
    const double psitilde_bs_0_0 = 1;
 
2908
    
 
2909
    // Compute psitilde_cs
 
2910
    const double psitilde_cs_00_0 = 1;
 
2911
    
 
2912
    // Compute basisvalues
 
2913
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
2914
    
 
2915
    // Table(s) of coefficients
 
2916
    const static double coefficients0[1][1] = \
 
2917
    {{1.15470053837925}};
 
2918
    
 
2919
    // Interesting (new) part
 
2920
    // Tables of derivatives of the polynomial base (transpose)
 
2921
    const static double dmats0[1][1] = \
 
2922
    {{0}};
 
2923
    
 
2924
    const static double dmats1[1][1] = \
 
2925
    {{0}};
 
2926
    
 
2927
    const static double dmats2[1][1] = \
 
2928
    {{0}};
 
2929
    
 
2930
    // Compute reference derivatives
 
2931
    // Declare pointer to array of derivatives on FIAT element
 
2932
    double *derivatives = new double [num_derivatives];
 
2933
    
 
2934
    // Declare coefficients
 
2935
    double coeff0_0 = 0;
 
2936
    
 
2937
    // Declare new coefficients
 
2938
    double new_coeff0_0 = 0;
 
2939
    
 
2940
    // Loop possible derivatives
 
2941
    for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
2942
    {
 
2943
      // Get values from coefficients array
 
2944
      new_coeff0_0 = coefficients0[dof][0];
 
2945
    
 
2946
      // Loop derivative order
 
2947
      for (unsigned int j = 0; j < n; j++)
 
2948
      {
 
2949
        // Update old coefficients
 
2950
        coeff0_0 = new_coeff0_0;
 
2951
    
 
2952
        if(combinations[deriv_num][j] == 0)
 
2953
        {
 
2954
          new_coeff0_0 = coeff0_0*dmats0[0][0];
 
2955
        }
 
2956
        if(combinations[deriv_num][j] == 1)
 
2957
        {
 
2958
          new_coeff0_0 = coeff0_0*dmats1[0][0];
 
2959
        }
 
2960
        if(combinations[deriv_num][j] == 2)
 
2961
        {
 
2962
          new_coeff0_0 = coeff0_0*dmats2[0][0];
 
2963
        }
 
2964
    
 
2965
      }
 
2966
      // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
2967
      derivatives[deriv_num] = new_coeff0_0*basisvalue0;
 
2968
    }
 
2969
    
 
2970
    // Transform derivatives back to physical element
 
2971
    for (unsigned int row = 0; row < num_derivatives; row++)
 
2972
    {
 
2973
      for (unsigned int col = 0; col < num_derivatives; col++)
 
2974
      {
 
2975
        values[row] += transform[row][col]*derivatives[col];
 
2976
      }
 
2977
    }
 
2978
    // Delete pointer to array of derivatives on FIAT element
 
2979
    delete [] derivatives;
 
2980
    
 
2981
    // Delete pointer to array of combinations of derivatives and transform
 
2982
    for (unsigned int row = 0; row < num_derivatives; row++)
 
2983
    {
 
2984
      delete [] combinations[row];
 
2985
      delete [] transform[row];
 
2986
    }
 
2987
    
 
2988
    delete [] combinations;
 
2989
    delete [] transform;
 
2990
  }
 
2991
 
 
2992
  /// Evaluate order n derivatives of all basis functions at given point in cell
 
2993
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
2994
                                              double* values,
 
2995
                                              const double* coordinates,
 
2996
                                              const ufc::cell& c) const
 
2997
  {
 
2998
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
 
2999
  }
 
3000
 
 
3001
  /// Evaluate linear functional for dof i on the function f
 
3002
  virtual double evaluate_dof(unsigned int i,
 
3003
                              const ufc::function& f,
 
3004
                              const ufc::cell& c) const
 
3005
  {
 
3006
    // The reference points, direction and weights:
 
3007
    const static double X[1][1][3] = {{{0.25, 0.25, 0.25}}};
 
3008
    const static double W[1][1] = {{1}};
 
3009
    const static double D[1][1][1] = {{{1}}};
 
3010
    
 
3011
    const double * const * x = c.coordinates;
 
3012
    double result = 0.0;
 
3013
    // Iterate over the points:
 
3014
    // Evaluate basis functions for affine mapping
 
3015
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1] - X[i][0][2];
 
3016
    const double w1 = X[i][0][0];
 
3017
    const double w2 = X[i][0][1];
 
3018
    const double w3 = X[i][0][2];
 
3019
    
 
3020
    // Compute affine mapping y = F(X)
 
3021
    double y[3];
 
3022
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0] + w3*x[3][0];
 
3023
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1] + w3*x[3][1];
 
3024
    y[2] = w0*x[0][2] + w1*x[1][2] + w2*x[2][2] + w3*x[3][2];
 
3025
    
 
3026
    // Evaluate function at physical points
 
3027
    double values[1];
 
3028
    f.evaluate(values, y, c);
 
3029
    
 
3030
    // Map function values using appropriate mapping
 
3031
    // Affine map: Do nothing
 
3032
    
 
3033
    // Note that we do not map the weights (yet).
 
3034
    
 
3035
    // Take directional components
 
3036
    for(int k = 0; k < 1; k++)
 
3037
      result += values[k]*D[i][0][k];
 
3038
    // Multiply by weights 
 
3039
    result *= W[i][0];
 
3040
    
 
3041
    return result;
 
3042
  }
 
3043
 
 
3044
  /// Evaluate linear functionals for all dofs on the function f
 
3045
  virtual void evaluate_dofs(double* values,
 
3046
                             const ufc::function& f,
 
3047
                             const ufc::cell& c) const
 
3048
  {
 
3049
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
3050
  }
 
3051
 
 
3052
  /// Interpolate vertex values from dof values
 
3053
  virtual void interpolate_vertex_values(double* vertex_values,
 
3054
                                         const double* dof_values,
 
3055
                                         const ufc::cell& c) const
 
3056
  {
 
3057
    // Evaluate at vertices and use affine mapping
 
3058
    vertex_values[0] = dof_values[0];
 
3059
    vertex_values[1] = dof_values[0];
 
3060
    vertex_values[2] = dof_values[0];
 
3061
    vertex_values[3] = dof_values[0];
 
3062
  }
 
3063
 
 
3064
  /// Return the number of sub elements (for a mixed element)
 
3065
  virtual unsigned int num_sub_elements() const
 
3066
  {
 
3067
    return 1;
 
3068
  }
 
3069
 
 
3070
  /// Create a new finite element for sub element i (for a mixed element)
 
3071
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
3072
  {
 
3073
    return new UFC_AdvectionBilinearForm_finite_element_2_2();
 
3074
  }
 
3075
 
 
3076
};
 
3077
 
 
3078
/// This class defines the interface for a finite element.
 
3079
 
 
3080
class UFC_AdvectionBilinearForm_finite_element_2: public ufc::finite_element
 
3081
{
 
3082
public:
 
3083
 
 
3084
  /// Constructor
 
3085
  UFC_AdvectionBilinearForm_finite_element_2() : ufc::finite_element()
 
3086
  {
 
3087
    // Do nothing
 
3088
  }
 
3089
 
 
3090
  /// Destructor
 
3091
  virtual ~UFC_AdvectionBilinearForm_finite_element_2()
 
3092
  {
 
3093
    // Do nothing
 
3094
  }
 
3095
 
 
3096
  /// Return a string identifying the finite element
 
3097
  virtual const char* signature() const
 
3098
  {
 
3099
    return "Mixed finite element: [Discontinuous Lagrange finite element of degree 0 on a tetrahedron, Discontinuous Lagrange finite element of degree 0 on a tetrahedron, Discontinuous Lagrange finite element of degree 0 on a tetrahedron]";
 
3100
  }
 
3101
 
 
3102
  /// Return the cell shape
 
3103
  virtual ufc::shape cell_shape() const
 
3104
  {
 
3105
    return ufc::tetrahedron;
 
3106
  }
 
3107
 
 
3108
  /// Return the dimension of the finite element function space
 
3109
  virtual unsigned int space_dimension() const
 
3110
  {
 
3111
    return 3;
 
3112
  }
 
3113
 
 
3114
  /// Return the rank of the value space
 
3115
  virtual unsigned int value_rank() const
 
3116
  {
 
3117
    return 1;
 
3118
  }
 
3119
 
 
3120
  /// Return the dimension of the value space for axis i
 
3121
  virtual unsigned int value_dimension(unsigned int i) const
 
3122
  {
 
3123
    return 3;
 
3124
  }
 
3125
 
 
3126
  /// Evaluate basis function i at given point in cell
 
3127
  virtual void evaluate_basis(unsigned int i,
 
3128
                              double* values,
 
3129
                              const double* coordinates,
 
3130
                              const ufc::cell& c) const
 
3131
  {
 
3132
    // Extract vertex coordinates
 
3133
    const double * const * element_coordinates = c.coordinates;
 
3134
    
 
3135
    // Compute Jacobian of affine map from reference cell
 
3136
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
3137
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
3138
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
3139
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
3140
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
3141
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
3142
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
3143
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
3144
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
3145
      
 
3146
    // Compute sub determinants
 
3147
    const double d00 = J_11*J_22 - J_12*J_21;
 
3148
    const double d01 = J_12*J_20 - J_10*J_22;
 
3149
    const double d02 = J_10*J_21 - J_11*J_20;
 
3150
    
 
3151
    const double d10 = J_02*J_21 - J_01*J_22;
 
3152
    const double d11 = J_00*J_22 - J_02*J_20;
 
3153
    const double d12 = J_01*J_20 - J_00*J_21;
 
3154
    
 
3155
    const double d20 = J_01*J_12 - J_02*J_11;
 
3156
    const double d21 = J_02*J_10 - J_00*J_12;
 
3157
    const double d22 = J_00*J_11 - J_01*J_10;
 
3158
      
 
3159
    // Compute determinant of Jacobian
 
3160
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
3161
    
 
3162
    // Compute inverse of Jacobian
 
3163
    
 
3164
    // Compute constants
 
3165
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
3166
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
3167
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
3168
    
 
3169
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
3170
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
3171
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
3172
    
 
3173
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
3174
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
3175
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
3176
    
 
3177
    // Get coordinates and map to the UFC reference element
 
3178
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
3179
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
3180
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
3181
    
 
3182
    // Map coordinates to the reference cube
 
3183
    if (std::abs(y + z - 1.0) < 1e-14)
 
3184
      x = 1.0;
 
3185
    else
 
3186
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
3187
    if (std::abs(z - 1.0) < 1e-14)
 
3188
      y = -1.0;
 
3189
    else
 
3190
      y = 2.0 * y/(1.0 - z) - 1.0;
 
3191
    z = 2.0 * z - 1.0;
 
3192
    
 
3193
    // Reset values
 
3194
    values[0] = 0;
 
3195
    values[1] = 0;
 
3196
    values[2] = 0;
 
3197
    
 
3198
    if (0 <= i && i <= 0)
 
3199
    {
 
3200
      // Map degree of freedom to element degree of freedom
 
3201
      const unsigned int dof = i;
 
3202
    
 
3203
      // Generate scalings
 
3204
      const double scalings_y_0 = 1;
 
3205
      const double scalings_z_0 = 1;
 
3206
    
 
3207
      // Compute psitilde_a
 
3208
      const double psitilde_a_0 = 1;
 
3209
    
 
3210
      // Compute psitilde_bs
 
3211
      const double psitilde_bs_0_0 = 1;
 
3212
    
 
3213
      // Compute psitilde_cs
 
3214
      const double psitilde_cs_00_0 = 1;
 
3215
    
 
3216
      // Compute basisvalues
 
3217
      const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
3218
    
 
3219
      // Table(s) of coefficients
 
3220
      const static double coefficients0[1][1] =   \
 
3221
      {{1.15470053837925}};
 
3222
    
 
3223
      // Extract relevant coefficients
 
3224
      const double coeff0_0 =   coefficients0[dof][0];
 
3225
    
 
3226
      // Compute value(s)
 
3227
      values[0] = coeff0_0*basisvalue0;
 
3228
    }
 
3229
    
 
3230
    if (1 <= i && i <= 1)
 
3231
    {
 
3232
      // Map degree of freedom to element degree of freedom
 
3233
      const unsigned int dof = i - 1;
 
3234
    
 
3235
      // Generate scalings
 
3236
      const double scalings_y_0 = 1;
 
3237
      const double scalings_z_0 = 1;
 
3238
    
 
3239
      // Compute psitilde_a
 
3240
      const double psitilde_a_0 = 1;
 
3241
    
 
3242
      // Compute psitilde_bs
 
3243
      const double psitilde_bs_0_0 = 1;
 
3244
    
 
3245
      // Compute psitilde_cs
 
3246
      const double psitilde_cs_00_0 = 1;
 
3247
    
 
3248
      // Compute basisvalues
 
3249
      const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
3250
    
 
3251
      // Table(s) of coefficients
 
3252
      const static double coefficients0[1][1] =   \
 
3253
      {{1.15470053837925}};
 
3254
    
 
3255
      // Extract relevant coefficients
 
3256
      const double coeff0_0 =   coefficients0[dof][0];
 
3257
    
 
3258
      // Compute value(s)
 
3259
      values[1] = coeff0_0*basisvalue0;
 
3260
    }
 
3261
    
 
3262
    if (2 <= i && i <= 2)
 
3263
    {
 
3264
      // Map degree of freedom to element degree of freedom
 
3265
      const unsigned int dof = i - 2;
 
3266
    
 
3267
      // Generate scalings
 
3268
      const double scalings_y_0 = 1;
 
3269
      const double scalings_z_0 = 1;
 
3270
    
 
3271
      // Compute psitilde_a
 
3272
      const double psitilde_a_0 = 1;
 
3273
    
 
3274
      // Compute psitilde_bs
 
3275
      const double psitilde_bs_0_0 = 1;
 
3276
    
 
3277
      // Compute psitilde_cs
 
3278
      const double psitilde_cs_00_0 = 1;
 
3279
    
 
3280
      // Compute basisvalues
 
3281
      const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
3282
    
 
3283
      // Table(s) of coefficients
 
3284
      const static double coefficients0[1][1] =   \
 
3285
      {{1.15470053837925}};
 
3286
    
 
3287
      // Extract relevant coefficients
 
3288
      const double coeff0_0 =   coefficients0[dof][0];
 
3289
    
 
3290
      // Compute value(s)
 
3291
      values[2] = coeff0_0*basisvalue0;
 
3292
    }
 
3293
    
 
3294
  }
 
3295
 
 
3296
  /// Evaluate all basis functions at given point in cell
 
3297
  virtual void evaluate_basis_all(double* values,
 
3298
                                  const double* coordinates,
 
3299
                                  const ufc::cell& c) const
 
3300
  {
 
3301
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
 
3302
  }
 
3303
 
 
3304
  /// Evaluate order n derivatives of basis function i at given point in cell
 
3305
  virtual void evaluate_basis_derivatives(unsigned int i,
 
3306
                                          unsigned int n,
 
3307
                                          double* values,
 
3308
                                          const double* coordinates,
 
3309
                                          const ufc::cell& c) const
 
3310
  {
 
3311
    // Extract vertex coordinates
 
3312
    const double * const * element_coordinates = c.coordinates;
 
3313
    
 
3314
    // Compute Jacobian of affine map from reference cell
 
3315
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
3316
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
3317
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
3318
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
3319
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
3320
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
3321
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
3322
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
3323
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
3324
      
 
3325
    // Compute sub determinants
 
3326
    const double d00 = J_11*J_22 - J_12*J_21;
 
3327
    const double d01 = J_12*J_20 - J_10*J_22;
 
3328
    const double d02 = J_10*J_21 - J_11*J_20;
 
3329
    
 
3330
    const double d10 = J_02*J_21 - J_01*J_22;
 
3331
    const double d11 = J_00*J_22 - J_02*J_20;
 
3332
    const double d12 = J_01*J_20 - J_00*J_21;
 
3333
    
 
3334
    const double d20 = J_01*J_12 - J_02*J_11;
 
3335
    const double d21 = J_02*J_10 - J_00*J_12;
 
3336
    const double d22 = J_00*J_11 - J_01*J_10;
 
3337
      
 
3338
    // Compute determinant of Jacobian
 
3339
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
3340
    
 
3341
    // Compute inverse of Jacobian
 
3342
    
 
3343
    // Compute constants
 
3344
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
3345
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
3346
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
3347
    
 
3348
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
3349
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
3350
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
3351
    
 
3352
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
3353
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
3354
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
3355
    
 
3356
    // Get coordinates and map to the UFC reference element
 
3357
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
3358
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
3359
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
3360
    
 
3361
    // Map coordinates to the reference cube
 
3362
    if (std::abs(y + z - 1.0) < 1e-14)
 
3363
      x = 1.0;
 
3364
    else
 
3365
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
3366
    if (std::abs(z - 1.0) < 1e-14)
 
3367
      y = -1.0;
 
3368
    else
 
3369
      y = 2.0 * y/(1.0 - z) - 1.0;
 
3370
    z = 2.0 * z - 1.0;
 
3371
    
 
3372
    // Compute number of derivatives
 
3373
    unsigned int num_derivatives = 1;
 
3374
    
 
3375
    for (unsigned int j = 0; j < n; j++)
 
3376
      num_derivatives *= 3;
 
3377
    
 
3378
    
 
3379
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
 
3380
    unsigned int **combinations = new unsigned int *[num_derivatives];
 
3381
        
 
3382
    for (unsigned int j = 0; j < num_derivatives; j++)
 
3383
    {
 
3384
      combinations[j] = new unsigned int [n];
 
3385
      for (unsigned int k = 0; k < n; k++)
 
3386
        combinations[j][k] = 0;
 
3387
    }
 
3388
        
 
3389
    // Generate combinations of derivatives
 
3390
    for (unsigned int row = 1; row < num_derivatives; row++)
 
3391
    {
 
3392
      for (unsigned int num = 0; num < row; num++)
 
3393
      {
 
3394
        for (unsigned int col = n-1; col+1 > 0; col--)
 
3395
        {
 
3396
          if (combinations[row][col] + 1 > 2)
 
3397
            combinations[row][col] = 0;
 
3398
          else
 
3399
          {
 
3400
            combinations[row][col] += 1;
 
3401
            break;
 
3402
          }
 
3403
        }
 
3404
      }
 
3405
    }
 
3406
    
 
3407
    // Compute inverse of Jacobian
 
3408
    const double Jinv[3][3] ={{d00 / detJ, d10 / detJ, d20 / detJ}, {d01 / detJ, d11 / detJ, d21 / detJ}, {d02 / detJ, d12 / detJ, d22 / detJ}};
 
3409
    
 
3410
    // Declare transformation matrix
 
3411
    // Declare pointer to two dimensional array and initialise
 
3412
    double **transform = new double *[num_derivatives];
 
3413
        
 
3414
    for (unsigned int j = 0; j < num_derivatives; j++)
 
3415
    {
 
3416
      transform[j] = new double [num_derivatives];
 
3417
      for (unsigned int k = 0; k < num_derivatives; k++)
 
3418
        transform[j][k] = 1;
 
3419
    }
 
3420
    
 
3421
    // Construct transformation matrix
 
3422
    for (unsigned int row = 0; row < num_derivatives; row++)
 
3423
    {
 
3424
      for (unsigned int col = 0; col < num_derivatives; col++)
 
3425
      {
 
3426
        for (unsigned int k = 0; k < n; k++)
 
3427
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
 
3428
      }
 
3429
    }
 
3430
    
 
3431
    // Reset values
 
3432
    for (unsigned int j = 0; j < 3*num_derivatives; j++)
 
3433
      values[j] = 0;
 
3434
    
 
3435
    if (0 <= i && i <= 0)
 
3436
    {
 
3437
      // Map degree of freedom to element degree of freedom
 
3438
      const unsigned int dof = i;
 
3439
    
 
3440
      // Generate scalings
 
3441
      const double scalings_y_0 = 1;
 
3442
      const double scalings_z_0 = 1;
 
3443
    
 
3444
      // Compute psitilde_a
 
3445
      const double psitilde_a_0 = 1;
 
3446
    
 
3447
      // Compute psitilde_bs
 
3448
      const double psitilde_bs_0_0 = 1;
 
3449
    
 
3450
      // Compute psitilde_cs
 
3451
      const double psitilde_cs_00_0 = 1;
 
3452
    
 
3453
      // Compute basisvalues
 
3454
      const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
3455
    
 
3456
      // Table(s) of coefficients
 
3457
      const static double coefficients0[1][1] =   \
 
3458
      {{1.15470053837925}};
 
3459
    
 
3460
      // Interesting (new) part
 
3461
      // Tables of derivatives of the polynomial base (transpose)
 
3462
      const static double dmats0[1][1] =   \
 
3463
      {{0}};
 
3464
    
 
3465
      const static double dmats1[1][1] =   \
 
3466
      {{0}};
 
3467
    
 
3468
      const static double dmats2[1][1] =   \
 
3469
      {{0}};
 
3470
    
 
3471
      // Compute reference derivatives
 
3472
      // Declare pointer to array of derivatives on FIAT element
 
3473
      double *derivatives = new double [num_derivatives];
 
3474
    
 
3475
      // Declare coefficients
 
3476
      double coeff0_0 = 0;
 
3477
    
 
3478
      // Declare new coefficients
 
3479
      double new_coeff0_0 = 0;
 
3480
    
 
3481
      // Loop possible derivatives
 
3482
      for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
3483
      {
 
3484
        // Get values from coefficients array
 
3485
        new_coeff0_0 = coefficients0[dof][0];
 
3486
    
 
3487
        // Loop derivative order
 
3488
        for (unsigned int j = 0; j < n; j++)
 
3489
        {
 
3490
          // Update old coefficients
 
3491
          coeff0_0 = new_coeff0_0;
 
3492
    
 
3493
          if(combinations[deriv_num][j] == 0)
 
3494
          {
 
3495
            new_coeff0_0 = coeff0_0*dmats0[0][0];
 
3496
          }
 
3497
          if(combinations[deriv_num][j] == 1)
 
3498
          {
 
3499
            new_coeff0_0 = coeff0_0*dmats1[0][0];
 
3500
          }
 
3501
          if(combinations[deriv_num][j] == 2)
 
3502
          {
 
3503
            new_coeff0_0 = coeff0_0*dmats2[0][0];
 
3504
          }
 
3505
    
 
3506
        }
 
3507
        // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
3508
        derivatives[deriv_num] = new_coeff0_0*basisvalue0;
 
3509
      }
 
3510
    
 
3511
      // Transform derivatives back to physical element
 
3512
      for (unsigned int row = 0; row < num_derivatives; row++)
 
3513
      {
 
3514
        for (unsigned int col = 0; col < num_derivatives; col++)
 
3515
        {
 
3516
          values[row] += transform[row][col]*derivatives[col];
 
3517
        }
 
3518
      }
 
3519
      // Delete pointer to array of derivatives on FIAT element
 
3520
      delete [] derivatives;
 
3521
    
 
3522
      // Delete pointer to array of combinations of derivatives and transform
 
3523
      for (unsigned int row = 0; row < num_derivatives; row++)
 
3524
      {
 
3525
        delete [] combinations[row];
 
3526
        delete [] transform[row];
 
3527
      }
 
3528
    
 
3529
      delete [] combinations;
 
3530
      delete [] transform;
 
3531
    }
 
3532
    
 
3533
    if (1 <= i && i <= 1)
 
3534
    {
 
3535
      // Map degree of freedom to element degree of freedom
 
3536
      const unsigned int dof = i - 1;
 
3537
    
 
3538
      // Generate scalings
 
3539
      const double scalings_y_0 = 1;
 
3540
      const double scalings_z_0 = 1;
 
3541
    
 
3542
      // Compute psitilde_a
 
3543
      const double psitilde_a_0 = 1;
 
3544
    
 
3545
      // Compute psitilde_bs
 
3546
      const double psitilde_bs_0_0 = 1;
 
3547
    
 
3548
      // Compute psitilde_cs
 
3549
      const double psitilde_cs_00_0 = 1;
 
3550
    
 
3551
      // Compute basisvalues
 
3552
      const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
3553
    
 
3554
      // Table(s) of coefficients
 
3555
      const static double coefficients0[1][1] =   \
 
3556
      {{1.15470053837925}};
 
3557
    
 
3558
      // Interesting (new) part
 
3559
      // Tables of derivatives of the polynomial base (transpose)
 
3560
      const static double dmats0[1][1] =   \
 
3561
      {{0}};
 
3562
    
 
3563
      const static double dmats1[1][1] =   \
 
3564
      {{0}};
 
3565
    
 
3566
      const static double dmats2[1][1] =   \
 
3567
      {{0}};
 
3568
    
 
3569
      // Compute reference derivatives
 
3570
      // Declare pointer to array of derivatives on FIAT element
 
3571
      double *derivatives = new double [num_derivatives];
 
3572
    
 
3573
      // Declare coefficients
 
3574
      double coeff0_0 = 0;
 
3575
    
 
3576
      // Declare new coefficients
 
3577
      double new_coeff0_0 = 0;
 
3578
    
 
3579
      // Loop possible derivatives
 
3580
      for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
3581
      {
 
3582
        // Get values from coefficients array
 
3583
        new_coeff0_0 = coefficients0[dof][0];
 
3584
    
 
3585
        // Loop derivative order
 
3586
        for (unsigned int j = 0; j < n; j++)
 
3587
        {
 
3588
          // Update old coefficients
 
3589
          coeff0_0 = new_coeff0_0;
 
3590
    
 
3591
          if(combinations[deriv_num][j] == 0)
 
3592
          {
 
3593
            new_coeff0_0 = coeff0_0*dmats0[0][0];
 
3594
          }
 
3595
          if(combinations[deriv_num][j] == 1)
 
3596
          {
 
3597
            new_coeff0_0 = coeff0_0*dmats1[0][0];
 
3598
          }
 
3599
          if(combinations[deriv_num][j] == 2)
 
3600
          {
 
3601
            new_coeff0_0 = coeff0_0*dmats2[0][0];
 
3602
          }
 
3603
    
 
3604
        }
 
3605
        // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
3606
        derivatives[deriv_num] = new_coeff0_0*basisvalue0;
 
3607
      }
 
3608
    
 
3609
      // Transform derivatives back to physical element
 
3610
      for (unsigned int row = 0; row < num_derivatives; row++)
 
3611
      {
 
3612
        for (unsigned int col = 0; col < num_derivatives; col++)
 
3613
        {
 
3614
          values[num_derivatives + row] += transform[row][col]*derivatives[col];
 
3615
        }
 
3616
      }
 
3617
      // Delete pointer to array of derivatives on FIAT element
 
3618
      delete [] derivatives;
 
3619
    
 
3620
      // Delete pointer to array of combinations of derivatives and transform
 
3621
      for (unsigned int row = 0; row < num_derivatives; row++)
 
3622
      {
 
3623
        delete [] combinations[row];
 
3624
        delete [] transform[row];
 
3625
      }
 
3626
    
 
3627
      delete [] combinations;
 
3628
      delete [] transform;
 
3629
    }
 
3630
    
 
3631
    if (2 <= i && i <= 2)
 
3632
    {
 
3633
      // Map degree of freedom to element degree of freedom
 
3634
      const unsigned int dof = i - 2;
 
3635
    
 
3636
      // Generate scalings
 
3637
      const double scalings_y_0 = 1;
 
3638
      const double scalings_z_0 = 1;
 
3639
    
 
3640
      // Compute psitilde_a
 
3641
      const double psitilde_a_0 = 1;
 
3642
    
 
3643
      // Compute psitilde_bs
 
3644
      const double psitilde_bs_0_0 = 1;
 
3645
    
 
3646
      // Compute psitilde_cs
 
3647
      const double psitilde_cs_00_0 = 1;
 
3648
    
 
3649
      // Compute basisvalues
 
3650
      const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
3651
    
 
3652
      // Table(s) of coefficients
 
3653
      const static double coefficients0[1][1] =   \
 
3654
      {{1.15470053837925}};
 
3655
    
 
3656
      // Interesting (new) part
 
3657
      // Tables of derivatives of the polynomial base (transpose)
 
3658
      const static double dmats0[1][1] =   \
 
3659
      {{0}};
 
3660
    
 
3661
      const static double dmats1[1][1] =   \
 
3662
      {{0}};
 
3663
    
 
3664
      const static double dmats2[1][1] =   \
 
3665
      {{0}};
 
3666
    
 
3667
      // Compute reference derivatives
 
3668
      // Declare pointer to array of derivatives on FIAT element
 
3669
      double *derivatives = new double [num_derivatives];
 
3670
    
 
3671
      // Declare coefficients
 
3672
      double coeff0_0 = 0;
 
3673
    
 
3674
      // Declare new coefficients
 
3675
      double new_coeff0_0 = 0;
 
3676
    
 
3677
      // Loop possible derivatives
 
3678
      for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
3679
      {
 
3680
        // Get values from coefficients array
 
3681
        new_coeff0_0 = coefficients0[dof][0];
 
3682
    
 
3683
        // Loop derivative order
 
3684
        for (unsigned int j = 0; j < n; j++)
 
3685
        {
 
3686
          // Update old coefficients
 
3687
          coeff0_0 = new_coeff0_0;
 
3688
    
 
3689
          if(combinations[deriv_num][j] == 0)
 
3690
          {
 
3691
            new_coeff0_0 = coeff0_0*dmats0[0][0];
 
3692
          }
 
3693
          if(combinations[deriv_num][j] == 1)
 
3694
          {
 
3695
            new_coeff0_0 = coeff0_0*dmats1[0][0];
 
3696
          }
 
3697
          if(combinations[deriv_num][j] == 2)
 
3698
          {
 
3699
            new_coeff0_0 = coeff0_0*dmats2[0][0];
 
3700
          }
 
3701
    
 
3702
        }
 
3703
        // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
3704
        derivatives[deriv_num] = new_coeff0_0*basisvalue0;
 
3705
      }
 
3706
    
 
3707
      // Transform derivatives back to physical element
 
3708
      for (unsigned int row = 0; row < num_derivatives; row++)
 
3709
      {
 
3710
        for (unsigned int col = 0; col < num_derivatives; col++)
 
3711
        {
 
3712
          values[2*num_derivatives + row] += transform[row][col]*derivatives[col];
 
3713
        }
 
3714
      }
 
3715
      // Delete pointer to array of derivatives on FIAT element
 
3716
      delete [] derivatives;
 
3717
    
 
3718
      // Delete pointer to array of combinations of derivatives and transform
 
3719
      for (unsigned int row = 0; row < num_derivatives; row++)
 
3720
      {
 
3721
        delete [] combinations[row];
 
3722
        delete [] transform[row];
 
3723
      }
 
3724
    
 
3725
      delete [] combinations;
 
3726
      delete [] transform;
 
3727
    }
 
3728
    
 
3729
  }
 
3730
 
 
3731
  /// Evaluate order n derivatives of all basis functions at given point in cell
 
3732
  virtual void evaluate_basis_derivatives_all(unsigned int n,
 
3733
                                              double* values,
 
3734
                                              const double* coordinates,
 
3735
                                              const ufc::cell& c) const
 
3736
  {
 
3737
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
 
3738
  }
 
3739
 
 
3740
  /// Evaluate linear functional for dof i on the function f
 
3741
  virtual double evaluate_dof(unsigned int i,
 
3742
                              const ufc::function& f,
 
3743
                              const ufc::cell& c) const
 
3744
  {
 
3745
    // The reference points, direction and weights:
 
3746
    const static double X[3][1][3] = {{{0.25, 0.25, 0.25}}, {{0.25, 0.25, 0.25}}, {{0.25, 0.25, 0.25}}};
 
3747
    const static double W[3][1] = {{1}, {1}, {1}};
 
3748
    const static double D[3][1][3] = {{{1, 0, 0}}, {{0, 1, 0}}, {{0, 0, 1}}};
 
3749
    
 
3750
    const double * const * x = c.coordinates;
 
3751
    double result = 0.0;
 
3752
    // Iterate over the points:
 
3753
    // Evaluate basis functions for affine mapping
 
3754
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1] - X[i][0][2];
 
3755
    const double w1 = X[i][0][0];
 
3756
    const double w2 = X[i][0][1];
 
3757
    const double w3 = X[i][0][2];
 
3758
    
 
3759
    // Compute affine mapping y = F(X)
 
3760
    double y[3];
 
3761
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0] + w3*x[3][0];
 
3762
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1] + w3*x[3][1];
 
3763
    y[2] = w0*x[0][2] + w1*x[1][2] + w2*x[2][2] + w3*x[3][2];
 
3764
    
 
3765
    // Evaluate function at physical points
 
3766
    double values[3];
 
3767
    f.evaluate(values, y, c);
 
3768
    
 
3769
    // Map function values using appropriate mapping
 
3770
    // Affine map: Do nothing
 
3771
    
 
3772
    // Note that we do not map the weights (yet).
 
3773
    
 
3774
    // Take directional components
 
3775
    for(int k = 0; k < 3; k++)
 
3776
      result += values[k]*D[i][0][k];
 
3777
    // Multiply by weights 
 
3778
    result *= W[i][0];
 
3779
    
 
3780
    return result;
 
3781
  }
 
3782
 
 
3783
  /// Evaluate linear functionals for all dofs on the function f
 
3784
  virtual void evaluate_dofs(double* values,
 
3785
                             const ufc::function& f,
 
3786
                             const ufc::cell& c) const
 
3787
  {
 
3788
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
3789
  }
 
3790
 
 
3791
  /// Interpolate vertex values from dof values
 
3792
  virtual void interpolate_vertex_values(double* vertex_values,
 
3793
                                         const double* dof_values,
 
3794
                                         const ufc::cell& c) const
 
3795
  {
 
3796
    // Evaluate at vertices and use affine mapping
 
3797
    vertex_values[0] = dof_values[0];
 
3798
    vertex_values[1] = dof_values[0];
 
3799
    vertex_values[2] = dof_values[0];
 
3800
    vertex_values[3] = dof_values[0];
 
3801
    // Evaluate at vertices and use affine mapping
 
3802
    vertex_values[4] = dof_values[1];
 
3803
    vertex_values[5] = dof_values[1];
 
3804
    vertex_values[6] = dof_values[1];
 
3805
    vertex_values[7] = dof_values[1];
 
3806
    // Evaluate at vertices and use affine mapping
 
3807
    vertex_values[8] = dof_values[2];
 
3808
    vertex_values[9] = dof_values[2];
 
3809
    vertex_values[10] = dof_values[2];
 
3810
    vertex_values[11] = dof_values[2];
 
3811
  }
 
3812
 
 
3813
  /// Return the number of sub elements (for a mixed element)
 
3814
  virtual unsigned int num_sub_elements() const
 
3815
  {
 
3816
    return 3;
 
3817
  }
 
3818
 
 
3819
  /// Create a new finite element for sub element i (for a mixed element)
 
3820
  virtual ufc::finite_element* create_sub_element(unsigned int i) const
 
3821
  {
 
3822
    switch ( i )
 
3823
    {
 
3824
    case 0:
 
3825
      return new UFC_AdvectionBilinearForm_finite_element_2_0();
 
3826
      break;
 
3827
    case 1:
 
3828
      return new UFC_AdvectionBilinearForm_finite_element_2_1();
 
3829
      break;
 
3830
    case 2:
 
3831
      return new UFC_AdvectionBilinearForm_finite_element_2_2();
 
3832
      break;
 
3833
    }
 
3834
    return 0;
 
3835
  }
 
3836
 
 
3837
};
 
3838
 
 
3839
/// This class defines the interface for a local-to-global mapping of
 
3840
/// degrees of freedom (dofs).
 
3841
 
 
3842
class UFC_AdvectionBilinearForm_dof_map_0: public ufc::dof_map
 
3843
{
 
3844
private:
 
3845
 
 
3846
  unsigned int __global_dimension;
 
3847
 
 
3848
public:
 
3849
 
 
3850
  /// Constructor
 
3851
  UFC_AdvectionBilinearForm_dof_map_0() : ufc::dof_map()
 
3852
  {
 
3853
    __global_dimension = 0;
 
3854
  }
 
3855
 
 
3856
  /// Destructor
 
3857
  virtual ~UFC_AdvectionBilinearForm_dof_map_0()
 
3858
  {
 
3859
    // Do nothing
 
3860
  }
 
3861
 
 
3862
  /// Return a string identifying the dof map
 
3863
  virtual const char* signature() const
 
3864
  {
 
3865
    return "FFC dof map for Lagrange finite element of degree 3 on a tetrahedron";
 
3866
  }
 
3867
 
 
3868
  /// Return true iff mesh entities of topological dimension d are needed
 
3869
  virtual bool needs_mesh_entities(unsigned int d) const
 
3870
  {
 
3871
    switch ( d )
 
3872
    {
 
3873
    case 0:
 
3874
      return true;
 
3875
      break;
 
3876
    case 1:
 
3877
      return true;
 
3878
      break;
 
3879
    case 2:
 
3880
      return true;
 
3881
      break;
 
3882
    case 3:
 
3883
      return false;
 
3884
      break;
 
3885
    }
 
3886
    return false;
 
3887
  }
 
3888
 
 
3889
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
3890
  virtual bool init_mesh(const ufc::mesh& m)
 
3891
  {
 
3892
    __global_dimension = m.num_entities[0] + 2*m.num_entities[1] + m.num_entities[2];
 
3893
    return false;
 
3894
  }
 
3895
 
 
3896
  /// Initialize dof map for given cell
 
3897
  virtual void init_cell(const ufc::mesh& m,
 
3898
                         const ufc::cell& c)
 
3899
  {
 
3900
    // Do nothing
 
3901
  }
 
3902
 
 
3903
  /// Finish initialization of dof map for cells
 
3904
  virtual void init_cell_finalize()
 
3905
  {
 
3906
    // Do nothing
 
3907
  }
 
3908
 
 
3909
  /// Return the dimension of the global finite element function space
 
3910
  virtual unsigned int global_dimension() const
 
3911
  {
 
3912
    return __global_dimension;
 
3913
  }
 
3914
 
 
3915
  /// Return the dimension of the local finite element function space
 
3916
  virtual unsigned int local_dimension() const
 
3917
  {
 
3918
    return 20;
 
3919
  }
 
3920
 
 
3921
  // Return the geometric dimension of the coordinates this dof map provides
 
3922
  virtual unsigned int geometric_dimension() const
 
3923
  {
 
3924
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
3925
  }
 
3926
 
 
3927
  /// Return the number of dofs on each cell facet
 
3928
  virtual unsigned int num_facet_dofs() const
 
3929
  {
 
3930
    return 10;
 
3931
  }
 
3932
 
 
3933
  /// Return the number of dofs associated with each cell entity of dimension d
 
3934
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
3935
  {
 
3936
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
3937
  }
 
3938
 
 
3939
  /// Tabulate the local-to-global mapping of dofs on a cell
 
3940
  virtual void tabulate_dofs(unsigned int* dofs,
 
3941
                             const ufc::mesh& m,
 
3942
                             const ufc::cell& c) const
 
3943
  {
 
3944
    dofs[0] = c.entity_indices[0][0];
 
3945
    dofs[1] = c.entity_indices[0][1];
 
3946
    dofs[2] = c.entity_indices[0][2];
 
3947
    dofs[3] = c.entity_indices[0][3];
 
3948
    unsigned int offset = m.num_entities[0];
 
3949
    dofs[4] = offset + 2*c.entity_indices[1][0];
 
3950
    dofs[5] = offset + 2*c.entity_indices[1][0] + 1;
 
3951
    dofs[6] = offset + 2*c.entity_indices[1][1];
 
3952
    dofs[7] = offset + 2*c.entity_indices[1][1] + 1;
 
3953
    dofs[8] = offset + 2*c.entity_indices[1][2];
 
3954
    dofs[9] = offset + 2*c.entity_indices[1][2] + 1;
 
3955
    dofs[10] = offset + 2*c.entity_indices[1][3];
 
3956
    dofs[11] = offset + 2*c.entity_indices[1][3] + 1;
 
3957
    dofs[12] = offset + 2*c.entity_indices[1][4];
 
3958
    dofs[13] = offset + 2*c.entity_indices[1][4] + 1;
 
3959
    dofs[14] = offset + 2*c.entity_indices[1][5];
 
3960
    dofs[15] = offset + 2*c.entity_indices[1][5] + 1;
 
3961
    offset = offset + 2*m.num_entities[1];
 
3962
    dofs[16] = offset + c.entity_indices[2][0];
 
3963
    dofs[17] = offset + c.entity_indices[2][1];
 
3964
    dofs[18] = offset + c.entity_indices[2][2];
 
3965
    dofs[19] = offset + c.entity_indices[2][3];
 
3966
  }
 
3967
 
 
3968
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
3969
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
3970
                                   unsigned int facet) const
 
3971
  {
 
3972
    switch ( facet )
 
3973
    {
 
3974
    case 0:
 
3975
      dofs[0] = 1;
 
3976
      dofs[1] = 2;
 
3977
      dofs[2] = 3;
 
3978
      dofs[3] = 4;
 
3979
      dofs[4] = 5;
 
3980
      dofs[5] = 6;
 
3981
      dofs[6] = 7;
 
3982
      dofs[7] = 8;
 
3983
      dofs[8] = 9;
 
3984
      dofs[9] = 16;
 
3985
      break;
 
3986
    case 1:
 
3987
      dofs[0] = 0;
 
3988
      dofs[1] = 2;
 
3989
      dofs[2] = 3;
 
3990
      dofs[3] = 4;
 
3991
      dofs[4] = 5;
 
3992
      dofs[5] = 10;
 
3993
      dofs[6] = 11;
 
3994
      dofs[7] = 12;
 
3995
      dofs[8] = 13;
 
3996
      dofs[9] = 17;
 
3997
      break;
 
3998
    case 2:
 
3999
      dofs[0] = 0;
 
4000
      dofs[1] = 1;
 
4001
      dofs[2] = 3;
 
4002
      dofs[3] = 6;
 
4003
      dofs[4] = 7;
 
4004
      dofs[5] = 10;
 
4005
      dofs[6] = 11;
 
4006
      dofs[7] = 14;
 
4007
      dofs[8] = 15;
 
4008
      dofs[9] = 18;
 
4009
      break;
 
4010
    case 3:
 
4011
      dofs[0] = 0;
 
4012
      dofs[1] = 1;
 
4013
      dofs[2] = 2;
 
4014
      dofs[3] = 8;
 
4015
      dofs[4] = 9;
 
4016
      dofs[5] = 12;
 
4017
      dofs[6] = 13;
 
4018
      dofs[7] = 14;
 
4019
      dofs[8] = 15;
 
4020
      dofs[9] = 19;
 
4021
      break;
 
4022
    }
 
4023
  }
 
4024
 
 
4025
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
4026
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
4027
                                    unsigned int d, unsigned int i) const
 
4028
  {
 
4029
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4030
  }
 
4031
 
 
4032
  /// Tabulate the coordinates of all dofs on a cell
 
4033
  virtual void tabulate_coordinates(double** coordinates,
 
4034
                                    const ufc::cell& c) const
 
4035
  {
 
4036
    const double * const * x = c.coordinates;
 
4037
    coordinates[0][0] = x[0][0];
 
4038
    coordinates[0][1] = x[0][1];
 
4039
    coordinates[0][2] = x[0][2];
 
4040
    coordinates[1][0] = x[1][0];
 
4041
    coordinates[1][1] = x[1][1];
 
4042
    coordinates[1][2] = x[1][2];
 
4043
    coordinates[2][0] = x[2][0];
 
4044
    coordinates[2][1] = x[2][1];
 
4045
    coordinates[2][2] = x[2][2];
 
4046
    coordinates[3][0] = x[3][0];
 
4047
    coordinates[3][1] = x[3][1];
 
4048
    coordinates[3][2] = x[3][2];
 
4049
    coordinates[4][0] = 0.666666666666667*x[2][0] + 0.333333333333333*x[3][0];
 
4050
    coordinates[4][1] = 0.666666666666667*x[2][1] + 0.333333333333333*x[3][1];
 
4051
    coordinates[4][2] = 0.666666666666667*x[2][2] + 0.333333333333333*x[3][2];
 
4052
    coordinates[5][0] = 0.333333333333333*x[2][0] + 0.666666666666667*x[3][0];
 
4053
    coordinates[5][1] = 0.333333333333333*x[2][1] + 0.666666666666667*x[3][1];
 
4054
    coordinates[5][2] = 0.333333333333333*x[2][2] + 0.666666666666667*x[3][2];
 
4055
    coordinates[6][0] = 0.666666666666667*x[1][0] + 0.333333333333333*x[3][0];
 
4056
    coordinates[6][1] = 0.666666666666667*x[1][1] + 0.333333333333333*x[3][1];
 
4057
    coordinates[6][2] = 0.666666666666667*x[1][2] + 0.333333333333333*x[3][2];
 
4058
    coordinates[7][0] = 0.333333333333333*x[1][0] + 0.666666666666667*x[3][0];
 
4059
    coordinates[7][1] = 0.333333333333333*x[1][1] + 0.666666666666667*x[3][1];
 
4060
    coordinates[7][2] = 0.333333333333333*x[1][2] + 0.666666666666667*x[3][2];
 
4061
    coordinates[8][0] = 0.666666666666667*x[1][0] + 0.333333333333333*x[2][0];
 
4062
    coordinates[8][1] = 0.666666666666667*x[1][1] + 0.333333333333333*x[2][1];
 
4063
    coordinates[8][2] = 0.666666666666667*x[1][2] + 0.333333333333333*x[2][2];
 
4064
    coordinates[9][0] = 0.333333333333333*x[1][0] + 0.666666666666667*x[2][0];
 
4065
    coordinates[9][1] = 0.333333333333333*x[1][1] + 0.666666666666667*x[2][1];
 
4066
    coordinates[9][2] = 0.333333333333333*x[1][2] + 0.666666666666667*x[2][2];
 
4067
    coordinates[10][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[3][0];
 
4068
    coordinates[10][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[3][1];
 
4069
    coordinates[10][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[3][2];
 
4070
    coordinates[11][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[3][0];
 
4071
    coordinates[11][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[3][1];
 
4072
    coordinates[11][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[3][2];
 
4073
    coordinates[12][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[2][0];
 
4074
    coordinates[12][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[2][1];
 
4075
    coordinates[12][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[2][2];
 
4076
    coordinates[13][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[2][0];
 
4077
    coordinates[13][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[2][1];
 
4078
    coordinates[13][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[2][2];
 
4079
    coordinates[14][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[1][0];
 
4080
    coordinates[14][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[1][1];
 
4081
    coordinates[14][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[1][2];
 
4082
    coordinates[15][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[1][0];
 
4083
    coordinates[15][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[1][1];
 
4084
    coordinates[15][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[1][2];
 
4085
    coordinates[16][0] = 0.333333333333333*x[1][0] + 0.333333333333333*x[2][0] + 0.333333333333333*x[3][0];
 
4086
    coordinates[16][1] = 0.333333333333333*x[1][1] + 0.333333333333333*x[2][1] + 0.333333333333333*x[3][1];
 
4087
    coordinates[16][2] = 0.333333333333333*x[1][2] + 0.333333333333333*x[2][2] + 0.333333333333333*x[3][2];
 
4088
    coordinates[17][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[2][0] + 0.333333333333333*x[3][0];
 
4089
    coordinates[17][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[2][1] + 0.333333333333333*x[3][1];
 
4090
    coordinates[17][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[2][2] + 0.333333333333333*x[3][2];
 
4091
    coordinates[18][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[1][0] + 0.333333333333333*x[3][0];
 
4092
    coordinates[18][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[1][1] + 0.333333333333333*x[3][1];
 
4093
    coordinates[18][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[1][2] + 0.333333333333333*x[3][2];
 
4094
    coordinates[19][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[1][0] + 0.333333333333333*x[2][0];
 
4095
    coordinates[19][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[1][1] + 0.333333333333333*x[2][1];
 
4096
    coordinates[19][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[1][2] + 0.333333333333333*x[2][2];
 
4097
  }
 
4098
 
 
4099
  /// Return the number of sub dof maps (for a mixed element)
 
4100
  virtual unsigned int num_sub_dof_maps() const
 
4101
  {
 
4102
    return 1;
 
4103
  }
 
4104
 
 
4105
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
4106
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
4107
  {
 
4108
    return new UFC_AdvectionBilinearForm_dof_map_0();
 
4109
  }
 
4110
 
 
4111
};
 
4112
 
 
4113
/// This class defines the interface for a local-to-global mapping of
 
4114
/// degrees of freedom (dofs).
 
4115
 
 
4116
class UFC_AdvectionBilinearForm_dof_map_1: public ufc::dof_map
 
4117
{
 
4118
private:
 
4119
 
 
4120
  unsigned int __global_dimension;
 
4121
 
 
4122
public:
 
4123
 
 
4124
  /// Constructor
 
4125
  UFC_AdvectionBilinearForm_dof_map_1() : ufc::dof_map()
 
4126
  {
 
4127
    __global_dimension = 0;
 
4128
  }
 
4129
 
 
4130
  /// Destructor
 
4131
  virtual ~UFC_AdvectionBilinearForm_dof_map_1()
 
4132
  {
 
4133
    // Do nothing
 
4134
  }
 
4135
 
 
4136
  /// Return a string identifying the dof map
 
4137
  virtual const char* signature() const
 
4138
  {
 
4139
    return "FFC dof map for Lagrange finite element of degree 3 on a tetrahedron";
 
4140
  }
 
4141
 
 
4142
  /// Return true iff mesh entities of topological dimension d are needed
 
4143
  virtual bool needs_mesh_entities(unsigned int d) const
 
4144
  {
 
4145
    switch ( d )
 
4146
    {
 
4147
    case 0:
 
4148
      return true;
 
4149
      break;
 
4150
    case 1:
 
4151
      return true;
 
4152
      break;
 
4153
    case 2:
 
4154
      return true;
 
4155
      break;
 
4156
    case 3:
 
4157
      return false;
 
4158
      break;
 
4159
    }
 
4160
    return false;
 
4161
  }
 
4162
 
 
4163
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
4164
  virtual bool init_mesh(const ufc::mesh& m)
 
4165
  {
 
4166
    __global_dimension = m.num_entities[0] + 2*m.num_entities[1] + m.num_entities[2];
 
4167
    return false;
 
4168
  }
 
4169
 
 
4170
  /// Initialize dof map for given cell
 
4171
  virtual void init_cell(const ufc::mesh& m,
 
4172
                         const ufc::cell& c)
 
4173
  {
 
4174
    // Do nothing
 
4175
  }
 
4176
 
 
4177
  /// Finish initialization of dof map for cells
 
4178
  virtual void init_cell_finalize()
 
4179
  {
 
4180
    // Do nothing
 
4181
  }
 
4182
 
 
4183
  /// Return the dimension of the global finite element function space
 
4184
  virtual unsigned int global_dimension() const
 
4185
  {
 
4186
    return __global_dimension;
 
4187
  }
 
4188
 
 
4189
  /// Return the dimension of the local finite element function space
 
4190
  virtual unsigned int local_dimension() const
 
4191
  {
 
4192
    return 20;
 
4193
  }
 
4194
 
 
4195
  // Return the geometric dimension of the coordinates this dof map provides
 
4196
  virtual unsigned int geometric_dimension() const
 
4197
  {
 
4198
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4199
  }
 
4200
 
 
4201
  /// Return the number of dofs on each cell facet
 
4202
  virtual unsigned int num_facet_dofs() const
 
4203
  {
 
4204
    return 10;
 
4205
  }
 
4206
 
 
4207
  /// Return the number of dofs associated with each cell entity of dimension d
 
4208
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
4209
  {
 
4210
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4211
  }
 
4212
 
 
4213
  /// Tabulate the local-to-global mapping of dofs on a cell
 
4214
  virtual void tabulate_dofs(unsigned int* dofs,
 
4215
                             const ufc::mesh& m,
 
4216
                             const ufc::cell& c) const
 
4217
  {
 
4218
    dofs[0] = c.entity_indices[0][0];
 
4219
    dofs[1] = c.entity_indices[0][1];
 
4220
    dofs[2] = c.entity_indices[0][2];
 
4221
    dofs[3] = c.entity_indices[0][3];
 
4222
    unsigned int offset = m.num_entities[0];
 
4223
    dofs[4] = offset + 2*c.entity_indices[1][0];
 
4224
    dofs[5] = offset + 2*c.entity_indices[1][0] + 1;
 
4225
    dofs[6] = offset + 2*c.entity_indices[1][1];
 
4226
    dofs[7] = offset + 2*c.entity_indices[1][1] + 1;
 
4227
    dofs[8] = offset + 2*c.entity_indices[1][2];
 
4228
    dofs[9] = offset + 2*c.entity_indices[1][2] + 1;
 
4229
    dofs[10] = offset + 2*c.entity_indices[1][3];
 
4230
    dofs[11] = offset + 2*c.entity_indices[1][3] + 1;
 
4231
    dofs[12] = offset + 2*c.entity_indices[1][4];
 
4232
    dofs[13] = offset + 2*c.entity_indices[1][4] + 1;
 
4233
    dofs[14] = offset + 2*c.entity_indices[1][5];
 
4234
    dofs[15] = offset + 2*c.entity_indices[1][5] + 1;
 
4235
    offset = offset + 2*m.num_entities[1];
 
4236
    dofs[16] = offset + c.entity_indices[2][0];
 
4237
    dofs[17] = offset + c.entity_indices[2][1];
 
4238
    dofs[18] = offset + c.entity_indices[2][2];
 
4239
    dofs[19] = offset + c.entity_indices[2][3];
 
4240
  }
 
4241
 
 
4242
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
4243
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
4244
                                   unsigned int facet) const
 
4245
  {
 
4246
    switch ( facet )
 
4247
    {
 
4248
    case 0:
 
4249
      dofs[0] = 1;
 
4250
      dofs[1] = 2;
 
4251
      dofs[2] = 3;
 
4252
      dofs[3] = 4;
 
4253
      dofs[4] = 5;
 
4254
      dofs[5] = 6;
 
4255
      dofs[6] = 7;
 
4256
      dofs[7] = 8;
 
4257
      dofs[8] = 9;
 
4258
      dofs[9] = 16;
 
4259
      break;
 
4260
    case 1:
 
4261
      dofs[0] = 0;
 
4262
      dofs[1] = 2;
 
4263
      dofs[2] = 3;
 
4264
      dofs[3] = 4;
 
4265
      dofs[4] = 5;
 
4266
      dofs[5] = 10;
 
4267
      dofs[6] = 11;
 
4268
      dofs[7] = 12;
 
4269
      dofs[8] = 13;
 
4270
      dofs[9] = 17;
 
4271
      break;
 
4272
    case 2:
 
4273
      dofs[0] = 0;
 
4274
      dofs[1] = 1;
 
4275
      dofs[2] = 3;
 
4276
      dofs[3] = 6;
 
4277
      dofs[4] = 7;
 
4278
      dofs[5] = 10;
 
4279
      dofs[6] = 11;
 
4280
      dofs[7] = 14;
 
4281
      dofs[8] = 15;
 
4282
      dofs[9] = 18;
 
4283
      break;
 
4284
    case 3:
 
4285
      dofs[0] = 0;
 
4286
      dofs[1] = 1;
 
4287
      dofs[2] = 2;
 
4288
      dofs[3] = 8;
 
4289
      dofs[4] = 9;
 
4290
      dofs[5] = 12;
 
4291
      dofs[6] = 13;
 
4292
      dofs[7] = 14;
 
4293
      dofs[8] = 15;
 
4294
      dofs[9] = 19;
 
4295
      break;
 
4296
    }
 
4297
  }
 
4298
 
 
4299
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
4300
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
4301
                                    unsigned int d, unsigned int i) const
 
4302
  {
 
4303
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4304
  }
 
4305
 
 
4306
  /// Tabulate the coordinates of all dofs on a cell
 
4307
  virtual void tabulate_coordinates(double** coordinates,
 
4308
                                    const ufc::cell& c) const
 
4309
  {
 
4310
    const double * const * x = c.coordinates;
 
4311
    coordinates[0][0] = x[0][0];
 
4312
    coordinates[0][1] = x[0][1];
 
4313
    coordinates[0][2] = x[0][2];
 
4314
    coordinates[1][0] = x[1][0];
 
4315
    coordinates[1][1] = x[1][1];
 
4316
    coordinates[1][2] = x[1][2];
 
4317
    coordinates[2][0] = x[2][0];
 
4318
    coordinates[2][1] = x[2][1];
 
4319
    coordinates[2][2] = x[2][2];
 
4320
    coordinates[3][0] = x[3][0];
 
4321
    coordinates[3][1] = x[3][1];
 
4322
    coordinates[3][2] = x[3][2];
 
4323
    coordinates[4][0] = 0.666666666666667*x[2][0] + 0.333333333333333*x[3][0];
 
4324
    coordinates[4][1] = 0.666666666666667*x[2][1] + 0.333333333333333*x[3][1];
 
4325
    coordinates[4][2] = 0.666666666666667*x[2][2] + 0.333333333333333*x[3][2];
 
4326
    coordinates[5][0] = 0.333333333333333*x[2][0] + 0.666666666666667*x[3][0];
 
4327
    coordinates[5][1] = 0.333333333333333*x[2][1] + 0.666666666666667*x[3][1];
 
4328
    coordinates[5][2] = 0.333333333333333*x[2][2] + 0.666666666666667*x[3][2];
 
4329
    coordinates[6][0] = 0.666666666666667*x[1][0] + 0.333333333333333*x[3][0];
 
4330
    coordinates[6][1] = 0.666666666666667*x[1][1] + 0.333333333333333*x[3][1];
 
4331
    coordinates[6][2] = 0.666666666666667*x[1][2] + 0.333333333333333*x[3][2];
 
4332
    coordinates[7][0] = 0.333333333333333*x[1][0] + 0.666666666666667*x[3][0];
 
4333
    coordinates[7][1] = 0.333333333333333*x[1][1] + 0.666666666666667*x[3][1];
 
4334
    coordinates[7][2] = 0.333333333333333*x[1][2] + 0.666666666666667*x[3][2];
 
4335
    coordinates[8][0] = 0.666666666666667*x[1][0] + 0.333333333333333*x[2][0];
 
4336
    coordinates[8][1] = 0.666666666666667*x[1][1] + 0.333333333333333*x[2][1];
 
4337
    coordinates[8][2] = 0.666666666666667*x[1][2] + 0.333333333333333*x[2][2];
 
4338
    coordinates[9][0] = 0.333333333333333*x[1][0] + 0.666666666666667*x[2][0];
 
4339
    coordinates[9][1] = 0.333333333333333*x[1][1] + 0.666666666666667*x[2][1];
 
4340
    coordinates[9][2] = 0.333333333333333*x[1][2] + 0.666666666666667*x[2][2];
 
4341
    coordinates[10][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[3][0];
 
4342
    coordinates[10][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[3][1];
 
4343
    coordinates[10][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[3][2];
 
4344
    coordinates[11][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[3][0];
 
4345
    coordinates[11][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[3][1];
 
4346
    coordinates[11][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[3][2];
 
4347
    coordinates[12][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[2][0];
 
4348
    coordinates[12][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[2][1];
 
4349
    coordinates[12][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[2][2];
 
4350
    coordinates[13][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[2][0];
 
4351
    coordinates[13][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[2][1];
 
4352
    coordinates[13][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[2][2];
 
4353
    coordinates[14][0] = 0.666666666666667*x[0][0] + 0.333333333333333*x[1][0];
 
4354
    coordinates[14][1] = 0.666666666666667*x[0][1] + 0.333333333333333*x[1][1];
 
4355
    coordinates[14][2] = 0.666666666666667*x[0][2] + 0.333333333333333*x[1][2];
 
4356
    coordinates[15][0] = 0.333333333333333*x[0][0] + 0.666666666666667*x[1][0];
 
4357
    coordinates[15][1] = 0.333333333333333*x[0][1] + 0.666666666666667*x[1][1];
 
4358
    coordinates[15][2] = 0.333333333333333*x[0][2] + 0.666666666666667*x[1][2];
 
4359
    coordinates[16][0] = 0.333333333333333*x[1][0] + 0.333333333333333*x[2][0] + 0.333333333333333*x[3][0];
 
4360
    coordinates[16][1] = 0.333333333333333*x[1][1] + 0.333333333333333*x[2][1] + 0.333333333333333*x[3][1];
 
4361
    coordinates[16][2] = 0.333333333333333*x[1][2] + 0.333333333333333*x[2][2] + 0.333333333333333*x[3][2];
 
4362
    coordinates[17][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[2][0] + 0.333333333333333*x[3][0];
 
4363
    coordinates[17][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[2][1] + 0.333333333333333*x[3][1];
 
4364
    coordinates[17][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[2][2] + 0.333333333333333*x[3][2];
 
4365
    coordinates[18][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[1][0] + 0.333333333333333*x[3][0];
 
4366
    coordinates[18][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[1][1] + 0.333333333333333*x[3][1];
 
4367
    coordinates[18][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[1][2] + 0.333333333333333*x[3][2];
 
4368
    coordinates[19][0] = 0.333333333333333*x[0][0] + 0.333333333333333*x[1][0] + 0.333333333333333*x[2][0];
 
4369
    coordinates[19][1] = 0.333333333333333*x[0][1] + 0.333333333333333*x[1][1] + 0.333333333333333*x[2][1];
 
4370
    coordinates[19][2] = 0.333333333333333*x[0][2] + 0.333333333333333*x[1][2] + 0.333333333333333*x[2][2];
 
4371
  }
 
4372
 
 
4373
  /// Return the number of sub dof maps (for a mixed element)
 
4374
  virtual unsigned int num_sub_dof_maps() const
 
4375
  {
 
4376
    return 1;
 
4377
  }
 
4378
 
 
4379
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
4380
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
4381
  {
 
4382
    return new UFC_AdvectionBilinearForm_dof_map_1();
 
4383
  }
 
4384
 
 
4385
};
 
4386
 
 
4387
/// This class defines the interface for a local-to-global mapping of
 
4388
/// degrees of freedom (dofs).
 
4389
 
 
4390
class UFC_AdvectionBilinearForm_dof_map_2_0: public ufc::dof_map
 
4391
{
 
4392
private:
 
4393
 
 
4394
  unsigned int __global_dimension;
 
4395
 
 
4396
public:
 
4397
 
 
4398
  /// Constructor
 
4399
  UFC_AdvectionBilinearForm_dof_map_2_0() : ufc::dof_map()
 
4400
  {
 
4401
    __global_dimension = 0;
 
4402
  }
 
4403
 
 
4404
  /// Destructor
 
4405
  virtual ~UFC_AdvectionBilinearForm_dof_map_2_0()
 
4406
  {
 
4407
    // Do nothing
 
4408
  }
 
4409
 
 
4410
  /// Return a string identifying the dof map
 
4411
  virtual const char* signature() const
 
4412
  {
 
4413
    return "FFC dof map for Discontinuous Lagrange finite element of degree 0 on a tetrahedron";
 
4414
  }
 
4415
 
 
4416
  /// Return true iff mesh entities of topological dimension d are needed
 
4417
  virtual bool needs_mesh_entities(unsigned int d) const
 
4418
  {
 
4419
    switch ( d )
 
4420
    {
 
4421
    case 0:
 
4422
      return false;
 
4423
      break;
 
4424
    case 1:
 
4425
      return false;
 
4426
      break;
 
4427
    case 2:
 
4428
      return false;
 
4429
      break;
 
4430
    case 3:
 
4431
      return true;
 
4432
      break;
 
4433
    }
 
4434
    return false;
 
4435
  }
 
4436
 
 
4437
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
4438
  virtual bool init_mesh(const ufc::mesh& m)
 
4439
  {
 
4440
    __global_dimension = m.num_entities[3];
 
4441
    return false;
 
4442
  }
 
4443
 
 
4444
  /// Initialize dof map for given cell
 
4445
  virtual void init_cell(const ufc::mesh& m,
 
4446
                         const ufc::cell& c)
 
4447
  {
 
4448
    // Do nothing
 
4449
  }
 
4450
 
 
4451
  /// Finish initialization of dof map for cells
 
4452
  virtual void init_cell_finalize()
 
4453
  {
 
4454
    // Do nothing
 
4455
  }
 
4456
 
 
4457
  /// Return the dimension of the global finite element function space
 
4458
  virtual unsigned int global_dimension() const
 
4459
  {
 
4460
    return __global_dimension;
 
4461
  }
 
4462
 
 
4463
  /// Return the dimension of the local finite element function space
 
4464
  virtual unsigned int local_dimension() const
 
4465
  {
 
4466
    return 1;
 
4467
  }
 
4468
 
 
4469
  // Return the geometric dimension of the coordinates this dof map provides
 
4470
  virtual unsigned int geometric_dimension() const
 
4471
  {
 
4472
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4473
  }
 
4474
 
 
4475
  /// Return the number of dofs on each cell facet
 
4476
  virtual unsigned int num_facet_dofs() const
 
4477
  {
 
4478
    return 0;
 
4479
  }
 
4480
 
 
4481
  /// Return the number of dofs associated with each cell entity of dimension d
 
4482
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
4483
  {
 
4484
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4485
  }
 
4486
 
 
4487
  /// Tabulate the local-to-global mapping of dofs on a cell
 
4488
  virtual void tabulate_dofs(unsigned int* dofs,
 
4489
                             const ufc::mesh& m,
 
4490
                             const ufc::cell& c) const
 
4491
  {
 
4492
    dofs[0] = c.entity_indices[3][0];
 
4493
  }
 
4494
 
 
4495
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
4496
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
4497
                                   unsigned int facet) const
 
4498
  {
 
4499
    switch ( facet )
 
4500
    {
 
4501
    case 0:
 
4502
      
 
4503
      break;
 
4504
    case 1:
 
4505
      
 
4506
      break;
 
4507
    case 2:
 
4508
      
 
4509
      break;
 
4510
    case 3:
 
4511
      
 
4512
      break;
 
4513
    }
 
4514
  }
 
4515
 
 
4516
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
4517
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
4518
                                    unsigned int d, unsigned int i) const
 
4519
  {
 
4520
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4521
  }
 
4522
 
 
4523
  /// Tabulate the coordinates of all dofs on a cell
 
4524
  virtual void tabulate_coordinates(double** coordinates,
 
4525
                                    const ufc::cell& c) const
 
4526
  {
 
4527
    const double * const * x = c.coordinates;
 
4528
    coordinates[0][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0] + 0.25*x[3][0];
 
4529
    coordinates[0][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1] + 0.25*x[3][1];
 
4530
    coordinates[0][2] = 0.25*x[0][2] + 0.25*x[1][2] + 0.25*x[2][2] + 0.25*x[3][2];
 
4531
  }
 
4532
 
 
4533
  /// Return the number of sub dof maps (for a mixed element)
 
4534
  virtual unsigned int num_sub_dof_maps() const
 
4535
  {
 
4536
    return 1;
 
4537
  }
 
4538
 
 
4539
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
4540
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
4541
  {
 
4542
    return new UFC_AdvectionBilinearForm_dof_map_2_0();
 
4543
  }
 
4544
 
 
4545
};
 
4546
 
 
4547
/// This class defines the interface for a local-to-global mapping of
 
4548
/// degrees of freedom (dofs).
 
4549
 
 
4550
class UFC_AdvectionBilinearForm_dof_map_2_1: public ufc::dof_map
 
4551
{
 
4552
private:
 
4553
 
 
4554
  unsigned int __global_dimension;
 
4555
 
 
4556
public:
 
4557
 
 
4558
  /// Constructor
 
4559
  UFC_AdvectionBilinearForm_dof_map_2_1() : ufc::dof_map()
 
4560
  {
 
4561
    __global_dimension = 0;
 
4562
  }
 
4563
 
 
4564
  /// Destructor
 
4565
  virtual ~UFC_AdvectionBilinearForm_dof_map_2_1()
 
4566
  {
 
4567
    // Do nothing
 
4568
  }
 
4569
 
 
4570
  /// Return a string identifying the dof map
 
4571
  virtual const char* signature() const
 
4572
  {
 
4573
    return "FFC dof map for Discontinuous Lagrange finite element of degree 0 on a tetrahedron";
 
4574
  }
 
4575
 
 
4576
  /// Return true iff mesh entities of topological dimension d are needed
 
4577
  virtual bool needs_mesh_entities(unsigned int d) const
 
4578
  {
 
4579
    switch ( d )
 
4580
    {
 
4581
    case 0:
 
4582
      return false;
 
4583
      break;
 
4584
    case 1:
 
4585
      return false;
 
4586
      break;
 
4587
    case 2:
 
4588
      return false;
 
4589
      break;
 
4590
    case 3:
 
4591
      return true;
 
4592
      break;
 
4593
    }
 
4594
    return false;
 
4595
  }
 
4596
 
 
4597
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
4598
  virtual bool init_mesh(const ufc::mesh& m)
 
4599
  {
 
4600
    __global_dimension = m.num_entities[3];
 
4601
    return false;
 
4602
  }
 
4603
 
 
4604
  /// Initialize dof map for given cell
 
4605
  virtual void init_cell(const ufc::mesh& m,
 
4606
                         const ufc::cell& c)
 
4607
  {
 
4608
    // Do nothing
 
4609
  }
 
4610
 
 
4611
  /// Finish initialization of dof map for cells
 
4612
  virtual void init_cell_finalize()
 
4613
  {
 
4614
    // Do nothing
 
4615
  }
 
4616
 
 
4617
  /// Return the dimension of the global finite element function space
 
4618
  virtual unsigned int global_dimension() const
 
4619
  {
 
4620
    return __global_dimension;
 
4621
  }
 
4622
 
 
4623
  /// Return the dimension of the local finite element function space
 
4624
  virtual unsigned int local_dimension() const
 
4625
  {
 
4626
    return 1;
 
4627
  }
 
4628
 
 
4629
  // Return the geometric dimension of the coordinates this dof map provides
 
4630
  virtual unsigned int geometric_dimension() const
 
4631
  {
 
4632
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4633
  }
 
4634
 
 
4635
  /// Return the number of dofs on each cell facet
 
4636
  virtual unsigned int num_facet_dofs() const
 
4637
  {
 
4638
    return 0;
 
4639
  }
 
4640
 
 
4641
  /// Return the number of dofs associated with each cell entity of dimension d
 
4642
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
4643
  {
 
4644
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4645
  }
 
4646
 
 
4647
  /// Tabulate the local-to-global mapping of dofs on a cell
 
4648
  virtual void tabulate_dofs(unsigned int* dofs,
 
4649
                             const ufc::mesh& m,
 
4650
                             const ufc::cell& c) const
 
4651
  {
 
4652
    dofs[0] = c.entity_indices[3][0];
 
4653
  }
 
4654
 
 
4655
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
4656
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
4657
                                   unsigned int facet) const
 
4658
  {
 
4659
    switch ( facet )
 
4660
    {
 
4661
    case 0:
 
4662
      
 
4663
      break;
 
4664
    case 1:
 
4665
      
 
4666
      break;
 
4667
    case 2:
 
4668
      
 
4669
      break;
 
4670
    case 3:
 
4671
      
 
4672
      break;
 
4673
    }
 
4674
  }
 
4675
 
 
4676
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
4677
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
4678
                                    unsigned int d, unsigned int i) const
 
4679
  {
 
4680
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4681
  }
 
4682
 
 
4683
  /// Tabulate the coordinates of all dofs on a cell
 
4684
  virtual void tabulate_coordinates(double** coordinates,
 
4685
                                    const ufc::cell& c) const
 
4686
  {
 
4687
    const double * const * x = c.coordinates;
 
4688
    coordinates[0][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0] + 0.25*x[3][0];
 
4689
    coordinates[0][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1] + 0.25*x[3][1];
 
4690
    coordinates[0][2] = 0.25*x[0][2] + 0.25*x[1][2] + 0.25*x[2][2] + 0.25*x[3][2];
 
4691
  }
 
4692
 
 
4693
  /// Return the number of sub dof maps (for a mixed element)
 
4694
  virtual unsigned int num_sub_dof_maps() const
 
4695
  {
 
4696
    return 1;
 
4697
  }
 
4698
 
 
4699
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
4700
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
4701
  {
 
4702
    return new UFC_AdvectionBilinearForm_dof_map_2_1();
 
4703
  }
 
4704
 
 
4705
};
 
4706
 
 
4707
/// This class defines the interface for a local-to-global mapping of
 
4708
/// degrees of freedom (dofs).
 
4709
 
 
4710
class UFC_AdvectionBilinearForm_dof_map_2_2: public ufc::dof_map
 
4711
{
 
4712
private:
 
4713
 
 
4714
  unsigned int __global_dimension;
 
4715
 
 
4716
public:
 
4717
 
 
4718
  /// Constructor
 
4719
  UFC_AdvectionBilinearForm_dof_map_2_2() : ufc::dof_map()
 
4720
  {
 
4721
    __global_dimension = 0;
 
4722
  }
 
4723
 
 
4724
  /// Destructor
 
4725
  virtual ~UFC_AdvectionBilinearForm_dof_map_2_2()
 
4726
  {
 
4727
    // Do nothing
 
4728
  }
 
4729
 
 
4730
  /// Return a string identifying the dof map
 
4731
  virtual const char* signature() const
 
4732
  {
 
4733
    return "FFC dof map for Discontinuous Lagrange finite element of degree 0 on a tetrahedron";
 
4734
  }
 
4735
 
 
4736
  /// Return true iff mesh entities of topological dimension d are needed
 
4737
  virtual bool needs_mesh_entities(unsigned int d) const
 
4738
  {
 
4739
    switch ( d )
 
4740
    {
 
4741
    case 0:
 
4742
      return false;
 
4743
      break;
 
4744
    case 1:
 
4745
      return false;
 
4746
      break;
 
4747
    case 2:
 
4748
      return false;
 
4749
      break;
 
4750
    case 3:
 
4751
      return true;
 
4752
      break;
 
4753
    }
 
4754
    return false;
 
4755
  }
 
4756
 
 
4757
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
4758
  virtual bool init_mesh(const ufc::mesh& m)
 
4759
  {
 
4760
    __global_dimension = m.num_entities[3];
 
4761
    return false;
 
4762
  }
 
4763
 
 
4764
  /// Initialize dof map for given cell
 
4765
  virtual void init_cell(const ufc::mesh& m,
 
4766
                         const ufc::cell& c)
 
4767
  {
 
4768
    // Do nothing
 
4769
  }
 
4770
 
 
4771
  /// Finish initialization of dof map for cells
 
4772
  virtual void init_cell_finalize()
 
4773
  {
 
4774
    // Do nothing
 
4775
  }
 
4776
 
 
4777
  /// Return the dimension of the global finite element function space
 
4778
  virtual unsigned int global_dimension() const
 
4779
  {
 
4780
    return __global_dimension;
 
4781
  }
 
4782
 
 
4783
  /// Return the dimension of the local finite element function space
 
4784
  virtual unsigned int local_dimension() const
 
4785
  {
 
4786
    return 1;
 
4787
  }
 
4788
 
 
4789
  // Return the geometric dimension of the coordinates this dof map provides
 
4790
  virtual unsigned int geometric_dimension() const
 
4791
  {
 
4792
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4793
  }
 
4794
 
 
4795
  /// Return the number of dofs on each cell facet
 
4796
  virtual unsigned int num_facet_dofs() const
 
4797
  {
 
4798
    return 0;
 
4799
  }
 
4800
 
 
4801
  /// Return the number of dofs associated with each cell entity of dimension d
 
4802
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
4803
  {
 
4804
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4805
  }
 
4806
 
 
4807
  /// Tabulate the local-to-global mapping of dofs on a cell
 
4808
  virtual void tabulate_dofs(unsigned int* dofs,
 
4809
                             const ufc::mesh& m,
 
4810
                             const ufc::cell& c) const
 
4811
  {
 
4812
    dofs[0] = c.entity_indices[3][0];
 
4813
  }
 
4814
 
 
4815
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
4816
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
4817
                                   unsigned int facet) const
 
4818
  {
 
4819
    switch ( facet )
 
4820
    {
 
4821
    case 0:
 
4822
      
 
4823
      break;
 
4824
    case 1:
 
4825
      
 
4826
      break;
 
4827
    case 2:
 
4828
      
 
4829
      break;
 
4830
    case 3:
 
4831
      
 
4832
      break;
 
4833
    }
 
4834
  }
 
4835
 
 
4836
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
4837
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
4838
                                    unsigned int d, unsigned int i) const
 
4839
  {
 
4840
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4841
  }
 
4842
 
 
4843
  /// Tabulate the coordinates of all dofs on a cell
 
4844
  virtual void tabulate_coordinates(double** coordinates,
 
4845
                                    const ufc::cell& c) const
 
4846
  {
 
4847
    const double * const * x = c.coordinates;
 
4848
    coordinates[0][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0] + 0.25*x[3][0];
 
4849
    coordinates[0][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1] + 0.25*x[3][1];
 
4850
    coordinates[0][2] = 0.25*x[0][2] + 0.25*x[1][2] + 0.25*x[2][2] + 0.25*x[3][2];
 
4851
  }
 
4852
 
 
4853
  /// Return the number of sub dof maps (for a mixed element)
 
4854
  virtual unsigned int num_sub_dof_maps() const
 
4855
  {
 
4856
    return 1;
 
4857
  }
 
4858
 
 
4859
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
4860
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
4861
  {
 
4862
    return new UFC_AdvectionBilinearForm_dof_map_2_2();
 
4863
  }
 
4864
 
 
4865
};
 
4866
 
 
4867
/// This class defines the interface for a local-to-global mapping of
 
4868
/// degrees of freedom (dofs).
 
4869
 
 
4870
class UFC_AdvectionBilinearForm_dof_map_2: public ufc::dof_map
 
4871
{
 
4872
private:
 
4873
 
 
4874
  unsigned int __global_dimension;
 
4875
 
 
4876
public:
 
4877
 
 
4878
  /// Constructor
 
4879
  UFC_AdvectionBilinearForm_dof_map_2() : ufc::dof_map()
 
4880
  {
 
4881
    __global_dimension = 0;
 
4882
  }
 
4883
 
 
4884
  /// Destructor
 
4885
  virtual ~UFC_AdvectionBilinearForm_dof_map_2()
 
4886
  {
 
4887
    // Do nothing
 
4888
  }
 
4889
 
 
4890
  /// Return a string identifying the dof map
 
4891
  virtual const char* signature() const
 
4892
  {
 
4893
    return "FFC dof map for Mixed finite element: [Discontinuous Lagrange finite element of degree 0 on a tetrahedron, Discontinuous Lagrange finite element of degree 0 on a tetrahedron, Discontinuous Lagrange finite element of degree 0 on a tetrahedron]";
 
4894
  }
 
4895
 
 
4896
  /// Return true iff mesh entities of topological dimension d are needed
 
4897
  virtual bool needs_mesh_entities(unsigned int d) const
 
4898
  {
 
4899
    switch ( d )
 
4900
    {
 
4901
    case 0:
 
4902
      return false;
 
4903
      break;
 
4904
    case 1:
 
4905
      return false;
 
4906
      break;
 
4907
    case 2:
 
4908
      return false;
 
4909
      break;
 
4910
    case 3:
 
4911
      return true;
 
4912
      break;
 
4913
    }
 
4914
    return false;
 
4915
  }
 
4916
 
 
4917
  /// Initialize dof map for mesh (return true iff init_cell() is needed)
 
4918
  virtual bool init_mesh(const ufc::mesh& m)
 
4919
  {
 
4920
    __global_dimension = 3*m.num_entities[3];
 
4921
    return false;
 
4922
  }
 
4923
 
 
4924
  /// Initialize dof map for given cell
 
4925
  virtual void init_cell(const ufc::mesh& m,
 
4926
                         const ufc::cell& c)
 
4927
  {
 
4928
    // Do nothing
 
4929
  }
 
4930
 
 
4931
  /// Finish initialization of dof map for cells
 
4932
  virtual void init_cell_finalize()
 
4933
  {
 
4934
    // Do nothing
 
4935
  }
 
4936
 
 
4937
  /// Return the dimension of the global finite element function space
 
4938
  virtual unsigned int global_dimension() const
 
4939
  {
 
4940
    return __global_dimension;
 
4941
  }
 
4942
 
 
4943
  /// Return the dimension of the local finite element function space
 
4944
  virtual unsigned int local_dimension() const
 
4945
  {
 
4946
    return 3;
 
4947
  }
 
4948
 
 
4949
  // Return the geometric dimension of the coordinates this dof map provides
 
4950
  virtual unsigned int geometric_dimension() const
 
4951
  {
 
4952
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4953
  }
 
4954
 
 
4955
  /// Return the number of dofs on each cell facet
 
4956
  virtual unsigned int num_facet_dofs() const
 
4957
  {
 
4958
    return 0;
 
4959
  }
 
4960
 
 
4961
  /// Return the number of dofs associated with each cell entity of dimension d
 
4962
  virtual unsigned int num_entity_dofs(unsigned int d) const
 
4963
  {
 
4964
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
4965
  }
 
4966
 
 
4967
  /// Tabulate the local-to-global mapping of dofs on a cell
 
4968
  virtual void tabulate_dofs(unsigned int* dofs,
 
4969
                             const ufc::mesh& m,
 
4970
                             const ufc::cell& c) const
 
4971
  {
 
4972
    dofs[0] = c.entity_indices[3][0];
 
4973
    unsigned int offset = m.num_entities[3];
 
4974
    dofs[1] = offset + c.entity_indices[3][0];
 
4975
    offset = offset + m.num_entities[3];
 
4976
    dofs[2] = offset + c.entity_indices[3][0];
 
4977
  }
 
4978
 
 
4979
  /// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
4980
  virtual void tabulate_facet_dofs(unsigned int* dofs,
 
4981
                                   unsigned int facet) const
 
4982
  {
 
4983
    switch ( facet )
 
4984
    {
 
4985
    case 0:
 
4986
      
 
4987
      break;
 
4988
    case 1:
 
4989
      
 
4990
      break;
 
4991
    case 2:
 
4992
      
 
4993
      break;
 
4994
    case 3:
 
4995
      
 
4996
      break;
 
4997
    }
 
4998
  }
 
4999
 
 
5000
  /// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
5001
  virtual void tabulate_entity_dofs(unsigned int* dofs,
 
5002
                                    unsigned int d, unsigned int i) const
 
5003
  {
 
5004
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
5005
  }
 
5006
 
 
5007
  /// Tabulate the coordinates of all dofs on a cell
 
5008
  virtual void tabulate_coordinates(double** coordinates,
 
5009
                                    const ufc::cell& c) const
 
5010
  {
 
5011
    const double * const * x = c.coordinates;
 
5012
    coordinates[0][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0] + 0.25*x[3][0];
 
5013
    coordinates[0][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1] + 0.25*x[3][1];
 
5014
    coordinates[0][2] = 0.25*x[0][2] + 0.25*x[1][2] + 0.25*x[2][2] + 0.25*x[3][2];
 
5015
    coordinates[1][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0] + 0.25*x[3][0];
 
5016
    coordinates[1][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1] + 0.25*x[3][1];
 
5017
    coordinates[1][2] = 0.25*x[0][2] + 0.25*x[1][2] + 0.25*x[2][2] + 0.25*x[3][2];
 
5018
    coordinates[2][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0] + 0.25*x[3][0];
 
5019
    coordinates[2][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1] + 0.25*x[3][1];
 
5020
    coordinates[2][2] = 0.25*x[0][2] + 0.25*x[1][2] + 0.25*x[2][2] + 0.25*x[3][2];
 
5021
  }
 
5022
 
 
5023
  /// Return the number of sub dof maps (for a mixed element)
 
5024
  virtual unsigned int num_sub_dof_maps() const
 
5025
  {
 
5026
    return 3;
 
5027
  }
 
5028
 
 
5029
  /// Create a new dof_map for sub dof map i (for a mixed element)
 
5030
  virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
 
5031
  {
 
5032
    switch ( i )
 
5033
    {
 
5034
    case 0:
 
5035
      return new UFC_AdvectionBilinearForm_dof_map_2_0();
 
5036
      break;
 
5037
    case 1:
 
5038
      return new UFC_AdvectionBilinearForm_dof_map_2_1();
 
5039
      break;
 
5040
    case 2:
 
5041
      return new UFC_AdvectionBilinearForm_dof_map_2_2();
 
5042
      break;
 
5043
    }
 
5044
    return 0;
 
5045
  }
 
5046
 
 
5047
};
 
5048
 
 
5049
/// This class defines the interface for the tabulation of the cell
 
5050
/// tensor corresponding to the local contribution to a form from
 
5051
/// the integral over a cell.
 
5052
 
 
5053
class UFC_AdvectionBilinearForm_cell_integral_0: public ufc::cell_integral
 
5054
{
 
5055
public:
 
5056
 
 
5057
  /// Constructor
 
5058
  UFC_AdvectionBilinearForm_cell_integral_0() : ufc::cell_integral()
 
5059
  {
 
5060
    // Do nothing
 
5061
  }
 
5062
 
 
5063
  /// Destructor
 
5064
  virtual ~UFC_AdvectionBilinearForm_cell_integral_0()
 
5065
  {
 
5066
    // Do nothing
 
5067
  }
 
5068
 
 
5069
  /// Tabulate the tensor for the contribution from a local cell
 
5070
  virtual void tabulate_tensor(double* A,
 
5071
                               const double * const * w,
 
5072
                               const ufc::cell& c) const
 
5073
  {
 
5074
    // Extract vertex coordinates
 
5075
    const double * const * x = c.coordinates;
 
5076
    
 
5077
    // Compute Jacobian of affine map from reference cell
 
5078
    const double J_00 = x[1][0] - x[0][0];
 
5079
    const double J_01 = x[2][0] - x[0][0];
 
5080
    const double J_02 = x[3][0] - x[0][0];
 
5081
    const double J_10 = x[1][1] - x[0][1];
 
5082
    const double J_11 = x[2][1] - x[0][1];
 
5083
    const double J_12 = x[3][1] - x[0][1];
 
5084
    const double J_20 = x[1][2] - x[0][2];
 
5085
    const double J_21 = x[2][2] - x[0][2];
 
5086
    const double J_22 = x[3][2] - x[0][2];
 
5087
      
 
5088
    // Compute sub determinants
 
5089
    const double d_00 = J_11*J_22 - J_12*J_21;
 
5090
    const double d_01 = J_12*J_20 - J_10*J_22;
 
5091
    const double d_02 = J_10*J_21 - J_11*J_20;
 
5092
    
 
5093
    const double d_10 = J_02*J_21 - J_01*J_22;
 
5094
    const double d_11 = J_00*J_22 - J_02*J_20;
 
5095
    const double d_12 = J_01*J_20 - J_00*J_21;
 
5096
    
 
5097
    const double d_20 = J_01*J_12 - J_02*J_11;
 
5098
    const double d_21 = J_02*J_10 - J_00*J_12;
 
5099
    const double d_22 = J_00*J_11 - J_01*J_10;
 
5100
      
 
5101
    // Compute determinant of Jacobian
 
5102
    double detJ = J_00*d_00 + J_10*d_10 + J_20*d_20;
 
5103
      
 
5104
    // Compute inverse of Jacobian
 
5105
    const double Jinv_00 = d_00 / detJ;
 
5106
    const double Jinv_01 = d_10 / detJ;
 
5107
    const double Jinv_02 = d_20 / detJ;
 
5108
    const double Jinv_10 = d_01 / detJ;
 
5109
    const double Jinv_11 = d_11 / detJ;
 
5110
    const double Jinv_12 = d_21 / detJ;
 
5111
    const double Jinv_20 = d_02 / detJ;
 
5112
    const double Jinv_21 = d_12 / detJ;
 
5113
    const double Jinv_22 = d_22 / detJ;
 
5114
    
 
5115
    // Set scale factor
 
5116
    const double det = std::abs(detJ);
 
5117
    
 
5118
    // Compute coefficients
 
5119
    const double c0_0_0_0 = w[0][0];
 
5120
    const double c0_0_0_1 = w[0][1];
 
5121
    const double c0_0_0_2 = w[0][2];
 
5122
    
 
5123
    // Compute geometry tensors
 
5124
    const double G0_0_0_0 = det*c0_0_0_0*Jinv_00;
 
5125
    const double G0_0_0_1 = det*c0_0_0_0*Jinv_10;
 
5126
    const double G0_0_0_2 = det*c0_0_0_0*Jinv_20;
 
5127
    const double G0_1_1_0 = det*c0_0_0_1*Jinv_01;
 
5128
    const double G0_1_1_1 = det*c0_0_0_1*Jinv_11;
 
5129
    const double G0_1_1_2 = det*c0_0_0_1*Jinv_21;
 
5130
    const double G0_2_2_0 = det*c0_0_0_2*Jinv_02;
 
5131
    const double G0_2_2_1 = det*c0_0_0_2*Jinv_12;
 
5132
    const double G0_2_2_2 = det*c0_0_0_2*Jinv_22;
 
5133
    
 
5134
    // Compute element tensor
 
5135
    A[0] = -0.00282738095238094*G0_0_0_0 - 0.00282738095238094*G0_0_0_1 - 0.00282738095238094*G0_0_0_2 - 0.00282738095238094*G0_1_1_0 - 0.00282738095238094*G0_1_1_1 - 0.00282738095238094*G0_1_1_2 - 0.00282738095238094*G0_2_2_0 - 0.00282738095238094*G0_2_2_1 - 0.00282738095238094*G0_2_2_2;
 
5136
    A[1] = 0.00081845238095238*G0_0_0_0 + 0.00081845238095238*G0_1_1_0 + 0.00081845238095238*G0_2_2_0;
 
5137
    A[2] = 0.000818452380952379*G0_0_0_1 + 0.000818452380952379*G0_1_1_1 + 0.000818452380952379*G0_2_2_1;
 
5138
    A[3] = 0.000818452380952379*G0_0_0_2 + 0.000818452380952379*G0_1_1_2 + 0.000818452380952379*G0_2_2_2;
 
5139
    A[4] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5140
    A[5] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5141
    A[6] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_2;
 
5142
    A[7] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_2;
 
5143
    A[8] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_1;
 
5144
    A[9] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_1;
 
5145
    A[10] = 0.00267857142857143*G0_0_0_0 + 0.00267857142857143*G0_0_0_1 + 0.00401785714285713*G0_0_0_2 + 0.00267857142857143*G0_1_1_0 + 0.00267857142857143*G0_1_1_1 + 0.00401785714285713*G0_1_1_2 + 0.00267857142857143*G0_2_2_0 + 0.00267857142857143*G0_2_2_1 + 0.00401785714285713*G0_2_2_2;
 
5146
    A[11] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142856*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142856*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142856*G0_2_2_2;
 
5147
    A[12] = 0.00267857142857143*G0_0_0_0 + 0.00401785714285713*G0_0_0_1 + 0.00267857142857143*G0_0_0_2 + 0.00267857142857143*G0_1_1_0 + 0.00401785714285713*G0_1_1_1 + 0.00267857142857143*G0_1_1_2 + 0.00267857142857143*G0_2_2_0 + 0.00401785714285713*G0_2_2_1 + 0.00267857142857143*G0_2_2_2;
 
5148
    A[13] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5149
    A[14] = 0.00401785714285713*G0_0_0_0 + 0.00267857142857143*G0_0_0_1 + 0.00267857142857143*G0_0_0_2 + 0.00401785714285713*G0_1_1_0 + 0.00267857142857143*G0_1_1_1 + 0.00267857142857143*G0_1_1_2 + 0.00401785714285713*G0_2_2_0 + 0.00267857142857143*G0_2_2_1 + 0.00267857142857143*G0_2_2_2;
 
5150
    A[15] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5151
    A[16] = 0.00736607142857142*G0_0_0_0 + 0.00736607142857142*G0_0_0_1 + 0.00736607142857143*G0_0_0_2 + 0.00736607142857142*G0_1_1_0 + 0.00736607142857142*G0_1_1_1 + 0.00736607142857143*G0_1_1_2 + 0.00736607142857142*G0_2_2_0 + 0.00736607142857142*G0_2_2_1 + 0.00736607142857143*G0_2_2_2;
 
5152
    A[17] = -0.00736607142857142*G0_0_0_0 - 0.00468749999999999*G0_0_0_1 - 0.0046875*G0_0_0_2 - 0.00736607142857142*G0_1_1_0 - 0.00468749999999999*G0_1_1_1 - 0.0046875*G0_1_1_2 - 0.00736607142857142*G0_2_2_0 - 0.00468749999999999*G0_2_2_1 - 0.0046875*G0_2_2_2;
 
5153
    A[18] = -0.0046875*G0_0_0_0 - 0.00736607142857142*G0_0_0_1 - 0.0046875*G0_0_0_2 - 0.0046875*G0_1_1_0 - 0.00736607142857142*G0_1_1_1 - 0.0046875*G0_1_1_2 - 0.0046875*G0_2_2_0 - 0.00736607142857142*G0_2_2_1 - 0.0046875*G0_2_2_2;
 
5154
    A[19] = -0.0046875*G0_0_0_0 - 0.0046875*G0_0_0_1 - 0.00736607142857143*G0_0_0_2 - 0.0046875*G0_1_1_0 - 0.0046875*G0_1_1_1 - 0.00736607142857143*G0_1_1_2 - 0.0046875*G0_2_2_0 - 0.0046875*G0_2_2_1 - 0.00736607142857143*G0_2_2_2;
 
5155
    A[20] = -0.000818452380952381*G0_0_0_0 - 0.000818452380952381*G0_0_0_1 - 0.00081845238095238*G0_0_0_2 - 0.000818452380952381*G0_1_1_0 - 0.000818452380952381*G0_1_1_1 - 0.00081845238095238*G0_1_1_2 - 0.000818452380952381*G0_2_2_0 - 0.000818452380952381*G0_2_2_1 - 0.00081845238095238*G0_2_2_2;
 
5156
    A[21] = 0.00282738095238095*G0_0_0_0 + 0.00282738095238095*G0_1_1_0 + 0.00282738095238095*G0_2_2_0;
 
5157
    A[22] = 0.000818452380952381*G0_0_0_1 + 0.000818452380952381*G0_1_1_1 + 0.000818452380952381*G0_2_2_1;
 
5158
    A[23] = 0.00081845238095238*G0_0_0_2 + 0.00081845238095238*G0_1_1_2 + 0.00081845238095238*G0_2_2_2;
 
5159
    A[24] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5160
    A[25] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5161
    A[26] = -0.00267857142857143*G0_0_0_0 + 0.00133928571428571*G0_0_0_2 - 0.00267857142857143*G0_1_1_0 + 0.00133928571428571*G0_1_1_2 - 0.00267857142857143*G0_2_2_0 + 0.00133928571428571*G0_2_2_2;
 
5162
    A[27] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_2_2_0;
 
5163
    A[28] = -0.00267857142857143*G0_0_0_0 + 0.00133928571428571*G0_0_0_1 - 0.00267857142857143*G0_1_1_0 + 0.00133928571428571*G0_1_1_1 - 0.00267857142857143*G0_2_2_0 + 0.00133928571428571*G0_2_2_1;
 
5164
    A[29] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_2_2_0;
 
5165
    A[30] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1;
 
5166
    A[31] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1;
 
5167
    A[32] = -0.00200892857142856*G0_0_0_0 - 0.00200892857142856*G0_0_0_2 - 0.00200892857142856*G0_1_1_0 - 0.00200892857142856*G0_1_1_2 - 0.00200892857142856*G0_2_2_0 - 0.00200892857142856*G0_2_2_2;
 
5168
    A[33] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_2;
 
5169
    A[34] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_2_2_0;
 
5170
    A[35] = -0.00401785714285714*G0_0_0_0 - 0.00133928571428571*G0_0_0_1 - 0.00133928571428571*G0_0_0_2 - 0.00401785714285714*G0_1_1_0 - 0.00133928571428571*G0_1_1_1 - 0.00133928571428571*G0_1_1_2 - 0.00401785714285714*G0_2_2_0 - 0.00133928571428571*G0_2_2_1 - 0.00133928571428571*G0_2_2_2;
 
5171
    A[36] = 0.00736607142857142*G0_0_0_0 + 0.00267857142857142*G0_0_0_1 + 0.00267857142857142*G0_0_0_2 + 0.00736607142857142*G0_1_1_0 + 0.00267857142857142*G0_1_1_1 + 0.00267857142857142*G0_1_1_2 + 0.00736607142857142*G0_2_2_0 + 0.00267857142857142*G0_2_2_1 + 0.00267857142857142*G0_2_2_2;
 
5172
    A[37] = -0.00736607142857142*G0_0_0_0 - 0.00736607142857142*G0_1_1_0 - 0.00736607142857142*G0_2_2_0;
 
5173
    A[38] = 0.0046875*G0_0_0_0 - 0.00267857142857142*G0_0_0_1 + 0.0046875*G0_1_1_0 - 0.00267857142857142*G0_1_1_1 + 0.0046875*G0_2_2_0 - 0.00267857142857142*G0_2_2_1;
 
5174
    A[39] = 0.00468749999999999*G0_0_0_0 - 0.00267857142857142*G0_0_0_2 + 0.00468749999999999*G0_1_1_0 - 0.00267857142857142*G0_1_1_2 + 0.00468749999999999*G0_2_2_0 - 0.00267857142857142*G0_2_2_2;
 
5175
    A[40] = -0.000818452380952379*G0_0_0_0 - 0.000818452380952379*G0_0_0_1 - 0.000818452380952379*G0_0_0_2 - 0.000818452380952379*G0_1_1_0 - 0.000818452380952379*G0_1_1_1 - 0.000818452380952379*G0_1_1_2 - 0.000818452380952379*G0_2_2_0 - 0.000818452380952379*G0_2_2_1 - 0.000818452380952379*G0_2_2_2;
 
5176
    A[41] = 0.00081845238095238*G0_0_0_0 + 0.00081845238095238*G0_1_1_0 + 0.00081845238095238*G0_2_2_0;
 
5177
    A[42] = 0.00282738095238095*G0_0_0_1 + 0.00282738095238095*G0_1_1_1 + 0.00282738095238095*G0_2_2_1;
 
5178
    A[43] = 0.000818452380952379*G0_0_0_2 + 0.000818452380952379*G0_1_1_2 + 0.000818452380952379*G0_2_2_2;
 
5179
    A[44] = -0.00267857142857143*G0_0_0_1 + 0.00133928571428571*G0_0_0_2 - 0.00267857142857143*G0_1_1_1 + 0.00133928571428571*G0_1_1_2 - 0.00267857142857143*G0_2_2_1 + 0.00133928571428571*G0_2_2_2;
 
5180
    A[45] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_1;
 
5181
    A[46] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_2;
 
5182
    A[47] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_2;
 
5183
    A[48] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_1;
 
5184
    A[49] = 0.00133928571428571*G0_0_0_0 - 0.00267857142857143*G0_0_0_1 + 0.00133928571428571*G0_1_1_0 - 0.00267857142857143*G0_1_1_1 + 0.00133928571428571*G0_2_2_0 - 0.00267857142857143*G0_2_2_1;
 
5185
    A[50] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1;
 
5186
    A[51] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1;
 
5187
    A[52] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_1;
 
5188
    A[53] = -0.00133928571428571*G0_0_0_0 - 0.00401785714285714*G0_0_0_1 - 0.00133928571428571*G0_0_0_2 - 0.00133928571428571*G0_1_1_0 - 0.00401785714285714*G0_1_1_1 - 0.00133928571428571*G0_1_1_2 - 0.00133928571428571*G0_2_2_0 - 0.00401785714285714*G0_2_2_1 - 0.00133928571428571*G0_2_2_2;
 
5189
    A[54] = -0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5190
    A[55] = -0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5191
    A[56] = 0.00267857142857142*G0_0_0_0 + 0.00736607142857142*G0_0_0_1 + 0.00267857142857142*G0_0_0_2 + 0.00267857142857142*G0_1_1_0 + 0.00736607142857142*G0_1_1_1 + 0.00267857142857142*G0_1_1_2 + 0.00267857142857142*G0_2_2_0 + 0.00736607142857142*G0_2_2_1 + 0.00267857142857142*G0_2_2_2;
 
5192
    A[57] = -0.00267857142857141*G0_0_0_0 + 0.0046875*G0_0_0_1 - 0.00267857142857141*G0_1_1_0 + 0.0046875*G0_1_1_1 - 0.00267857142857141*G0_2_2_0 + 0.0046875*G0_2_2_1;
 
5193
    A[58] = -0.00736607142857142*G0_0_0_1 - 0.00736607142857142*G0_1_1_1 - 0.00736607142857142*G0_2_2_1;
 
5194
    A[59] = 0.0046875*G0_0_0_1 - 0.00267857142857142*G0_0_0_2 + 0.0046875*G0_1_1_1 - 0.00267857142857142*G0_1_1_2 + 0.0046875*G0_2_2_1 - 0.00267857142857142*G0_2_2_2;
 
5195
    A[60] = -0.000818452380952381*G0_0_0_0 - 0.000818452380952381*G0_0_0_1 - 0.00081845238095238*G0_0_0_2 - 0.000818452380952381*G0_1_1_0 - 0.000818452380952381*G0_1_1_1 - 0.00081845238095238*G0_1_1_2 - 0.000818452380952381*G0_2_2_0 - 0.000818452380952381*G0_2_2_1 - 0.00081845238095238*G0_2_2_2;
 
5196
    A[61] = 0.000818452380952381*G0_0_0_0 + 0.000818452380952381*G0_1_1_0 + 0.000818452380952381*G0_2_2_0;
 
5197
    A[62] = 0.000818452380952381*G0_0_0_1 + 0.000818452380952381*G0_1_1_1 + 0.000818452380952381*G0_2_2_1;
 
5198
    A[63] = 0.00282738095238095*G0_0_0_2 + 0.00282738095238095*G0_1_1_2 + 0.00282738095238095*G0_2_2_2;
 
5199
    A[64] = 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_2;
 
5200
    A[65] = 0.00133928571428571*G0_0_0_1 - 0.00267857142857142*G0_0_0_2 + 0.00133928571428571*G0_1_1_1 - 0.00267857142857142*G0_1_1_2 + 0.00133928571428571*G0_2_2_1 - 0.00267857142857142*G0_2_2_2;
 
5201
    A[66] = 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_2;
 
5202
    A[67] = 0.00133928571428571*G0_0_0_0 - 0.00267857142857142*G0_0_0_2 + 0.00133928571428571*G0_1_1_0 - 0.00267857142857142*G0_1_1_2 + 0.00133928571428571*G0_2_2_0 - 0.00267857142857142*G0_2_2_2;
 
5203
    A[68] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_1;
 
5204
    A[69] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_1;
 
5205
    A[70] = 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_2;
 
5206
    A[71] = -0.00133928571428571*G0_0_0_0 - 0.00133928571428571*G0_0_0_1 - 0.00401785714285714*G0_0_0_2 - 0.00133928571428571*G0_1_1_0 - 0.00133928571428571*G0_1_1_1 - 0.00401785714285714*G0_1_1_2 - 0.00133928571428571*G0_2_2_0 - 0.00133928571428571*G0_2_2_1 - 0.00401785714285714*G0_2_2_2;
 
5207
    A[72] = -0.00200892857142856*G0_0_0_0 - 0.00200892857142856*G0_0_0_2 - 0.00200892857142856*G0_1_1_0 - 0.00200892857142856*G0_1_1_2 - 0.00200892857142856*G0_2_2_0 - 0.00200892857142856*G0_2_2_2;
 
5208
    A[73] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_2;
 
5209
    A[74] = -0.00200892857142856*G0_0_0_1 - 0.00200892857142856*G0_0_0_2 - 0.00200892857142856*G0_1_1_1 - 0.00200892857142856*G0_1_1_2 - 0.00200892857142856*G0_2_2_1 - 0.00200892857142856*G0_2_2_2;
 
5210
    A[75] = -0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5211
    A[76] = 0.00267857142857141*G0_0_0_0 + 0.00267857142857142*G0_0_0_1 + 0.00736607142857141*G0_0_0_2 + 0.00267857142857141*G0_1_1_0 + 0.00267857142857142*G0_1_1_1 + 0.00736607142857141*G0_1_1_2 + 0.00267857142857141*G0_2_2_0 + 0.00267857142857142*G0_2_2_1 + 0.00736607142857141*G0_2_2_2;
 
5212
    A[77] = -0.00267857142857141*G0_0_0_0 + 0.00468749999999999*G0_0_0_2 - 0.00267857142857141*G0_1_1_0 + 0.00468749999999999*G0_1_1_2 - 0.00267857142857141*G0_2_2_0 + 0.00468749999999999*G0_2_2_2;
 
5213
    A[78] = -0.00267857142857142*G0_0_0_1 + 0.00468749999999999*G0_0_0_2 - 0.00267857142857142*G0_1_1_1 + 0.00468749999999999*G0_1_1_2 - 0.00267857142857142*G0_2_2_1 + 0.00468749999999999*G0_2_2_2;
 
5214
    A[79] = -0.00736607142857141*G0_0_0_2 - 0.00736607142857141*G0_1_1_2 - 0.00736607142857141*G0_2_2_2;
 
5215
    A[80] = -0.00200892857142858*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142858*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142858*G0_2_2_0 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5216
    A[81] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_2_2_0;
 
5217
    A[82] = 0.00401785714285714*G0_0_0_1 + 0.00401785714285714*G0_1_1_1 + 0.00401785714285714*G0_2_2_1;
 
5218
    A[83] = -0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_2;
 
5219
    A[84] = 0.0200892857142857*G0_0_0_1 + 0.0200892857142857*G0_0_0_2 + 0.0200892857142857*G0_1_1_1 + 0.0200892857142857*G0_1_1_2 + 0.0200892857142857*G0_2_2_1 + 0.0200892857142857*G0_2_2_2;
 
5220
    A[85] = -0.0100446428571428*G0_0_0_1 - 0.00401785714285714*G0_0_0_2 - 0.0100446428571428*G0_1_1_1 - 0.00401785714285714*G0_1_1_2 - 0.0100446428571428*G0_2_2_1 - 0.00401785714285714*G0_2_2_2;
 
5221
    A[86] = -0.00401785714285714*G0_0_0_0 - 0.00200892857142857*G0_0_0_2 - 0.00401785714285714*G0_1_1_0 - 0.00200892857142857*G0_1_1_2 - 0.00401785714285714*G0_2_2_0 - 0.00200892857142857*G0_2_2_2;
 
5222
    A[87] = -0.0100446428571428*G0_0_0_0 - 0.00803571428571428*G0_0_0_2 - 0.0100446428571428*G0_1_1_0 - 0.00803571428571428*G0_1_1_2 - 0.0100446428571428*G0_2_2_0 - 0.00803571428571428*G0_2_2_2;
 
5223
    A[88] = -0.0100446428571428*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.0100446428571428*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.0100446428571428*G0_2_2_0 - 0.00200892857142857*G0_2_2_1;
 
5224
    A[89] = 0.0200892857142857*G0_0_0_0 + 0.0100446428571429*G0_0_0_1 + 0.0200892857142857*G0_1_1_0 + 0.0100446428571429*G0_1_1_1 + 0.0200892857142857*G0_2_2_0 + 0.0100446428571429*G0_2_2_1;
 
5225
    A[90] = 0.00401785714285715*G0_0_0_0 + 0.00401785714285715*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00401785714285715*G0_1_1_0 + 0.00401785714285715*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00401785714285715*G0_2_2_0 + 0.00401785714285715*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5226
    A[91] = 0.0100446428571428*G0_0_0_0 + 0.0100446428571428*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.0100446428571428*G0_1_1_0 + 0.0100446428571428*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.0100446428571428*G0_2_2_0 + 0.0100446428571428*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5227
    A[92] = 0.0100446428571429*G0_0_0_0 + 0.00803571428571429*G0_0_0_1 + 0.0100446428571429*G0_0_0_2 + 0.0100446428571429*G0_1_1_0 + 0.00803571428571429*G0_1_1_1 + 0.0100446428571429*G0_1_1_2 + 0.0100446428571429*G0_2_2_0 + 0.00803571428571429*G0_2_2_1 + 0.0100446428571429*G0_2_2_2;
 
5228
    A[93] = -0.0200892857142857*G0_0_0_0 - 0.0100446428571429*G0_0_0_1 - 0.0200892857142857*G0_0_0_2 - 0.0200892857142857*G0_1_1_0 - 0.0100446428571429*G0_1_1_1 - 0.0200892857142857*G0_1_1_2 - 0.0200892857142857*G0_2_2_0 - 0.0100446428571429*G0_2_2_1 - 0.0200892857142857*G0_2_2_2;
 
5229
    A[94] = 0.00200892857142858*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142858*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142858*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5230
    A[95] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5231
    A[96] = 0.0120535714285714*G0_0_0_0 - 0.0120535714285714*G0_0_0_1 + 0.00602678571428572*G0_0_0_2 + 0.0120535714285714*G0_1_1_0 - 0.0120535714285714*G0_1_1_1 + 0.00602678571428572*G0_1_1_2 + 0.0120535714285714*G0_2_2_0 - 0.0120535714285714*G0_2_2_1 + 0.00602678571428572*G0_2_2_2;
 
5232
    A[97] = -0.0120535714285714*G0_0_0_0 - 0.0241071428571429*G0_0_0_1 - 0.00602678571428572*G0_0_0_2 - 0.0120535714285714*G0_1_1_0 - 0.0241071428571429*G0_1_1_1 - 0.00602678571428572*G0_1_1_2 - 0.0120535714285714*G0_2_2_0 - 0.0241071428571429*G0_2_2_1 - 0.00602678571428572*G0_2_2_2;
 
5233
    A[98] = 0.0120535714285714*G0_0_0_1 + 0.0060267857142857*G0_0_0_2 + 0.0120535714285714*G0_1_1_1 + 0.0060267857142857*G0_1_1_2 + 0.0120535714285714*G0_2_2_1 + 0.0060267857142857*G0_2_2_2;
 
5234
    A[99] = -0.0120535714285714*G0_0_0_1 - 0.00602678571428571*G0_0_0_2 - 0.0120535714285714*G0_1_1_1 - 0.00602678571428571*G0_1_1_2 - 0.0120535714285714*G0_2_2_1 - 0.00602678571428571*G0_2_2_2;
 
5235
    A[100] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5236
    A[101] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_2_2_0;
 
5237
    A[102] = -0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_2_2_1;
 
5238
    A[103] = 0.00401785714285714*G0_0_0_2 + 0.00401785714285714*G0_1_1_2 + 0.00401785714285714*G0_2_2_2;
 
5239
    A[104] = -0.00401785714285716*G0_0_0_1 - 0.0100446428571428*G0_0_0_2 - 0.00401785714285716*G0_1_1_1 - 0.0100446428571428*G0_1_1_2 - 0.00401785714285716*G0_2_2_1 - 0.0100446428571428*G0_2_2_2;
 
5240
    A[105] = 0.0200892857142857*G0_0_0_1 + 0.0200892857142857*G0_0_0_2 + 0.0200892857142857*G0_1_1_1 + 0.0200892857142857*G0_1_1_2 + 0.0200892857142857*G0_2_2_1 + 0.0200892857142857*G0_2_2_2;
 
5241
    A[106] = -0.0100446428571428*G0_0_0_0 - 0.00200892857142856*G0_0_0_2 - 0.0100446428571428*G0_1_1_0 - 0.00200892857142856*G0_1_1_2 - 0.0100446428571428*G0_2_2_0 - 0.00200892857142856*G0_2_2_2;
 
5242
    A[107] = 0.0200892857142857*G0_0_0_0 + 0.0100446428571428*G0_0_0_2 + 0.0200892857142857*G0_1_1_0 + 0.0100446428571428*G0_1_1_2 + 0.0200892857142857*G0_2_2_0 + 0.0100446428571428*G0_2_2_2;
 
5243
    A[108] = -0.00401785714285713*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00401785714285713*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00401785714285713*G0_2_2_0 - 0.00200892857142857*G0_2_2_1;
 
5244
    A[109] = -0.0100446428571428*G0_0_0_0 - 0.00803571428571427*G0_0_0_1 - 0.0100446428571428*G0_1_1_0 - 0.00803571428571427*G0_1_1_1 - 0.0100446428571428*G0_2_2_0 - 0.00803571428571427*G0_2_2_1;
 
5245
    A[110] = 0.0100446428571428*G0_0_0_0 + 0.0100446428571428*G0_0_0_1 + 0.00803571428571428*G0_0_0_2 + 0.0100446428571428*G0_1_1_0 + 0.0100446428571428*G0_1_1_1 + 0.00803571428571428*G0_1_1_2 + 0.0100446428571428*G0_2_2_0 + 0.0100446428571428*G0_2_2_1 + 0.00803571428571428*G0_2_2_2;
 
5246
    A[111] = -0.0200892857142857*G0_0_0_0 - 0.0200892857142857*G0_0_0_1 - 0.0100446428571428*G0_0_0_2 - 0.0200892857142857*G0_1_1_0 - 0.0200892857142857*G0_1_1_1 - 0.0100446428571428*G0_1_1_2 - 0.0200892857142857*G0_2_2_0 - 0.0200892857142857*G0_2_2_1 - 0.0100446428571428*G0_2_2_2;
 
5247
    A[112] = 0.00401785714285713*G0_0_0_0 + 0.00200892857142856*G0_0_0_1 + 0.00401785714285713*G0_0_0_2 + 0.00401785714285713*G0_1_1_0 + 0.00200892857142856*G0_1_1_1 + 0.00401785714285713*G0_1_1_2 + 0.00401785714285713*G0_2_2_0 + 0.00200892857142856*G0_2_2_1 + 0.00401785714285713*G0_2_2_2;
 
5248
    A[113] = 0.0100446428571428*G0_0_0_0 + 0.00200892857142858*G0_0_0_1 + 0.0100446428571429*G0_0_0_2 + 0.0100446428571428*G0_1_1_0 + 0.00200892857142858*G0_1_1_1 + 0.0100446428571429*G0_1_1_2 + 0.0100446428571428*G0_2_2_0 + 0.00200892857142858*G0_2_2_1 + 0.0100446428571429*G0_2_2_2;
 
5249
    A[114] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5250
    A[115] = 0.00200892857142856*G0_0_0_1 + 0.00200892857142856*G0_0_0_2 + 0.00200892857142856*G0_1_1_1 + 0.00200892857142856*G0_1_1_2 + 0.00200892857142856*G0_2_2_1 + 0.00200892857142856*G0_2_2_2;
 
5251
    A[116] = 0.0120535714285714*G0_0_0_0 + 0.00602678571428571*G0_0_0_1 - 0.0120535714285714*G0_0_0_2 + 0.0120535714285714*G0_1_1_0 + 0.00602678571428571*G0_1_1_1 - 0.0120535714285714*G0_1_1_2 + 0.0120535714285714*G0_2_2_0 + 0.00602678571428571*G0_2_2_1 - 0.0120535714285714*G0_2_2_2;
 
5252
    A[117] = -0.0120535714285714*G0_0_0_0 - 0.00602678571428569*G0_0_0_1 - 0.0241071428571428*G0_0_0_2 - 0.0120535714285714*G0_1_1_0 - 0.00602678571428569*G0_1_1_1 - 0.0241071428571428*G0_1_1_2 - 0.0120535714285714*G0_2_2_0 - 0.00602678571428569*G0_2_2_1 - 0.0241071428571428*G0_2_2_2;
 
5253
    A[118] = -0.00602678571428571*G0_0_0_1 - 0.0120535714285714*G0_0_0_2 - 0.00602678571428571*G0_1_1_1 - 0.0120535714285714*G0_1_1_2 - 0.00602678571428571*G0_2_2_1 - 0.0120535714285714*G0_2_2_2;
 
5254
    A[119] = 0.00602678571428571*G0_0_0_1 + 0.0120535714285714*G0_0_0_2 + 0.00602678571428571*G0_1_1_1 + 0.0120535714285714*G0_1_1_2 + 0.00602678571428571*G0_2_2_1 + 0.0120535714285714*G0_2_2_2;
 
5255
    A[120] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5256
    A[121] = 0.00401785714285714*G0_0_0_0 + 0.00401785714285714*G0_1_1_0 + 0.00401785714285714*G0_2_2_0;
 
5257
    A[122] = 0.00200892857142856*G0_0_0_1 + 0.00200892857142856*G0_1_1_1 + 0.00200892857142856*G0_2_2_1;
 
5258
    A[123] = -0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_2;
 
5259
    A[124] = -0.00401785714285713*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00401785714285713*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00401785714285713*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5260
    A[125] = -0.0100446428571428*G0_0_0_1 - 0.00803571428571427*G0_0_0_2 - 0.0100446428571428*G0_1_1_1 - 0.00803571428571427*G0_1_1_2 - 0.0100446428571428*G0_2_2_1 - 0.00803571428571427*G0_2_2_2;
 
5261
    A[126] = 0.0200892857142857*G0_0_0_0 + 0.0200892857142857*G0_0_0_2 + 0.0200892857142857*G0_1_1_0 + 0.0200892857142857*G0_1_1_2 + 0.0200892857142857*G0_2_2_0 + 0.0200892857142857*G0_2_2_2;
 
5262
    A[127] = -0.0100446428571428*G0_0_0_0 - 0.00401785714285713*G0_0_0_2 - 0.0100446428571428*G0_1_1_0 - 0.00401785714285713*G0_1_1_2 - 0.0100446428571428*G0_2_2_0 - 0.00401785714285713*G0_2_2_2;
 
5263
    A[128] = 0.0100446428571429*G0_0_0_0 + 0.0200892857142857*G0_0_0_1 + 0.0100446428571429*G0_1_1_0 + 0.0200892857142857*G0_1_1_1 + 0.0100446428571429*G0_2_2_0 + 0.0200892857142857*G0_2_2_1;
 
5264
    A[129] = -0.00200892857142857*G0_0_0_0 - 0.0100446428571428*G0_0_0_1 - 0.00200892857142857*G0_1_1_0 - 0.0100446428571428*G0_1_1_1 - 0.00200892857142857*G0_2_2_0 - 0.0100446428571428*G0_2_2_1;
 
5265
    A[130] = 0.00401785714285714*G0_0_0_0 + 0.00401785714285714*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00401785714285714*G0_1_1_0 + 0.00401785714285714*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00401785714285714*G0_2_2_0 + 0.00401785714285714*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5266
    A[131] = 0.0100446428571428*G0_0_0_0 + 0.0100446428571428*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.0100446428571428*G0_1_1_0 + 0.0100446428571428*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.0100446428571428*G0_2_2_0 + 0.0100446428571428*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5267
    A[132] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142856*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142856*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142856*G0_2_2_2;
 
5268
    A[133] = 0.00200892857142858*G0_0_0_0 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142858*G0_1_1_0 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142858*G0_2_2_0 + 0.00200892857142857*G0_2_2_2;
 
5269
    A[134] = 0.00803571428571429*G0_0_0_0 + 0.0100446428571429*G0_0_0_1 + 0.0100446428571429*G0_0_0_2 + 0.00803571428571429*G0_1_1_0 + 0.0100446428571429*G0_1_1_1 + 0.0100446428571429*G0_1_1_2 + 0.00803571428571429*G0_2_2_0 + 0.0100446428571429*G0_2_2_1 + 0.0100446428571429*G0_2_2_2;
 
5270
    A[135] = -0.0100446428571429*G0_0_0_0 - 0.0200892857142857*G0_0_0_1 - 0.0200892857142857*G0_0_0_2 - 0.0100446428571429*G0_1_1_0 - 0.0200892857142857*G0_1_1_1 - 0.0200892857142857*G0_1_1_2 - 0.0100446428571429*G0_2_2_0 - 0.0200892857142857*G0_2_2_1 - 0.0200892857142857*G0_2_2_2;
 
5271
    A[136] = -0.0120535714285714*G0_0_0_0 + 0.0120535714285714*G0_0_0_1 + 0.00602678571428572*G0_0_0_2 - 0.0120535714285714*G0_1_1_0 + 0.0120535714285714*G0_1_1_1 + 0.00602678571428572*G0_1_1_2 - 0.0120535714285714*G0_2_2_0 + 0.0120535714285714*G0_2_2_1 + 0.00602678571428572*G0_2_2_2;
 
5272
    A[137] = 0.0120535714285714*G0_0_0_0 + 0.00602678571428571*G0_0_0_2 + 0.0120535714285714*G0_1_1_0 + 0.00602678571428571*G0_1_1_2 + 0.0120535714285714*G0_2_2_0 + 0.00602678571428571*G0_2_2_2;
 
5273
    A[138] = -0.0241071428571428*G0_0_0_0 - 0.0120535714285714*G0_0_0_1 - 0.00602678571428573*G0_0_0_2 - 0.0241071428571428*G0_1_1_0 - 0.0120535714285714*G0_1_1_1 - 0.00602678571428573*G0_1_1_2 - 0.0241071428571428*G0_2_2_0 - 0.0120535714285714*G0_2_2_1 - 0.00602678571428573*G0_2_2_2;
 
5274
    A[139] = -0.0120535714285714*G0_0_0_0 - 0.00602678571428573*G0_0_0_2 - 0.0120535714285714*G0_1_1_0 - 0.00602678571428573*G0_1_1_2 - 0.0120535714285714*G0_2_2_0 - 0.00602678571428573*G0_2_2_2;
 
5275
    A[140] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5276
    A[141] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_2_2_0;
 
5277
    A[142] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_1;
 
5278
    A[143] = 0.00401785714285714*G0_0_0_2 + 0.00401785714285714*G0_1_1_2 + 0.00401785714285714*G0_2_2_2;
 
5279
    A[144] = -0.0100446428571429*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.0100446428571429*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.0100446428571429*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5280
    A[145] = 0.0200892857142857*G0_0_0_1 + 0.0100446428571428*G0_0_0_2 + 0.0200892857142857*G0_1_1_1 + 0.0100446428571428*G0_1_1_2 + 0.0200892857142857*G0_2_2_1 + 0.0100446428571428*G0_2_2_2;
 
5281
    A[146] = -0.00401785714285714*G0_0_0_0 - 0.0100446428571428*G0_0_0_2 - 0.00401785714285714*G0_1_1_0 - 0.0100446428571428*G0_1_1_2 - 0.00401785714285714*G0_2_2_0 - 0.0100446428571428*G0_2_2_2;
 
5282
    A[147] = 0.0200892857142857*G0_0_0_0 + 0.0200892857142857*G0_0_0_2 + 0.0200892857142857*G0_1_1_0 + 0.0200892857142857*G0_1_1_2 + 0.0200892857142857*G0_2_2_0 + 0.0200892857142857*G0_2_2_2;
 
5283
    A[148] = -0.00803571428571428*G0_0_0_0 - 0.0100446428571428*G0_0_0_1 - 0.00803571428571428*G0_1_1_0 - 0.0100446428571428*G0_1_1_1 - 0.00803571428571428*G0_2_2_0 - 0.0100446428571428*G0_2_2_1;
 
5284
    A[149] = -0.00200892857142856*G0_0_0_0 - 0.00401785714285714*G0_0_0_1 - 0.00200892857142856*G0_1_1_0 - 0.00401785714285714*G0_1_1_1 - 0.00200892857142856*G0_2_2_0 - 0.00401785714285714*G0_2_2_1;
 
5285
    A[150] = 0.0100446428571428*G0_0_0_0 + 0.0100446428571428*G0_0_0_1 + 0.00803571428571428*G0_0_0_2 + 0.0100446428571428*G0_1_1_0 + 0.0100446428571428*G0_1_1_1 + 0.00803571428571428*G0_1_1_2 + 0.0100446428571428*G0_2_2_0 + 0.0100446428571428*G0_2_2_1 + 0.00803571428571428*G0_2_2_2;
 
5286
    A[151] = -0.0200892857142857*G0_0_0_0 - 0.0200892857142857*G0_0_0_1 - 0.0100446428571428*G0_0_0_2 - 0.0200892857142857*G0_1_1_0 - 0.0200892857142857*G0_1_1_1 - 0.0100446428571428*G0_1_1_2 - 0.0200892857142857*G0_2_2_0 - 0.0200892857142857*G0_2_2_1 - 0.0100446428571428*G0_2_2_2;
 
5287
    A[152] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_2;
 
5288
    A[153] = 0.00200892857142856*G0_0_0_0 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142856*G0_1_1_0 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142856*G0_2_2_0 + 0.00200892857142857*G0_2_2_2;
 
5289
    A[154] = 0.00200892857142857*G0_0_0_0 + 0.00401785714285713*G0_0_0_1 + 0.00401785714285714*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00401785714285713*G0_1_1_1 + 0.00401785714285714*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00401785714285713*G0_2_2_1 + 0.00401785714285714*G0_2_2_2;
 
5290
    A[155] = 0.00200892857142857*G0_0_0_0 + 0.0100446428571428*G0_0_0_1 + 0.0100446428571428*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.0100446428571428*G0_1_1_1 + 0.0100446428571428*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.0100446428571428*G0_2_2_1 + 0.0100446428571428*G0_2_2_2;
 
5291
    A[156] = 0.00602678571428571*G0_0_0_0 + 0.0120535714285714*G0_0_0_1 - 0.0120535714285714*G0_0_0_2 + 0.00602678571428571*G0_1_1_0 + 0.0120535714285714*G0_1_1_1 - 0.0120535714285714*G0_1_1_2 + 0.00602678571428571*G0_2_2_0 + 0.0120535714285714*G0_2_2_1 - 0.0120535714285714*G0_2_2_2;
 
5292
    A[157] = -0.00602678571428571*G0_0_0_0 - 0.0120535714285714*G0_0_0_2 - 0.00602678571428571*G0_1_1_0 - 0.0120535714285714*G0_1_1_2 - 0.00602678571428571*G0_2_2_0 - 0.0120535714285714*G0_2_2_2;
 
5293
    A[158] = -0.00602678571428571*G0_0_0_0 - 0.0120535714285714*G0_0_0_1 - 0.0241071428571428*G0_0_0_2 - 0.00602678571428571*G0_1_1_0 - 0.0120535714285714*G0_1_1_1 - 0.0241071428571428*G0_1_1_2 - 0.00602678571428571*G0_2_2_0 - 0.0120535714285714*G0_2_2_1 - 0.0241071428571428*G0_2_2_2;
 
5294
    A[159] = 0.00602678571428571*G0_0_0_0 + 0.0120535714285714*G0_0_0_2 + 0.00602678571428571*G0_1_1_0 + 0.0120535714285714*G0_1_1_2 + 0.00602678571428571*G0_2_2_0 + 0.0120535714285714*G0_2_2_2;
 
5295
    A[160] = -0.00200892857142858*G0_0_0_0 - 0.00200892857142858*G0_0_0_1 - 0.00200892857142858*G0_0_0_2 - 0.00200892857142858*G0_1_1_0 - 0.00200892857142858*G0_1_1_1 - 0.00200892857142858*G0_1_1_2 - 0.00200892857142858*G0_2_2_0 - 0.00200892857142858*G0_2_2_1 - 0.00200892857142858*G0_2_2_2;
 
5296
    A[161] = 0.00401785714285714*G0_0_0_0 + 0.00401785714285714*G0_1_1_0 + 0.00401785714285714*G0_2_2_0;
 
5297
    A[162] = -0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_2_2_1;
 
5298
    A[163] = 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_2;
 
5299
    A[164] = -0.00803571428571427*G0_0_0_1 - 0.0100446428571428*G0_0_0_2 - 0.00803571428571427*G0_1_1_1 - 0.0100446428571428*G0_1_1_2 - 0.00803571428571427*G0_2_2_1 - 0.0100446428571428*G0_2_2_2;
 
5300
    A[165] = -0.00200892857142858*G0_0_0_1 - 0.00401785714285715*G0_0_0_2 - 0.00200892857142858*G0_1_1_1 - 0.00401785714285715*G0_1_1_2 - 0.00200892857142858*G0_2_2_1 - 0.00401785714285715*G0_2_2_2;
 
5301
    A[166] = 0.0100446428571429*G0_0_0_0 + 0.0200892857142857*G0_0_0_2 + 0.0100446428571429*G0_1_1_0 + 0.0200892857142857*G0_1_1_2 + 0.0100446428571429*G0_2_2_0 + 0.0200892857142857*G0_2_2_2;
 
5302
    A[167] = -0.00200892857142857*G0_0_0_0 - 0.0100446428571428*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.0100446428571428*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.0100446428571428*G0_2_2_2;
 
5303
    A[168] = 0.0200892857142857*G0_0_0_0 + 0.0200892857142857*G0_0_0_1 + 0.0200892857142857*G0_1_1_0 + 0.0200892857142857*G0_1_1_1 + 0.0200892857142857*G0_2_2_0 + 0.0200892857142857*G0_2_2_1;
 
5304
    A[169] = -0.0100446428571429*G0_0_0_0 - 0.00401785714285713*G0_0_0_1 - 0.0100446428571429*G0_1_1_0 - 0.00401785714285713*G0_1_1_1 - 0.0100446428571429*G0_2_2_0 - 0.00401785714285713*G0_2_2_1;
 
5305
    A[170] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_1;
 
5306
    A[171] = 0.00200892857142858*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 + 0.00200892857142858*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142858*G0_2_2_0 + 0.00200892857142857*G0_2_2_1;
 
5307
    A[172] = 0.00401785714285714*G0_0_0_0 + 0.00200892857142858*G0_0_0_1 + 0.00401785714285714*G0_0_0_2 + 0.00401785714285714*G0_1_1_0 + 0.00200892857142858*G0_1_1_1 + 0.00401785714285714*G0_1_1_2 + 0.00401785714285714*G0_2_2_0 + 0.00200892857142858*G0_2_2_1 + 0.00401785714285714*G0_2_2_2;
 
5308
    A[173] = 0.0100446428571429*G0_0_0_0 + 0.00200892857142858*G0_0_0_1 + 0.0100446428571429*G0_0_0_2 + 0.0100446428571429*G0_1_1_0 + 0.00200892857142858*G0_1_1_1 + 0.0100446428571429*G0_1_1_2 + 0.0100446428571429*G0_2_2_0 + 0.00200892857142858*G0_2_2_1 + 0.0100446428571429*G0_2_2_2;
 
5309
    A[174] = 0.00803571428571431*G0_0_0_0 + 0.0100446428571429*G0_0_0_1 + 0.0100446428571429*G0_0_0_2 + 0.00803571428571431*G0_1_1_0 + 0.0100446428571429*G0_1_1_1 + 0.0100446428571429*G0_1_1_2 + 0.00803571428571431*G0_2_2_0 + 0.0100446428571429*G0_2_2_1 + 0.0100446428571429*G0_2_2_2;
 
5310
    A[175] = -0.0100446428571429*G0_0_0_0 - 0.0200892857142857*G0_0_0_1 - 0.0200892857142857*G0_0_0_2 - 0.0100446428571429*G0_1_1_0 - 0.0200892857142857*G0_1_1_1 - 0.0200892857142857*G0_1_1_2 - 0.0100446428571429*G0_2_2_0 - 0.0200892857142857*G0_2_2_1 - 0.0200892857142857*G0_2_2_2;
 
5311
    A[176] = -0.0120535714285714*G0_0_0_0 + 0.00602678571428572*G0_0_0_1 + 0.0120535714285714*G0_0_0_2 - 0.0120535714285714*G0_1_1_0 + 0.00602678571428572*G0_1_1_1 + 0.0120535714285714*G0_1_1_2 - 0.0120535714285714*G0_2_2_0 + 0.00602678571428572*G0_2_2_1 + 0.0120535714285714*G0_2_2_2;
 
5312
    A[177] = 0.0120535714285714*G0_0_0_0 + 0.00602678571428571*G0_0_0_1 + 0.0120535714285714*G0_1_1_0 + 0.00602678571428571*G0_1_1_1 + 0.0120535714285714*G0_2_2_0 + 0.00602678571428571*G0_2_2_1;
 
5313
    A[178] = -0.0120535714285714*G0_0_0_0 - 0.00602678571428573*G0_0_0_1 - 0.0120535714285714*G0_1_1_0 - 0.00602678571428573*G0_1_1_1 - 0.0120535714285714*G0_2_2_0 - 0.00602678571428573*G0_2_2_1;
 
5314
    A[179] = -0.0241071428571429*G0_0_0_0 - 0.00602678571428574*G0_0_0_1 - 0.0120535714285715*G0_0_0_2 - 0.0241071428571429*G0_1_1_0 - 0.00602678571428574*G0_1_1_1 - 0.0120535714285715*G0_1_1_2 - 0.0241071428571429*G0_2_2_0 - 0.00602678571428574*G0_2_2_1 - 0.0120535714285715*G0_2_2_2;
 
5315
    A[180] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5316
    A[181] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_2_2_0;
 
5317
    A[182] = 0.00401785714285714*G0_0_0_1 + 0.00401785714285714*G0_1_1_1 + 0.00401785714285714*G0_2_2_1;
 
5318
    A[183] = 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_2;
 
5319
    A[184] = 0.0100446428571429*G0_0_0_1 + 0.0200892857142857*G0_0_0_2 + 0.0100446428571429*G0_1_1_1 + 0.0200892857142857*G0_1_1_2 + 0.0100446428571429*G0_2_2_1 + 0.0200892857142857*G0_2_2_2;
 
5320
    A[185] = -0.00200892857142857*G0_0_0_1 - 0.0100446428571428*G0_0_0_2 - 0.00200892857142857*G0_1_1_1 - 0.0100446428571428*G0_1_1_2 - 0.00200892857142857*G0_2_2_1 - 0.0100446428571428*G0_2_2_2;
 
5321
    A[186] = -0.00803571428571429*G0_0_0_0 - 0.0100446428571429*G0_0_0_2 - 0.00803571428571429*G0_1_1_0 - 0.0100446428571429*G0_1_1_2 - 0.00803571428571429*G0_2_2_0 - 0.0100446428571429*G0_2_2_2;
 
5322
    A[187] = -0.00200892857142857*G0_0_0_0 - 0.00401785714285714*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00401785714285714*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00401785714285714*G0_2_2_2;
 
5323
    A[188] = -0.00401785714285715*G0_0_0_0 - 0.0100446428571429*G0_0_0_1 - 0.00401785714285715*G0_1_1_0 - 0.0100446428571429*G0_1_1_1 - 0.00401785714285715*G0_2_2_0 - 0.0100446428571429*G0_2_2_1;
 
5324
    A[189] = 0.0200892857142857*G0_0_0_0 + 0.0200892857142857*G0_0_0_1 + 0.0200892857142857*G0_1_1_0 + 0.0200892857142857*G0_1_1_1 + 0.0200892857142857*G0_2_2_0 + 0.0200892857142857*G0_2_2_1;
 
5325
    A[190] = 0.00200892857142858*G0_0_0_0 + 0.00200892857142858*G0_0_0_1 + 0.00200892857142858*G0_1_1_0 + 0.00200892857142858*G0_1_1_1 + 0.00200892857142858*G0_2_2_0 + 0.00200892857142858*G0_2_2_1;
 
5326
    A[191] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_1;
 
5327
    A[192] = 0.0100446428571429*G0_0_0_0 + 0.0080357142857143*G0_0_0_1 + 0.0100446428571429*G0_0_0_2 + 0.0100446428571429*G0_1_1_0 + 0.0080357142857143*G0_1_1_1 + 0.0100446428571429*G0_1_1_2 + 0.0100446428571429*G0_2_2_0 + 0.0080357142857143*G0_2_2_1 + 0.0100446428571429*G0_2_2_2;
 
5328
    A[193] = -0.0200892857142857*G0_0_0_0 - 0.0100446428571429*G0_0_0_1 - 0.0200892857142857*G0_0_0_2 - 0.0200892857142857*G0_1_1_0 - 0.0100446428571429*G0_1_1_1 - 0.0200892857142857*G0_1_1_2 - 0.0200892857142857*G0_2_2_0 - 0.0100446428571429*G0_2_2_1 - 0.0200892857142857*G0_2_2_2;
 
5329
    A[194] = 0.00200892857142857*G0_0_0_0 + 0.00401785714285715*G0_0_0_1 + 0.00401785714285715*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00401785714285715*G0_1_1_1 + 0.00401785714285715*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00401785714285715*G0_2_2_1 + 0.00401785714285715*G0_2_2_2;
 
5330
    A[195] = 0.00200892857142857*G0_0_0_0 + 0.0100446428571429*G0_0_0_1 + 0.0100446428571429*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.0100446428571429*G0_1_1_1 + 0.0100446428571429*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.0100446428571429*G0_2_2_1 + 0.0100446428571429*G0_2_2_2;
 
5331
    A[196] = 0.00602678571428572*G0_0_0_0 - 0.0120535714285714*G0_0_0_1 + 0.0120535714285714*G0_0_0_2 + 0.00602678571428572*G0_1_1_0 - 0.0120535714285714*G0_1_1_1 + 0.0120535714285714*G0_1_1_2 + 0.00602678571428572*G0_2_2_0 - 0.0120535714285714*G0_2_2_1 + 0.0120535714285714*G0_2_2_2;
 
5332
    A[197] = -0.00602678571428571*G0_0_0_0 - 0.0120535714285714*G0_0_0_1 - 0.00602678571428571*G0_1_1_0 - 0.0120535714285714*G0_1_1_1 - 0.00602678571428571*G0_2_2_0 - 0.0120535714285714*G0_2_2_1;
 
5333
    A[198] = 0.00602678571428571*G0_0_0_0 + 0.0120535714285714*G0_0_0_1 + 0.00602678571428571*G0_1_1_0 + 0.0120535714285714*G0_1_1_1 + 0.00602678571428571*G0_2_2_0 + 0.0120535714285714*G0_2_2_1;
 
5334
    A[199] = -0.00602678571428572*G0_0_0_0 - 0.0241071428571428*G0_0_0_1 - 0.0120535714285714*G0_0_0_2 - 0.00602678571428572*G0_1_1_0 - 0.0241071428571428*G0_1_1_1 - 0.0120535714285714*G0_1_1_2 - 0.00602678571428572*G0_2_2_0 - 0.0241071428571428*G0_2_2_1 - 0.0120535714285714*G0_2_2_2;
 
5335
    A[200] = -0.00401785714285713*G0_0_0_0 - 0.00401785714285713*G0_0_0_1 - 0.00401785714285713*G0_0_0_2 - 0.00401785714285713*G0_1_1_0 - 0.00401785714285713*G0_1_1_1 - 0.00401785714285713*G0_1_1_2 - 0.00401785714285713*G0_2_2_0 - 0.00401785714285713*G0_2_2_1 - 0.00401785714285713*G0_2_2_2;
 
5336
    A[201] = 0.00200892857142856*G0_0_0_0 + 0.00200892857142856*G0_1_1_0 + 0.00200892857142856*G0_2_2_0;
 
5337
    A[202] = 0.00200892857142856*G0_0_0_1 + 0.00200892857142856*G0_1_1_1 + 0.00200892857142856*G0_2_2_1;
 
5338
    A[203] = -0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_2;
 
5339
    A[204] = -0.00401785714285713*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00401785714285713*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00401785714285713*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5340
    A[205] = -0.0100446428571428*G0_0_0_1 - 0.00803571428571428*G0_0_0_2 - 0.0100446428571428*G0_1_1_1 - 0.00803571428571428*G0_1_1_2 - 0.0100446428571428*G0_2_2_1 - 0.00803571428571428*G0_2_2_2;
 
5341
    A[206] = -0.00401785714285713*G0_0_0_0 - 0.00200892857142857*G0_0_0_2 - 0.00401785714285713*G0_1_1_0 - 0.00200892857142857*G0_1_1_2 - 0.00401785714285713*G0_2_2_0 - 0.00200892857142857*G0_2_2_2;
 
5342
    A[207] = -0.0100446428571428*G0_0_0_0 - 0.00803571428571428*G0_0_0_2 - 0.0100446428571428*G0_1_1_0 - 0.00803571428571428*G0_1_1_2 - 0.0100446428571428*G0_2_2_0 - 0.00803571428571428*G0_2_2_2;
 
5343
    A[208] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1;
 
5344
    A[209] = -0.00200892857142858*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142858*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142858*G0_2_2_0 - 0.00200892857142857*G0_2_2_1;
 
5345
    A[210] = -0.0200892857142857*G0_0_0_0 - 0.0200892857142857*G0_0_0_1 - 0.0200892857142857*G0_1_1_0 - 0.0200892857142857*G0_1_1_1 - 0.0200892857142857*G0_2_2_0 - 0.0200892857142857*G0_2_2_1;
 
5346
    A[211] = 0.0100446428571428*G0_0_0_0 + 0.0100446428571428*G0_0_0_1 + 0.0060267857142857*G0_0_0_2 + 0.0100446428571428*G0_1_1_0 + 0.0100446428571428*G0_1_1_1 + 0.0060267857142857*G0_1_1_2 + 0.0100446428571428*G0_2_2_0 + 0.0100446428571428*G0_2_2_1 + 0.0060267857142857*G0_2_2_2;
 
5347
    A[212] = -0.0100446428571428*G0_0_0_0 + 0.0100446428571428*G0_0_0_1 - 0.0100446428571428*G0_0_0_2 - 0.0100446428571428*G0_1_1_0 + 0.0100446428571428*G0_1_1_1 - 0.0100446428571428*G0_1_1_2 - 0.0100446428571428*G0_2_2_0 + 0.0100446428571428*G0_2_2_1 - 0.0100446428571428*G0_2_2_2;
 
5348
    A[213] = 0.00200892857142858*G0_0_0_0 - 0.00803571428571426*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142858*G0_1_1_0 - 0.00803571428571426*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142858*G0_2_2_0 - 0.00803571428571426*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5349
    A[214] = 0.0100446428571428*G0_0_0_0 - 0.0100446428571428*G0_0_0_1 - 0.0100446428571428*G0_0_0_2 + 0.0100446428571428*G0_1_1_0 - 0.0100446428571428*G0_1_1_1 - 0.0100446428571428*G0_1_1_2 + 0.0100446428571428*G0_2_2_0 - 0.0100446428571428*G0_2_2_1 - 0.0100446428571428*G0_2_2_2;
 
5350
    A[215] = -0.00803571428571427*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 + 0.00200892857142858*G0_0_0_2 - 0.00803571428571427*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142858*G0_1_1_2 - 0.00803571428571427*G0_2_2_0 + 0.00200892857142857*G0_2_2_1 + 0.00200892857142858*G0_2_2_2;
 
5351
    A[216] = -0.0120535714285714*G0_0_0_0 - 0.0120535714285714*G0_0_0_1 - 0.00602678571428573*G0_0_0_2 - 0.0120535714285714*G0_1_1_0 - 0.0120535714285714*G0_1_1_1 - 0.00602678571428573*G0_1_1_2 - 0.0120535714285714*G0_2_2_0 - 0.0120535714285714*G0_2_2_1 - 0.00602678571428573*G0_2_2_2;
 
5352
    A[217] = 0.0120535714285714*G0_0_0_0 + 0.0241071428571428*G0_0_0_1 + 0.0180803571428571*G0_0_0_2 + 0.0120535714285714*G0_1_1_0 + 0.0241071428571428*G0_1_1_1 + 0.0180803571428571*G0_1_1_2 + 0.0120535714285714*G0_2_2_0 + 0.0241071428571428*G0_2_2_1 + 0.0180803571428571*G0_2_2_2;
 
5353
    A[218] = 0.0241071428571428*G0_0_0_0 + 0.0120535714285714*G0_0_0_1 + 0.0180803571428571*G0_0_0_2 + 0.0241071428571428*G0_1_1_0 + 0.0120535714285714*G0_1_1_1 + 0.0180803571428571*G0_1_1_2 + 0.0241071428571428*G0_2_2_0 + 0.0120535714285714*G0_2_2_1 + 0.0180803571428571*G0_2_2_2;
 
5354
    A[219] = 0.0120535714285714*G0_0_0_0 + 0.0120535714285714*G0_0_0_1 + 0.00602678571428573*G0_0_0_2 + 0.0120535714285714*G0_1_1_0 + 0.0120535714285714*G0_1_1_1 + 0.00602678571428573*G0_1_1_2 + 0.0120535714285714*G0_2_2_0 + 0.0120535714285714*G0_2_2_1 + 0.00602678571428573*G0_2_2_2;
 
5355
    A[220] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5356
    A[221] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_2_2_0;
 
5357
    A[222] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_1;
 
5358
    A[223] = 0.00401785714285714*G0_0_0_2 + 0.00401785714285714*G0_1_1_2 + 0.00401785714285714*G0_2_2_2;
 
5359
    A[224] = -0.0100446428571429*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.0100446428571429*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.0100446428571429*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5360
    A[225] = 0.0200892857142857*G0_0_0_1 + 0.0100446428571428*G0_0_0_2 + 0.0200892857142857*G0_1_1_1 + 0.0100446428571428*G0_1_1_2 + 0.0200892857142857*G0_2_2_1 + 0.0100446428571428*G0_2_2_2;
 
5361
    A[226] = -0.0100446428571428*G0_0_0_0 - 0.00200892857142856*G0_0_0_2 - 0.0100446428571428*G0_1_1_0 - 0.00200892857142856*G0_1_1_2 - 0.0100446428571428*G0_2_2_0 - 0.00200892857142856*G0_2_2_2;
 
5362
    A[227] = 0.0200892857142857*G0_0_0_0 + 0.0100446428571428*G0_0_0_2 + 0.0200892857142857*G0_1_1_0 + 0.0100446428571428*G0_1_1_2 + 0.0200892857142857*G0_2_2_0 + 0.0100446428571428*G0_2_2_2;
 
5363
    A[228] = -0.00200892857142856*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142856*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142856*G0_2_2_0 - 0.00200892857142857*G0_2_2_1;
 
5364
    A[229] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1;
 
5365
    A[230] = 0.00401785714285714*G0_0_0_0 + 0.00401785714285714*G0_0_0_1 - 0.00602678571428569*G0_0_0_2 + 0.00401785714285714*G0_1_1_0 + 0.00401785714285714*G0_1_1_1 - 0.00602678571428569*G0_1_1_2 + 0.00401785714285714*G0_2_2_0 + 0.00401785714285714*G0_2_2_1 - 0.00602678571428569*G0_2_2_2;
 
5366
    A[231] = -0.0200892857142857*G0_0_0_0 - 0.0200892857142857*G0_0_0_1 - 0.0200892857142857*G0_1_1_0 - 0.0200892857142857*G0_1_1_1 - 0.0200892857142857*G0_2_2_0 - 0.0200892857142857*G0_2_2_1;
 
5367
    A[232] = 0.00803571428571428*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 + 0.00803571428571428*G0_0_0_2 + 0.00803571428571428*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 + 0.00803571428571428*G0_1_1_2 + 0.00803571428571428*G0_2_2_0 - 0.00200892857142857*G0_2_2_1 + 0.00803571428571428*G0_2_2_2;
 
5368
    A[233] = 0.00200892857142856*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142856*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142856*G0_2_2_0 - 0.00200892857142857*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5369
    A[234] = -0.00200892857142857*G0_0_0_0 + 0.00803571428571428*G0_0_0_1 + 0.00803571428571428*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 + 0.00803571428571428*G0_1_1_1 + 0.00803571428571428*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 + 0.00803571428571428*G0_2_2_1 + 0.00803571428571428*G0_2_2_2;
 
5370
    A[235] = -0.00200892857142857*G0_0_0_0 + 0.00200892857142856*G0_0_0_1 + 0.00200892857142856*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 + 0.00200892857142856*G0_1_1_1 + 0.00200892857142856*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 + 0.00200892857142856*G0_2_2_1 + 0.00200892857142856*G0_2_2_2;
 
5371
    A[236] = 0.00602678571428571*G0_0_0_0 + 0.00602678571428573*G0_0_0_1 - 0.0060267857142857*G0_0_0_2 + 0.00602678571428571*G0_1_1_0 + 0.00602678571428573*G0_1_1_1 - 0.0060267857142857*G0_1_1_2 + 0.00602678571428571*G0_2_2_0 + 0.00602678571428573*G0_2_2_1 - 0.0060267857142857*G0_2_2_2;
 
5372
    A[237] = -0.00602678571428571*G0_0_0_0 + 0.00602678571428571*G0_0_0_1 - 0.0180803571428571*G0_0_0_2 - 0.00602678571428571*G0_1_1_0 + 0.00602678571428571*G0_1_1_1 - 0.0180803571428571*G0_1_1_2 - 0.00602678571428571*G0_2_2_0 + 0.00602678571428571*G0_2_2_1 - 0.0180803571428571*G0_2_2_2;
 
5373
    A[238] = 0.0060267857142857*G0_0_0_0 - 0.00602678571428572*G0_0_0_1 - 0.0180803571428571*G0_0_0_2 + 0.0060267857142857*G0_1_1_0 - 0.00602678571428572*G0_1_1_1 - 0.0180803571428571*G0_1_1_2 + 0.0060267857142857*G0_2_2_0 - 0.00602678571428572*G0_2_2_1 - 0.0180803571428571*G0_2_2_2;
 
5374
    A[239] = -0.00602678571428572*G0_0_0_0 - 0.00602678571428571*G0_0_0_1 + 0.0060267857142857*G0_0_0_2 - 0.00602678571428572*G0_1_1_0 - 0.00602678571428571*G0_1_1_1 + 0.0060267857142857*G0_1_1_2 - 0.00602678571428572*G0_2_2_0 - 0.00602678571428571*G0_2_2_1 + 0.0060267857142857*G0_2_2_2;
 
5375
    A[240] = -0.00401785714285713*G0_0_0_0 - 0.00401785714285714*G0_0_0_1 - 0.00401785714285713*G0_0_0_2 - 0.00401785714285713*G0_1_1_0 - 0.00401785714285714*G0_1_1_1 - 0.00401785714285713*G0_1_1_2 - 0.00401785714285713*G0_2_2_0 - 0.00401785714285714*G0_2_2_1 - 0.00401785714285713*G0_2_2_2;
 
5376
    A[241] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_2_2_0;
 
5377
    A[242] = -0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_2_2_1;
 
5378
    A[243] = 0.00200892857142856*G0_0_0_2 + 0.00200892857142856*G0_1_1_2 + 0.00200892857142856*G0_2_2_2;
 
5379
    A[244] = -0.00803571428571428*G0_0_0_1 - 0.0100446428571428*G0_0_0_2 - 0.00803571428571428*G0_1_1_1 - 0.0100446428571428*G0_1_1_2 - 0.00803571428571428*G0_2_2_1 - 0.0100446428571428*G0_2_2_2;
 
5380
    A[245] = -0.00200892857142857*G0_0_0_1 - 0.00401785714285713*G0_0_0_2 - 0.00200892857142857*G0_1_1_1 - 0.00401785714285713*G0_1_1_2 - 0.00200892857142857*G0_2_2_1 - 0.00401785714285713*G0_2_2_2;
 
5381
    A[246] = -0.00200892857142856*G0_0_0_0 - 0.00200892857142856*G0_0_0_2 - 0.00200892857142856*G0_1_1_0 - 0.00200892857142856*G0_1_1_2 - 0.00200892857142856*G0_2_2_0 - 0.00200892857142856*G0_2_2_2;
 
5382
    A[247] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_2;
 
5383
    A[248] = -0.00401785714285714*G0_0_0_0 - 0.00200892857142856*G0_0_0_1 - 0.00401785714285714*G0_1_1_0 - 0.00200892857142856*G0_1_1_1 - 0.00401785714285714*G0_2_2_0 - 0.00200892857142856*G0_2_2_1;
 
5384
    A[249] = -0.0100446428571429*G0_0_0_0 - 0.00803571428571429*G0_0_0_1 - 0.0100446428571429*G0_1_1_0 - 0.00803571428571429*G0_1_1_1 - 0.0100446428571429*G0_2_2_0 - 0.00803571428571429*G0_2_2_1;
 
5385
    A[250] = -0.0100446428571429*G0_0_0_0 - 0.0100446428571429*G0_0_0_1 + 0.0100446428571428*G0_0_0_2 - 0.0100446428571429*G0_1_1_0 - 0.0100446428571429*G0_1_1_1 + 0.0100446428571428*G0_1_1_2 - 0.0100446428571429*G0_2_2_0 - 0.0100446428571429*G0_2_2_1 + 0.0100446428571428*G0_2_2_2;
 
5386
    A[251] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 - 0.00803571428571427*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 - 0.00803571428571427*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_1 - 0.00803571428571427*G0_2_2_2;
 
5387
    A[252] = -0.0200892857142857*G0_0_0_0 - 0.0200892857142857*G0_0_0_2 - 0.0200892857142857*G0_1_1_0 - 0.0200892857142857*G0_1_1_2 - 0.0200892857142857*G0_2_2_0 - 0.0200892857142857*G0_2_2_2;
 
5388
    A[253] = 0.0100446428571429*G0_0_0_0 + 0.0060267857142857*G0_0_0_1 + 0.0100446428571429*G0_0_0_2 + 0.0100446428571429*G0_1_1_0 + 0.0060267857142857*G0_1_1_1 + 0.0100446428571429*G0_1_1_2 + 0.0100446428571429*G0_2_2_0 + 0.0060267857142857*G0_2_2_1 + 0.0100446428571429*G0_2_2_2;
 
5389
    A[254] = 0.0100446428571428*G0_0_0_0 - 0.0100446428571428*G0_0_0_1 - 0.0100446428571428*G0_0_0_2 + 0.0100446428571428*G0_1_1_0 - 0.0100446428571428*G0_1_1_1 - 0.0100446428571428*G0_1_1_2 + 0.0100446428571428*G0_2_2_0 - 0.0100446428571428*G0_2_2_1 - 0.0100446428571428*G0_2_2_2;
 
5390
    A[255] = -0.00803571428571428*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 - 0.00803571428571428*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 - 0.00803571428571428*G0_2_2_0 + 0.00200892857142857*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5391
    A[256] = -0.0120535714285714*G0_0_0_0 - 0.00602678571428571*G0_0_0_1 - 0.0120535714285714*G0_0_0_2 - 0.0120535714285714*G0_1_1_0 - 0.00602678571428571*G0_1_1_1 - 0.0120535714285714*G0_1_1_2 - 0.0120535714285714*G0_2_2_0 - 0.00602678571428571*G0_2_2_1 - 0.0120535714285714*G0_2_2_2;
 
5392
    A[257] = 0.0120535714285714*G0_0_0_0 + 0.0180803571428571*G0_0_0_1 + 0.0241071428571428*G0_0_0_2 + 0.0120535714285714*G0_1_1_0 + 0.0180803571428571*G0_1_1_1 + 0.0241071428571428*G0_1_1_2 + 0.0120535714285714*G0_2_2_0 + 0.0180803571428571*G0_2_2_1 + 0.0241071428571428*G0_2_2_2;
 
5393
    A[258] = 0.0120535714285714*G0_0_0_0 + 0.00602678571428571*G0_0_0_1 + 0.0120535714285714*G0_0_0_2 + 0.0120535714285714*G0_1_1_0 + 0.00602678571428571*G0_1_1_1 + 0.0120535714285714*G0_1_1_2 + 0.0120535714285714*G0_2_2_0 + 0.00602678571428571*G0_2_2_1 + 0.0120535714285714*G0_2_2_2;
 
5394
    A[259] = 0.0241071428571428*G0_0_0_0 + 0.0180803571428571*G0_0_0_1 + 0.0120535714285714*G0_0_0_2 + 0.0241071428571428*G0_1_1_0 + 0.0180803571428571*G0_1_1_1 + 0.0120535714285714*G0_1_1_2 + 0.0241071428571428*G0_2_2_0 + 0.0180803571428571*G0_2_2_1 + 0.0120535714285714*G0_2_2_2;
 
5395
    A[260] = 0.00200892857142856*G0_0_0_0 + 0.00200892857142856*G0_0_0_1 + 0.00200892857142856*G0_0_0_2 + 0.00200892857142856*G0_1_1_0 + 0.00200892857142856*G0_1_1_1 + 0.00200892857142856*G0_1_1_2 + 0.00200892857142856*G0_2_2_0 + 0.00200892857142856*G0_2_2_1 + 0.00200892857142856*G0_2_2_2;
 
5396
    A[261] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_2_2_0;
 
5397
    A[262] = 0.00401785714285714*G0_0_0_1 + 0.00401785714285714*G0_1_1_1 + 0.00401785714285714*G0_2_2_1;
 
5398
    A[263] = 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_2;
 
5399
    A[264] = 0.0100446428571429*G0_0_0_1 + 0.0200892857142857*G0_0_0_2 + 0.0100446428571429*G0_1_1_1 + 0.0200892857142857*G0_1_1_2 + 0.0100446428571429*G0_2_2_1 + 0.0200892857142857*G0_2_2_2;
 
5400
    A[265] = -0.00200892857142857*G0_0_0_1 - 0.0100446428571428*G0_0_0_2 - 0.00200892857142857*G0_1_1_1 - 0.0100446428571428*G0_1_1_2 - 0.00200892857142857*G0_2_2_1 - 0.0100446428571428*G0_2_2_2;
 
5401
    A[266] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_2;
 
5402
    A[267] = -0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_2;
 
5403
    A[268] = -0.0100446428571429*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 - 0.0100446428571429*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 - 0.0100446428571429*G0_2_2_0 - 0.00200892857142857*G0_2_2_1;
 
5404
    A[269] = 0.0200892857142857*G0_0_0_0 + 0.0100446428571428*G0_0_0_1 + 0.0200892857142857*G0_1_1_0 + 0.0100446428571428*G0_1_1_1 + 0.0200892857142857*G0_2_2_0 + 0.0100446428571428*G0_2_2_1;
 
5405
    A[270] = 0.00803571428571429*G0_0_0_0 + 0.00803571428571429*G0_0_0_1 - 0.00200892857142856*G0_0_0_2 + 0.00803571428571429*G0_1_1_0 + 0.00803571428571429*G0_1_1_1 - 0.00200892857142856*G0_1_1_2 + 0.00803571428571429*G0_2_2_0 + 0.00803571428571429*G0_2_2_1 - 0.00200892857142856*G0_2_2_2;
 
5406
    A[271] = 0.00200892857142856*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 - 0.00200892857142858*G0_0_0_2 + 0.00200892857142856*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 - 0.00200892857142858*G0_1_1_2 + 0.00200892857142856*G0_2_2_0 + 0.00200892857142857*G0_2_2_1 - 0.00200892857142858*G0_2_2_2;
 
5407
    A[272] = 0.00401785714285716*G0_0_0_0 - 0.00602678571428569*G0_0_0_1 + 0.00401785714285716*G0_0_0_2 + 0.00401785714285716*G0_1_1_0 - 0.00602678571428569*G0_1_1_1 + 0.00401785714285716*G0_1_1_2 + 0.00401785714285716*G0_2_2_0 - 0.00602678571428569*G0_2_2_1 + 0.00401785714285716*G0_2_2_2;
 
5408
    A[273] = -0.0200892857142857*G0_0_0_0 - 0.0200892857142857*G0_0_0_2 - 0.0200892857142857*G0_1_1_0 - 0.0200892857142857*G0_1_1_2 - 0.0200892857142857*G0_2_2_0 - 0.0200892857142857*G0_2_2_2;
 
5409
    A[274] = -0.00200892857142856*G0_0_0_0 + 0.00803571428571429*G0_0_0_1 + 0.00803571428571429*G0_0_0_2 - 0.00200892857142856*G0_1_1_0 + 0.00803571428571429*G0_1_1_1 + 0.00803571428571429*G0_1_1_2 - 0.00200892857142856*G0_2_2_0 + 0.00803571428571429*G0_2_2_1 + 0.00803571428571429*G0_2_2_2;
 
5410
    A[275] = -0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5411
    A[276] = 0.00602678571428571*G0_0_0_0 - 0.00602678571428572*G0_0_0_1 + 0.00602678571428569*G0_0_0_2 + 0.00602678571428571*G0_1_1_0 - 0.00602678571428572*G0_1_1_1 + 0.00602678571428569*G0_1_1_2 + 0.00602678571428571*G0_2_2_0 - 0.00602678571428572*G0_2_2_1 + 0.00602678571428569*G0_2_2_2;
 
5412
    A[277] = -0.0060267857142857*G0_0_0_0 - 0.0180803571428571*G0_0_0_1 + 0.00602678571428569*G0_0_0_2 - 0.0060267857142857*G0_1_1_0 - 0.0180803571428571*G0_1_1_1 + 0.00602678571428569*G0_1_1_2 - 0.0060267857142857*G0_2_2_0 - 0.0180803571428571*G0_2_2_1 + 0.00602678571428569*G0_2_2_2;
 
5413
    A[278] = -0.00602678571428572*G0_0_0_0 + 0.00602678571428571*G0_0_0_1 - 0.00602678571428572*G0_0_0_2 - 0.00602678571428572*G0_1_1_0 + 0.00602678571428571*G0_1_1_1 - 0.00602678571428572*G0_1_1_2 - 0.00602678571428572*G0_2_2_0 + 0.00602678571428571*G0_2_2_1 - 0.00602678571428572*G0_2_2_2;
 
5414
    A[279] = 0.0060267857142857*G0_0_0_0 - 0.0180803571428571*G0_0_0_1 - 0.00602678571428569*G0_0_0_2 + 0.0060267857142857*G0_1_1_0 - 0.0180803571428571*G0_1_1_1 - 0.00602678571428569*G0_1_1_2 + 0.0060267857142857*G0_2_2_0 - 0.0180803571428571*G0_2_2_1 - 0.00602678571428569*G0_2_2_2;
 
5415
    A[280] = -0.00401785714285713*G0_0_0_0 - 0.00401785714285713*G0_0_0_1 - 0.00401785714285713*G0_0_0_2 - 0.00401785714285713*G0_1_1_0 - 0.00401785714285713*G0_1_1_1 - 0.00401785714285713*G0_1_1_2 - 0.00401785714285713*G0_2_2_0 - 0.00401785714285713*G0_2_2_1 - 0.00401785714285713*G0_2_2_2;
 
5416
    A[281] = -0.00200892857142856*G0_0_0_0 - 0.00200892857142856*G0_1_1_0 - 0.00200892857142856*G0_2_2_0;
 
5417
    A[282] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_1;
 
5418
    A[283] = 0.00200892857142856*G0_0_0_2 + 0.00200892857142856*G0_1_1_2 + 0.00200892857142856*G0_2_2_2;
 
5419
    A[284] = -0.00200892857142858*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142858*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142858*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5420
    A[285] = -0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5421
    A[286] = -0.00803571428571428*G0_0_0_0 - 0.0100446428571428*G0_0_0_2 - 0.00803571428571428*G0_1_1_0 - 0.0100446428571428*G0_1_1_2 - 0.00803571428571428*G0_2_2_0 - 0.0100446428571428*G0_2_2_2;
 
5422
    A[287] = -0.00200892857142857*G0_0_0_0 - 0.00401785714285714*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.00401785714285714*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.00401785714285714*G0_2_2_2;
 
5423
    A[288] = -0.00803571428571429*G0_0_0_0 - 0.0100446428571428*G0_0_0_1 - 0.00803571428571429*G0_1_1_0 - 0.0100446428571428*G0_1_1_1 - 0.00803571428571429*G0_2_2_0 - 0.0100446428571428*G0_2_2_1;
 
5424
    A[289] = -0.00200892857142857*G0_0_0_0 - 0.00401785714285715*G0_0_0_1 - 0.00200892857142857*G0_1_1_0 - 0.00401785714285715*G0_1_1_1 - 0.00200892857142857*G0_2_2_0 - 0.00401785714285715*G0_2_2_1;
 
5425
    A[290] = -0.0100446428571428*G0_0_0_0 - 0.0100446428571429*G0_0_0_1 + 0.0100446428571428*G0_0_0_2 - 0.0100446428571428*G0_1_1_0 - 0.0100446428571429*G0_1_1_1 + 0.0100446428571428*G0_1_1_2 - 0.0100446428571428*G0_2_2_0 - 0.0100446428571429*G0_2_2_1 + 0.0100446428571428*G0_2_2_2;
 
5426
    A[291] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 - 0.00803571428571426*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 - 0.00803571428571426*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_1 - 0.00803571428571426*G0_2_2_2;
 
5427
    A[292] = -0.0100446428571429*G0_0_0_0 + 0.0100446428571428*G0_0_0_1 - 0.0100446428571429*G0_0_0_2 - 0.0100446428571429*G0_1_1_0 + 0.0100446428571428*G0_1_1_1 - 0.0100446428571429*G0_1_1_2 - 0.0100446428571429*G0_2_2_0 + 0.0100446428571428*G0_2_2_1 - 0.0100446428571429*G0_2_2_2;
 
5428
    A[293] = 0.00200892857142857*G0_0_0_0 - 0.00803571428571426*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 - 0.00803571428571426*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 - 0.00803571428571426*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5429
    A[294] = -0.0200892857142857*G0_0_0_1 - 0.0200892857142857*G0_0_0_2 - 0.0200892857142857*G0_1_1_1 - 0.0200892857142857*G0_1_1_2 - 0.0200892857142857*G0_2_2_1 - 0.0200892857142857*G0_2_2_2;
 
5430
    A[295] = 0.00602678571428569*G0_0_0_0 + 0.0100446428571428*G0_0_0_1 + 0.0100446428571428*G0_0_0_2 + 0.00602678571428569*G0_1_1_0 + 0.0100446428571428*G0_1_1_1 + 0.0100446428571428*G0_1_1_2 + 0.00602678571428569*G0_2_2_0 + 0.0100446428571428*G0_2_2_1 + 0.0100446428571428*G0_2_2_2;
 
5431
    A[296] = -0.00602678571428572*G0_0_0_0 - 0.0120535714285714*G0_0_0_1 - 0.0120535714285714*G0_0_0_2 - 0.00602678571428572*G0_1_1_0 - 0.0120535714285714*G0_1_1_1 - 0.0120535714285714*G0_1_1_2 - 0.00602678571428572*G0_2_2_0 - 0.0120535714285714*G0_2_2_1 - 0.0120535714285714*G0_2_2_2;
 
5432
    A[297] = 0.00602678571428572*G0_0_0_0 + 0.0120535714285714*G0_0_0_1 + 0.0120535714285714*G0_0_0_2 + 0.00602678571428572*G0_1_1_0 + 0.0120535714285714*G0_1_1_1 + 0.0120535714285714*G0_1_1_2 + 0.00602678571428572*G0_2_2_0 + 0.0120535714285714*G0_2_2_1 + 0.0120535714285714*G0_2_2_2;
 
5433
    A[298] = 0.0180803571428571*G0_0_0_0 + 0.0120535714285714*G0_0_0_1 + 0.0241071428571428*G0_0_0_2 + 0.0180803571428571*G0_1_1_0 + 0.0120535714285714*G0_1_1_1 + 0.0241071428571428*G0_1_1_2 + 0.0180803571428571*G0_2_2_0 + 0.0120535714285714*G0_2_2_1 + 0.0241071428571428*G0_2_2_2;
 
5434
    A[299] = 0.0180803571428571*G0_0_0_0 + 0.0241071428571428*G0_0_0_1 + 0.0120535714285714*G0_0_0_2 + 0.0180803571428571*G0_1_1_0 + 0.0241071428571428*G0_1_1_1 + 0.0120535714285714*G0_1_1_2 + 0.0180803571428571*G0_2_2_0 + 0.0241071428571428*G0_2_2_1 + 0.0120535714285714*G0_2_2_2;
 
5435
    A[300] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5436
    A[301] = 0.00401785714285713*G0_0_0_0 + 0.00401785714285713*G0_1_1_0 + 0.00401785714285713*G0_2_2_0;
 
5437
    A[302] = 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_2_2_1;
 
5438
    A[303] = 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_2;
 
5439
    A[304] = -0.00200892857142856*G0_0_0_1 - 0.00200892857142856*G0_0_0_2 - 0.00200892857142856*G0_1_1_1 - 0.00200892857142856*G0_1_1_2 - 0.00200892857142856*G0_2_2_1 - 0.00200892857142856*G0_2_2_2;
 
5440
    A[305] = -0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 - 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 - 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5441
    A[306] = 0.0100446428571428*G0_0_0_0 + 0.0200892857142857*G0_0_0_2 + 0.0100446428571428*G0_1_1_0 + 0.0200892857142857*G0_1_1_2 + 0.0100446428571428*G0_2_2_0 + 0.0200892857142857*G0_2_2_2;
 
5442
    A[307] = -0.00200892857142857*G0_0_0_0 - 0.0100446428571428*G0_0_0_2 - 0.00200892857142857*G0_1_1_0 - 0.0100446428571428*G0_1_1_2 - 0.00200892857142857*G0_2_2_0 - 0.0100446428571428*G0_2_2_2;
 
5443
    A[308] = 0.0100446428571429*G0_0_0_0 + 0.0200892857142857*G0_0_0_1 + 0.0100446428571429*G0_1_1_0 + 0.0200892857142857*G0_1_1_1 + 0.0100446428571429*G0_2_2_0 + 0.0200892857142857*G0_2_2_1;
 
5444
    A[309] = -0.00200892857142856*G0_0_0_0 - 0.0100446428571428*G0_0_0_1 - 0.00200892857142856*G0_1_1_0 - 0.0100446428571428*G0_1_1_1 - 0.00200892857142856*G0_2_2_0 - 0.0100446428571428*G0_2_2_1;
 
5445
    A[310] = 0.00803571428571428*G0_0_0_0 + 0.00803571428571428*G0_0_0_1 - 0.00200892857142856*G0_0_0_2 + 0.00803571428571428*G0_1_1_0 + 0.00803571428571428*G0_1_1_1 - 0.00200892857142856*G0_1_1_2 + 0.00803571428571428*G0_2_2_0 + 0.00803571428571428*G0_2_2_1 - 0.00200892857142856*G0_2_2_2;
 
5446
    A[311] = 0.00200892857142857*G0_0_0_0 + 0.00200892857142857*G0_0_0_1 - 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 + 0.00200892857142857*G0_1_1_1 - 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 + 0.00200892857142857*G0_2_2_1 - 0.00200892857142857*G0_2_2_2;
 
5447
    A[312] = 0.00803571428571428*G0_0_0_0 - 0.00200892857142856*G0_0_0_1 + 0.00803571428571428*G0_0_0_2 + 0.00803571428571428*G0_1_1_0 - 0.00200892857142856*G0_1_1_1 + 0.00803571428571428*G0_1_1_2 + 0.00803571428571428*G0_2_2_0 - 0.00200892857142856*G0_2_2_1 + 0.00803571428571428*G0_2_2_2;
 
5448
    A[313] = 0.00200892857142857*G0_0_0_0 - 0.00200892857142857*G0_0_0_1 + 0.00200892857142857*G0_0_0_2 + 0.00200892857142857*G0_1_1_0 - 0.00200892857142857*G0_1_1_1 + 0.00200892857142857*G0_1_1_2 + 0.00200892857142857*G0_2_2_0 - 0.00200892857142857*G0_2_2_1 + 0.00200892857142857*G0_2_2_2;
 
5449
    A[314] = -0.0060267857142857*G0_0_0_0 + 0.00401785714285714*G0_0_0_1 + 0.00401785714285714*G0_0_0_2 - 0.0060267857142857*G0_1_1_0 + 0.00401785714285714*G0_1_1_1 + 0.00401785714285714*G0_1_1_2 - 0.0060267857142857*G0_2_2_0 + 0.00401785714285714*G0_2_2_1 + 0.00401785714285714*G0_2_2_2;
 
5450
    A[315] = -0.0200892857142857*G0_0_0_1 - 0.0200892857142857*G0_0_0_2 - 0.0200892857142857*G0_1_1_1 - 0.0200892857142857*G0_1_1_2 - 0.0200892857142857*G0_2_2_1 - 0.0200892857142857*G0_2_2_2;
 
5451
    A[316] = -0.00602678571428569*G0_0_0_0 + 0.00602678571428572*G0_0_0_1 + 0.00602678571428573*G0_0_0_2 - 0.00602678571428569*G0_1_1_0 + 0.00602678571428572*G0_1_1_1 + 0.00602678571428573*G0_1_1_2 - 0.00602678571428569*G0_2_2_0 + 0.00602678571428572*G0_2_2_1 + 0.00602678571428573*G0_2_2_2;
 
5452
    A[317] = 0.00602678571428569*G0_0_0_0 - 0.00602678571428571*G0_0_0_1 - 0.00602678571428571*G0_0_0_2 + 0.00602678571428569*G0_1_1_0 - 0.00602678571428571*G0_1_1_1 - 0.00602678571428571*G0_1_1_2 + 0.00602678571428569*G0_2_2_0 - 0.00602678571428571*G0_2_2_1 - 0.00602678571428571*G0_2_2_2;
 
5453
    A[318] = -0.0180803571428571*G0_0_0_0 - 0.00602678571428572*G0_0_0_1 + 0.00602678571428569*G0_0_0_2 - 0.0180803571428571*G0_1_1_0 - 0.00602678571428572*G0_1_1_1 + 0.00602678571428569*G0_1_1_2 - 0.0180803571428571*G0_2_2_0 - 0.00602678571428572*G0_2_2_1 + 0.00602678571428569*G0_2_2_2;
 
5454
    A[319] = -0.0180803571428571*G0_0_0_0 + 0.00602678571428568*G0_0_0_1 - 0.00602678571428574*G0_0_0_2 - 0.0180803571428571*G0_1_1_0 + 0.00602678571428568*G0_1_1_1 - 0.00602678571428574*G0_1_1_2 - 0.0180803571428571*G0_2_2_0 + 0.00602678571428568*G0_2_2_1 - 0.00602678571428574*G0_2_2_2;
 
5455
    A[320] = -0.00736607142857144*G0_0_0_0 - 0.00736607142857144*G0_0_0_1 - 0.00736607142857144*G0_0_0_2 - 0.00736607142857144*G0_1_1_0 - 0.00736607142857144*G0_1_1_1 - 0.00736607142857144*G0_1_1_2 - 0.00736607142857144*G0_2_2_0 - 0.00736607142857144*G0_2_2_1 - 0.00736607142857144*G0_2_2_2;
 
5456
    A[321] = -0.00468749999999999*G0_0_0_0 - 0.00468749999999999*G0_1_1_0 - 0.00468749999999999*G0_2_2_0;
 
5457
    A[322] = -0.0046875*G0_0_0_1 - 0.0046875*G0_1_1_1 - 0.0046875*G0_2_2_1;
 
5458
    A[323] = -0.0046875*G0_0_0_2 - 0.0046875*G0_1_1_2 - 0.0046875*G0_2_2_2;
 
5459
    A[324] = 0.0241071428571428*G0_0_0_1 + 0.00602678571428572*G0_0_0_2 + 0.0241071428571428*G0_1_1_1 + 0.00602678571428572*G0_1_1_2 + 0.0241071428571428*G0_2_2_1 + 0.00602678571428572*G0_2_2_2;
 
5460
    A[325] = 0.0060267857142857*G0_0_0_1 + 0.0241071428571428*G0_0_0_2 + 0.0060267857142857*G0_1_1_1 + 0.0241071428571428*G0_1_1_2 + 0.0060267857142857*G0_2_2_1 + 0.0241071428571428*G0_2_2_2;
 
5461
    A[326] = 0.0241071428571428*G0_0_0_0 + 0.00602678571428571*G0_0_0_2 + 0.0241071428571428*G0_1_1_0 + 0.00602678571428571*G0_1_1_2 + 0.0241071428571428*G0_2_2_0 + 0.00602678571428571*G0_2_2_2;
 
5462
    A[327] = 0.00602678571428571*G0_0_0_0 + 0.0241071428571428*G0_0_0_2 + 0.00602678571428571*G0_1_1_0 + 0.0241071428571428*G0_1_1_2 + 0.00602678571428571*G0_2_2_0 + 0.0241071428571428*G0_2_2_2;
 
5463
    A[328] = 0.0241071428571429*G0_0_0_0 + 0.00602678571428572*G0_0_0_1 + 0.0241071428571429*G0_1_1_0 + 0.00602678571428572*G0_1_1_1 + 0.0241071428571429*G0_2_2_0 + 0.00602678571428572*G0_2_2_1;
 
5464
    A[329] = 0.00602678571428573*G0_0_0_0 + 0.0241071428571429*G0_0_0_1 + 0.00602678571428573*G0_1_1_0 + 0.0241071428571429*G0_1_1_1 + 0.00602678571428573*G0_2_2_0 + 0.0241071428571429*G0_2_2_1;
 
5465
    A[330] = 0.0120535714285714*G0_0_0_0 + 0.0120535714285714*G0_0_0_1 + 0.00602678571428573*G0_0_0_2 + 0.0120535714285714*G0_1_1_0 + 0.0120535714285714*G0_1_1_1 + 0.00602678571428573*G0_1_1_2 + 0.0120535714285714*G0_2_2_0 + 0.0120535714285714*G0_2_2_1 + 0.00602678571428573*G0_2_2_2;
 
5466
    A[331] = -0.0060267857142857*G0_0_0_0 - 0.0060267857142857*G0_0_0_1 + 0.00602678571428572*G0_0_0_2 - 0.0060267857142857*G0_1_1_0 - 0.0060267857142857*G0_1_1_1 + 0.00602678571428572*G0_1_1_2 - 0.0060267857142857*G0_2_2_0 - 0.0060267857142857*G0_2_2_1 + 0.00602678571428572*G0_2_2_2;
 
5467
    A[332] = 0.0120535714285715*G0_0_0_0 + 0.00602678571428575*G0_0_0_1 + 0.0120535714285715*G0_0_0_2 + 0.0120535714285715*G0_1_1_0 + 0.00602678571428575*G0_1_1_1 + 0.0120535714285715*G0_1_1_2 + 0.0120535714285715*G0_2_2_0 + 0.00602678571428575*G0_2_2_1 + 0.0120535714285715*G0_2_2_2;
 
5468
    A[333] = -0.00602678571428572*G0_0_0_0 + 0.00602678571428568*G0_0_0_1 - 0.00602678571428572*G0_0_0_2 - 0.00602678571428572*G0_1_1_0 + 0.00602678571428568*G0_1_1_1 - 0.00602678571428572*G0_1_1_2 - 0.00602678571428572*G0_2_2_0 + 0.00602678571428568*G0_2_2_1 - 0.00602678571428572*G0_2_2_2;
 
5469
    A[334] = 0.00602678571428574*G0_0_0_0 + 0.0120535714285714*G0_0_0_1 + 0.0120535714285714*G0_0_0_2 + 0.00602678571428574*G0_1_1_0 + 0.0120535714285714*G0_1_1_1 + 0.0120535714285714*G0_1_1_2 + 0.00602678571428574*G0_2_2_0 + 0.0120535714285714*G0_2_2_1 + 0.0120535714285714*G0_2_2_2;
 
5470
    A[335] = 0.0060267857142857*G0_0_0_0 - 0.00602678571428573*G0_0_0_1 - 0.00602678571428574*G0_0_0_2 + 0.0060267857142857*G0_1_1_0 - 0.00602678571428573*G0_1_1_1 - 0.00602678571428574*G0_1_1_2 + 0.0060267857142857*G0_2_2_0 - 0.00602678571428573*G0_2_2_1 - 0.00602678571428574*G0_2_2_2;
 
5471
    A[336] = 0.0723214285714285*G0_0_0_0 + 0.0723214285714285*G0_0_0_1 + 0.0723214285714286*G0_0_0_2 + 0.0723214285714285*G0_1_1_0 + 0.0723214285714285*G0_1_1_1 + 0.0723214285714286*G0_1_1_2 + 0.0723214285714285*G0_2_2_0 + 0.0723214285714285*G0_2_2_1 + 0.0723214285714286*G0_2_2_2;
 
5472
    A[337] = -0.0723214285714285*G0_0_0_0 - 0.0361607142857143*G0_0_0_1 - 0.0361607142857143*G0_0_0_2 - 0.0723214285714285*G0_1_1_0 - 0.0361607142857143*G0_1_1_1 - 0.0361607142857143*G0_1_1_2 - 0.0723214285714285*G0_2_2_0 - 0.0361607142857143*G0_2_2_1 - 0.0361607142857143*G0_2_2_2;
 
5473
    A[338] = -0.0361607142857143*G0_0_0_0 - 0.0723214285714285*G0_0_0_1 - 0.0361607142857143*G0_0_0_2 - 0.0361607142857143*G0_1_1_0 - 0.0723214285714285*G0_1_1_1 - 0.0361607142857143*G0_1_1_2 - 0.0361607142857143*G0_2_2_0 - 0.0723214285714285*G0_2_2_1 - 0.0361607142857143*G0_2_2_2;
 
5474
    A[339] = -0.0361607142857143*G0_0_0_0 - 0.0361607142857143*G0_0_0_1 - 0.0723214285714286*G0_0_0_2 - 0.0361607142857143*G0_1_1_0 - 0.0361607142857143*G0_1_1_1 - 0.0723214285714286*G0_1_1_2 - 0.0361607142857143*G0_2_2_0 - 0.0361607142857143*G0_2_2_1 - 0.0723214285714286*G0_2_2_2;
 
5475
    A[340] = 0.00468749999999999*G0_0_0_0 + 0.00468749999999999*G0_0_0_1 + 0.00468749999999999*G0_0_0_2 + 0.00468749999999999*G0_1_1_0 + 0.00468749999999999*G0_1_1_1 + 0.00468749999999999*G0_1_1_2 + 0.00468749999999999*G0_2_2_0 + 0.00468749999999999*G0_2_2_1 + 0.00468749999999999*G0_2_2_2;
 
5476
    A[341] = 0.00736607142857142*G0_0_0_0 + 0.00736607142857142*G0_1_1_0 + 0.00736607142857142*G0_2_2_0;
 
5477
    A[342] = -0.00468749999999999*G0_0_0_1 - 0.00468749999999999*G0_1_1_1 - 0.00468749999999999*G0_2_2_1;
 
5478
    A[343] = -0.0046875*G0_0_0_2 - 0.0046875*G0_1_1_2 - 0.0046875*G0_2_2_2;
 
5479
    A[344] = 0.0241071428571428*G0_0_0_1 + 0.0060267857142857*G0_0_0_2 + 0.0241071428571428*G0_1_1_1 + 0.0060267857142857*G0_1_1_2 + 0.0241071428571428*G0_2_2_1 + 0.0060267857142857*G0_2_2_2;
 
5480
    A[345] = 0.00602678571428571*G0_0_0_1 + 0.0241071428571428*G0_0_0_2 + 0.00602678571428571*G0_1_1_1 + 0.0241071428571428*G0_1_1_2 + 0.00602678571428571*G0_2_2_1 + 0.0241071428571428*G0_2_2_2;
 
5481
    A[346] = -0.0120535714285714*G0_0_0_0 - 0.0060267857142857*G0_0_0_2 - 0.0120535714285714*G0_1_1_0 - 0.0060267857142857*G0_1_1_2 - 0.0120535714285714*G0_2_2_0 - 0.0060267857142857*G0_2_2_2;
 
5482
    A[347] = 0.00602678571428571*G0_0_0_0 + 0.0120535714285714*G0_0_0_2 + 0.00602678571428571*G0_1_1_0 + 0.0120535714285714*G0_1_1_2 + 0.00602678571428571*G0_2_2_0 + 0.0120535714285714*G0_2_2_2;
 
5483
    A[348] = -0.0120535714285714*G0_0_0_0 - 0.00602678571428571*G0_0_0_1 - 0.0120535714285714*G0_1_1_0 - 0.00602678571428571*G0_1_1_1 - 0.0120535714285714*G0_2_2_0 - 0.00602678571428571*G0_2_2_1;
 
5484
    A[349] = 0.00602678571428571*G0_0_0_0 + 0.0120535714285714*G0_0_0_1 + 0.00602678571428571*G0_1_1_0 + 0.0120535714285714*G0_1_1_1 + 0.00602678571428571*G0_2_2_0 + 0.0120535714285714*G0_2_2_1;
 
5485
    A[350] = -0.0241071428571428*G0_0_0_0 - 0.0241071428571428*G0_0_0_1 - 0.0180803571428571*G0_0_0_2 - 0.0241071428571428*G0_1_1_0 - 0.0241071428571428*G0_1_1_1 - 0.0180803571428571*G0_1_1_2 - 0.0241071428571428*G0_2_2_0 - 0.0241071428571428*G0_2_2_1 - 0.0180803571428571*G0_2_2_2;
 
5486
    A[351] = -0.00602678571428571*G0_0_0_0 - 0.00602678571428571*G0_0_0_1 + 0.0180803571428571*G0_0_0_2 - 0.00602678571428571*G0_1_1_0 - 0.00602678571428571*G0_1_1_1 + 0.0180803571428571*G0_1_1_2 - 0.00602678571428571*G0_2_2_0 - 0.00602678571428571*G0_2_2_1 + 0.0180803571428571*G0_2_2_2;
 
5487
    A[352] = -0.0241071428571428*G0_0_0_0 - 0.0180803571428571*G0_0_0_1 - 0.0241071428571428*G0_0_0_2 - 0.0241071428571428*G0_1_1_0 - 0.0180803571428571*G0_1_1_1 - 0.0241071428571428*G0_1_1_2 - 0.0241071428571428*G0_2_2_0 - 0.0180803571428571*G0_2_2_1 - 0.0241071428571428*G0_2_2_2;
 
5488
    A[353] = -0.0060267857142857*G0_0_0_0 + 0.0180803571428571*G0_0_0_1 - 0.0060267857142857*G0_0_0_2 - 0.0060267857142857*G0_1_1_0 + 0.0180803571428571*G0_1_1_1 - 0.0060267857142857*G0_1_1_2 - 0.0060267857142857*G0_2_2_0 + 0.0180803571428571*G0_2_2_1 - 0.0060267857142857*G0_2_2_2;
 
5489
    A[354] = -0.00602678571428572*G0_0_0_0 - 0.0120535714285714*G0_0_0_1 - 0.0120535714285714*G0_0_0_2 - 0.00602678571428572*G0_1_1_0 - 0.0120535714285714*G0_1_1_1 - 0.0120535714285714*G0_1_1_2 - 0.00602678571428572*G0_2_2_0 - 0.0120535714285714*G0_2_2_1 - 0.0120535714285714*G0_2_2_2;
 
5490
    A[355] = -0.00602678571428571*G0_0_0_0 + 0.0060267857142857*G0_0_0_1 + 0.00602678571428569*G0_0_0_2 - 0.00602678571428571*G0_1_1_0 + 0.0060267857142857*G0_1_1_1 + 0.00602678571428569*G0_1_1_2 - 0.00602678571428571*G0_2_2_0 + 0.0060267857142857*G0_2_2_1 + 0.00602678571428569*G0_2_2_2;
 
5491
    A[356] = 0.0723214285714285*G0_0_0_0 + 0.0361607142857143*G0_0_0_1 + 0.0361607142857142*G0_0_0_2 + 0.0723214285714285*G0_1_1_0 + 0.0361607142857143*G0_1_1_1 + 0.0361607142857142*G0_1_1_2 + 0.0723214285714285*G0_2_2_0 + 0.0361607142857143*G0_2_2_1 + 0.0361607142857142*G0_2_2_2;
 
5492
    A[357] = -0.0723214285714285*G0_0_0_0 - 0.0723214285714285*G0_1_1_0 - 0.0723214285714285*G0_2_2_0;
 
5493
    A[358] = 0.0361607142857143*G0_0_0_0 - 0.0361607142857142*G0_0_0_1 + 0.0361607142857143*G0_1_1_0 - 0.0361607142857142*G0_1_1_1 + 0.0361607142857143*G0_2_2_0 - 0.0361607142857142*G0_2_2_1;
 
5494
    A[359] = 0.0361607142857143*G0_0_0_0 - 0.0361607142857142*G0_0_0_2 + 0.0361607142857143*G0_1_1_0 - 0.0361607142857142*G0_1_1_2 + 0.0361607142857143*G0_2_2_0 - 0.0361607142857142*G0_2_2_2;
 
5495
    A[360] = 0.0046875*G0_0_0_0 + 0.0046875*G0_0_0_1 + 0.0046875*G0_0_0_2 + 0.0046875*G0_1_1_0 + 0.0046875*G0_1_1_1 + 0.0046875*G0_1_1_2 + 0.0046875*G0_2_2_0 + 0.0046875*G0_2_2_1 + 0.0046875*G0_2_2_2;
 
5496
    A[361] = -0.0046875*G0_0_0_0 - 0.0046875*G0_1_1_0 - 0.0046875*G0_2_2_0;
 
5497
    A[362] = 0.0073660714285714*G0_0_0_1 + 0.0073660714285714*G0_1_1_1 + 0.0073660714285714*G0_2_2_1;
 
5498
    A[363] = -0.00468749999999999*G0_0_0_2 - 0.00468749999999999*G0_1_1_2 - 0.00468749999999999*G0_2_2_2;
 
5499
    A[364] = -0.0120535714285714*G0_0_0_1 - 0.00602678571428571*G0_0_0_2 - 0.0120535714285714*G0_1_1_1 - 0.00602678571428571*G0_1_1_2 - 0.0120535714285714*G0_2_2_1 - 0.00602678571428571*G0_2_2_2;
 
5500
    A[365] = 0.0060267857142857*G0_0_0_1 + 0.0120535714285714*G0_0_0_2 + 0.0060267857142857*G0_1_1_1 + 0.0120535714285714*G0_1_1_2 + 0.0060267857142857*G0_2_2_1 + 0.0120535714285714*G0_2_2_2;
 
5501
    A[366] = 0.0241071428571428*G0_0_0_0 + 0.00602678571428569*G0_0_0_2 + 0.0241071428571428*G0_1_1_0 + 0.00602678571428569*G0_1_1_2 + 0.0241071428571428*G0_2_2_0 + 0.00602678571428569*G0_2_2_2;
 
5502
    A[367] = 0.0060267857142857*G0_0_0_0 + 0.0241071428571428*G0_0_0_2 + 0.0060267857142857*G0_1_1_0 + 0.0241071428571428*G0_1_1_2 + 0.0060267857142857*G0_2_2_0 + 0.0241071428571428*G0_2_2_2;
 
5503
    A[368] = 0.0120535714285714*G0_0_0_0 + 0.0060267857142857*G0_0_0_1 + 0.0120535714285714*G0_1_1_0 + 0.0060267857142857*G0_1_1_1 + 0.0120535714285714*G0_2_2_0 + 0.0060267857142857*G0_2_2_1;
 
5504
    A[369] = -0.00602678571428571*G0_0_0_0 - 0.0120535714285714*G0_0_0_1 - 0.00602678571428571*G0_1_1_0 - 0.0120535714285714*G0_1_1_1 - 0.00602678571428571*G0_2_2_0 - 0.0120535714285714*G0_2_2_1;
 
5505
    A[370] = -0.0241071428571428*G0_0_0_0 - 0.0241071428571428*G0_0_0_1 - 0.0180803571428571*G0_0_0_2 - 0.0241071428571428*G0_1_1_0 - 0.0241071428571428*G0_1_1_1 - 0.0180803571428571*G0_1_1_2 - 0.0241071428571428*G0_2_2_0 - 0.0241071428571428*G0_2_2_1 - 0.0180803571428571*G0_2_2_2;
 
5506
    A[371] = -0.0060267857142857*G0_0_0_0 - 0.0060267857142857*G0_0_0_1 + 0.0180803571428571*G0_0_0_2 - 0.0060267857142857*G0_1_1_0 - 0.0060267857142857*G0_1_1_1 + 0.0180803571428571*G0_1_1_2 - 0.0060267857142857*G0_2_2_0 - 0.0060267857142857*G0_2_2_1 + 0.0180803571428571*G0_2_2_2;
 
5507
    A[372] = -0.0120535714285714*G0_0_0_0 - 0.00602678571428571*G0_0_0_1 - 0.0120535714285714*G0_0_0_2 - 0.0120535714285714*G0_1_1_0 - 0.00602678571428571*G0_1_1_1 - 0.0120535714285714*G0_1_1_2 - 0.0120535714285714*G0_2_2_0 - 0.00602678571428571*G0_2_2_1 - 0.0120535714285714*G0_2_2_2;
 
5508
    A[373] = 0.00602678571428572*G0_0_0_0 - 0.0060267857142857*G0_0_0_1 + 0.00602678571428572*G0_0_0_2 + 0.00602678571428572*G0_1_1_0 - 0.0060267857142857*G0_1_1_1 + 0.00602678571428572*G0_1_1_2 + 0.00602678571428572*G0_2_2_0 - 0.0060267857142857*G0_2_2_1 + 0.00602678571428572*G0_2_2_2;
 
5509
    A[374] = -0.0180803571428571*G0_0_0_0 - 0.0241071428571428*G0_0_0_1 - 0.0241071428571428*G0_0_0_2 - 0.0180803571428571*G0_1_1_0 - 0.0241071428571428*G0_1_1_1 - 0.0241071428571428*G0_1_1_2 - 0.0180803571428571*G0_2_2_0 - 0.0241071428571428*G0_2_2_1 - 0.0241071428571428*G0_2_2_2;
 
5510
    A[375] = 0.0180803571428571*G0_0_0_0 - 0.0060267857142857*G0_0_0_1 - 0.0060267857142857*G0_0_0_2 + 0.0180803571428571*G0_1_1_0 - 0.0060267857142857*G0_1_1_1 - 0.0060267857142857*G0_1_1_2 + 0.0180803571428571*G0_2_2_0 - 0.0060267857142857*G0_2_2_1 - 0.0060267857142857*G0_2_2_2;
 
5511
    A[376] = 0.0361607142857142*G0_0_0_0 + 0.0723214285714284*G0_0_0_1 + 0.0361607142857142*G0_0_0_2 + 0.0361607142857142*G0_1_1_0 + 0.0723214285714284*G0_1_1_1 + 0.0361607142857142*G0_1_1_2 + 0.0361607142857142*G0_2_2_0 + 0.0723214285714284*G0_2_2_1 + 0.0361607142857142*G0_2_2_2;
 
5512
    A[377] = -0.0361607142857142*G0_0_0_0 + 0.0361607142857142*G0_0_0_1 - 0.0361607142857142*G0_1_1_0 + 0.0361607142857142*G0_1_1_1 - 0.0361607142857142*G0_2_2_0 + 0.0361607142857142*G0_2_2_1;
 
5513
    A[378] = -0.0723214285714284*G0_0_0_1 - 0.0723214285714284*G0_1_1_1 - 0.0723214285714284*G0_2_2_1;
 
5514
    A[379] = 0.0361607142857142*G0_0_0_1 - 0.0361607142857142*G0_0_0_2 + 0.0361607142857142*G0_1_1_1 - 0.0361607142857142*G0_1_1_2 + 0.0361607142857142*G0_2_2_1 - 0.0361607142857142*G0_2_2_2;
 
5515
    A[380] = 0.00468749999999999*G0_0_0_0 + 0.00468749999999999*G0_0_0_1 + 0.00468749999999999*G0_0_0_2 + 0.00468749999999999*G0_1_1_0 + 0.00468749999999999*G0_1_1_1 + 0.00468749999999999*G0_1_1_2 + 0.00468749999999999*G0_2_2_0 + 0.00468749999999999*G0_2_2_1 + 0.00468749999999999*G0_2_2_2;
 
5516
    A[381] = -0.00468749999999999*G0_0_0_0 - 0.00468749999999999*G0_1_1_0 - 0.00468749999999999*G0_2_2_0;
 
5517
    A[382] = -0.00468749999999999*G0_0_0_1 - 0.00468749999999999*G0_1_1_1 - 0.00468749999999999*G0_2_2_1;
 
5518
    A[383] = 0.00736607142857141*G0_0_0_2 + 0.00736607142857141*G0_1_1_2 + 0.00736607142857141*G0_2_2_2;
 
5519
    A[384] = 0.0120535714285714*G0_0_0_1 + 0.00602678571428571*G0_0_0_2 + 0.0120535714285714*G0_1_1_1 + 0.00602678571428571*G0_1_1_2 + 0.0120535714285714*G0_2_2_1 + 0.00602678571428571*G0_2_2_2;
 
5520
    A[385] = -0.00602678571428571*G0_0_0_1 - 0.0120535714285714*G0_0_0_2 - 0.00602678571428571*G0_1_1_1 - 0.0120535714285714*G0_1_1_2 - 0.00602678571428571*G0_2_2_1 - 0.0120535714285714*G0_2_2_2;
 
5521
    A[386] = 0.0120535714285714*G0_0_0_0 + 0.0060267857142857*G0_0_0_2 + 0.0120535714285714*G0_1_1_0 + 0.0060267857142857*G0_1_1_2 + 0.0120535714285714*G0_2_2_0 + 0.0060267857142857*G0_2_2_2;
 
5522
    A[387] = -0.00602678571428571*G0_0_0_0 - 0.0120535714285714*G0_0_0_2 - 0.00602678571428571*G0_1_1_0 - 0.0120535714285714*G0_1_1_2 - 0.00602678571428571*G0_2_2_0 - 0.0120535714285714*G0_2_2_2;
 
5523
    A[388] = 0.0241071428571428*G0_0_0_0 + 0.00602678571428572*G0_0_0_1 + 0.0241071428571428*G0_1_1_0 + 0.00602678571428572*G0_1_1_1 + 0.0241071428571428*G0_2_2_0 + 0.00602678571428572*G0_2_2_1;
 
5524
    A[389] = 0.0060267857142857*G0_0_0_0 + 0.0241071428571428*G0_0_0_1 + 0.0060267857142857*G0_1_1_0 + 0.0241071428571428*G0_1_1_1 + 0.0060267857142857*G0_2_2_0 + 0.0241071428571428*G0_2_2_1;
 
5525
    A[390] = -0.0120535714285714*G0_0_0_0 - 0.0120535714285714*G0_0_0_1 - 0.00602678571428573*G0_0_0_2 - 0.0120535714285714*G0_1_1_0 - 0.0120535714285714*G0_1_1_1 - 0.00602678571428573*G0_1_1_2 - 0.0120535714285714*G0_2_2_0 - 0.0120535714285714*G0_2_2_1 - 0.00602678571428573*G0_2_2_2;
 
5526
    A[391] = 0.00602678571428571*G0_0_0_0 + 0.00602678571428571*G0_0_0_1 - 0.00602678571428569*G0_0_0_2 + 0.00602678571428571*G0_1_1_0 + 0.00602678571428571*G0_1_1_1 - 0.00602678571428569*G0_1_1_2 + 0.00602678571428571*G0_2_2_0 + 0.00602678571428571*G0_2_2_1 - 0.00602678571428569*G0_2_2_2;
 
5527
    A[392] = -0.0241071428571428*G0_0_0_0 - 0.0180803571428571*G0_0_0_1 - 0.0241071428571428*G0_0_0_2 - 0.0241071428571428*G0_1_1_0 - 0.0180803571428571*G0_1_1_1 - 0.0241071428571428*G0_1_1_2 - 0.0241071428571428*G0_2_2_0 - 0.0180803571428571*G0_2_2_1 - 0.0241071428571428*G0_2_2_2;
 
5528
    A[393] = -0.0060267857142857*G0_0_0_0 + 0.0180803571428571*G0_0_0_1 - 0.0060267857142857*G0_0_0_2 - 0.0060267857142857*G0_1_1_0 + 0.0180803571428571*G0_1_1_1 - 0.0060267857142857*G0_1_1_2 - 0.0060267857142857*G0_2_2_0 + 0.0180803571428571*G0_2_2_1 - 0.0060267857142857*G0_2_2_2;
 
5529
    A[394] = -0.0180803571428571*G0_0_0_0 - 0.0241071428571429*G0_0_0_1 - 0.0241071428571429*G0_0_0_2 - 0.0180803571428571*G0_1_1_0 - 0.0241071428571429*G0_1_1_1 - 0.0241071428571429*G0_1_1_2 - 0.0180803571428571*G0_2_2_0 - 0.0241071428571429*G0_2_2_1 - 0.0241071428571429*G0_2_2_2;
 
5530
    A[395] = 0.0180803571428571*G0_0_0_0 - 0.00602678571428572*G0_0_0_1 - 0.00602678571428572*G0_0_0_2 + 0.0180803571428571*G0_1_1_0 - 0.00602678571428572*G0_1_1_1 - 0.00602678571428572*G0_1_1_2 + 0.0180803571428571*G0_2_2_0 - 0.00602678571428572*G0_2_2_1 - 0.00602678571428572*G0_2_2_2;
 
5531
    A[396] = 0.0361607142857142*G0_0_0_0 + 0.0361607142857143*G0_0_0_1 + 0.0723214285714285*G0_0_0_2 + 0.0361607142857142*G0_1_1_0 + 0.0361607142857143*G0_1_1_1 + 0.0723214285714285*G0_1_1_2 + 0.0361607142857142*G0_2_2_0 + 0.0361607142857143*G0_2_2_1 + 0.0723214285714285*G0_2_2_2;
 
5532
    A[397] = -0.0361607142857142*G0_0_0_0 + 0.0361607142857142*G0_0_0_2 - 0.0361607142857142*G0_1_1_0 + 0.0361607142857142*G0_1_1_2 - 0.0361607142857142*G0_2_2_0 + 0.0361607142857142*G0_2_2_2;
 
5533
    A[398] = -0.0361607142857143*G0_0_0_1 + 0.0361607142857142*G0_0_0_2 - 0.0361607142857143*G0_1_1_1 + 0.0361607142857142*G0_1_1_2 - 0.0361607142857143*G0_2_2_1 + 0.0361607142857142*G0_2_2_2;
 
5534
    A[399] = -0.0723214285714285*G0_0_0_2 - 0.0723214285714285*G0_1_1_2 - 0.0723214285714285*G0_2_2_2;
 
5535
  }
 
5536
 
 
5537
};
 
5538
 
 
5539
/// This class defines the interface for the assembly of the global
 
5540
/// tensor corresponding to a form with r + n arguments, that is, a
 
5541
/// mapping
 
5542
///
 
5543
///     a : V1 x V2 x ... Vr x W1 x W2 x ... x Wn -> R
 
5544
///
 
5545
/// with arguments v1, v2, ..., vr, w1, w2, ..., wn. The rank r
 
5546
/// global tensor A is defined by
 
5547
///
 
5548
///     A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
 
5549
///
 
5550
/// where each argument Vj represents the application to the
 
5551
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
 
5552
/// fixed functions (coefficients).
 
5553
 
 
5554
class UFC_AdvectionBilinearForm: public ufc::form
 
5555
{
 
5556
public:
 
5557
 
 
5558
  /// Constructor
 
5559
  UFC_AdvectionBilinearForm() : ufc::form()
 
5560
  {
 
5561
    // Do nothing
 
5562
  }
 
5563
 
 
5564
  /// Destructor
 
5565
  virtual ~UFC_AdvectionBilinearForm()
 
5566
  {
 
5567
    // Do nothing
 
5568
  }
 
5569
 
 
5570
  /// Return a string identifying the form
 
5571
  virtual const char* signature() const
 
5572
  {
 
5573
    return "w0_a1(dXa2/dxa0) | vi0*va1[a0]*((d/dXa2)vi1)*dX(0)";
 
5574
  }
 
5575
 
 
5576
  /// Return the rank of the global tensor (r)
 
5577
  virtual unsigned int rank() const
 
5578
  {
 
5579
    return 2;
 
5580
  }
 
5581
 
 
5582
  /// Return the number of coefficients (n)
 
5583
  virtual unsigned int num_coefficients() const
 
5584
  {
 
5585
    return 1;
 
5586
  }
 
5587
 
 
5588
  /// Return the number of cell integrals
 
5589
  virtual unsigned int num_cell_integrals() const
 
5590
  {
 
5591
    return 1;
 
5592
  }
 
5593
  
 
5594
  /// Return the number of exterior facet integrals
 
5595
  virtual unsigned int num_exterior_facet_integrals() const
 
5596
  {
 
5597
    return 0;
 
5598
  }
 
5599
  
 
5600
  /// Return the number of interior facet integrals
 
5601
  virtual unsigned int num_interior_facet_integrals() const
 
5602
  {
 
5603
    return 0;
 
5604
  }
 
5605
    
 
5606
  /// Create a new finite element for argument function i
 
5607
  virtual ufc::finite_element* create_finite_element(unsigned int i) const
 
5608
  {
 
5609
    switch ( i )
 
5610
    {
 
5611
    case 0:
 
5612
      return new UFC_AdvectionBilinearForm_finite_element_0();
 
5613
      break;
 
5614
    case 1:
 
5615
      return new UFC_AdvectionBilinearForm_finite_element_1();
 
5616
      break;
 
5617
    case 2:
 
5618
      return new UFC_AdvectionBilinearForm_finite_element_2();
 
5619
      break;
 
5620
    }
 
5621
    return 0;
 
5622
  }
 
5623
  
 
5624
  /// Create a new dof map for argument function i
 
5625
  virtual ufc::dof_map* create_dof_map(unsigned int i) const
 
5626
  {
 
5627
    switch ( i )
 
5628
    {
 
5629
    case 0:
 
5630
      return new UFC_AdvectionBilinearForm_dof_map_0();
 
5631
      break;
 
5632
    case 1:
 
5633
      return new UFC_AdvectionBilinearForm_dof_map_1();
 
5634
      break;
 
5635
    case 2:
 
5636
      return new UFC_AdvectionBilinearForm_dof_map_2();
 
5637
      break;
 
5638
    }
 
5639
    return 0;
 
5640
  }
 
5641
 
 
5642
  /// Create a new cell integral on sub domain i
 
5643
  virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
 
5644
  {
 
5645
    return new UFC_AdvectionBilinearForm_cell_integral_0();
 
5646
  }
 
5647
 
 
5648
  /// Create a new exterior facet integral on sub domain i
 
5649
  virtual ufc::exterior_facet_integral* create_exterior_facet_integral(unsigned int i) const
 
5650
  {
 
5651
    return 0;
 
5652
  }
 
5653
 
 
5654
  /// Create a new interior facet integral on sub domain i
 
5655
  virtual ufc::interior_facet_integral* create_interior_facet_integral(unsigned int i) const
 
5656
  {
 
5657
    return 0;
 
5658
  }
 
5659
 
 
5660
};
 
5661
 
 
5662
// DOLFIN wrappers
 
5663
 
 
5664
#include <dolfin/Form.h>
 
5665
 
 
5666
class AdvectionBilinearForm : public dolfin::Form
 
5667
{
 
5668
public:
 
5669
 
 
5670
  AdvectionBilinearForm(dolfin::Function& w0) : dolfin::Form()
 
5671
  {
 
5672
    __coefficients.push_back(&w0);
 
5673
  }
 
5674
 
 
5675
  /// Return UFC form
 
5676
  virtual const ufc::form& form() const
 
5677
  {
 
5678
    return __form;
 
5679
  }
 
5680
  
 
5681
  /// Return array of coefficients
 
5682
  virtual const dolfin::Array<dolfin::Function*>& coefficients() const
 
5683
  {
 
5684
    return __coefficients;
 
5685
  }
 
5686
 
 
5687
private:
 
5688
 
 
5689
  // UFC form
 
5690
  UFC_AdvectionBilinearForm __form;
 
5691
 
 
5692
  /// Array of coefficients
 
5693
  dolfin::Array<dolfin::Function*> __coefficients;
 
5694
 
 
5695
};
 
5696
 
 
5697
#endif