~unicorn-core/unicorn/hpc

« back to all changes in this revision

Viewing changes to ucsolver/fsi/unicorn/NSEContinuity3D.cpp

  • Committer: Niclas Jansson
  • Date: 2012-03-01 08:20:27 UTC
  • mfrom: (129.5.32 0.1.3-hpc)
  • Revision ID: njansson@csc.kth.se-20120301082027-snah9zahbb5d3t8n
Fixed F77 calling in elastic smoother

Show diffs side-by-side

added added

removed removed

Lines of Context:
6889
6889
    return new UFC_NSEContinuity3DLinearForm_finite_element_3();
6890
6890
}
6891
6891
 
 
6892
 
 
6893
/// Constructor
 
6894
UFC_NSEContinuity3DLinearForm_finite_element_4::UFC_NSEContinuity3DLinearForm_finite_element_4() : ufc::finite_element()
 
6895
{
 
6896
    // Do nothing
 
6897
}
 
6898
 
 
6899
/// Destructor
 
6900
UFC_NSEContinuity3DLinearForm_finite_element_4::~UFC_NSEContinuity3DLinearForm_finite_element_4()
 
6901
{
 
6902
    // Do nothing
 
6903
}
 
6904
 
 
6905
/// Return a string identifying the finite element
 
6906
const char* UFC_NSEContinuity3DLinearForm_finite_element_4::signature() const
 
6907
{
 
6908
    return "Discontinuous Lagrange finite element of degree 0 on a tetrahedron";
 
6909
}
 
6910
 
 
6911
/// Return the cell shape
 
6912
ufc::shape UFC_NSEContinuity3DLinearForm_finite_element_4::cell_shape() const
 
6913
{
 
6914
    return ufc::tetrahedron;
 
6915
}
 
6916
 
 
6917
/// Return the dimension of the finite element function space
 
6918
unsigned int UFC_NSEContinuity3DLinearForm_finite_element_4::space_dimension() const
 
6919
{
 
6920
    return 1;
 
6921
}
 
6922
 
 
6923
/// Return the rank of the value space
 
6924
unsigned int UFC_NSEContinuity3DLinearForm_finite_element_4::value_rank() const
 
6925
{
 
6926
    return 0;
 
6927
}
 
6928
 
 
6929
/// Return the dimension of the value space for axis i
 
6930
unsigned int UFC_NSEContinuity3DLinearForm_finite_element_4::value_dimension(unsigned int i) const
 
6931
{
 
6932
    return 1;
 
6933
}
 
6934
 
 
6935
/// Evaluate basis function i at given point in cell
 
6936
void UFC_NSEContinuity3DLinearForm_finite_element_4::evaluate_basis(unsigned int i,
 
6937
                                   double* values,
 
6938
                                   const double* coordinates,
 
6939
                                   const ufc::cell& c) const
 
6940
{
 
6941
    // Extract vertex coordinates
 
6942
    const double * const * element_coordinates = c.coordinates;
 
6943
    
 
6944
    // Compute Jacobian of affine map from reference cell
 
6945
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
6946
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
6947
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
6948
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
6949
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
6950
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
6951
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
6952
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
6953
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
6954
      
 
6955
    // Compute sub determinants
 
6956
    const double d00 = J_11*J_22 - J_12*J_21;
 
6957
    const double d01 = J_12*J_20 - J_10*J_22;
 
6958
    const double d02 = J_10*J_21 - J_11*J_20;
 
6959
    
 
6960
    const double d10 = J_02*J_21 - J_01*J_22;
 
6961
    const double d11 = J_00*J_22 - J_02*J_20;
 
6962
    const double d12 = J_01*J_20 - J_00*J_21;
 
6963
    
 
6964
    const double d20 = J_01*J_12 - J_02*J_11;
 
6965
    const double d21 = J_02*J_10 - J_00*J_12;
 
6966
    const double d22 = J_00*J_11 - J_01*J_10;
 
6967
      
 
6968
    // Compute determinant of Jacobian
 
6969
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
6970
    
 
6971
    // Compute inverse of Jacobian
 
6972
    
 
6973
    // Compute constants
 
6974
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
6975
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
6976
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
6977
    
 
6978
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
6979
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
6980
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
6981
    
 
6982
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
6983
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
6984
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
6985
    
 
6986
    // Get coordinates and map to the UFC reference element
 
6987
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
6988
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
6989
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
6990
    
 
6991
    // Map coordinates to the reference cube
 
6992
    if (std::abs(y + z - 1.0) < 1e-14)
 
6993
      x = 1.0;
 
6994
    else
 
6995
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
6996
    if (std::abs(z - 1.0) < 1e-14)
 
6997
      y = -1.0;
 
6998
    else
 
6999
      y = 2.0 * y/(1.0 - z) - 1.0;
 
7000
    z = 2.0 * z - 1.0;
 
7001
    
 
7002
    // Reset values
 
7003
    *values = 0;
 
7004
    
 
7005
    // Map degree of freedom to element degree of freedom
 
7006
    const unsigned int dof = i;
 
7007
    
 
7008
    // Generate scalings
 
7009
    const double scalings_y_0 = 1;
 
7010
    const double scalings_z_0 = 1;
 
7011
    
 
7012
    // Compute psitilde_a
 
7013
    const double psitilde_a_0 = 1;
 
7014
    
 
7015
    // Compute psitilde_bs
 
7016
    const double psitilde_bs_0_0 = 1;
 
7017
    
 
7018
    // Compute psitilde_cs
 
7019
    const double psitilde_cs_00_0 = 1;
 
7020
    
 
7021
    // Compute basisvalues
 
7022
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
7023
    
 
7024
    // Table(s) of coefficients
 
7025
    const static double coefficients0[1][1] = \
 
7026
    {{1.15470053837925}};
 
7027
    
 
7028
    // Extract relevant coefficients
 
7029
    const double coeff0_0 = coefficients0[dof][0];
 
7030
    
 
7031
    // Compute value(s)
 
7032
    *values = coeff0_0*basisvalue0;
 
7033
}
 
7034
 
 
7035
/// Evaluate all basis functions at given point in cell
 
7036
void UFC_NSEContinuity3DLinearForm_finite_element_4::evaluate_basis_all(double* values,
 
7037
                                       const double* coordinates,
 
7038
                                       const ufc::cell& c) const
 
7039
{
 
7040
    throw std::runtime_error("The vectorised version of evaluate_basis() is not yet implemented.");
 
7041
}
 
7042
 
 
7043
/// Evaluate order n derivatives of basis function i at given point in cell
 
7044
void UFC_NSEContinuity3DLinearForm_finite_element_4::evaluate_basis_derivatives(unsigned int i,
 
7045
                                               unsigned int n,
 
7046
                                               double* values,
 
7047
                                               const double* coordinates,
 
7048
                                               const ufc::cell& c) const
 
7049
{
 
7050
    // Extract vertex coordinates
 
7051
    const double * const * element_coordinates = c.coordinates;
 
7052
    
 
7053
    // Compute Jacobian of affine map from reference cell
 
7054
    const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
 
7055
    const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
 
7056
    const double J_02 = element_coordinates[3][0] - element_coordinates[0][0];
 
7057
    const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
 
7058
    const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
 
7059
    const double J_12 = element_coordinates[3][1] - element_coordinates[0][1];
 
7060
    const double J_20 = element_coordinates[1][2] - element_coordinates[0][2];
 
7061
    const double J_21 = element_coordinates[2][2] - element_coordinates[0][2];
 
7062
    const double J_22 = element_coordinates[3][2] - element_coordinates[0][2];
 
7063
      
 
7064
    // Compute sub determinants
 
7065
    const double d00 = J_11*J_22 - J_12*J_21;
 
7066
    const double d01 = J_12*J_20 - J_10*J_22;
 
7067
    const double d02 = J_10*J_21 - J_11*J_20;
 
7068
    
 
7069
    const double d10 = J_02*J_21 - J_01*J_22;
 
7070
    const double d11 = J_00*J_22 - J_02*J_20;
 
7071
    const double d12 = J_01*J_20 - J_00*J_21;
 
7072
    
 
7073
    const double d20 = J_01*J_12 - J_02*J_11;
 
7074
    const double d21 = J_02*J_10 - J_00*J_12;
 
7075
    const double d22 = J_00*J_11 - J_01*J_10;
 
7076
      
 
7077
    // Compute determinant of Jacobian
 
7078
    double detJ = J_00*d00 + J_10*d10 + J_20*d20;
 
7079
    
 
7080
    // Compute inverse of Jacobian
 
7081
    
 
7082
    // Compute constants
 
7083
    const double C0 = d00*(element_coordinates[0][0] - element_coordinates[2][0] - element_coordinates[3][0]) \
 
7084
                    + d10*(element_coordinates[0][1] - element_coordinates[2][1] - element_coordinates[3][1]) \
 
7085
                    + d20*(element_coordinates[0][2] - element_coordinates[2][2] - element_coordinates[3][2]);
 
7086
    
 
7087
    const double C1 = d01*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[3][0]) \
 
7088
                    + d11*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[3][1]) \
 
7089
                    + d21*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[3][2]);
 
7090
    
 
7091
    const double C2 = d02*(element_coordinates[0][0] - element_coordinates[1][0] - element_coordinates[2][0]) \
 
7092
                    + d12*(element_coordinates[0][1] - element_coordinates[1][1] - element_coordinates[2][1]) \
 
7093
                    + d22*(element_coordinates[0][2] - element_coordinates[1][2] - element_coordinates[2][2]);
 
7094
    
 
7095
    // Get coordinates and map to the UFC reference element
 
7096
    double x = (C0 + d00*coordinates[0] + d10*coordinates[1] + d20*coordinates[2]) / detJ;
 
7097
    double y = (C1 + d01*coordinates[0] + d11*coordinates[1] + d21*coordinates[2]) / detJ;
 
7098
    double z = (C2 + d02*coordinates[0] + d12*coordinates[1] + d22*coordinates[2]) / detJ;
 
7099
    
 
7100
    // Map coordinates to the reference cube
 
7101
    if (std::abs(y + z - 1.0) < 1e-14)
 
7102
      x = 1.0;
 
7103
    else
 
7104
      x = -2.0 * x/(y + z - 1.0) - 1.0;
 
7105
    if (std::abs(z - 1.0) < 1e-14)
 
7106
      y = -1.0;
 
7107
    else
 
7108
      y = 2.0 * y/(1.0 - z) - 1.0;
 
7109
    z = 2.0 * z - 1.0;
 
7110
    
 
7111
    // Compute number of derivatives
 
7112
    unsigned int num_derivatives = 1;
 
7113
    
 
7114
    for (unsigned int j = 0; j < n; j++)
 
7115
      num_derivatives *= 3;
 
7116
    
 
7117
    
 
7118
    // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
 
7119
    unsigned int **combinations = new unsigned int *[num_derivatives];
 
7120
        
 
7121
    for (unsigned int j = 0; j < num_derivatives; j++)
 
7122
    {
 
7123
      combinations[j] = new unsigned int [n];
 
7124
      for (unsigned int k = 0; k < n; k++)
 
7125
        combinations[j][k] = 0;
 
7126
    }
 
7127
        
 
7128
    // Generate combinations of derivatives
 
7129
    for (unsigned int row = 1; row < num_derivatives; row++)
 
7130
    {
 
7131
      for (unsigned int num = 0; num < row; num++)
 
7132
      {
 
7133
        for (unsigned int col = n-1; col+1 > 0; col--)
 
7134
        {
 
7135
          if (combinations[row][col] + 1 > 2)
 
7136
            combinations[row][col] = 0;
 
7137
          else
 
7138
          {
 
7139
            combinations[row][col] += 1;
 
7140
            break;
 
7141
          }
 
7142
        }
 
7143
      }
 
7144
    }
 
7145
    
 
7146
    // Compute inverse of Jacobian
 
7147
    const double Jinv[3][3] ={{d00 / detJ, d10 / detJ, d20 / detJ}, {d01 / detJ, d11 / detJ, d21 / detJ}, {d02 / detJ, d12 / detJ, d22 / detJ}};
 
7148
    
 
7149
    // Declare transformation matrix
 
7150
    // Declare pointer to two dimensional array and initialise
 
7151
    double **transform = new double *[num_derivatives];
 
7152
        
 
7153
    for (unsigned int j = 0; j < num_derivatives; j++)
 
7154
    {
 
7155
      transform[j] = new double [num_derivatives];
 
7156
      for (unsigned int k = 0; k < num_derivatives; k++)
 
7157
        transform[j][k] = 1;
 
7158
    }
 
7159
    
 
7160
    // Construct transformation matrix
 
7161
    for (unsigned int row = 0; row < num_derivatives; row++)
 
7162
    {
 
7163
      for (unsigned int col = 0; col < num_derivatives; col++)
 
7164
      {
 
7165
        for (unsigned int k = 0; k < n; k++)
 
7166
          transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
 
7167
      }
 
7168
    }
 
7169
    
 
7170
    // Reset values
 
7171
    for (unsigned int j = 0; j < 1*num_derivatives; j++)
 
7172
      values[j] = 0;
 
7173
    
 
7174
    // Map degree of freedom to element degree of freedom
 
7175
    const unsigned int dof = i;
 
7176
    
 
7177
    // Generate scalings
 
7178
    const double scalings_y_0 = 1;
 
7179
    const double scalings_z_0 = 1;
 
7180
    
 
7181
    // Compute psitilde_a
 
7182
    const double psitilde_a_0 = 1;
 
7183
    
 
7184
    // Compute psitilde_bs
 
7185
    const double psitilde_bs_0_0 = 1;
 
7186
    
 
7187
    // Compute psitilde_cs
 
7188
    const double psitilde_cs_00_0 = 1;
 
7189
    
 
7190
    // Compute basisvalues
 
7191
    const double basisvalue0 = 0.866025403784439*psitilde_a_0*scalings_y_0*psitilde_bs_0_0*scalings_z_0*psitilde_cs_00_0;
 
7192
    
 
7193
    // Table(s) of coefficients
 
7194
    const static double coefficients0[1][1] = \
 
7195
    {{1.15470053837925}};
 
7196
    
 
7197
    // Interesting (new) part
 
7198
    // Tables of derivatives of the polynomial base (transpose)
 
7199
    const static double dmats0[1][1] = \
 
7200
    {{0}};
 
7201
    
 
7202
    const static double dmats1[1][1] = \
 
7203
    {{0}};
 
7204
    
 
7205
    const static double dmats2[1][1] = \
 
7206
    {{0}};
 
7207
    
 
7208
    // Compute reference derivatives
 
7209
    // Declare pointer to array of derivatives on FIAT element
 
7210
    double *derivatives = new double [num_derivatives];
 
7211
    
 
7212
    // Declare coefficients
 
7213
    double coeff0_0 = 0;
 
7214
    
 
7215
    // Declare new coefficients
 
7216
    double new_coeff0_0 = 0;
 
7217
    
 
7218
    // Loop possible derivatives
 
7219
    for (unsigned int deriv_num = 0; deriv_num < num_derivatives; deriv_num++)
 
7220
    {
 
7221
      // Get values from coefficients array
 
7222
      new_coeff0_0 = coefficients0[dof][0];
 
7223
    
 
7224
      // Loop derivative order
 
7225
      for (unsigned int j = 0; j < n; j++)
 
7226
      {
 
7227
        // Update old coefficients
 
7228
        coeff0_0 = new_coeff0_0;
 
7229
    
 
7230
        if(combinations[deriv_num][j] == 0)
 
7231
        {
 
7232
          new_coeff0_0 = coeff0_0*dmats0[0][0];
 
7233
        }
 
7234
        if(combinations[deriv_num][j] == 1)
 
7235
        {
 
7236
          new_coeff0_0 = coeff0_0*dmats1[0][0];
 
7237
        }
 
7238
        if(combinations[deriv_num][j] == 2)
 
7239
        {
 
7240
          new_coeff0_0 = coeff0_0*dmats2[0][0];
 
7241
        }
 
7242
    
 
7243
      }
 
7244
      // Compute derivatives on reference element as dot product of coefficients and basisvalues
 
7245
      derivatives[deriv_num] = new_coeff0_0*basisvalue0;
 
7246
    }
 
7247
    
 
7248
    // Transform derivatives back to physical element
 
7249
    for (unsigned int row = 0; row < num_derivatives; row++)
 
7250
    {
 
7251
      for (unsigned int col = 0; col < num_derivatives; col++)
 
7252
      {
 
7253
        values[row] += transform[row][col]*derivatives[col];
 
7254
      }
 
7255
    }
 
7256
    // Delete pointer to array of derivatives on FIAT element
 
7257
    delete [] derivatives;
 
7258
    
 
7259
    // Delete pointer to array of combinations of derivatives and transform
 
7260
    for (unsigned int row = 0; row < num_derivatives; row++)
 
7261
    {
 
7262
      delete [] combinations[row];
 
7263
      delete [] transform[row];
 
7264
    }
 
7265
    
 
7266
    delete [] combinations;
 
7267
    delete [] transform;
 
7268
}
 
7269
 
 
7270
/// Evaluate order n derivatives of all basis functions at given point in cell
 
7271
void UFC_NSEContinuity3DLinearForm_finite_element_4::evaluate_basis_derivatives_all(unsigned int n,
 
7272
                                                   double* values,
 
7273
                                                   const double* coordinates,
 
7274
                                                   const ufc::cell& c) const
 
7275
{
 
7276
    throw std::runtime_error("The vectorised version of evaluate_basis_derivatives() is not yet implemented.");
 
7277
}
 
7278
 
 
7279
/// Evaluate linear functional for dof i on the function f
 
7280
double UFC_NSEContinuity3DLinearForm_finite_element_4::evaluate_dof(unsigned int i,
 
7281
                                   const ufc::function& f,
 
7282
                                   const ufc::cell& c) const
 
7283
{
 
7284
    // The reference points, direction and weights:
 
7285
    const static double X[1][1][3] = {{{0.25, 0.25, 0.25}}};
 
7286
    const static double W[1][1] = {{1}};
 
7287
    const static double D[1][1][1] = {{{1}}};
 
7288
    
 
7289
    const double * const * x = c.coordinates;
 
7290
    double result = 0.0;
 
7291
    // Iterate over the points:
 
7292
    // Evaluate basis functions for affine mapping
 
7293
    const double w0 = 1.0 - X[i][0][0] - X[i][0][1] - X[i][0][2];
 
7294
    const double w1 = X[i][0][0];
 
7295
    const double w2 = X[i][0][1];
 
7296
    const double w3 = X[i][0][2];
 
7297
    
 
7298
    // Compute affine mapping y = F(X)
 
7299
    double y[3];
 
7300
    y[0] = w0*x[0][0] + w1*x[1][0] + w2*x[2][0] + w3*x[3][0];
 
7301
    y[1] = w0*x[0][1] + w1*x[1][1] + w2*x[2][1] + w3*x[3][1];
 
7302
    y[2] = w0*x[0][2] + w1*x[1][2] + w2*x[2][2] + w3*x[3][2];
 
7303
    
 
7304
    // Evaluate function at physical points
 
7305
    double values[1];
 
7306
    f.evaluate(values, y, c);
 
7307
    
 
7308
    // Map function values using appropriate mapping
 
7309
    // Affine map: Do nothing
 
7310
    
 
7311
    // Note that we do not map the weights (yet).
 
7312
    
 
7313
    // Take directional components
 
7314
    for(int k = 0; k < 1; k++)
 
7315
      result += values[k]*D[i][0][k];
 
7316
    // Multiply by weights 
 
7317
    result *= W[i][0];
 
7318
    
 
7319
    return result;
 
7320
}
 
7321
 
 
7322
/// Evaluate linear functionals for all dofs on the function f
 
7323
void UFC_NSEContinuity3DLinearForm_finite_element_4::evaluate_dofs(double* values,
 
7324
                                  const ufc::function& f,
 
7325
                                  const ufc::cell& c) const
 
7326
{
 
7327
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
7328
}
 
7329
 
 
7330
/// Interpolate vertex values from dof values
 
7331
void UFC_NSEContinuity3DLinearForm_finite_element_4::interpolate_vertex_values(double* vertex_values,
 
7332
                                              const double* dof_values,
 
7333
                                              const ufc::cell& c) const
 
7334
{
 
7335
    // Evaluate at vertices and use affine mapping
 
7336
    vertex_values[0] = dof_values[0];
 
7337
    vertex_values[1] = dof_values[0];
 
7338
    vertex_values[2] = dof_values[0];
 
7339
    vertex_values[3] = dof_values[0];
 
7340
}
 
7341
 
 
7342
/// Return the number of sub elements (for a mixed element)
 
7343
unsigned int UFC_NSEContinuity3DLinearForm_finite_element_4::num_sub_elements() const
 
7344
{
 
7345
    return 1;
 
7346
}
 
7347
 
 
7348
/// Create a new finite element for sub element i (for a mixed element)
 
7349
ufc::finite_element* UFC_NSEContinuity3DLinearForm_finite_element_4::create_sub_element(unsigned int i) const
 
7350
{
 
7351
    return new UFC_NSEContinuity3DLinearForm_finite_element_4();
 
7352
}
 
7353
 
6892
7354
/// Constructor
6893
7355
UFC_NSEContinuity3DLinearForm_dof_map_0::UFC_NSEContinuity3DLinearForm_dof_map_0() : ufc::dof_map()
6894
7356
{
8116
8578
 
8117
8579
 
8118
8580
/// Constructor
 
8581
UFC_NSEContinuity3DLinearForm_dof_map_4::UFC_NSEContinuity3DLinearForm_dof_map_4() : ufc::dof_map()
 
8582
{
 
8583
    __global_dimension = 0;
 
8584
}
 
8585
 
 
8586
/// Destructor
 
8587
UFC_NSEContinuity3DLinearForm_dof_map_4::~UFC_NSEContinuity3DLinearForm_dof_map_4()
 
8588
{
 
8589
    // Do nothing
 
8590
}
 
8591
 
 
8592
/// Return a string identifying the dof map
 
8593
const char* UFC_NSEContinuity3DLinearForm_dof_map_4::signature() const
 
8594
{
 
8595
    return "FFC dof map for Discontinuous Lagrange finite element of degree 0 on a tetrahedron";
 
8596
}
 
8597
 
 
8598
/// Return true iff mesh entities of topological dimension d are needed
 
8599
bool UFC_NSEContinuity3DLinearForm_dof_map_4::needs_mesh_entities(unsigned int d) const
 
8600
{
 
8601
    switch ( d )
 
8602
    {
 
8603
    case 0:
 
8604
      return false;
 
8605
      break;
 
8606
    case 1:
 
8607
      return false;
 
8608
      break;
 
8609
    case 2:
 
8610
      return false;
 
8611
      break;
 
8612
    case 3:
 
8613
      return true;
 
8614
      break;
 
8615
    }
 
8616
    return false;
 
8617
}
 
8618
 
 
8619
/// Initialize dof map for mesh (return true iff init_cell() is needed)
 
8620
bool UFC_NSEContinuity3DLinearForm_dof_map_4::init_mesh(const ufc::mesh& m)
 
8621
{
 
8622
    __global_dimension = m.num_entities[3];
 
8623
    return false;
 
8624
}
 
8625
 
 
8626
/// Initialize dof map for given cell
 
8627
void UFC_NSEContinuity3DLinearForm_dof_map_4::init_cell(const ufc::mesh& m,
 
8628
                              const ufc::cell& c)
 
8629
{
 
8630
    // Do nothing
 
8631
}
 
8632
 
 
8633
/// Finish initialization of dof map for cells
 
8634
void UFC_NSEContinuity3DLinearForm_dof_map_4::init_cell_finalize()
 
8635
{
 
8636
    // Do nothing
 
8637
}
 
8638
 
 
8639
/// Return the dimension of the global finite element function space
 
8640
unsigned int UFC_NSEContinuity3DLinearForm_dof_map_4::global_dimension() const
 
8641
{
 
8642
    return __global_dimension;
 
8643
}
 
8644
 
 
8645
/// Return the dimension of the local finite element function space
 
8646
unsigned int UFC_NSEContinuity3DLinearForm_dof_map_4::local_dimension() const
 
8647
{
 
8648
    return 1;
 
8649
}
 
8650
 
 
8651
// Return the geometric dimension of the coordinates this dof map provides
 
8652
unsigned int UFC_NSEContinuity3DLinearForm_dof_map_4::geometric_dimension() const
 
8653
{
 
8654
    return 3;
 
8655
}
 
8656
 
 
8657
/// Return the number of dofs on each cell facet
 
8658
unsigned int UFC_NSEContinuity3DLinearForm_dof_map_4::num_facet_dofs() const
 
8659
{
 
8660
    return 0;
 
8661
}
 
8662
 
 
8663
/// Return the number of dofs associated with each cell entity of dimension d
 
8664
unsigned int UFC_NSEContinuity3DLinearForm_dof_map_4::num_entity_dofs(unsigned int d) const
 
8665
{
 
8666
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
8667
}
 
8668
 
 
8669
/// Tabulate the local-to-global mapping of dofs on a cell
 
8670
void UFC_NSEContinuity3DLinearForm_dof_map_4::tabulate_dofs(unsigned int* dofs,
 
8671
                                  const ufc::mesh& m,
 
8672
                                  const ufc::cell& c) const
 
8673
{
 
8674
    dofs[0] = c.entity_indices[3][0];
 
8675
}
 
8676
 
 
8677
/// Tabulate the local-to-local mapping from facet dofs to cell dofs
 
8678
void UFC_NSEContinuity3DLinearForm_dof_map_4::tabulate_facet_dofs(unsigned int* dofs,
 
8679
                                        unsigned int facet) const
 
8680
{
 
8681
    switch ( facet )
 
8682
    {
 
8683
    case 0:
 
8684
      
 
8685
      break;
 
8686
    case 1:
 
8687
      
 
8688
      break;
 
8689
    case 2:
 
8690
      
 
8691
      break;
 
8692
    case 3:
 
8693
      
 
8694
      break;
 
8695
    }
 
8696
}
 
8697
 
 
8698
/// Tabulate the local-to-local mapping of dofs on entity (d, i)
 
8699
void UFC_NSEContinuity3DLinearForm_dof_map_4::tabulate_entity_dofs(unsigned int* dofs,
 
8700
                                  unsigned int d, unsigned int i) const
 
8701
{
 
8702
    throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
 
8703
}
 
8704
 
 
8705
/// Tabulate the coordinates of all dofs on a cell
 
8706
void UFC_NSEContinuity3DLinearForm_dof_map_4::tabulate_coordinates(double** coordinates,
 
8707
                                         const ufc::cell& c) const
 
8708
{
 
8709
    const double * const * x = c.coordinates;
 
8710
    coordinates[0][0] = 0.25*x[0][0] + 0.25*x[1][0] + 0.25*x[2][0] + 0.25*x[3][0];
 
8711
    coordinates[0][1] = 0.25*x[0][1] + 0.25*x[1][1] + 0.25*x[2][1] + 0.25*x[3][1];
 
8712
    coordinates[0][2] = 0.25*x[0][2] + 0.25*x[1][2] + 0.25*x[2][2] + 0.25*x[3][2];
 
8713
}
 
8714
 
 
8715
/// Return the number of sub dof maps (for a mixed element)
 
8716
unsigned int UFC_NSEContinuity3DLinearForm_dof_map_4::num_sub_dof_maps() const
 
8717
{
 
8718
    return 1;
 
8719
}
 
8720
 
 
8721
/// Create a new dof_map for sub dof map i (for a mixed element)
 
8722
ufc::dof_map* UFC_NSEContinuity3DLinearForm_dof_map_4::create_sub_dof_map(unsigned int i) const
 
8723
{
 
8724
    return new UFC_NSEContinuity3DLinearForm_dof_map_4();
 
8725
}
 
8726
 
 
8727
 
 
8728
/// Constructor
8119
8729
UFC_NSEContinuity3DLinearForm_cell_integral_0::UFC_NSEContinuity3DLinearForm_cell_integral_0() : ufc::cell_integral()
8120
8730
{
8121
8731
    // Do nothing
8178
8788
    
8179
8789
    
8180
8790
    // Compute element tensor (using quadrature representation, optimisation level 2)
8181
 
    // Total number of operations to compute element tensor (from this point): 208
 
8791
    // Total number of operations to compute element tensor (from this point): 619
8182
8792
    
8183
8793
    // Reset values of the element tensor block
8184
8794
    for (unsigned int j = 0; j < 4; j++)
8186
8796
      A[j] = 0;
8187
8797
    }// end loop over 'j'
8188
8798
    
8189
 
    // Array of quadrature weights (tensor/monomial term 0)
 
8799
    // Array of quadrature weights (tensor/monomial terms (0, 2))
8190
8800
    const static double W0 = -0.166666666666666;
8191
8801
    // Array of quadrature weights (tensor/monomial term 1)
8192
8802
    const static double W1 = 0.333333333333333;
8193
8803
    
8194
 
    const static double P_t1_p0_s0[1][2] = \
 
8804
    const static double P_t2_s2_s2_s0[1][2] = \
8195
8805
    {{-1, 1}};
8196
8806
    // Array of non-zero columns
8197
 
    static const unsigned int nzc7[2] = {0, 1};
8198
 
    // Array of non-zero columns
8199
 
    static const unsigned int nzc0[2] = {0, 1};
8200
 
    // Array of non-zero columns
8201
 
    static const unsigned int nzc10[2] = {4, 5};
8202
 
    // Array of non-zero columns
8203
 
    static const unsigned int nzc3[2] = {8, 9};
8204
 
    // Array of non-zero columns
8205
 
    static const unsigned int nzc4[2] = {8, 10};
8206
 
    // Array of non-zero columns
8207
 
    static const unsigned int nzc5[2] = {8, 11};
8208
 
    // Array of non-zero columns
8209
 
    static const unsigned int nzc8[2] = {0, 2};
8210
 
    // Array of non-zero columns
8211
 
    static const unsigned int nzc6[2] = {0, 3};
8212
 
    // Array of non-zero columns
8213
 
    static const unsigned int nzc2[2] = {0, 3};
8214
 
    // Array of non-zero columns
8215
 
    static const unsigned int nzc1[2] = {0, 2};
8216
 
    // Array of non-zero columns
8217
 
    static const unsigned int nzc11[2] = {4, 7};
8218
 
    // Array of non-zero columns
8219
 
    static const unsigned int nzc9[2] = {4, 6};
 
8807
    static const unsigned int nzc9[2] = {0, 3};
 
8808
    // Array of non-zero columns
 
8809
    static const unsigned int nzc0[2] = {8, 9};
 
8810
    // Array of non-zero columns
 
8811
    static const unsigned int nzc3[2] = {8, 10};
 
8812
    // Array of non-zero columns
 
8813
    static const unsigned int nzc4[2] = {8, 11};
 
8814
    // Array of non-zero columns
 
8815
    static const unsigned int nzc5[2] = {4, 6};
 
8816
    // Array of non-zero columns
 
8817
    static const unsigned int nzc6[2] = {4, 5};
 
8818
    // Array of non-zero columns
 
8819
    static const unsigned int nzc7[2] = {4, 7};
 
8820
    // Array of non-zero columns
 
8821
    static const unsigned int nzc8[2] = {0, 1};
 
8822
    // Array of non-zero columns
 
8823
    static const unsigned int nzc10[2] = {0, 2};
 
8824
    // Array of non-zero columns
 
8825
    static const unsigned int nzc12[2] = {0, 2};
 
8826
    // Array of non-zero columns
 
8827
    static const unsigned int nzc13[2] = {0, 3};
 
8828
    // Array of non-zero columns
 
8829
    static const unsigned int nzc14[2] = {0, 1};
8220
8830
    
8221
 
    const static double P_t0_p0[1][4] = \
 
8831
    const static double P_t2_s1_s1[1][4] = \
8222
8832
    {{0.25, 0.25, 0.25, 0.25}};
 
8833
    // Array of non-zero columns
 
8834
    static const unsigned int nzc1[4] = {4, 5, 6, 7};
 
8835
    // Array of non-zero columns
 
8836
    static const unsigned int nzc2[4] = {8, 9, 10, 11};
 
8837
    // Array of non-zero columns
 
8838
    static const unsigned int nzc11[4] = {0, 1, 2, 3};
8223
8839
    
8224
 
    // Number of operations to compute geometry constants = 90
 
8840
    // Number of operations to compute geometry constants = 270
8225
8841
    const double G0 = Jinv_00*W0*det;
8226
8842
    const double G1 = Jinv_01*W0*det;
8227
8843
    const double G2 = Jinv_02*W0*det;
8231
8847
    const double G6 = Jinv_20*W0*det;
8232
8848
    const double G7 = Jinv_21*W0*det;
8233
8849
    const double G8 = Jinv_22*W0*det;
8234
 
    const double G9 = Jinv_00*Jinv_10*W1*det*w[2][0];
8235
 
    const double G10 = Jinv_01*Jinv_11*W1*det*w[2][0];
8236
 
    const double G11 = Jinv_02*Jinv_12*W1*det*w[2][0];
8237
 
    const double G12 = Jinv_10*Jinv_10*W1*det*w[2][0];
8238
 
    const double G13 = Jinv_10*Jinv_20*W1*det*w[2][0];
8239
 
    const double G14 = Jinv_11*Jinv_11*W1*det*w[2][0];
8240
 
    const double G15 = Jinv_11*Jinv_21*W1*det*w[2][0];
8241
 
    const double G16 = Jinv_12*Jinv_12*W1*det*w[2][0];
8242
 
    const double G17 = Jinv_12*Jinv_22*W1*det*w[2][0];
8243
 
    const double G18 = Jinv_00*Jinv_00*W1*det*w[2][0];
8244
 
    const double G19 = Jinv_00*Jinv_20*W1*det*w[2][0];
8245
 
    const double G20 = Jinv_01*Jinv_01*W1*det*w[2][0];
8246
 
    const double G21 = Jinv_01*Jinv_21*W1*det*w[2][0];
8247
 
    const double G22 = Jinv_02*Jinv_02*W1*det*w[2][0];
8248
 
    const double G23 = Jinv_02*Jinv_22*W1*det*w[2][0];
8249
 
    const double G24 = Jinv_20*Jinv_20*W1*det*w[2][0];
8250
 
    const double G25 = Jinv_21*Jinv_21*W1*det*w[2][0];
8251
 
    const double G26 = Jinv_22*Jinv_22*W1*det*w[2][0];
 
8850
    const double G9 = Jinv_00*Jinv_10*W0*det*w[2][0];
 
8851
    const double G10 = Jinv_00*Jinv_11*W0*det*w[2][0];
 
8852
    const double G11 = Jinv_00*Jinv_12*W0*det*w[2][0];
 
8853
    const double G12 = Jinv_01*Jinv_10*W0*det*w[2][0];
 
8854
    const double G13 = Jinv_01*Jinv_11*W0*det*w[2][0];
 
8855
    const double G14 = Jinv_01*Jinv_12*W0*det*w[2][0];
 
8856
    const double G15 = Jinv_02*Jinv_10*W0*det*w[2][0];
 
8857
    const double G16 = Jinv_02*Jinv_11*W0*det*w[2][0];
 
8858
    const double G17 = Jinv_02*Jinv_12*W0*det*w[2][0];
 
8859
    const double G18 = Jinv_10*Jinv_10*W0*det*w[2][0];
 
8860
    const double G19 = Jinv_10*Jinv_11*W0*det*w[2][0];
 
8861
    const double G20 = Jinv_10*Jinv_12*W0*det*w[2][0];
 
8862
    const double G21 = Jinv_10*Jinv_20*W0*det*w[2][0];
 
8863
    const double G22 = Jinv_10*Jinv_21*W0*det*w[2][0];
 
8864
    const double G23 = Jinv_10*Jinv_22*W0*det*w[2][0];
 
8865
    const double G24 = Jinv_11*Jinv_11*W0*det*w[2][0];
 
8866
    const double G25 = Jinv_11*Jinv_12*W0*det*w[2][0];
 
8867
    const double G26 = Jinv_11*Jinv_20*W0*det*w[2][0];
 
8868
    const double G27 = Jinv_11*Jinv_21*W0*det*w[2][0];
 
8869
    const double G28 = Jinv_11*Jinv_22*W0*det*w[2][0];
 
8870
    const double G29 = Jinv_12*Jinv_12*W0*det*w[2][0];
 
8871
    const double G30 = Jinv_12*Jinv_20*W0*det*w[2][0];
 
8872
    const double G31 = Jinv_12*Jinv_21*W0*det*w[2][0];
 
8873
    const double G32 = Jinv_12*Jinv_22*W0*det*w[2][0];
 
8874
    const double G33 = Jinv_00*Jinv_20*W0*det*w[2][0];
 
8875
    const double G34 = Jinv_00*Jinv_21*W0*det*w[2][0];
 
8876
    const double G35 = Jinv_00*Jinv_22*W0*det*w[2][0];
 
8877
    const double G36 = Jinv_01*Jinv_20*W0*det*w[2][0];
 
8878
    const double G37 = Jinv_01*Jinv_21*W0*det*w[2][0];
 
8879
    const double G38 = Jinv_01*Jinv_22*W0*det*w[2][0];
 
8880
    const double G39 = Jinv_02*Jinv_20*W0*det*w[2][0];
 
8881
    const double G40 = Jinv_02*Jinv_21*W0*det*w[2][0];
 
8882
    const double G41 = Jinv_02*Jinv_22*W0*det*w[2][0];
 
8883
    const double G42 = Jinv_20*Jinv_20*W0*det*w[2][0];
 
8884
    const double G43 = Jinv_20*Jinv_21*W0*det*w[2][0];
 
8885
    const double G44 = Jinv_20*Jinv_22*W0*det*w[2][0];
 
8886
    const double G45 = Jinv_21*Jinv_21*W0*det*w[2][0];
 
8887
    const double G46 = Jinv_21*Jinv_22*W0*det*w[2][0];
 
8888
    const double G47 = Jinv_22*Jinv_22*W0*det*w[2][0];
 
8889
    const double G48 = Jinv_00*Jinv_00*W0*det*w[2][0];
 
8890
    const double G49 = Jinv_00*Jinv_01*W0*det*w[2][0];
 
8891
    const double G50 = Jinv_00*Jinv_02*W0*det*w[2][0];
 
8892
    const double G51 = Jinv_01*Jinv_01*W0*det*w[2][0];
 
8893
    const double G52 = Jinv_01*Jinv_02*W0*det*w[2][0];
 
8894
    const double G53 = Jinv_02*Jinv_02*W0*det*w[2][0];
 
8895
    const double G54 = Jinv_00*Jinv_10*W1*det*w[3][0];
 
8896
    const double G55 = Jinv_01*Jinv_11*W1*det*w[3][0];
 
8897
    const double G56 = Jinv_02*Jinv_12*W1*det*w[3][0];
 
8898
    const double G57 = Jinv_10*Jinv_10*W1*det*w[3][0];
 
8899
    const double G58 = Jinv_10*Jinv_20*W1*det*w[3][0];
 
8900
    const double G59 = Jinv_11*Jinv_11*W1*det*w[3][0];
 
8901
    const double G60 = Jinv_11*Jinv_21*W1*det*w[3][0];
 
8902
    const double G61 = Jinv_12*Jinv_12*W1*det*w[3][0];
 
8903
    const double G62 = Jinv_12*Jinv_22*W1*det*w[3][0];
 
8904
    const double G63 = Jinv_00*Jinv_20*W1*det*w[3][0];
 
8905
    const double G64 = Jinv_01*Jinv_21*W1*det*w[3][0];
 
8906
    const double G65 = Jinv_02*Jinv_22*W1*det*w[3][0];
 
8907
    const double G66 = Jinv_20*Jinv_20*W1*det*w[3][0];
 
8908
    const double G67 = Jinv_21*Jinv_21*W1*det*w[3][0];
 
8909
    const double G68 = Jinv_22*Jinv_22*W1*det*w[3][0];
 
8910
    const double G69 = Jinv_00*Jinv_00*W1*det*w[3][0];
 
8911
    const double G70 = Jinv_01*Jinv_01*W1*det*w[3][0];
 
8912
    const double G71 = Jinv_02*Jinv_02*W1*det*w[3][0];
8252
8913
    
8253
 
    // Loop quadrature points (tensor/monomial terms (0, 1))
8254
 
    // Number of operations to compute element tensor for following IP loop = 118
 
8914
    // Loop quadrature points (tensor/monomial terms (0, 1, 2))
 
8915
    // Number of operations to compute element tensor for following IP loop = 349
8255
8916
    // Only 1 integration point, omitting IP loop.
8256
8917
    
8257
8918
    // Declare function values.
8267
8928
    double F9 = 0;
8268
8929
    double F10 = 0;
8269
8930
    double F11 = 0;
 
8931
    double F12 = 0;
 
8932
    double F13 = 0;
 
8933
    double F14 = 0;
 
8934
    double F15 = 0;
 
8935
    double F16 = 0;
 
8936
    double F17 = 0;
 
8937
    double F18 = 0;
 
8938
    double F19 = 0;
 
8939
    double F20 = 0;
 
8940
    double F21 = 0;
 
8941
    double F22 = 0;
 
8942
    double F23 = 0;
8270
8943
    
8271
8944
    // Compute function values.
8272
8945
    // Number of operations to compute values = 48
8273
8946
    for (unsigned int r = 0; r < 2; r++)
8274
8947
    {
8275
 
      F0 += P_t1_p0_s0[0][r]*w[1][nzc7[r]];
8276
 
      F1 += P_t1_p0_s0[0][r]*w[1][nzc10[r]];
8277
 
      F2 += P_t1_p0_s0[0][r]*w[1][nzc3[r]];
8278
 
      F3 += P_t1_p0_s0[0][r]*w[1][nzc8[r]];
8279
 
      F4 += P_t1_p0_s0[0][r]*w[1][nzc9[r]];
8280
 
      F5 += P_t1_p0_s0[0][r]*w[1][nzc4[r]];
8281
 
      F6 += P_t1_p0_s0[0][r]*w[1][nzc6[r]];
8282
 
      F7 += P_t1_p0_s0[0][r]*w[1][nzc11[r]];
8283
 
      F8 += P_t1_p0_s0[0][r]*w[1][nzc5[r]];
8284
 
      F9 += P_t1_p0_s0[0][r]*w[0][nzc0[r]];
8285
 
      F10 += P_t1_p0_s0[0][r]*w[0][nzc1[r]];
8286
 
      F11 += P_t1_p0_s0[0][r]*w[0][nzc2[r]];
 
8948
      F0 += P_t2_s2_s2_s0[0][r]*w[1][nzc14[r]];
 
8949
      F1 += P_t2_s2_s2_s0[0][r]*w[1][nzc6[r]];
 
8950
      F2 += P_t2_s2_s2_s0[0][r]*w[1][nzc0[r]];
 
8951
      F3 += P_t2_s2_s2_s0[0][r]*w[1][nzc12[r]];
 
8952
      F4 += P_t2_s2_s2_s0[0][r]*w[1][nzc5[r]];
 
8953
      F5 += P_t2_s2_s2_s0[0][r]*w[1][nzc3[r]];
 
8954
      F6 += P_t2_s2_s2_s0[0][r]*w[1][nzc13[r]];
 
8955
      F7 += P_t2_s2_s2_s0[0][r]*w[1][nzc7[r]];
 
8956
      F8 += P_t2_s2_s2_s0[0][r]*w[1][nzc4[r]];
 
8957
      F23 += P_t2_s2_s2_s0[0][r]*w[0][nzc9[r]];
 
8958
      F22 += P_t2_s2_s2_s0[0][r]*w[0][nzc10[r]];
 
8959
      F21 += P_t2_s2_s2_s0[0][r]*w[0][nzc8[r]];
 
8960
    }// end loop over 'r'
 
8961
    // Number of operations to compute values = 36
 
8962
    for (unsigned int s = 0; s < 2; s++)
 
8963
    {
 
8964
      F18 += P_t2_s2_s2_s0[0][s]*w[1][nzc3[s]];
 
8965
      F20 += P_t2_s2_s2_s0[0][s]*w[1][nzc4[s]];
 
8966
      F19 += P_t2_s2_s2_s0[0][s]*w[1][nzc7[s]];
 
8967
      F12 += P_t2_s2_s2_s0[0][s]*w[1][nzc14[s]];
 
8968
      F13 += P_t2_s2_s2_s0[0][s]*w[1][nzc6[s]];
 
8969
      F16 += P_t2_s2_s2_s0[0][s]*w[1][nzc13[s]];
 
8970
      F17 += P_t2_s2_s2_s0[0][s]*w[1][nzc5[s]];
 
8971
      F14 += P_t2_s2_s2_s0[0][s]*w[1][nzc0[s]];
 
8972
      F15 += P_t2_s2_s2_s0[0][s]*w[1][nzc12[s]];
 
8973
    }// end loop over 's'
 
8974
    // Number of operations to compute values = 24
 
8975
    for (unsigned int r = 0; r < 4; r++)
 
8976
    {
 
8977
      F9 += P_t2_s1_s1[0][r]*w[1][nzc11[r]];
 
8978
      F10 += P_t2_s1_s1[0][r]*w[1][nzc1[r]];
 
8979
      F11 += P_t2_s1_s1[0][r]*w[1][nzc2[r]];
8287
8980
    }// end loop over 'r'
8288
8981
    
8289
 
    // Number of operations to compute declarations = 50
8290
 
    const double Gip0 = (G12 + G14 + G16)*F10 + (G10 + G11 + G9)*F9 + (G13 + G15 + G17)*F11;
8291
 
    const double Gip1 = (G19 + G21 + G23)*F11 + (G10 + G11 + G9)*F10 + (G18 + G20 + G22)*F9;
8292
 
    const double Gip2 = (G24 + G25 + G26)*F11 + (G13 + G15 + G17)*F10 + (G19 + G21 + G23)*F9;
 
8982
    // Number of operations to compute declarations = 221
 
8983
    const double Gip0 = (G69 + G70 + G71)*F21 + (G54 + G55 + G56)*F22 + (G63 + G64 + G65)*F23 + (F12*G48 + F13*G49 + F14*G50 + F15*G9 + F16*G33 + F17*G12 + F18*G15 + F19*G36 + F20*G39)*F9 + (F12*G50 + F13*G52 + F14*G53 + F15*G11 + F16*G35 + F17*G14 + F18*G17 + F19*G38 + F20*G41)*F11 + (F12*G49 + F13*G51 + F14*G52 + F15*G10 + F16*G34 + F17*G13 + F18*G16 + F19*G37 + F20*G40)*F10;
 
8984
    const double Gip1 = (G63 + G64 + G65)*F21 + (G58 + G60 + G62)*F22 + (G66 + G67 + G68)*F23 + (F12*G33 + F13*G34 + F14*G35 + F15*G21 + F16*G42 + F17*G22 + F18*G23 + F19*G43 + F20*G44)*F9 + (F12*G39 + F13*G40 + F14*G41 + F15*G30 + F16*G44 + F17*G31 + F18*G32 + F19*G46 + F20*G47)*F11 + (F12*G36 + F13*G37 + F14*G38 + F15*G26 + F16*G43 + F17*G27 + F18*G28 + F19*G45 + F20*G46)*F10;
 
8985
    const double Gip2 = (G54 + G55 + G56)*F21 + (G57 + G59 + G61)*F22 + (G58 + G60 + G62)*F23 + (F12*G9 + F13*G10 + F14*G11 + F15*G18 + F16*G21 + F17*G19 + F18*G20 + F19*G26 + F20*G30)*F9 + (F12*G15 + F13*G16 + F14*G17 + F15*G20 + F16*G23 + F17*G25 + F18*G29 + F19*G28 + F20*G32)*F11 + (F12*G12 + F13*G13 + F14*G14 + F15*G19 + F16*G22 + F17*G24 + F18*G25 + F19*G27 + F20*G31)*F10;
8293
8986
    const double Gip3 = F0*G0 + F1*G1 + F2*G2 + F3*G3 + F4*G4 + F5*G5 + F6*G6 + F7*G7 + F8*G8;
8294
8987
    
8295
8988
    // Loop primary indices.
8297
8990
    for (unsigned int j = 0; j < 2; j++)
8298
8991
    {
8299
8992
      // Number of operations to compute entry = 2
8300
 
      A[nzc1[j]] += P_t1_p0_s0[0][j]*Gip0;
8301
 
      // Number of operations to compute entry = 2
8302
 
      A[nzc0[j]] += P_t1_p0_s0[0][j]*Gip1;
8303
 
      // Number of operations to compute entry = 2
8304
 
      A[nzc2[j]] += P_t1_p0_s0[0][j]*Gip2;
 
8993
      A[nzc8[j]] += P_t2_s2_s2_s0[0][j]*Gip0;
 
8994
      // Number of operations to compute entry = 2
 
8995
      A[nzc9[j]] += P_t2_s2_s2_s0[0][j]*Gip1;
 
8996
      // Number of operations to compute entry = 2
 
8997
      A[nzc10[j]] += P_t2_s2_s2_s0[0][j]*Gip2;
8305
8998
    }// end loop over 'j'
8306
8999
    
8307
9000
    // Number of operations for primary indices = 8
8308
9001
    for (unsigned int j = 0; j < 4; j++)
8309
9002
    {
8310
9003
      // Number of operations to compute entry = 2
8311
 
      A[j] += P_t0_p0[0][j]*Gip3;
 
9004
      A[j] += P_t2_s1_s1[0][j]*Gip3;
8312
9005
    }// end loop over 'j'
8313
9006
    
8314
9007
}
8328
9021
/// Return a string identifying the form
8329
9022
const char* UFC_NSEContinuity3DLinearForm::signature() const
8330
9023
{
8331
 
    return "-w1_a0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11](dXa1[0, 1, 2]/dxa2[0, 1, 2]) | vi0[0, 1, 2, 3]*((d/dXa1[0, 1, 2])va0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11][a2[0, 1, 2]])*dX(0) + 2.0w2_a0[0]w0_a1[0, 1, 2, 3](dXa2[0, 1, 2]/dxb0[0, 1, 2])(dXa3[0, 1, 2]/dxb0[0, 1, 2]) | va0[0]*((d/dXa2[0, 1, 2])vi0[0, 1, 2, 3])*((d/dXa3[0, 1, 2])va1[0, 1, 2, 3])*dX(0)";
 
9024
    return "-w1_a0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11](dXa1[0, 1, 2]/dxa2[0, 1, 2]) | vi0[0, 1, 2, 3]*((d/dXa1[0, 1, 2])va0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11][a2[0, 1, 2]])*dX(0) + 2.0w3_a0[0]w0_a1[0, 1, 2, 3](dXa2[0, 1, 2]/dxb0[0, 1, 2])(dXa3[0, 1, 2]/dxb0[0, 1, 2]) | va0[0]*((d/dXa2[0, 1, 2])vi0[0, 1, 2, 3])*((d/dXa3[0, 1, 2])va1[0, 1, 2, 3])*dX(0) + -w2_a0[0]w1_a1[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]w1_a2[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11](dXa3[0, 1, 2]/dxa5[0, 1, 2])(dXa4[0, 1, 2]/dxa6[0, 1, 2]) | va0[0]*va1[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11][a5[0, 1, 2]]*((d/dXa3[0, 1, 2])va2[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11][a6[0, 1, 2]])*((d/dXa4[0, 1, 2])vi0[0, 1, 2, 3])*dX(0)";
8332
9025
}
8333
9026
 
8334
9027
/// Return the rank of the global tensor (r)
8340
9033
/// Return the number of coefficients (n)
8341
9034
unsigned int UFC_NSEContinuity3DLinearForm::num_coefficients() const
8342
9035
{
8343
 
    return 3;
 
9036
    return 4;
8344
9037
}
8345
9038
 
8346
9039
/// Return the number of cell integrals
8378
9071
    case 3:
8379
9072
      return new UFC_NSEContinuity3DLinearForm_finite_element_3();
8380
9073
      break;
 
9074
    case 4:
 
9075
      return new UFC_NSEContinuity3DLinearForm_finite_element_4();
 
9076
      break;
8381
9077
    }
8382
9078
    return 0;
8383
9079
}
8399
9095
    case 3:
8400
9096
      return new UFC_NSEContinuity3DLinearForm_dof_map_3();
8401
9097
      break;
 
9098
    case 4:
 
9099
      return new UFC_NSEContinuity3DLinearForm_dof_map_4();
 
9100
      break;
8402
9101
    }
8403
9102
    return 0;
8404
9103
}