[cig-commits] commit: MADDs-5a compiles for 0.9.5
Mercurial
hg at geodynamics.org
Wed Dec 9 20:51:19 PST 2009
changeset: 104:4a13310e1545
user: Marc Spiegelman <mspieg at ldeo.columbia.edu>
date: Sun Dec 06 21:52:19 2009 -0500
files: MADDs-5/MADDs-5a/cpp/PetscUtilities.cpp MADDs-5/MADDs-5a/cpp/PetscUtilities.h MADDs-5/MADDs-5a/cpp/SConstruct MADDs-5/MADDs-5a/cpp/Stokes_P2P1.h MADDs-5/MADDs-5a/cpp/Stokes_P2P1.ufl MADDs-5/MADDs-5a/cpp/forms/Stokes_P2P1.ufl MADDs-5/MADDs-5a/cpp/main.cpp
description:
MADDs-5a compiles for 0.9.5
diff -r 0b9832b2bf6b -r 4a13310e1545 MADDs-5/MADDs-5a/cpp/PetscUtilities.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MADDs-5/MADDs-5a/cpp/PetscUtilities.cpp Sun Dec 06 21:52:19 2009 -0500
@@ -0,0 +1,82 @@
+// Copyright (C) 2008 Marc Spiegelman
+// Licensed under the GNU LGPL Version 2.1.
+//
+// First added: 6 Mar 2009 17:50:29
+// Last changed: 6 Dec 2009 21:47:12
+//
+// source file for mixed PETSc/Dolfin utility functions
+//
+
+
+
+
+#include "PetscUtilities.h"
+
+
+//-----------------------------------------------------------------------------
+//utility routine to use find maximum magnitude of a vector valued function V using petsc vec operations
+// and the global dof_number i_max
+PetscErrorCode FindMaxMagV(double& max_mag_v, dolfin::uint& imax, Function& V)
+{
+ Function V0 = V[0];
+ Function V1 = V[1]; //FixME: hardwired to 2-D functions at the moment
+
+ PETScVector mag_v(V0.vector().size()), v_tmp(V0.vector().size());
+
+ //calculate the magnitude of the melt flux
+ mag_v = V0.vector();
+ mag_v *= V0.vector();
+ v_tmp = V1.vector();
+ v_tmp *= V1.vector();
+ mag_v += v_tmp;
+
+ //find the max value and location of V squared
+ int i_max;
+ double v_squared_max;
+ VecMax(*(mag_v.vec()), &i_max, &v_squared_max);
+
+ max_mag_v = sqrt(v_squared_max);
+ imax = i_max;
+
+ //printf("max|V|^2=%g, max|V|=%g, at point %d\n",v_squared_max,max_mag_v,i_max);
+ PetscFunctionReturn(0);
+}
+
+
+// Additional Utility functions for calculating maximum melt velocity
+
+//-----------------------------------------------------------------------------
+//utility routine to use find maximum magnitude of the melt velocity using petsc vec operations
+// only issue is that the melt_flux and the porosity are not necessarily in the same FunctionSpace,
+// will need to interpolate the porosity to the same function space as the melt_flux
+PetscErrorCode FindMaxMeltVelocity(double& max_mag_v, Function& melt_flux, Function& f, const double& U0onw0, const double& epsilon )
+{
+
+ //find maximum melt flux
+ double qMax;
+ dolfin::uint iMax;
+ FindMaxMagV(qMax, iMax, melt_flux);
+
+ //interpolate the porosity to the same function space as the scalar melt flux
+ Function qx = melt_flux[0];
+ Function f_interp(qx.function_space());
+ f_interp.interpolate(f);
+
+ //find the porosity at the location of maximum flux
+ double fMax;
+ fMax = f_interp.vector()[iMax];
+
+ //check for zero divide or extremely small porosities
+ if (fMax < epsilon) {
+ max_mag_v = U0onw0;
+ }
+ else {
+ max_mag_v = qMax/fMax;
+ }
+ printf("max_flux = %g, f at max = %g, max |v|=%g\n",qMax,fMax,max_mag_v);
+ PetscFunctionReturn(0);
+
+
+}
+//-----------------------------------------------------------------------------
+
diff -r 0b9832b2bf6b -r 4a13310e1545 MADDs-5/MADDs-5a/cpp/PetscUtilities.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MADDs-5/MADDs-5a/cpp/PetscUtilities.h Sun Dec 06 21:52:19 2009 -0500
@@ -0,0 +1,37 @@
+// Copyright (C) 2008 Marc Spiegelman
+// Licensed under the GNU LGPL Version 2.1.
+//
+// First added: 6 Mar 2009 17:50:29
+// Last changed: 6 Mar 2009 17:50:35
+//
+// prototype file for PETSC/Dolfin utility functions
+//
+
+
+#include <math.h>
+#include <boost/shared_ptr.hpp>
+#include "petsc.h"
+#include "petscsnes.h"
+
+#include <dolfin/log/log.h>
+#include <dolfin/parameter/dolfin_parameter.h>
+#include <dolfin/fem/Assembler.h>
+#include <dolfin/fem/BoundaryCondition.h>
+#include <dolfin/fem/DirichletBC.h>
+#include <dolfin/function/Function.h>
+#include <dolfin/function/FunctionSpace.h>
+#include <dolfin/common/NoDeleter.h>
+#include <dolfin/la/Vector.h>
+#include <dolfin/la/PETScMatrix.h>
+#include <dolfin/la/PETScVector.h>
+#include <dolfin/la/PETScKrylovSolver.h>
+
+
+using namespace dolfin;
+
+//PETSc Utility functions for finding
+
+extern PetscErrorCode FindMaxMagV(double& max_mag_v, dolfin::uint& imax, Function& V);
+extern PetscErrorCode FindMaxMeltVelocity(double& max_mag_v, Function& melt_flux, Function& f, const double& U0onw0, const double& epsilon );
+
+
diff -r 0b9832b2bf6b -r 4a13310e1545 MADDs-5/MADDs-5a/cpp/SConstruct
--- a/MADDs-5/MADDs-5a/cpp/SConstruct Sun Dec 06 14:03:20 2009 -0500
+++ b/MADDs-5/MADDs-5a/cpp/SConstruct Sun Dec 06 21:52:19 2009 -0500
@@ -13,4 +13,4 @@ env.ParseConfig('pkg-config --cflags --l
env.ParseConfig('pkg-config --cflags --libs dolfin')
# Program name
-env.Program('MADDs-5a', ['main.cpp', 'utils.cpp', 'PetscFunctions.cpp','PETScMagmaFSSNESInitialize.cpp','MagmaEquations.cpp','SemiLagrangianRHS.cpp','Projection.cpp','MeltFlux.cpp'])
+env.Program('MADDs-5a', ['main.cpp', 'utils.cpp', 'PetscFunctions.cpp','PETScMagmaFSSNESInitialize.cpp','PetscUtilities.cpp','MagmaEquations.cpp','SemiLagrangianRHS.cpp','Projection.cpp','MeltFlux.cpp'])
diff -r 0b9832b2bf6b -r 4a13310e1545 MADDs-5/MADDs-5a/cpp/Stokes_P2P1.h
--- a/MADDs-5/MADDs-5a/cpp/Stokes_P2P1.h Sun Dec 06 14:03:20 2009 -0500
+++ b/MADDs-5/MADDs-5a/cpp/Stokes_P2P1.h Sun Dec 06 21:52:19 2009 -0500
@@ -1,5 +1,5 @@
// This code conforms with the UFC specification version 1.0
-// and was automatically generated by FFC version 0.6.1.
+// and was automatically generated by FFC version 0.7.1.
//
// Warning: This code was generated with the option '-l dolfin'
// and contains DOLFIN-specific wrappers that depend on DOLFIN.
@@ -14,67 +14,67 @@
/// This class defines the interface for a finite element.
-class UFC_Stokes_P2P1BilinearForm_finite_element_0_0_0: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_finite_element_0_0_0() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_finite_element_0_0_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "FiniteElement('Lagrange', 'triangle', 2)";
- }
-
- /// Return the cell shape
- virtual ufc::shape cell_shape() const
- {
- return ufc::triangle;
- }
-
- /// Return the dimension of the finite element function space
- virtual unsigned int space_dimension() const
- {
- return 6;
- }
-
- /// Return the rank of the value space
- virtual unsigned int value_rank() const
- {
- return 0;
- }
-
- /// Return the dimension of the value space for axis i
- virtual unsigned int value_dimension(unsigned int i) const
- {
- return 1;
- }
-
- /// Evaluate basis function i at given point in cell
- virtual void evaluate_basis(unsigned int i,
- double* values,
- const double* coordinates,
- const ufc::cell& c) const
- {
- // Extract vertex coordinates
- const double * const * element_coordinates = c.coordinates;
-
- // Compute Jacobian of affine map from reference cell
- const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
- const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
- const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
- const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+class stokes_p2p1_0_finite_element_0_0_0: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_0_finite_element_0_0_0() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_finite_element_0_0_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
+ }
+
+ /// Return the cell shape
+ virtual ufc::shape cell_shape() const
+ {
+ return ufc::triangle;
+ }
+
+ /// Return the dimension of the finite element function space
+ virtual unsigned int space_dimension() const
+ {
+ return 6;
+ }
+
+ /// Return the rank of the value space
+ virtual unsigned int value_rank() const
+ {
+ return 0;
+ }
+
+ /// Return the dimension of the value space for axis i
+ virtual unsigned int value_dimension(unsigned int i) const
+ {
+ return 1;
+ }
+
+ /// Evaluate basis function i at given point in cell
+ virtual void evaluate_basis(unsigned int i,
+ double* values,
+ const double* coordinates,
+ const ufc::cell& c) const
+ {
+ // Extract vertex coordinates
+ const double * const * element_coordinates = c.coordinates;
+
+ // Compute Jacobian of affine map from reference cell
+ const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
+ const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
+ const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
+ const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -128,7 +128,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -171,69 +171,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -285,7 +285,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -295,7 +295,7 @@ public:
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -303,7 +303,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -414,9 +414,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
- const static double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
+ static const double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
+ static const double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -443,7 +443,7 @@ public:
// Take directional components
for(int k = 0; k < 1; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -477,74 +477,74 @@ public:
/// Create a new finite element for sub element i (for a mixed element)
virtual ufc::finite_element* create_sub_element(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_finite_element_0_0_0();
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1BilinearForm_finite_element_0_0_1: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_finite_element_0_0_1() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_finite_element_0_0_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "FiniteElement('Lagrange', 'triangle', 2)";
- }
-
- /// Return the cell shape
- virtual ufc::shape cell_shape() const
- {
- return ufc::triangle;
- }
-
- /// Return the dimension of the finite element function space
- virtual unsigned int space_dimension() const
- {
- return 6;
- }
-
- /// Return the rank of the value space
- virtual unsigned int value_rank() const
- {
- return 0;
- }
-
- /// Return the dimension of the value space for axis i
- virtual unsigned int value_dimension(unsigned int i) const
- {
- return 1;
- }
-
- /// Evaluate basis function i at given point in cell
- virtual void evaluate_basis(unsigned int i,
- double* values,
- const double* coordinates,
- const ufc::cell& c) const
- {
- // Extract vertex coordinates
- const double * const * element_coordinates = c.coordinates;
-
- // Compute Jacobian of affine map from reference cell
- const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
- const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
- const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
- const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+ return new stokes_p2p1_0_finite_element_0_0_0();
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_0_finite_element_0_0_1: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_0_finite_element_0_0_1() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_finite_element_0_0_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
+ }
+
+ /// Return the cell shape
+ virtual ufc::shape cell_shape() const
+ {
+ return ufc::triangle;
+ }
+
+ /// Return the dimension of the finite element function space
+ virtual unsigned int space_dimension() const
+ {
+ return 6;
+ }
+
+ /// Return the rank of the value space
+ virtual unsigned int value_rank() const
+ {
+ return 0;
+ }
+
+ /// Return the dimension of the value space for axis i
+ virtual unsigned int value_dimension(unsigned int i) const
+ {
+ return 1;
+ }
+
+ /// Evaluate basis function i at given point in cell
+ virtual void evaluate_basis(unsigned int i,
+ double* values,
+ const double* coordinates,
+ const ufc::cell& c) const
+ {
+ // Extract vertex coordinates
+ const double * const * element_coordinates = c.coordinates;
+
+ // Compute Jacobian of affine map from reference cell
+ const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
+ const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
+ const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
+ const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -598,7 +598,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -641,69 +641,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -755,7 +755,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -765,7 +765,7 @@ public:
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -773,7 +773,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -884,9 +884,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
- const static double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
+ static const double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
+ static const double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -913,7 +913,7 @@ public:
// Take directional components
for(int k = 0; k < 1; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -947,33 +947,33 @@ public:
/// Create a new finite element for sub element i (for a mixed element)
virtual ufc::finite_element* create_sub_element(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_finite_element_0_0_1();
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1BilinearForm_finite_element_0_0: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_finite_element_0_0() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_finite_element_0_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)])";
+ return new stokes_p2p1_0_finite_element_0_0_1();
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_0_finite_element_0_0: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_0_finite_element_0_0() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_finite_element_0_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2)";
}
/// Return the cell shape
@@ -1014,7 +1014,7 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -1071,7 +1071,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -1123,7 +1123,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -1168,69 +1168,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -1284,17 +1284,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -1302,7 +1302,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -1430,17 +1430,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -1448,7 +1448,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -1561,9 +1561,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[12][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
- const static double W[12][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[12][1][2] = {{{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}};
+ static const double X[12][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
+ static const double W[12][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[12][1][2] = {{{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -1590,7 +1590,7 @@ public:
// Take directional components
for(int k = 0; k < 2; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -1631,80 +1631,80 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1BilinearForm_finite_element_0_0_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1BilinearForm_finite_element_0_0_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1BilinearForm_finite_element_0_1: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_finite_element_0_1() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_finite_element_0_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "FiniteElement('Lagrange', 'triangle', 1)";
- }
-
- /// Return the cell shape
- virtual ufc::shape cell_shape() const
- {
- return ufc::triangle;
- }
-
- /// Return the dimension of the finite element function space
- virtual unsigned int space_dimension() const
- {
- return 3;
- }
-
- /// Return the rank of the value space
- virtual unsigned int value_rank() const
- {
- return 0;
- }
-
- /// Return the dimension of the value space for axis i
- virtual unsigned int value_dimension(unsigned int i) const
- {
- return 1;
- }
-
- /// Evaluate basis function i at given point in cell
- virtual void evaluate_basis(unsigned int i,
- double* values,
- const double* coordinates,
- const ufc::cell& c) const
- {
- // Extract vertex coordinates
- const double * const * element_coordinates = c.coordinates;
-
- // Compute Jacobian of affine map from reference cell
- const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
- const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
- const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
- const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+ return new stokes_p2p1_0_finite_element_0_0_0();
+ break;
+ case 1:
+ return new stokes_p2p1_0_finite_element_0_0_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_0_finite_element_0_1: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_0_finite_element_0_1() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_finite_element_0_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)";
+ }
+
+ /// Return the cell shape
+ virtual ufc::shape cell_shape() const
+ {
+ return ufc::triangle;
+ }
+
+ /// Return the dimension of the finite element function space
+ virtual unsigned int space_dimension() const
+ {
+ return 3;
+ }
+
+ /// Return the rank of the value space
+ virtual unsigned int value_rank() const
+ {
+ return 0;
+ }
+
+ /// Return the dimension of the value space for axis i
+ virtual unsigned int value_dimension(unsigned int i) const
+ {
+ return 1;
+ }
+
+ /// Evaluate basis function i at given point in cell
+ virtual void evaluate_basis(unsigned int i,
+ double* values,
+ const double* coordinates,
+ const ufc::cell& c) const
+ {
+ // Extract vertex coordinates
+ const double * const * element_coordinates = c.coordinates;
+
+ // Compute Jacobian of affine map from reference cell
+ const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
+ const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
+ const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
+ const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -1750,7 +1750,7 @@ public:
const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
// Table(s) of coefficients
- const static double coefficients0[3][3] = \
+ static const double coefficients0[3][3] = \
{{0.471404520791032, -0.288675134594813, -0.166666666666667},
{0.471404520791032, 0.288675134594813, -0.166666666666667},
{0.471404520791032, 0, 0.333333333333333}};
@@ -1787,69 +1787,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -1893,19 +1893,19 @@ public:
const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
// Table(s) of coefficients
- const static double coefficients0[3][3] = \
+ static const double coefficients0[3][3] = \
{{0.471404520791032, -0.288675134594813, -0.166666666666667},
{0.471404520791032, 0.288675134594813, -0.166666666666667},
{0.471404520791032, 0, 0.333333333333333}};
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[3][3] = \
+ static const double dmats0[3][3] = \
{{0, 0, 0},
{4.89897948556636, 0, 0},
{0, 0, 0}};
- const static double dmats1[3][3] = \
+ static const double dmats1[3][3] = \
{{0, 0, 0},
{2.44948974278318, 0, 0},
{4.24264068711928, 0, 0}};
@@ -1995,9 +1995,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[3][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}};
- const static double W[3][1] = {{1}, {1}, {1}};
- const static double D[3][1][1] = {{{1}}, {{1}}, {{1}}};
+ static const double X[3][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}};
+ static const double W[3][1] = {{1}, {1}, {1}};
+ static const double D[3][1][1] = {{{1}}, {{1}}, {{1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -2024,7 +2024,7 @@ public:
// Take directional components
for(int k = 0; k < 1; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -2058,33 +2058,33 @@ public:
/// Create a new finite element for sub element i (for a mixed element)
virtual ufc::finite_element* create_sub_element(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_finite_element_0_1();
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1BilinearForm_finite_element_0: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_finite_element_0() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_finite_element_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "MixedElement([MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)]), FiniteElement('Lagrange', 'triangle', 1)])";
+ return new stokes_p2p1_0_finite_element_0_1();
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_0_finite_element_0: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_0_finite_element_0() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_finite_element_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) })";
}
/// Return the cell shape
@@ -2125,7 +2125,7 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -2183,7 +2183,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -2235,7 +2235,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -2279,7 +2279,7 @@ public:
const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
// Table(s) of coefficients
- const static double coefficients0[3][3] = \
+ static const double coefficients0[3][3] = \
{{0.471404520791032, -0.288675134594813, -0.166666666666667},
{0.471404520791032, 0.288675134594813, -0.166666666666667},
{0.471404520791032, 0, 0.333333333333333}};
@@ -2318,69 +2318,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -2434,17 +2434,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -2452,7 +2452,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -2580,17 +2580,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -2598,7 +2598,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -2718,19 +2718,19 @@ public:
const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
// Table(s) of coefficients
- const static double coefficients0[3][3] = \
+ static const double coefficients0[3][3] = \
{{0.471404520791032, -0.288675134594813, -0.166666666666667},
{0.471404520791032, 0.288675134594813, -0.166666666666667},
{0.471404520791032, 0, 0.333333333333333}};
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[3][3] = \
+ static const double dmats0[3][3] = \
{{0, 0, 0},
{4.89897948556636, 0, 0},
{0, 0, 0}};
- const static double dmats1[3][3] = \
+ static const double dmats1[3][3] = \
{{0, 0, 0},
{2.44948974278318, 0, 0},
{4.24264068711928, 0, 0}};
@@ -2822,9 +2822,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}};
- const static double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[15][1][3] = {{{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 0, 1}}, {{0, 0, 1}}, {{0, 0, 1}}};
+ static const double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}};
+ static const double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[15][1][3] = {{{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 0, 1}}, {{0, 0, 1}}, {{0, 0, 1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -2851,7 +2851,7 @@ public:
// Take directional components
for(int k = 0; k < 3; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -2896,80 +2896,80 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1BilinearForm_finite_element_0_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1BilinearForm_finite_element_0_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1BilinearForm_finite_element_1_0_0: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_finite_element_1_0_0() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_finite_element_1_0_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "FiniteElement('Lagrange', 'triangle', 2)";
- }
-
- /// Return the cell shape
- virtual ufc::shape cell_shape() const
- {
- return ufc::triangle;
- }
-
- /// Return the dimension of the finite element function space
- virtual unsigned int space_dimension() const
- {
- return 6;
- }
-
- /// Return the rank of the value space
- virtual unsigned int value_rank() const
- {
- return 0;
- }
-
- /// Return the dimension of the value space for axis i
- virtual unsigned int value_dimension(unsigned int i) const
- {
- return 1;
- }
-
- /// Evaluate basis function i at given point in cell
- virtual void evaluate_basis(unsigned int i,
- double* values,
- const double* coordinates,
- const ufc::cell& c) const
- {
- // Extract vertex coordinates
- const double * const * element_coordinates = c.coordinates;
-
- // Compute Jacobian of affine map from reference cell
- const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
- const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
- const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
- const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+ return new stokes_p2p1_0_finite_element_0_0();
+ break;
+ case 1:
+ return new stokes_p2p1_0_finite_element_0_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_0_finite_element_1_0_0: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_0_finite_element_1_0_0() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_finite_element_1_0_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
+ }
+
+ /// Return the cell shape
+ virtual ufc::shape cell_shape() const
+ {
+ return ufc::triangle;
+ }
+
+ /// Return the dimension of the finite element function space
+ virtual unsigned int space_dimension() const
+ {
+ return 6;
+ }
+
+ /// Return the rank of the value space
+ virtual unsigned int value_rank() const
+ {
+ return 0;
+ }
+
+ /// Return the dimension of the value space for axis i
+ virtual unsigned int value_dimension(unsigned int i) const
+ {
+ return 1;
+ }
+
+ /// Evaluate basis function i at given point in cell
+ virtual void evaluate_basis(unsigned int i,
+ double* values,
+ const double* coordinates,
+ const ufc::cell& c) const
+ {
+ // Extract vertex coordinates
+ const double * const * element_coordinates = c.coordinates;
+
+ // Compute Jacobian of affine map from reference cell
+ const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
+ const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
+ const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
+ const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -3023,7 +3023,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -3066,69 +3066,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -3180,7 +3180,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -3190,7 +3190,7 @@ public:
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -3198,7 +3198,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -3309,9 +3309,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
- const static double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
+ static const double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
+ static const double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -3338,7 +3338,7 @@ public:
// Take directional components
for(int k = 0; k < 1; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -3372,74 +3372,74 @@ public:
/// Create a new finite element for sub element i (for a mixed element)
virtual ufc::finite_element* create_sub_element(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_finite_element_1_0_0();
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1BilinearForm_finite_element_1_0_1: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_finite_element_1_0_1() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_finite_element_1_0_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "FiniteElement('Lagrange', 'triangle', 2)";
- }
-
- /// Return the cell shape
- virtual ufc::shape cell_shape() const
- {
- return ufc::triangle;
- }
-
- /// Return the dimension of the finite element function space
- virtual unsigned int space_dimension() const
- {
- return 6;
- }
-
- /// Return the rank of the value space
- virtual unsigned int value_rank() const
- {
- return 0;
- }
-
- /// Return the dimension of the value space for axis i
- virtual unsigned int value_dimension(unsigned int i) const
- {
- return 1;
- }
-
- /// Evaluate basis function i at given point in cell
- virtual void evaluate_basis(unsigned int i,
- double* values,
- const double* coordinates,
- const ufc::cell& c) const
- {
- // Extract vertex coordinates
- const double * const * element_coordinates = c.coordinates;
-
- // Compute Jacobian of affine map from reference cell
- const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
- const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
- const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
- const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+ return new stokes_p2p1_0_finite_element_1_0_0();
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_0_finite_element_1_0_1: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_0_finite_element_1_0_1() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_finite_element_1_0_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
+ }
+
+ /// Return the cell shape
+ virtual ufc::shape cell_shape() const
+ {
+ return ufc::triangle;
+ }
+
+ /// Return the dimension of the finite element function space
+ virtual unsigned int space_dimension() const
+ {
+ return 6;
+ }
+
+ /// Return the rank of the value space
+ virtual unsigned int value_rank() const
+ {
+ return 0;
+ }
+
+ /// Return the dimension of the value space for axis i
+ virtual unsigned int value_dimension(unsigned int i) const
+ {
+ return 1;
+ }
+
+ /// Evaluate basis function i at given point in cell
+ virtual void evaluate_basis(unsigned int i,
+ double* values,
+ const double* coordinates,
+ const ufc::cell& c) const
+ {
+ // Extract vertex coordinates
+ const double * const * element_coordinates = c.coordinates;
+
+ // Compute Jacobian of affine map from reference cell
+ const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
+ const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
+ const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
+ const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -3493,7 +3493,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -3536,69 +3536,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -3650,7 +3650,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -3660,7 +3660,7 @@ public:
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -3668,7 +3668,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -3779,9 +3779,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
- const static double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
+ static const double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
+ static const double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -3808,7 +3808,7 @@ public:
// Take directional components
for(int k = 0; k < 1; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -3842,33 +3842,33 @@ public:
/// Create a new finite element for sub element i (for a mixed element)
virtual ufc::finite_element* create_sub_element(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_finite_element_1_0_1();
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1BilinearForm_finite_element_1_0: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_finite_element_1_0() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_finite_element_1_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)])";
+ return new stokes_p2p1_0_finite_element_1_0_1();
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_0_finite_element_1_0: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_0_finite_element_1_0() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_finite_element_1_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2)";
}
/// Return the cell shape
@@ -3909,7 +3909,7 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -3966,7 +3966,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -4018,7 +4018,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -4063,69 +4063,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -4179,17 +4179,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -4197,7 +4197,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -4325,17 +4325,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -4343,7 +4343,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -4456,9 +4456,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[12][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
- const static double W[12][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[12][1][2] = {{{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}};
+ static const double X[12][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
+ static const double W[12][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[12][1][2] = {{{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -4485,7 +4485,7 @@ public:
// Take directional components
for(int k = 0; k < 2; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -4526,80 +4526,80 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1BilinearForm_finite_element_1_0_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1BilinearForm_finite_element_1_0_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1BilinearForm_finite_element_1_1: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_finite_element_1_1() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_finite_element_1_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "FiniteElement('Lagrange', 'triangle', 1)";
- }
-
- /// Return the cell shape
- virtual ufc::shape cell_shape() const
- {
- return ufc::triangle;
- }
-
- /// Return the dimension of the finite element function space
- virtual unsigned int space_dimension() const
- {
- return 3;
- }
-
- /// Return the rank of the value space
- virtual unsigned int value_rank() const
- {
- return 0;
- }
-
- /// Return the dimension of the value space for axis i
- virtual unsigned int value_dimension(unsigned int i) const
- {
- return 1;
- }
-
- /// Evaluate basis function i at given point in cell
- virtual void evaluate_basis(unsigned int i,
- double* values,
- const double* coordinates,
- const ufc::cell& c) const
- {
- // Extract vertex coordinates
- const double * const * element_coordinates = c.coordinates;
-
- // Compute Jacobian of affine map from reference cell
- const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
- const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
- const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
- const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+ return new stokes_p2p1_0_finite_element_1_0_0();
+ break;
+ case 1:
+ return new stokes_p2p1_0_finite_element_1_0_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_0_finite_element_1_1: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_0_finite_element_1_1() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_finite_element_1_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)";
+ }
+
+ /// Return the cell shape
+ virtual ufc::shape cell_shape() const
+ {
+ return ufc::triangle;
+ }
+
+ /// Return the dimension of the finite element function space
+ virtual unsigned int space_dimension() const
+ {
+ return 3;
+ }
+
+ /// Return the rank of the value space
+ virtual unsigned int value_rank() const
+ {
+ return 0;
+ }
+
+ /// Return the dimension of the value space for axis i
+ virtual unsigned int value_dimension(unsigned int i) const
+ {
+ return 1;
+ }
+
+ /// Evaluate basis function i at given point in cell
+ virtual void evaluate_basis(unsigned int i,
+ double* values,
+ const double* coordinates,
+ const ufc::cell& c) const
+ {
+ // Extract vertex coordinates
+ const double * const * element_coordinates = c.coordinates;
+
+ // Compute Jacobian of affine map from reference cell
+ const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
+ const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
+ const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
+ const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -4645,7 +4645,7 @@ public:
const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
// Table(s) of coefficients
- const static double coefficients0[3][3] = \
+ static const double coefficients0[3][3] = \
{{0.471404520791032, -0.288675134594813, -0.166666666666667},
{0.471404520791032, 0.288675134594813, -0.166666666666667},
{0.471404520791032, 0, 0.333333333333333}};
@@ -4682,69 +4682,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -4788,19 +4788,19 @@ public:
const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
// Table(s) of coefficients
- const static double coefficients0[3][3] = \
+ static const double coefficients0[3][3] = \
{{0.471404520791032, -0.288675134594813, -0.166666666666667},
{0.471404520791032, 0.288675134594813, -0.166666666666667},
{0.471404520791032, 0, 0.333333333333333}};
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[3][3] = \
+ static const double dmats0[3][3] = \
{{0, 0, 0},
{4.89897948556636, 0, 0},
{0, 0, 0}};
- const static double dmats1[3][3] = \
+ static const double dmats1[3][3] = \
{{0, 0, 0},
{2.44948974278318, 0, 0},
{4.24264068711928, 0, 0}};
@@ -4890,9 +4890,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[3][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}};
- const static double W[3][1] = {{1}, {1}, {1}};
- const static double D[3][1][1] = {{{1}}, {{1}}, {{1}}};
+ static const double X[3][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}};
+ static const double W[3][1] = {{1}, {1}, {1}};
+ static const double D[3][1][1] = {{{1}}, {{1}}, {{1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -4919,7 +4919,7 @@ public:
// Take directional components
for(int k = 0; k < 1; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -4953,33 +4953,33 @@ public:
/// Create a new finite element for sub element i (for a mixed element)
virtual ufc::finite_element* create_sub_element(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_finite_element_1_1();
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1BilinearForm_finite_element_1: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_finite_element_1() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_finite_element_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "MixedElement([MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)]), FiniteElement('Lagrange', 'triangle', 1)])";
+ return new stokes_p2p1_0_finite_element_1_1();
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_0_finite_element_1: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_0_finite_element_1() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_finite_element_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) })";
}
/// Return the cell shape
@@ -5020,7 +5020,7 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -5078,7 +5078,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -5130,7 +5130,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -5174,7 +5174,7 @@ public:
const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
// Table(s) of coefficients
- const static double coefficients0[3][3] = \
+ static const double coefficients0[3][3] = \
{{0.471404520791032, -0.288675134594813, -0.166666666666667},
{0.471404520791032, 0.288675134594813, -0.166666666666667},
{0.471404520791032, 0, 0.333333333333333}};
@@ -5213,69 +5213,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -5329,17 +5329,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -5347,7 +5347,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -5475,17 +5475,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -5493,7 +5493,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -5613,19 +5613,19 @@ public:
const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
// Table(s) of coefficients
- const static double coefficients0[3][3] = \
+ static const double coefficients0[3][3] = \
{{0.471404520791032, -0.288675134594813, -0.166666666666667},
{0.471404520791032, 0.288675134594813, -0.166666666666667},
{0.471404520791032, 0, 0.333333333333333}};
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[3][3] = \
+ static const double dmats0[3][3] = \
{{0, 0, 0},
{4.89897948556636, 0, 0},
{0, 0, 0}};
- const static double dmats1[3][3] = \
+ static const double dmats1[3][3] = \
{{0, 0, 0},
{2.44948974278318, 0, 0},
{4.24264068711928, 0, 0}};
@@ -5717,9 +5717,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}};
- const static double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[15][1][3] = {{{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 0, 1}}, {{0, 0, 1}}, {{0, 0, 1}}};
+ static const double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}};
+ static const double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[15][1][3] = {{{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 0, 1}}, {{0, 0, 1}}, {{0, 0, 1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -5746,7 +5746,7 @@ public:
// Take directional components
for(int k = 0; k < 3; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -5791,80 +5791,80 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1BilinearForm_finite_element_1_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1BilinearForm_finite_element_1_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1BilinearForm_finite_element_2: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_finite_element_2() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_finite_element_2()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "FiniteElement('Discontinuous Lagrange', 'triangle', 0)";
- }
-
- /// Return the cell shape
- virtual ufc::shape cell_shape() const
- {
- return ufc::triangle;
- }
-
- /// Return the dimension of the finite element function space
- virtual unsigned int space_dimension() const
- {
- return 1;
- }
-
- /// Return the rank of the value space
- virtual unsigned int value_rank() const
- {
- return 0;
- }
-
- /// Return the dimension of the value space for axis i
- virtual unsigned int value_dimension(unsigned int i) const
- {
- return 1;
- }
-
- /// Evaluate basis function i at given point in cell
- virtual void evaluate_basis(unsigned int i,
- double* values,
- const double* coordinates,
- const ufc::cell& c) const
- {
- // Extract vertex coordinates
- const double * const * element_coordinates = c.coordinates;
-
- // Compute Jacobian of affine map from reference cell
- const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
- const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
- const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
- const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+ return new stokes_p2p1_0_finite_element_1_0();
+ break;
+ case 1:
+ return new stokes_p2p1_0_finite_element_1_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_0_finite_element_2: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_0_finite_element_2() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_finite_element_2()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "FiniteElement('Discontinuous Lagrange', Cell('triangle', 1, Space(2)), 0)";
+ }
+
+ /// Return the cell shape
+ virtual ufc::shape cell_shape() const
+ {
+ return ufc::triangle;
+ }
+
+ /// Return the dimension of the finite element function space
+ virtual unsigned int space_dimension() const
+ {
+ return 1;
+ }
+
+ /// Return the rank of the value space
+ virtual unsigned int value_rank() const
+ {
+ return 0;
+ }
+
+ /// Return the dimension of the value space for axis i
+ virtual unsigned int value_dimension(unsigned int i) const
+ {
+ return 1;
+ }
+
+ /// Evaluate basis function i at given point in cell
+ virtual void evaluate_basis(unsigned int i,
+ double* values,
+ const double* coordinates,
+ const ufc::cell& c) const
+ {
+ // Extract vertex coordinates
+ const double * const * element_coordinates = c.coordinates;
+
+ // Compute Jacobian of affine map from reference cell
+ const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
+ const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
+ const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
+ const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -5904,7 +5904,7 @@ public:
const double basisvalue0 = 0.707106781186548*psitilde_a_0*scalings_y_0*psitilde_bs_0_0;
// Table(s) of coefficients
- const static double coefficients0[1][1] = \
+ static const double coefficients0[1][1] = \
{{1.41421356237309}};
// Extract relevant coefficients
@@ -5937,69 +5937,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -6037,15 +6037,15 @@ public:
const double basisvalue0 = 0.707106781186548*psitilde_a_0*scalings_y_0*psitilde_bs_0_0;
// Table(s) of coefficients
- const static double coefficients0[1][1] = \
+ static const double coefficients0[1][1] = \
{{1.41421356237309}};
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[1][1] = \
+ static const double dmats0[1][1] = \
{{0}};
- const static double dmats1[1][1] = \
+ static const double dmats1[1][1] = \
{{0}};
// Compute reference derivatives
@@ -6121,9 +6121,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[1][1][2] = {{{0.333333333333333, 0.333333333333333}}};
- const static double W[1][1] = {{1}};
- const static double D[1][1][1] = {{{1}}};
+ static const double X[1][1][2] = {{{0.333333333333333, 0.333333333333333}}};
+ static const double W[1][1] = {{1}};
+ static const double D[1][1][1] = {{{1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -6150,7 +6150,7 @@ public:
// Take directional components
for(int k = 0; k < 1; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -6184,38 +6184,38 @@ public:
/// Create a new finite element for sub element i (for a mixed element)
virtual ufc::finite_element* create_sub_element(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_finite_element_2();
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1BilinearForm_dof_map_0_0_0: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_dof_map_0_0_0() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_dof_map_0_0_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for FiniteElement('Lagrange', 'triangle', 2)";
+ return new stokes_p2p1_0_finite_element_2();
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_0_dof_map_0_0_0: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_0_dof_map_0_0_0() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_dof_map_0_0_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -6262,8 +6262,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 6;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 6;
}
@@ -6359,38 +6365,38 @@ public:
/// Create a new dof_map for sub dof map i (for a mixed element)
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_dof_map_0_0_0();
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1BilinearForm_dof_map_0_0_1: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_dof_map_0_0_1() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_dof_map_0_0_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for FiniteElement('Lagrange', 'triangle', 2)";
+ return new stokes_p2p1_0_dof_map_0_0_0();
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_0_dof_map_0_0_1: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_0_dof_map_0_0_1() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_dof_map_0_0_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -6437,8 +6443,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 6;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 6;
}
@@ -6534,38 +6546,38 @@ public:
/// Create a new dof_map for sub dof map i (for a mixed element)
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_dof_map_0_0_1();
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1BilinearForm_dof_map_0_0: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_dof_map_0_0() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_dof_map_0_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)])";
+ return new stokes_p2p1_0_dof_map_0_0_1();
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_0_dof_map_0_0: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_0_dof_map_0_0() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_dof_map_0_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -6612,8 +6624,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 12;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 12;
}
@@ -6741,44 +6759,44 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1BilinearForm_dof_map_0_0_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1BilinearForm_dof_map_0_0_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1BilinearForm_dof_map_0_1: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_dof_map_0_1() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_dof_map_0_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for FiniteElement('Lagrange', 'triangle', 1)";
+ return new stokes_p2p1_0_dof_map_0_0_0();
+ break;
+ case 1:
+ return new stokes_p2p1_0_dof_map_0_0_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_0_dof_map_0_1: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_0_dof_map_0_1() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_dof_map_0_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -6825,122 +6843,128 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
- {
- return 3;
- }
-
- // Return the geometric dimension of the coordinates this dof map provides
- virtual unsigned int geometric_dimension() const
- {
- return 2;
- }
-
- /// Return the number of dofs on each cell facet
- virtual unsigned int num_facet_dofs() const
- {
- return 2;
- }
-
- /// Return the number of dofs associated with each cell entity of dimension d
- virtual unsigned int num_entity_dofs(unsigned int d) const
- {
- throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
- }
-
- /// Tabulate the local-to-global mapping of dofs on a cell
- virtual void tabulate_dofs(unsigned int* dofs,
- const ufc::mesh& m,
- const ufc::cell& c) const
- {
- dofs[0] = c.entity_indices[0][0];
- dofs[1] = c.entity_indices[0][1];
- dofs[2] = c.entity_indices[0][2];
- }
-
- /// Tabulate the local-to-local mapping from facet dofs to cell dofs
- virtual void tabulate_facet_dofs(unsigned int* dofs,
- unsigned int facet) const
- {
- switch ( facet )
- {
- case 0:
- dofs[0] = 1;
- dofs[1] = 2;
- break;
- case 1:
- dofs[0] = 0;
- dofs[1] = 2;
- break;
- case 2:
- dofs[0] = 0;
- dofs[1] = 1;
- break;
- }
- }
-
- /// Tabulate the local-to-local mapping of dofs on entity (d, i)
- virtual void tabulate_entity_dofs(unsigned int* dofs,
- unsigned int d, unsigned int i) const
- {
- throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
- }
-
- /// Tabulate the coordinates of all dofs on a cell
- virtual void tabulate_coordinates(double** coordinates,
- const ufc::cell& c) const
- {
- const double * const * x = c.coordinates;
- coordinates[0][0] = x[0][0];
- coordinates[0][1] = x[0][1];
- coordinates[1][0] = x[1][0];
- coordinates[1][1] = x[1][1];
- coordinates[2][0] = x[2][0];
- coordinates[2][1] = x[2][1];
- }
-
- /// Return the number of sub dof maps (for a mixed element)
- virtual unsigned int num_sub_dof_maps() const
- {
- return 1;
- }
-
- /// Create a new dof_map for sub dof map i (for a mixed element)
- virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
- {
- return new UFC_Stokes_P2P1BilinearForm_dof_map_0_1();
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1BilinearForm_dof_map_0: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_dof_map_0() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_dof_map_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for MixedElement([MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)]), FiniteElement('Lagrange', 'triangle', 1)])";
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 3;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
+ {
+ return 3;
+ }
+
+ // Return the geometric dimension of the coordinates this dof map provides
+ virtual unsigned int geometric_dimension() const
+ {
+ return 2;
+ }
+
+ /// Return the number of dofs on each cell facet
+ virtual unsigned int num_facet_dofs() const
+ {
+ return 2;
+ }
+
+ /// Return the number of dofs associated with each cell entity of dimension d
+ virtual unsigned int num_entity_dofs(unsigned int d) const
+ {
+ throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
+ }
+
+ /// Tabulate the local-to-global mapping of dofs on a cell
+ virtual void tabulate_dofs(unsigned int* dofs,
+ const ufc::mesh& m,
+ const ufc::cell& c) const
+ {
+ dofs[0] = c.entity_indices[0][0];
+ dofs[1] = c.entity_indices[0][1];
+ dofs[2] = c.entity_indices[0][2];
+ }
+
+ /// Tabulate the local-to-local mapping from facet dofs to cell dofs
+ virtual void tabulate_facet_dofs(unsigned int* dofs,
+ unsigned int facet) const
+ {
+ switch ( facet )
+ {
+ case 0:
+ dofs[0] = 1;
+ dofs[1] = 2;
+ break;
+ case 1:
+ dofs[0] = 0;
+ dofs[1] = 2;
+ break;
+ case 2:
+ dofs[0] = 0;
+ dofs[1] = 1;
+ break;
+ }
+ }
+
+ /// Tabulate the local-to-local mapping of dofs on entity (d, i)
+ virtual void tabulate_entity_dofs(unsigned int* dofs,
+ unsigned int d, unsigned int i) const
+ {
+ throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
+ }
+
+ /// Tabulate the coordinates of all dofs on a cell
+ virtual void tabulate_coordinates(double** coordinates,
+ const ufc::cell& c) const
+ {
+ const double * const * x = c.coordinates;
+ coordinates[0][0] = x[0][0];
+ coordinates[0][1] = x[0][1];
+ coordinates[1][0] = x[1][0];
+ coordinates[1][1] = x[1][1];
+ coordinates[2][0] = x[2][0];
+ coordinates[2][1] = x[2][1];
+ }
+
+ /// Return the number of sub dof maps (for a mixed element)
+ virtual unsigned int num_sub_dof_maps() const
+ {
+ return 1;
+ }
+
+ /// Create a new dof_map for sub dof map i (for a mixed element)
+ virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
+ {
+ return new stokes_p2p1_0_dof_map_0_1();
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_0_dof_map_0: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_0_dof_map_0() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_dof_map_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) })";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -6987,8 +7011,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 15;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 15;
}
@@ -7132,44 +7162,44 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1BilinearForm_dof_map_0_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1BilinearForm_dof_map_0_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1BilinearForm_dof_map_1_0_0: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_dof_map_1_0_0() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_dof_map_1_0_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for FiniteElement('Lagrange', 'triangle', 2)";
+ return new stokes_p2p1_0_dof_map_0_0();
+ break;
+ case 1:
+ return new stokes_p2p1_0_dof_map_0_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_0_dof_map_1_0_0: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_0_dof_map_1_0_0() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_dof_map_1_0_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -7216,8 +7246,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 6;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 6;
}
@@ -7313,38 +7349,38 @@ public:
/// Create a new dof_map for sub dof map i (for a mixed element)
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_dof_map_1_0_0();
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1BilinearForm_dof_map_1_0_1: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_dof_map_1_0_1() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_dof_map_1_0_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for FiniteElement('Lagrange', 'triangle', 2)";
+ return new stokes_p2p1_0_dof_map_1_0_0();
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_0_dof_map_1_0_1: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_0_dof_map_1_0_1() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_dof_map_1_0_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -7391,8 +7427,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 6;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 6;
}
@@ -7488,38 +7530,38 @@ public:
/// Create a new dof_map for sub dof map i (for a mixed element)
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_dof_map_1_0_1();
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1BilinearForm_dof_map_1_0: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_dof_map_1_0() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_dof_map_1_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)])";
+ return new stokes_p2p1_0_dof_map_1_0_1();
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_0_dof_map_1_0: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_0_dof_map_1_0() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_dof_map_1_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -7566,8 +7608,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 12;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 12;
}
@@ -7695,44 +7743,44 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1BilinearForm_dof_map_1_0_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1BilinearForm_dof_map_1_0_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1BilinearForm_dof_map_1_1: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_dof_map_1_1() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_dof_map_1_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for FiniteElement('Lagrange', 'triangle', 1)";
+ return new stokes_p2p1_0_dof_map_1_0_0();
+ break;
+ case 1:
+ return new stokes_p2p1_0_dof_map_1_0_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_0_dof_map_1_1: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_0_dof_map_1_1() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_dof_map_1_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -7779,122 +7827,128 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
- {
- return 3;
- }
-
- // Return the geometric dimension of the coordinates this dof map provides
- virtual unsigned int geometric_dimension() const
- {
- return 2;
- }
-
- /// Return the number of dofs on each cell facet
- virtual unsigned int num_facet_dofs() const
- {
- return 2;
- }
-
- /// Return the number of dofs associated with each cell entity of dimension d
- virtual unsigned int num_entity_dofs(unsigned int d) const
- {
- throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
- }
-
- /// Tabulate the local-to-global mapping of dofs on a cell
- virtual void tabulate_dofs(unsigned int* dofs,
- const ufc::mesh& m,
- const ufc::cell& c) const
- {
- dofs[0] = c.entity_indices[0][0];
- dofs[1] = c.entity_indices[0][1];
- dofs[2] = c.entity_indices[0][2];
- }
-
- /// Tabulate the local-to-local mapping from facet dofs to cell dofs
- virtual void tabulate_facet_dofs(unsigned int* dofs,
- unsigned int facet) const
- {
- switch ( facet )
- {
- case 0:
- dofs[0] = 1;
- dofs[1] = 2;
- break;
- case 1:
- dofs[0] = 0;
- dofs[1] = 2;
- break;
- case 2:
- dofs[0] = 0;
- dofs[1] = 1;
- break;
- }
- }
-
- /// Tabulate the local-to-local mapping of dofs on entity (d, i)
- virtual void tabulate_entity_dofs(unsigned int* dofs,
- unsigned int d, unsigned int i) const
- {
- throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
- }
-
- /// Tabulate the coordinates of all dofs on a cell
- virtual void tabulate_coordinates(double** coordinates,
- const ufc::cell& c) const
- {
- const double * const * x = c.coordinates;
- coordinates[0][0] = x[0][0];
- coordinates[0][1] = x[0][1];
- coordinates[1][0] = x[1][0];
- coordinates[1][1] = x[1][1];
- coordinates[2][0] = x[2][0];
- coordinates[2][1] = x[2][1];
- }
-
- /// Return the number of sub dof maps (for a mixed element)
- virtual unsigned int num_sub_dof_maps() const
- {
- return 1;
- }
-
- /// Create a new dof_map for sub dof map i (for a mixed element)
- virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
- {
- return new UFC_Stokes_P2P1BilinearForm_dof_map_1_1();
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1BilinearForm_dof_map_1: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_dof_map_1() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_dof_map_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for MixedElement([MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)]), FiniteElement('Lagrange', 'triangle', 1)])";
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 3;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
+ {
+ return 3;
+ }
+
+ // Return the geometric dimension of the coordinates this dof map provides
+ virtual unsigned int geometric_dimension() const
+ {
+ return 2;
+ }
+
+ /// Return the number of dofs on each cell facet
+ virtual unsigned int num_facet_dofs() const
+ {
+ return 2;
+ }
+
+ /// Return the number of dofs associated with each cell entity of dimension d
+ virtual unsigned int num_entity_dofs(unsigned int d) const
+ {
+ throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
+ }
+
+ /// Tabulate the local-to-global mapping of dofs on a cell
+ virtual void tabulate_dofs(unsigned int* dofs,
+ const ufc::mesh& m,
+ const ufc::cell& c) const
+ {
+ dofs[0] = c.entity_indices[0][0];
+ dofs[1] = c.entity_indices[0][1];
+ dofs[2] = c.entity_indices[0][2];
+ }
+
+ /// Tabulate the local-to-local mapping from facet dofs to cell dofs
+ virtual void tabulate_facet_dofs(unsigned int* dofs,
+ unsigned int facet) const
+ {
+ switch ( facet )
+ {
+ case 0:
+ dofs[0] = 1;
+ dofs[1] = 2;
+ break;
+ case 1:
+ dofs[0] = 0;
+ dofs[1] = 2;
+ break;
+ case 2:
+ dofs[0] = 0;
+ dofs[1] = 1;
+ break;
+ }
+ }
+
+ /// Tabulate the local-to-local mapping of dofs on entity (d, i)
+ virtual void tabulate_entity_dofs(unsigned int* dofs,
+ unsigned int d, unsigned int i) const
+ {
+ throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
+ }
+
+ /// Tabulate the coordinates of all dofs on a cell
+ virtual void tabulate_coordinates(double** coordinates,
+ const ufc::cell& c) const
+ {
+ const double * const * x = c.coordinates;
+ coordinates[0][0] = x[0][0];
+ coordinates[0][1] = x[0][1];
+ coordinates[1][0] = x[1][0];
+ coordinates[1][1] = x[1][1];
+ coordinates[2][0] = x[2][0];
+ coordinates[2][1] = x[2][1];
+ }
+
+ /// Return the number of sub dof maps (for a mixed element)
+ virtual unsigned int num_sub_dof_maps() const
+ {
+ return 1;
+ }
+
+ /// Create a new dof_map for sub dof map i (for a mixed element)
+ virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
+ {
+ return new stokes_p2p1_0_dof_map_1_1();
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_0_dof_map_1: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_0_dof_map_1() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_dof_map_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) })";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -7941,8 +7995,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 15;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 15;
}
@@ -8086,44 +8146,44 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1BilinearForm_dof_map_1_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1BilinearForm_dof_map_1_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1BilinearForm_dof_map_2: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_dof_map_2() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_dof_map_2()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for FiniteElement('Discontinuous Lagrange', 'triangle', 0)";
+ return new stokes_p2p1_0_dof_map_1_0();
+ break;
+ case 1:
+ return new stokes_p2p1_0_dof_map_1_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_0_dof_map_2: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_0_dof_map_2() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_dof_map_2()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for FiniteElement('Discontinuous Lagrange', Cell('triangle', 1, Space(2)), 0)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -8170,8 +8230,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 1;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 1;
}
@@ -8245,7 +8311,7 @@ public:
/// Create a new dof_map for sub dof map i (for a mixed element)
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_dof_map_2();
+ return new stokes_p2p1_0_dof_map_2();
}
};
@@ -8254,18 +8320,18 @@ public:
/// tensor corresponding to the local contribution to a form from
/// the integral over a cell.
-class UFC_Stokes_P2P1BilinearForm_cell_integral_0: public ufc::cell_integral
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm_cell_integral_0() : ufc::cell_integral()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm_cell_integral_0()
+class stokes_p2p1_0_cell_integral_0_quadrature: public ufc::cell_integral
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_0_cell_integral_0_quadrature() : ufc::cell_integral()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_cell_integral_0_quadrature()
{
// Do nothing
}
@@ -8283,10 +8349,10 @@ public:
const double J_01 = x[2][0] - x[0][0];
const double J_10 = x[1][1] - x[0][1];
const double J_11 = x[2][1] - x[0][1];
-
+
// Compute determinant of Jacobian
double detJ = J_00*J_11 - J_01*J_10;
-
+
// Compute inverse of Jacobian
const double Jinv_00 = J_11 / detJ;
const double Jinv_01 = -J_01 / detJ;
@@ -8296,252 +8362,193 @@ public:
// Set scale factor
const double det = std::abs(detJ);
- // Number of operations to compute element tensor = 336
- // Compute coefficients
- const double c0_0_0_0 = w[0][0];
-
- // Compute geometry tensors
- // Number of operations to compute decalrations = 28
- const double G0_0_0_0 = det*c0_0_0_0*(Jinv_00*Jinv_00 + Jinv_01*Jinv_01);
- const double G0_0_0_1 = det*c0_0_0_0*(Jinv_00*Jinv_10 + Jinv_01*Jinv_11);
- const double G0_0_1_0 = det*c0_0_0_0*(Jinv_10*Jinv_00 + Jinv_11*Jinv_01);
- const double G0_0_1_1 = det*c0_0_0_0*(Jinv_10*Jinv_10 + Jinv_11*Jinv_11);
- const double G1_0_0 = det*Jinv_00;
- const double G1_0_1 = det*Jinv_01;
- const double G1_1_0 = det*Jinv_10;
- const double G1_1_1 = det*Jinv_11;
- const double G2_0_0 = det*Jinv_00;
- const double G2_0_1 = det*Jinv_01;
- const double G2_1_0 = det*Jinv_10;
- const double G2_1_1 = det*Jinv_11;
-
- // Compute element tensor
- // Number of operations to compute tensor = 308
- A[0] = 0.499999999999999*G0_0_0_0 + 0.499999999999999*G0_0_0_1 + 0.499999999999999*G0_0_1_0 + 0.499999999999999*G0_0_1_1;
- A[1] = 0.166666666666666*G0_0_0_0 + 0.166666666666667*G0_0_1_0;
- A[2] = 0.166666666666666*G0_0_0_1 + 0.166666666666666*G0_0_1_1;
- A[3] = 0;
- A[4] = -0.666666666666665*G0_0_0_1 - 0.666666666666665*G0_0_1_1;
- A[5] = -0.666666666666666*G0_0_0_0 - 0.666666666666666*G0_0_1_0;
- A[6] = 0;
- A[7] = 0;
- A[8] = 0;
- A[9] = 0;
- A[10] = 0;
- A[11] = 0;
- A[12] = 0.166666666666666*G1_0_0 + 0.166666666666666*G1_1_0;
- A[13] = 0;
- A[14] = 0;
- A[15] = 0.166666666666666*G0_0_0_0 + 0.166666666666667*G0_0_0_1;
- A[16] = 0.499999999999999*G0_0_0_0;
- A[17] = -0.166666666666666*G0_0_0_1;
- A[18] = 0.666666666666666*G0_0_0_1;
- A[19] = 0;
- A[20] = -0.666666666666666*G0_0_0_0 - 0.666666666666666*G0_0_0_1;
- A[21] = 0;
- A[22] = 0;
- A[23] = 0;
- A[24] = 0;
- A[25] = 0;
- A[26] = 0;
- A[27] = 0;
- A[28] = -0.166666666666666*G1_0_0;
- A[29] = 0;
- A[30] = 0.166666666666666*G0_0_1_0 + 0.166666666666666*G0_0_1_1;
- A[31] = -0.166666666666666*G0_0_1_0;
- A[32] = 0.499999999999999*G0_0_1_1;
- A[33] = 0.666666666666665*G0_0_1_0;
- A[34] = -0.666666666666665*G0_0_1_0 - 0.666666666666665*G0_0_1_1;
- A[35] = 0;
- A[36] = 0;
- A[37] = 0;
- A[38] = 0;
- A[39] = 0;
- A[40] = 0;
- A[41] = 0;
- A[42] = 0;
- A[43] = 0;
- A[44] = -0.166666666666666*G1_1_0;
- A[45] = 0;
- A[46] = 0.666666666666666*G0_0_1_0;
- A[47] = 0.666666666666665*G0_0_0_1;
- A[48] = 1.33333333333333*G0_0_0_0 + 0.666666666666665*G0_0_0_1 + 0.666666666666665*G0_0_1_0 + 1.33333333333333*G0_0_1_1;
- A[49] = -1.33333333333333*G0_0_0_0 - 0.666666666666666*G0_0_0_1 - 0.666666666666665*G0_0_1_0;
- A[50] = -0.666666666666665*G0_0_0_1 - 0.666666666666665*G0_0_1_0 - 1.33333333333333*G0_0_1_1;
- A[51] = 0;
- A[52] = 0;
- A[53] = 0;
- A[54] = 0;
- A[55] = 0;
- A[56] = 0;
- A[57] = -0.166666666666666*G1_0_0 - 0.166666666666666*G1_1_0;
- A[58] = -0.166666666666666*G1_0_0 - 0.333333333333333*G1_1_0;
- A[59] = -0.333333333333333*G1_0_0 - 0.166666666666666*G1_1_0;
- A[60] = -0.666666666666665*G0_0_1_0 - 0.666666666666665*G0_0_1_1;
- A[61] = 0;
- A[62] = -0.666666666666665*G0_0_0_1 - 0.666666666666665*G0_0_1_1;
- A[63] = -1.33333333333333*G0_0_0_0 - 0.666666666666665*G0_0_0_1 - 0.666666666666665*G0_0_1_0;
- A[64] = 1.33333333333333*G0_0_0_0 + 0.666666666666666*G0_0_0_1 + 0.666666666666665*G0_0_1_0 + 1.33333333333333*G0_0_1_1;
- A[65] = 0.666666666666665*G0_0_0_1 + 0.666666666666665*G0_0_1_0;
- A[66] = 0;
- A[67] = 0;
- A[68] = 0;
- A[69] = 0;
- A[70] = 0;
- A[71] = 0;
- A[72] = 0.166666666666666*G1_0_0 - 0.166666666666666*G1_1_0;
- A[73] = 0.166666666666666*G1_0_0;
- A[74] = 0.333333333333333*G1_0_0 + 0.166666666666666*G1_1_0;
- A[75] = -0.666666666666665*G0_0_0_0 - 0.666666666666666*G0_0_0_1;
- A[76] = -0.666666666666666*G0_0_0_0 - 0.666666666666666*G0_0_1_0;
- A[77] = 0;
- A[78] = -0.666666666666665*G0_0_0_1 - 0.666666666666665*G0_0_1_0 - 1.33333333333333*G0_0_1_1;
- A[79] = 0.666666666666665*G0_0_0_1 + 0.666666666666665*G0_0_1_0;
- A[80] = 1.33333333333333*G0_0_0_0 + 0.666666666666665*G0_0_0_1 + 0.666666666666665*G0_0_1_0 + 1.33333333333333*G0_0_1_1;
- A[81] = 0;
- A[82] = 0;
- A[83] = 0;
- A[84] = 0;
- A[85] = 0;
- A[86] = 0;
- A[87] = -0.166666666666666*G1_0_0 + 0.166666666666666*G1_1_0;
- A[88] = 0.166666666666666*G1_0_0 + 0.333333333333333*G1_1_0;
- A[89] = 0.166666666666666*G1_1_0;
- A[90] = 0;
- A[91] = 0;
- A[92] = 0;
- A[93] = 0;
- A[94] = 0;
- A[95] = 0;
- A[96] = 0.499999999999999*G0_0_0_0 + 0.499999999999999*G0_0_0_1 + 0.499999999999999*G0_0_1_0 + 0.499999999999999*G0_0_1_1;
- A[97] = 0.166666666666666*G0_0_0_0 + 0.166666666666667*G0_0_1_0;
- A[98] = 0.166666666666666*G0_0_0_1 + 0.166666666666666*G0_0_1_1;
- A[99] = 0;
- A[100] = -0.666666666666665*G0_0_0_1 - 0.666666666666665*G0_0_1_1;
- A[101] = -0.666666666666666*G0_0_0_0 - 0.666666666666666*G0_0_1_0;
- A[102] = 0.166666666666666*G1_0_1 + 0.166666666666666*G1_1_1;
- A[103] = 0;
- A[104] = 0;
- A[105] = 0;
- A[106] = 0;
- A[107] = 0;
- A[108] = 0;
- A[109] = 0;
- A[110] = 0;
- A[111] = 0.166666666666666*G0_0_0_0 + 0.166666666666667*G0_0_0_1;
- A[112] = 0.499999999999999*G0_0_0_0;
- A[113] = -0.166666666666666*G0_0_0_1;
- A[114] = 0.666666666666666*G0_0_0_1;
- A[115] = 0;
- A[116] = -0.666666666666666*G0_0_0_0 - 0.666666666666666*G0_0_0_1;
- A[117] = 0;
- A[118] = -0.166666666666666*G1_0_1;
- A[119] = 0;
- A[120] = 0;
- A[121] = 0;
- A[122] = 0;
- A[123] = 0;
- A[124] = 0;
- A[125] = 0;
- A[126] = 0.166666666666666*G0_0_1_0 + 0.166666666666666*G0_0_1_1;
- A[127] = -0.166666666666666*G0_0_1_0;
- A[128] = 0.499999999999999*G0_0_1_1;
- A[129] = 0.666666666666665*G0_0_1_0;
- A[130] = -0.666666666666665*G0_0_1_0 - 0.666666666666665*G0_0_1_1;
- A[131] = 0;
- A[132] = 0;
- A[133] = 0;
- A[134] = -0.166666666666666*G1_1_1;
- A[135] = 0;
- A[136] = 0;
- A[137] = 0;
- A[138] = 0;
- A[139] = 0;
- A[140] = 0;
- A[141] = 0;
- A[142] = 0.666666666666666*G0_0_1_0;
- A[143] = 0.666666666666665*G0_0_0_1;
- A[144] = 1.33333333333333*G0_0_0_0 + 0.666666666666665*G0_0_0_1 + 0.666666666666665*G0_0_1_0 + 1.33333333333333*G0_0_1_1;
- A[145] = -1.33333333333333*G0_0_0_0 - 0.666666666666666*G0_0_0_1 - 0.666666666666665*G0_0_1_0;
- A[146] = -0.666666666666665*G0_0_0_1 - 0.666666666666665*G0_0_1_0 - 1.33333333333333*G0_0_1_1;
- A[147] = -0.166666666666666*G1_0_1 - 0.166666666666666*G1_1_1;
- A[148] = -0.166666666666666*G1_0_1 - 0.333333333333333*G1_1_1;
- A[149] = -0.333333333333333*G1_0_1 - 0.166666666666666*G1_1_1;
- A[150] = 0;
- A[151] = 0;
- A[152] = 0;
- A[153] = 0;
- A[154] = 0;
- A[155] = 0;
- A[156] = -0.666666666666665*G0_0_1_0 - 0.666666666666665*G0_0_1_1;
- A[157] = 0;
- A[158] = -0.666666666666665*G0_0_0_1 - 0.666666666666665*G0_0_1_1;
- A[159] = -1.33333333333333*G0_0_0_0 - 0.666666666666665*G0_0_0_1 - 0.666666666666665*G0_0_1_0;
- A[160] = 1.33333333333333*G0_0_0_0 + 0.666666666666666*G0_0_0_1 + 0.666666666666665*G0_0_1_0 + 1.33333333333333*G0_0_1_1;
- A[161] = 0.666666666666665*G0_0_0_1 + 0.666666666666665*G0_0_1_0;
- A[162] = 0.166666666666666*G1_0_1 - 0.166666666666666*G1_1_1;
- A[163] = 0.166666666666666*G1_0_1;
- A[164] = 0.333333333333333*G1_0_1 + 0.166666666666666*G1_1_1;
- A[165] = 0;
- A[166] = 0;
- A[167] = 0;
- A[168] = 0;
- A[169] = 0;
- A[170] = 0;
- A[171] = -0.666666666666665*G0_0_0_0 - 0.666666666666666*G0_0_0_1;
- A[172] = -0.666666666666666*G0_0_0_0 - 0.666666666666666*G0_0_1_0;
- A[173] = 0;
- A[174] = -0.666666666666665*G0_0_0_1 - 0.666666666666665*G0_0_1_0 - 1.33333333333333*G0_0_1_1;
- A[175] = 0.666666666666665*G0_0_0_1 + 0.666666666666665*G0_0_1_0;
- A[176] = 1.33333333333333*G0_0_0_0 + 0.666666666666665*G0_0_0_1 + 0.666666666666665*G0_0_1_0 + 1.33333333333333*G0_0_1_1;
- A[177] = -0.166666666666666*G1_0_1 + 0.166666666666666*G1_1_1;
- A[178] = 0.166666666666666*G1_0_1 + 0.333333333333333*G1_1_1;
- A[179] = 0.166666666666666*G1_1_1;
- A[180] = -0.166666666666666*G2_0_0 - 0.166666666666666*G2_1_0;
- A[181] = 0;
- A[182] = 0;
- A[183] = 0.166666666666666*G2_0_0 + 0.166666666666666*G2_1_0;
- A[184] = -0.166666666666666*G2_0_0 + 0.166666666666666*G2_1_0;
- A[185] = 0.166666666666666*G2_0_0 - 0.166666666666666*G2_1_0;
- A[186] = -0.166666666666666*G2_0_1 - 0.166666666666666*G2_1_1;
- A[187] = 0;
- A[188] = 0;
- A[189] = 0.166666666666666*G2_0_1 + 0.166666666666666*G2_1_1;
- A[190] = -0.166666666666666*G2_0_1 + 0.166666666666666*G2_1_1;
- A[191] = 0.166666666666666*G2_0_1 - 0.166666666666666*G2_1_1;
- A[192] = 0;
- A[193] = 0;
- A[194] = 0;
- A[195] = 0;
- A[196] = 0.166666666666666*G2_0_0;
- A[197] = 0;
- A[198] = 0.166666666666666*G2_0_0 + 0.333333333333333*G2_1_0;
- A[199] = -0.166666666666666*G2_0_0;
- A[200] = -0.166666666666666*G2_0_0 - 0.333333333333333*G2_1_0;
- A[201] = 0;
- A[202] = 0.166666666666666*G2_0_1;
- A[203] = 0;
- A[204] = 0.166666666666666*G2_0_1 + 0.333333333333333*G2_1_1;
- A[205] = -0.166666666666666*G2_0_1;
- A[206] = -0.166666666666666*G2_0_1 - 0.333333333333333*G2_1_1;
- A[207] = 0;
- A[208] = 0;
- A[209] = 0;
- A[210] = 0;
- A[211] = 0;
- A[212] = 0.166666666666666*G2_1_0;
- A[213] = 0.333333333333333*G2_0_0 + 0.166666666666666*G2_1_0;
- A[214] = -0.333333333333333*G2_0_0 - 0.166666666666666*G2_1_0;
- A[215] = -0.166666666666666*G2_1_0;
- A[216] = 0;
- A[217] = 0;
- A[218] = 0.166666666666666*G2_1_1;
- A[219] = 0.333333333333333*G2_0_1 + 0.166666666666666*G2_1_1;
- A[220] = -0.333333333333333*G2_0_1 - 0.166666666666666*G2_1_1;
- A[221] = -0.166666666666666*G2_1_1;
- A[222] = 0;
- A[223] = 0;
- A[224] = 0;
+
+ // Array of quadrature weights
+ static const double W4[4] = {0.159020690871988, 0.0909793091280113, 0.159020690871988, 0.0909793091280113};
+ // Quadrature points on the UFC reference element: (0.178558728263616, 0.155051025721682), (0.0750311102226081, 0.644948974278318), (0.666390246014701, 0.155051025721682), (0.280019915499074, 0.644948974278318)
+
+ // Value of basis functions at quadrature points.
+ static const double FE1_C0_D01[4][5] = \
+ {{-1.66556098405881, -0.379795897113271, 0.714234913054466, 2.04535688117208, -0.714234913054465},
+ {-0.120079661996297, 1.57979589711327, 0.300124440890433, -1.45971623511698, -0.300124440890432},
+ {0.285765086945535, -0.379795897113271, 2.6655609840588, 0.0940308101677372, -2.66556098405881},
+ {0.699875559109568, 1.57979589711327, 1.1200796619963, -2.27967145622284, -1.1200796619963}};
+
+ // Array of non-zero columns
+ static const unsigned int nzc4[5] = {6, 8, 9, 10, 11};
+ // Array of non-zero columns
+ static const unsigned int nzc1[5] = {0, 2, 3, 4, 5};
+ static const double FE1_C0_D10[4][5] = \
+ {{-1.66556098405881, -0.285765086945534, 0.620204102886728, -0.620204102886728, 1.95132607100434},
+ {-0.120079661996296, -0.699875559109567, 2.57979589711327, -2.57979589711327, 0.819955221105864},
+ {0.285765086945534, 1.66556098405881, 0.620204102886729, -0.620204102886729, -1.95132607100434},
+ {0.699875559109568, 0.120079661996297, 2.57979589711327, -2.57979589711327, -0.819955221105864}};
+
+ // Array of non-zero columns
+ static const unsigned int nzc5[5] = {6, 7, 9, 10, 11};
+ // Array of non-zero columns
+ static const unsigned int nzc2[5] = {0, 1, 3, 4, 5};
+ static const double FE1_C2[4][3] = \
+ {{0.666390246014701, 0.178558728263616, 0.155051025721682},
+ {0.280019915499074, 0.0750311102226082, 0.644948974278318},
+ {0.178558728263616, 0.666390246014701, 0.155051025721682},
+ {0.0750311102226081, 0.280019915499074, 0.644948974278318}};
+
+ // Array of non-zero columns
+ static const unsigned int nzc6[3] = {12, 13, 14};
+
+ // Number of operations to compute geometry constants: 23
+ const double G0 = Jinv_01*det;
+ const double G1 = -Jinv_00*det;
+ const double G2 = det*w[0][0]*(Jinv_00*Jinv_00 + Jinv_01*Jinv_01);
+ const double G3 = det*w[0][0]*(Jinv_00*Jinv_10 + Jinv_01*Jinv_11);
+ const double G4 = det*w[0][0]*(Jinv_10*Jinv_10 + Jinv_11*Jinv_11);
+ const double G5 = Jinv_00*det;
+ const double G6 = Jinv_10*det;
+ const double G7 = -Jinv_01*det;
+ const double G8 = -Jinv_10*det;
+ const double G9 = -Jinv_11*det;
+ const double G10 = Jinv_11*det;
+
+ // Compute element tensor using UFL quadrature representation
+ // Optimisations: ('simplify expressions', True), ('ignore zero tables', True), ('non zero columns', True), ('remove zero terms', True), ('ignore ones', True)
+ // Total number of operations to compute element tensor: 3907
+
+ // Loop quadrature points for integral
+ // Number of operations to compute element tensor for following IP loop = 3884
+ for (unsigned int ip = 0; ip < 4; ip++)
+ {
+
+ // Number of operations to compute ip constants: 11
+ // Number of operations: 1
+ const double Gip0 = G0*W4[ip];
+
+ // Number of operations: 1
+ const double Gip1 = G1*W4[ip];
+
+ // Number of operations: 1
+ const double Gip2 = G2*W4[ip];
+
+ // Number of operations: 1
+ const double Gip3 = G3*W4[ip];
+
+ // Number of operations: 1
+ const double Gip4 = G4*W4[ip];
+
+ // Number of operations: 1
+ const double Gip5 = G5*W4[ip];
+
+ // Number of operations: 1
+ const double Gip6 = G6*W4[ip];
+
+ // Number of operations: 1
+ const double Gip7 = G7*W4[ip];
+
+ // Number of operations: 1
+ const double Gip8 = G8*W4[ip];
+
+ // Number of operations: 1
+ const double Gip9 = G9*W4[ip];
+
+ // Number of operations: 1
+ const double Gip10 = G10*W4[ip];
+
+
+ // Number of operations for primary indices: 180
+ for (unsigned int j = 0; j < 5; j++)
+ {
+ for (unsigned int k = 0; k < 3; k++)
+ {
+ // Number of operations to compute entry: 3
+ A[nzc2[j]*15 + nzc6[k]] += FE1_C0_D10[ip][j]*FE1_C2[ip][k]*Gip1;
+ // Number of operations to compute entry: 3
+ A[nzc5[j]*15 + nzc6[k]] += FE1_C0_D10[ip][j]*FE1_C2[ip][k]*Gip7;
+ // Number of operations to compute entry: 3
+ A[nzc1[j]*15 + nzc6[k]] += FE1_C0_D01[ip][j]*FE1_C2[ip][k]*Gip8;
+ // Number of operations to compute entry: 3
+ A[nzc4[j]*15 + nzc6[k]] += FE1_C0_D01[ip][j]*FE1_C2[ip][k]*Gip9;
+ }// end loop over 'k'
+ }// end loop over 'j'
+
+ // Number of operations for primary indices: 600
+ for (unsigned int j = 0; j < 5; j++)
+ {
+ for (unsigned int k = 0; k < 5; k++)
+ {
+ // Number of operations to compute entry: 3
+ A[nzc2[j]*15 + nzc2[k]] += FE1_C0_D10[ip][j]*FE1_C0_D10[ip][k]*Gip2;
+ // Number of operations to compute entry: 3
+ A[nzc2[j]*15 + nzc1[k]] += FE1_C0_D01[ip][k]*FE1_C0_D10[ip][j]*Gip3;
+ // Number of operations to compute entry: 3
+ A[nzc4[j]*15 + nzc4[k]] += FE1_C0_D01[ip][j]*FE1_C0_D01[ip][k]*Gip4;
+ // Number of operations to compute entry: 3
+ A[nzc5[j]*15 + nzc4[k]] += FE1_C0_D01[ip][k]*FE1_C0_D10[ip][j]*Gip3;
+ // Number of operations to compute entry: 3
+ A[nzc5[j]*15 + nzc5[k]] += FE1_C0_D10[ip][j]*FE1_C0_D10[ip][k]*Gip2;
+ // Number of operations to compute entry: 3
+ A[nzc4[j]*15 + nzc5[k]] += FE1_C0_D01[ip][j]*FE1_C0_D10[ip][k]*Gip3;
+ // Number of operations to compute entry: 3
+ A[nzc1[j]*15 + nzc2[k]] += FE1_C0_D01[ip][j]*FE1_C0_D10[ip][k]*Gip3;
+ // Number of operations to compute entry: 3
+ A[nzc1[j]*15 + nzc1[k]] += FE1_C0_D01[ip][j]*FE1_C0_D01[ip][k]*Gip4;
+ }// end loop over 'k'
+ }// end loop over 'j'
+
+ // Number of operations for primary indices: 180
+ for (unsigned int j = 0; j < 3; j++)
+ {
+ for (unsigned int k = 0; k < 5; k++)
+ {
+ // Number of operations to compute entry: 3
+ A[nzc6[j]*15 + nzc5[k]] += FE1_C0_D10[ip][k]*FE1_C2[ip][j]*Gip0;
+ // Number of operations to compute entry: 3
+ A[nzc6[j]*15 + nzc2[k]] += FE1_C0_D10[ip][k]*FE1_C2[ip][j]*Gip5;
+ // Number of operations to compute entry: 3
+ A[nzc6[j]*15 + nzc1[k]] += FE1_C0_D01[ip][k]*FE1_C2[ip][j]*Gip6;
+ // Number of operations to compute entry: 3
+ A[nzc6[j]*15 + nzc4[k]] += FE1_C0_D01[ip][k]*FE1_C2[ip][j]*Gip10;
+ }// end loop over 'k'
+ }// end loop over 'j'
+ }// end loop over 'ip'
+ }
+
+};
+
+/// This class defines the interface for the tabulation of the cell
+/// tensor corresponding to the local contribution to a form from
+/// the integral over a cell.
+
+class stokes_p2p1_0_cell_integral_0: public ufc::cell_integral
+{
+private:
+
+ stokes_p2p1_0_cell_integral_0_quadrature integral_0_quadrature;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_0_cell_integral_0() : ufc::cell_integral()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_0_cell_integral_0()
+ {
+ // Do nothing
+ }
+
+ /// Tabulate the tensor for the contribution from a local cell
+ virtual void tabulate_tensor(double* A,
+ const double * const * w,
+ const ufc::cell& c) const
+ {
+ // Reset values of the element tensor block
+ for (unsigned int j = 0; j < 225; j++)
+ A[j] = 0;
+
+ // Add all contributions to element tensor
+ integral_0_quadrature.tabulate_tensor(A, w, c);
}
};
@@ -8561,18 +8568,18 @@ public:
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
/// fixed functions (coefficients).
-class UFC_Stokes_P2P1BilinearForm: public ufc::form
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1BilinearForm() : ufc::form()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1BilinearForm()
+class stokes_p2p1_form_0: public ufc::form
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_form_0() : ufc::form()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_form_0()
{
// Do nothing
}
@@ -8580,7 +8587,7 @@ public:
/// Return a string identifying the form
virtual const char* signature() const
{
- return "w0_a0[0](dXa1[0, 1]/dxb0[0, 1])(dXa2[0, 1]/dxb0[0, 1]) | va0[0]*((d/dXa1[0, 1])vi0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14][b0[0, 1]])*((d/dXa2[0, 1])vi1[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14][b0[0, 1]])*dX(0) + -(dXa0[0, 1]/dxa1[0, 1]) | ((d/dXa0[0, 1])vi0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14][a1[0, 1]])*vi1[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14][2]*dX(0) + (dXa0[0, 1]/dxa1[0, 1]) | vi0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14][2]*((d/dXa0[0, 1])vi1[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14][a1[0, 1]])*dX(0)";
+ return "Form([Integral(Sum(Product(IndexSum(Indexed(ListTensor(Indexed(SpatialDerivative(BasisFunction(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 1), MultiIndex((Index(0),), {Index(0): 2})), MultiIndex((FixedIndex(0),), {})), Indexed(SpatialDerivative(BasisFunction(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 1), MultiIndex((Index(0),), {Index(0): 2})), MultiIndex((FixedIndex(1),), {}))), MultiIndex((Index(0),), {Index(0): 2})), MultiIndex((Index(0),), {Index(0): 2})), Indexed(BasisFunction(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((FixedIndex(2),), {FixedIndex(2): 3}))), Sum(Product(Constant(Cell('triangle', 1, Space(2)), 0), IndexSum(IndexSum(Product(Indexed(ComponentTensor(Indexed(ListTensor(Indexed(SpatialDerivative(BasisFunction(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((Index(1),), {Index(1): 2})), MultiIndex((FixedIndex(0),), {})), Indexed(SpatialDerivative(BasisFunction(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((Index(1),), {Index(1): 2})), MultiIndex((FixedIndex(1),), {}))), MultiIndex((Index(2),), {Index(2): 2})), MultiIndex((Index(2), Index(1)), {Index(2): 2, Index(1): 2})), MultiIndex((Index(3), Index(4)), {Index(4): 2, Index(3): 2})), Indexed(ComponentTensor(Indexed(ListTensor(Indexed(SpatialDerivative(BasisFunction(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 1), MultiIndex((Index(5),), {Index(5): 2})), MultiIndex((FixedIndex(0),), {})), Indexed(SpatialDerivative(BasisFunction(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 1), MultiIndex((Index(5),), {Index(5): 2})), MultiIndex((FixedIndex(1),), {}))), MultiIndex((Index(6),), {Index(6): 2})), MultiIndex((Index(6), Index(5)), {Index(5): 2, Index(6): 2})), MultiIndex((Index(3), Index(4)), {Index(4): 2, Index(3): 2}))), MultiIndex((Index(3),), {Index(3): 2})), MultiIndex((Index(4),), {Index(4): 2}))), Product(IntValue(-1, (), (), {}), Product(IndexSum(Indexed(ListTensor(Indexed(SpatialDerivative(BasisFunction(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((Index(7),), {Index(7): 2})), MultiIndex((FixedIndex(0),), {})), Indexed(SpatialDerivative(BasisFunction(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((Index(7),), {Index(7): 2})), MultiIndex((FixedIndex(1),), {}))), MultiIndex((Index(7),), {Index(7): 2})), MultiIndex((Index(7),), {Index(7): 2})), Indexed(BasisFunction(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 1), MultiIndex((FixedIndex(2),), {FixedIndex(2): 3})))))), Measure('cell', 0, None))])";
}
/// Return the rank of the global tensor (r)
@@ -8600,50 +8607,50 @@ public:
{
return 1;
}
-
+
/// Return the number of exterior facet integrals
virtual unsigned int num_exterior_facet_integrals() const
{
return 0;
}
-
+
/// Return the number of interior facet integrals
virtual unsigned int num_interior_facet_integrals() const
{
return 0;
}
-
+
/// Create a new finite element for argument function i
virtual ufc::finite_element* create_finite_element(unsigned int i) const
{
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1BilinearForm_finite_element_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1BilinearForm_finite_element_1();
- break;
- case 2:
- return new UFC_Stokes_P2P1BilinearForm_finite_element_2();
- break;
- }
- return 0;
- }
-
+ return new stokes_p2p1_0_finite_element_0();
+ break;
+ case 1:
+ return new stokes_p2p1_0_finite_element_1();
+ break;
+ case 2:
+ return new stokes_p2p1_0_finite_element_2();
+ break;
+ }
+ return 0;
+ }
+
/// Create a new dof map for argument function i
virtual ufc::dof_map* create_dof_map(unsigned int i) const
{
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1BilinearForm_dof_map_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1BilinearForm_dof_map_1();
- break;
- case 2:
- return new UFC_Stokes_P2P1BilinearForm_dof_map_2();
+ return new stokes_p2p1_0_dof_map_0();
+ break;
+ case 1:
+ return new stokes_p2p1_0_dof_map_1();
+ break;
+ case 2:
+ return new stokes_p2p1_0_dof_map_2();
break;
}
return 0;
@@ -8652,7 +8659,7 @@ public:
/// Create a new cell integral on sub domain i
virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
{
- return new UFC_Stokes_P2P1BilinearForm_cell_integral_0();
+ return new stokes_p2p1_0_cell_integral_0();
}
/// Create a new exterior facet integral on sub domain i
@@ -8671,67 +8678,67 @@ public:
/// This class defines the interface for a finite element.
-class UFC_Stokes_P2P1LinearForm_finite_element_0_0_0: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_finite_element_0_0_0() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_finite_element_0_0_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "FiniteElement('Lagrange', 'triangle', 2)";
- }
-
- /// Return the cell shape
- virtual ufc::shape cell_shape() const
- {
- return ufc::triangle;
- }
-
- /// Return the dimension of the finite element function space
- virtual unsigned int space_dimension() const
- {
- return 6;
- }
-
- /// Return the rank of the value space
- virtual unsigned int value_rank() const
- {
- return 0;
- }
-
- /// Return the dimension of the value space for axis i
- virtual unsigned int value_dimension(unsigned int i) const
- {
- return 1;
- }
-
- /// Evaluate basis function i at given point in cell
- virtual void evaluate_basis(unsigned int i,
- double* values,
- const double* coordinates,
- const ufc::cell& c) const
- {
- // Extract vertex coordinates
- const double * const * element_coordinates = c.coordinates;
-
- // Compute Jacobian of affine map from reference cell
- const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
- const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
- const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
- const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+class stokes_p2p1_1_finite_element_0_0_0: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_1_finite_element_0_0_0() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_finite_element_0_0_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
+ }
+
+ /// Return the cell shape
+ virtual ufc::shape cell_shape() const
+ {
+ return ufc::triangle;
+ }
+
+ /// Return the dimension of the finite element function space
+ virtual unsigned int space_dimension() const
+ {
+ return 6;
+ }
+
+ /// Return the rank of the value space
+ virtual unsigned int value_rank() const
+ {
+ return 0;
+ }
+
+ /// Return the dimension of the value space for axis i
+ virtual unsigned int value_dimension(unsigned int i) const
+ {
+ return 1;
+ }
+
+ /// Evaluate basis function i at given point in cell
+ virtual void evaluate_basis(unsigned int i,
+ double* values,
+ const double* coordinates,
+ const ufc::cell& c) const
+ {
+ // Extract vertex coordinates
+ const double * const * element_coordinates = c.coordinates;
+
+ // Compute Jacobian of affine map from reference cell
+ const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
+ const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
+ const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
+ const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -8785,7 +8792,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -8828,69 +8835,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -8942,7 +8949,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -8952,7 +8959,7 @@ public:
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -8960,7 +8967,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -9071,9 +9078,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
- const static double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
+ static const double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
+ static const double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -9100,7 +9107,7 @@ public:
// Take directional components
for(int k = 0; k < 1; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -9134,74 +9141,74 @@ public:
/// Create a new finite element for sub element i (for a mixed element)
virtual ufc::finite_element* create_sub_element(unsigned int i) const
{
- return new UFC_Stokes_P2P1LinearForm_finite_element_0_0_0();
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1LinearForm_finite_element_0_0_1: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_finite_element_0_0_1() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_finite_element_0_0_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "FiniteElement('Lagrange', 'triangle', 2)";
- }
-
- /// Return the cell shape
- virtual ufc::shape cell_shape() const
- {
- return ufc::triangle;
- }
-
- /// Return the dimension of the finite element function space
- virtual unsigned int space_dimension() const
- {
- return 6;
- }
-
- /// Return the rank of the value space
- virtual unsigned int value_rank() const
- {
- return 0;
- }
-
- /// Return the dimension of the value space for axis i
- virtual unsigned int value_dimension(unsigned int i) const
- {
- return 1;
- }
-
- /// Evaluate basis function i at given point in cell
- virtual void evaluate_basis(unsigned int i,
- double* values,
- const double* coordinates,
- const ufc::cell& c) const
- {
- // Extract vertex coordinates
- const double * const * element_coordinates = c.coordinates;
-
- // Compute Jacobian of affine map from reference cell
- const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
- const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
- const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
- const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+ return new stokes_p2p1_1_finite_element_0_0_0();
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_1_finite_element_0_0_1: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_1_finite_element_0_0_1() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_finite_element_0_0_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
+ }
+
+ /// Return the cell shape
+ virtual ufc::shape cell_shape() const
+ {
+ return ufc::triangle;
+ }
+
+ /// Return the dimension of the finite element function space
+ virtual unsigned int space_dimension() const
+ {
+ return 6;
+ }
+
+ /// Return the rank of the value space
+ virtual unsigned int value_rank() const
+ {
+ return 0;
+ }
+
+ /// Return the dimension of the value space for axis i
+ virtual unsigned int value_dimension(unsigned int i) const
+ {
+ return 1;
+ }
+
+ /// Evaluate basis function i at given point in cell
+ virtual void evaluate_basis(unsigned int i,
+ double* values,
+ const double* coordinates,
+ const ufc::cell& c) const
+ {
+ // Extract vertex coordinates
+ const double * const * element_coordinates = c.coordinates;
+
+ // Compute Jacobian of affine map from reference cell
+ const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
+ const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
+ const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
+ const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -9255,7 +9262,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -9298,69 +9305,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -9412,7 +9419,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -9422,7 +9429,7 @@ public:
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -9430,7 +9437,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -9541,9 +9548,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
- const static double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
+ static const double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
+ static const double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -9570,7 +9577,7 @@ public:
// Take directional components
for(int k = 0; k < 1; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -9604,33 +9611,33 @@ public:
/// Create a new finite element for sub element i (for a mixed element)
virtual ufc::finite_element* create_sub_element(unsigned int i) const
{
- return new UFC_Stokes_P2P1LinearForm_finite_element_0_0_1();
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1LinearForm_finite_element_0_0: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_finite_element_0_0() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_finite_element_0_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)])";
+ return new stokes_p2p1_1_finite_element_0_0_1();
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_1_finite_element_0_0: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_1_finite_element_0_0() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_finite_element_0_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2)";
}
/// Return the cell shape
@@ -9671,7 +9678,7 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -9728,7 +9735,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -9780,7 +9787,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -9825,69 +9832,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -9941,17 +9948,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -9959,7 +9966,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -10087,17 +10094,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -10105,7 +10112,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -10218,9 +10225,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[12][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
- const static double W[12][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[12][1][2] = {{{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}};
+ static const double X[12][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
+ static const double W[12][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[12][1][2] = {{{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -10247,7 +10254,7 @@ public:
// Take directional components
for(int k = 0; k < 2; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -10288,80 +10295,80 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1LinearForm_finite_element_0_0_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1LinearForm_finite_element_0_0_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1LinearForm_finite_element_0_1: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_finite_element_0_1() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_finite_element_0_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "FiniteElement('Lagrange', 'triangle', 1)";
- }
-
- /// Return the cell shape
- virtual ufc::shape cell_shape() const
- {
- return ufc::triangle;
- }
-
- /// Return the dimension of the finite element function space
- virtual unsigned int space_dimension() const
- {
- return 3;
- }
-
- /// Return the rank of the value space
- virtual unsigned int value_rank() const
- {
- return 0;
- }
-
- /// Return the dimension of the value space for axis i
- virtual unsigned int value_dimension(unsigned int i) const
- {
- return 1;
- }
-
- /// Evaluate basis function i at given point in cell
- virtual void evaluate_basis(unsigned int i,
- double* values,
- const double* coordinates,
- const ufc::cell& c) const
- {
- // Extract vertex coordinates
- const double * const * element_coordinates = c.coordinates;
-
- // Compute Jacobian of affine map from reference cell
- const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
- const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
- const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
- const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+ return new stokes_p2p1_1_finite_element_0_0_0();
+ break;
+ case 1:
+ return new stokes_p2p1_1_finite_element_0_0_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_1_finite_element_0_1: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_1_finite_element_0_1() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_finite_element_0_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)";
+ }
+
+ /// Return the cell shape
+ virtual ufc::shape cell_shape() const
+ {
+ return ufc::triangle;
+ }
+
+ /// Return the dimension of the finite element function space
+ virtual unsigned int space_dimension() const
+ {
+ return 3;
+ }
+
+ /// Return the rank of the value space
+ virtual unsigned int value_rank() const
+ {
+ return 0;
+ }
+
+ /// Return the dimension of the value space for axis i
+ virtual unsigned int value_dimension(unsigned int i) const
+ {
+ return 1;
+ }
+
+ /// Evaluate basis function i at given point in cell
+ virtual void evaluate_basis(unsigned int i,
+ double* values,
+ const double* coordinates,
+ const ufc::cell& c) const
+ {
+ // Extract vertex coordinates
+ const double * const * element_coordinates = c.coordinates;
+
+ // Compute Jacobian of affine map from reference cell
+ const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
+ const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
+ const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
+ const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -10407,7 +10414,7 @@ public:
const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
// Table(s) of coefficients
- const static double coefficients0[3][3] = \
+ static const double coefficients0[3][3] = \
{{0.471404520791032, -0.288675134594813, -0.166666666666667},
{0.471404520791032, 0.288675134594813, -0.166666666666667},
{0.471404520791032, 0, 0.333333333333333}};
@@ -10444,69 +10451,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -10550,19 +10557,19 @@ public:
const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
// Table(s) of coefficients
- const static double coefficients0[3][3] = \
+ static const double coefficients0[3][3] = \
{{0.471404520791032, -0.288675134594813, -0.166666666666667},
{0.471404520791032, 0.288675134594813, -0.166666666666667},
{0.471404520791032, 0, 0.333333333333333}};
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[3][3] = \
+ static const double dmats0[3][3] = \
{{0, 0, 0},
{4.89897948556636, 0, 0},
{0, 0, 0}};
- const static double dmats1[3][3] = \
+ static const double dmats1[3][3] = \
{{0, 0, 0},
{2.44948974278318, 0, 0},
{4.24264068711928, 0, 0}};
@@ -10652,9 +10659,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[3][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}};
- const static double W[3][1] = {{1}, {1}, {1}};
- const static double D[3][1][1] = {{{1}}, {{1}}, {{1}}};
+ static const double X[3][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}};
+ static const double W[3][1] = {{1}, {1}, {1}};
+ static const double D[3][1][1] = {{{1}}, {{1}}, {{1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -10681,7 +10688,7 @@ public:
// Take directional components
for(int k = 0; k < 1; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -10715,33 +10722,33 @@ public:
/// Create a new finite element for sub element i (for a mixed element)
virtual ufc::finite_element* create_sub_element(unsigned int i) const
{
- return new UFC_Stokes_P2P1LinearForm_finite_element_0_1();
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1LinearForm_finite_element_0: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_finite_element_0() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_finite_element_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "MixedElement([MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)]), FiniteElement('Lagrange', 'triangle', 1)])";
+ return new stokes_p2p1_1_finite_element_0_1();
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_1_finite_element_0: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_1_finite_element_0() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_finite_element_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) })";
}
/// Return the cell shape
@@ -10782,7 +10789,7 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -10840,7 +10847,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -10892,7 +10899,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -10936,7 +10943,7 @@ public:
const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
// Table(s) of coefficients
- const static double coefficients0[3][3] = \
+ static const double coefficients0[3][3] = \
{{0.471404520791032, -0.288675134594813, -0.166666666666667},
{0.471404520791032, 0.288675134594813, -0.166666666666667},
{0.471404520791032, 0, 0.333333333333333}};
@@ -10975,69 +10982,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -11091,17 +11098,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -11109,7 +11116,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -11237,17 +11244,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -11255,7 +11262,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -11375,19 +11382,19 @@ public:
const double basisvalue2 = psitilde_a_0*scalings_y_0*psitilde_bs_0_1;
// Table(s) of coefficients
- const static double coefficients0[3][3] = \
+ static const double coefficients0[3][3] = \
{{0.471404520791032, -0.288675134594813, -0.166666666666667},
{0.471404520791032, 0.288675134594813, -0.166666666666667},
{0.471404520791032, 0, 0.333333333333333}};
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[3][3] = \
+ static const double dmats0[3][3] = \
{{0, 0, 0},
{4.89897948556636, 0, 0},
{0, 0, 0}};
- const static double dmats1[3][3] = \
+ static const double dmats1[3][3] = \
{{0, 0, 0},
{2.44948974278318, 0, 0},
{4.24264068711928, 0, 0}};
@@ -11479,9 +11486,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}};
- const static double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[15][1][3] = {{{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 0, 1}}, {{0, 0, 1}}, {{0, 0, 1}}};
+ static const double X[15][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}};
+ static const double W[15][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[15][1][3] = {{{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{1, 0, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 1, 0}}, {{0, 0, 1}}, {{0, 0, 1}}, {{0, 0, 1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -11508,7 +11515,7 @@ public:
// Take directional components
for(int k = 0; k < 3; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -11553,80 +11560,80 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1LinearForm_finite_element_0_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1LinearForm_finite_element_0_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1LinearForm_finite_element_1_0: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_finite_element_1_0() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_finite_element_1_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "FiniteElement('Lagrange', 'triangle', 2)";
- }
-
- /// Return the cell shape
- virtual ufc::shape cell_shape() const
- {
- return ufc::triangle;
- }
-
- /// Return the dimension of the finite element function space
- virtual unsigned int space_dimension() const
- {
- return 6;
- }
-
- /// Return the rank of the value space
- virtual unsigned int value_rank() const
- {
- return 0;
- }
-
- /// Return the dimension of the value space for axis i
- virtual unsigned int value_dimension(unsigned int i) const
- {
- return 1;
- }
-
- /// Evaluate basis function i at given point in cell
- virtual void evaluate_basis(unsigned int i,
- double* values,
- const double* coordinates,
- const ufc::cell& c) const
- {
- // Extract vertex coordinates
- const double * const * element_coordinates = c.coordinates;
-
- // Compute Jacobian of affine map from reference cell
- const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
- const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
- const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
- const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+ return new stokes_p2p1_1_finite_element_0_0();
+ break;
+ case 1:
+ return new stokes_p2p1_1_finite_element_0_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_1_finite_element_1_0: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_1_finite_element_1_0() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_finite_element_1_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
+ }
+
+ /// Return the cell shape
+ virtual ufc::shape cell_shape() const
+ {
+ return ufc::triangle;
+ }
+
+ /// Return the dimension of the finite element function space
+ virtual unsigned int space_dimension() const
+ {
+ return 6;
+ }
+
+ /// Return the rank of the value space
+ virtual unsigned int value_rank() const
+ {
+ return 0;
+ }
+
+ /// Return the dimension of the value space for axis i
+ virtual unsigned int value_dimension(unsigned int i) const
+ {
+ return 1;
+ }
+
+ /// Evaluate basis function i at given point in cell
+ virtual void evaluate_basis(unsigned int i,
+ double* values,
+ const double* coordinates,
+ const ufc::cell& c) const
+ {
+ // Extract vertex coordinates
+ const double * const * element_coordinates = c.coordinates;
+
+ // Compute Jacobian of affine map from reference cell
+ const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
+ const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
+ const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
+ const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -11680,7 +11687,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -11723,69 +11730,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -11837,7 +11844,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -11847,7 +11854,7 @@ public:
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -11855,7 +11862,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -11966,9 +11973,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
- const static double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
+ static const double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
+ static const double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -11995,7 +12002,7 @@ public:
// Take directional components
for(int k = 0; k < 1; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -12029,74 +12036,74 @@ public:
/// Create a new finite element for sub element i (for a mixed element)
virtual ufc::finite_element* create_sub_element(unsigned int i) const
{
- return new UFC_Stokes_P2P1LinearForm_finite_element_1_0();
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1LinearForm_finite_element_1_1: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_finite_element_1_1() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_finite_element_1_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "FiniteElement('Lagrange', 'triangle', 2)";
- }
-
- /// Return the cell shape
- virtual ufc::shape cell_shape() const
- {
- return ufc::triangle;
- }
-
- /// Return the dimension of the finite element function space
- virtual unsigned int space_dimension() const
- {
- return 6;
- }
-
- /// Return the rank of the value space
- virtual unsigned int value_rank() const
- {
- return 0;
- }
-
- /// Return the dimension of the value space for axis i
- virtual unsigned int value_dimension(unsigned int i) const
- {
- return 1;
- }
-
- /// Evaluate basis function i at given point in cell
- virtual void evaluate_basis(unsigned int i,
- double* values,
- const double* coordinates,
- const ufc::cell& c) const
- {
- // Extract vertex coordinates
- const double * const * element_coordinates = c.coordinates;
-
- // Compute Jacobian of affine map from reference cell
- const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
- const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
- const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
- const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+ return new stokes_p2p1_1_finite_element_1_0();
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_1_finite_element_1_1: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_1_finite_element_1_1() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_finite_element_1_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
+ }
+
+ /// Return the cell shape
+ virtual ufc::shape cell_shape() const
+ {
+ return ufc::triangle;
+ }
+
+ /// Return the dimension of the finite element function space
+ virtual unsigned int space_dimension() const
+ {
+ return 6;
+ }
+
+ /// Return the rank of the value space
+ virtual unsigned int value_rank() const
+ {
+ return 0;
+ }
+
+ /// Return the dimension of the value space for axis i
+ virtual unsigned int value_dimension(unsigned int i) const
+ {
+ return 1;
+ }
+
+ /// Evaluate basis function i at given point in cell
+ virtual void evaluate_basis(unsigned int i,
+ double* values,
+ const double* coordinates,
+ const ufc::cell& c) const
+ {
+ // Extract vertex coordinates
+ const double * const * element_coordinates = c.coordinates;
+
+ // Compute Jacobian of affine map from reference cell
+ const double J_00 = element_coordinates[1][0] - element_coordinates[0][0];
+ const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
+ const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
+ const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -12150,7 +12157,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -12193,69 +12200,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -12307,7 +12314,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -12317,7 +12324,7 @@ public:
// Interesting (new) part
// Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -12325,7 +12332,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -12436,9 +12443,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
- const static double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
+ static const double X[6][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
+ static const double W[6][1] = {{1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[6][1][1] = {{{1}}, {{1}}, {{1}}, {{1}}, {{1}}, {{1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -12465,7 +12472,7 @@ public:
// Take directional components
for(int k = 0; k < 1; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -12499,33 +12506,33 @@ public:
/// Create a new finite element for sub element i (for a mixed element)
virtual ufc::finite_element* create_sub_element(unsigned int i) const
{
- return new UFC_Stokes_P2P1LinearForm_finite_element_1_1();
- }
-
-};
-
-/// This class defines the interface for a finite element.
-
-class UFC_Stokes_P2P1LinearForm_finite_element_1: public ufc::finite_element
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_finite_element_1() : ufc::finite_element()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_finite_element_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the finite element
- virtual const char* signature() const
- {
- return "MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)])";
+ return new stokes_p2p1_1_finite_element_1_1();
+ }
+
+};
+
+/// This class defines the interface for a finite element.
+
+class stokes_p2p1_1_finite_element_1: public ufc::finite_element
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_1_finite_element_1() : ufc::finite_element()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_finite_element_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the finite element
+ virtual const char* signature() const
+ {
+ return "VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2)";
}
/// Return the cell shape
@@ -12566,7 +12573,7 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
+
// Compute determinant of Jacobian
const double detJ = J_00*J_11 - J_01*J_10;
@@ -12623,7 +12630,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -12675,7 +12682,7 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
+ static const double coefficients0[6][6] = \
{{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
{0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
{0, 0, 0.2, 0, 0, 0.163299316185545},
@@ -12720,69 +12727,69 @@ public:
const double J_01 = element_coordinates[2][0] - element_coordinates[0][0];
const double J_10 = element_coordinates[1][1] - element_coordinates[0][1];
const double J_11 = element_coordinates[2][1] - element_coordinates[0][1];
-
- // Compute determinant of Jacobian
- const double detJ = J_00*J_11 - J_01*J_10;
-
- // Compute inverse of Jacobian
-
- // Get coordinates and map to the reference (UFC) element
- double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
- element_coordinates[0][0]*element_coordinates[2][1] +\
- J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
- double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
- element_coordinates[1][0]*element_coordinates[0][1] -\
- J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
-
- // Map coordinates to the reference square
- if (std::abs(y - 1.0) < 1e-14)
- x = -1.0;
- else
- x = 2.0 *x/(1.0 - y) - 1.0;
- y = 2.0*y - 1.0;
-
- // Compute number of derivatives
- unsigned int num_derivatives = 1;
-
- for (unsigned int j = 0; j < n; j++)
- num_derivatives *= 2;
-
-
- // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
- unsigned int **combinations = new unsigned int *[num_derivatives];
-
- for (unsigned int j = 0; j < num_derivatives; j++)
- {
- combinations[j] = new unsigned int [n];
- for (unsigned int k = 0; k < n; k++)
- combinations[j][k] = 0;
- }
-
- // Generate combinations of derivatives
- for (unsigned int row = 1; row < num_derivatives; row++)
- {
- for (unsigned int num = 0; num < row; num++)
- {
- for (unsigned int col = n-1; col+1 > 0; col--)
- {
- if (combinations[row][col] + 1 > 1)
- combinations[row][col] = 0;
- else
- {
- combinations[row][col] += 1;
- break;
- }
- }
- }
- }
-
- // Compute inverse of Jacobian
- const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
-
- // Declare transformation matrix
- // Declare pointer to two dimensional array and initialise
- double **transform = new double *[num_derivatives];
-
+
+ // Compute determinant of Jacobian
+ const double detJ = J_00*J_11 - J_01*J_10;
+
+ // Compute inverse of Jacobian
+
+ // Get coordinates and map to the reference (UFC) element
+ double x = (element_coordinates[0][1]*element_coordinates[2][0] -\
+ element_coordinates[0][0]*element_coordinates[2][1] +\
+ J_11*coordinates[0] - J_01*coordinates[1]) / detJ;
+ double y = (element_coordinates[1][1]*element_coordinates[0][0] -\
+ element_coordinates[1][0]*element_coordinates[0][1] -\
+ J_10*coordinates[0] + J_00*coordinates[1]) / detJ;
+
+ // Map coordinates to the reference square
+ if (std::abs(y - 1.0) < 1e-14)
+ x = -1.0;
+ else
+ x = 2.0 *x/(1.0 - y) - 1.0;
+ y = 2.0*y - 1.0;
+
+ // Compute number of derivatives
+ unsigned int num_derivatives = 1;
+
+ for (unsigned int j = 0; j < n; j++)
+ num_derivatives *= 2;
+
+
+ // Declare pointer to two dimensional array that holds combinations of derivatives and initialise
+ unsigned int **combinations = new unsigned int *[num_derivatives];
+
+ for (unsigned int j = 0; j < num_derivatives; j++)
+ {
+ combinations[j] = new unsigned int [n];
+ for (unsigned int k = 0; k < n; k++)
+ combinations[j][k] = 0;
+ }
+
+ // Generate combinations of derivatives
+ for (unsigned int row = 1; row < num_derivatives; row++)
+ {
+ for (unsigned int num = 0; num < row; num++)
+ {
+ for (unsigned int col = n-1; col+1 > 0; col--)
+ {
+ if (combinations[row][col] + 1 > 1)
+ combinations[row][col] = 0;
+ else
+ {
+ combinations[row][col] += 1;
+ break;
+ }
+ }
+ }
+ }
+
+ // Compute inverse of Jacobian
+ const double Jinv[2][2] = {{J_11 / detJ, -J_01 / detJ}, {-J_10 / detJ, J_00 / detJ}};
+
+ // Declare transformation matrix
+ // Declare pointer to two dimensional array and initialise
+ double **transform = new double *[num_derivatives];
+
for (unsigned int j = 0; j < num_derivatives; j++)
{
transform[j] = new double [num_derivatives];
@@ -12836,17 +12843,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -12854,7 +12861,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -12982,17 +12989,17 @@ public:
const double basisvalue5 = 1.22474487139159*psitilde_a_0*scalings_y_0*psitilde_bs_0_2;
// Table(s) of coefficients
- const static double coefficients0[6][6] = \
- {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
- {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
- {0, 0, 0.2, 0, 0, 0.163299316185545},
- {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
- {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
- {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
-
- // Interesting (new) part
- // Tables of derivatives of the polynomial base (transpose)
- const static double dmats0[6][6] = \
+ static const double coefficients0[6][6] = \
+ {{0, -0.173205080756888, -0.1, 0.121716123890037, 0.0942809041582064, 0.0544331053951817},
+ {0, 0.173205080756888, -0.1, 0.121716123890037, -0.0942809041582063, 0.0544331053951818},
+ {0, 0, 0.2, 0, 0, 0.163299316185545},
+ {0.471404520791032, 0.23094010767585, 0.133333333333333, 0, 0.188561808316413, -0.163299316185545},
+ {0.471404520791032, -0.23094010767585, 0.133333333333333, 0, -0.188561808316413, -0.163299316185545},
+ {0.471404520791032, 0, -0.266666666666667, -0.243432247780074, 0, 0.0544331053951817}};
+
+ // Interesting (new) part
+ // Tables of derivatives of the polynomial base (transpose)
+ static const double dmats0[6][6] = \
{{0, 0, 0, 0, 0, 0},
{4.89897948556636, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
@@ -13000,7 +13007,7 @@ public:
{4, 0, 7.07106781186548, 0, 0, 0},
{0, 0, 0, 0, 0, 0}};
- const static double dmats1[6][6] = \
+ static const double dmats1[6][6] = \
{{0, 0, 0, 0, 0, 0},
{2.44948974278318, 0, 0, 0, 0, 0},
{4.24264068711928, 0, 0, 0, 0, 0},
@@ -13113,9 +13120,9 @@ public:
const ufc::cell& c) const
{
// The reference points, direction and weights:
- const static double X[12][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
- const static double W[12][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
- const static double D[12][1][2] = {{{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}};
+ static const double X[12][1][2] = {{{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}, {{0, 0}}, {{1, 0}}, {{0, 1}}, {{0.5, 0.5}}, {{0, 0.5}}, {{0.5, 0}}};
+ static const double W[12][1] = {{1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}, {1}};
+ static const double D[12][1][2] = {{{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{1, 0}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}, {{0, 1}}};
const double * const * x = c.coordinates;
double result = 0.0;
@@ -13142,7 +13149,7 @@ public:
// Take directional components
for(int k = 0; k < 2; k++)
result += values[k]*D[i][0][k];
- // Multiply by weights
+ // Multiply by weights
result *= W[i][0];
return result;
@@ -13183,44 +13190,44 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1LinearForm_finite_element_1_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1LinearForm_finite_element_1_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1LinearForm_dof_map_0_0_0: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_dof_map_0_0_0() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_dof_map_0_0_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for FiniteElement('Lagrange', 'triangle', 2)";
+ return new stokes_p2p1_1_finite_element_1_0();
+ break;
+ case 1:
+ return new stokes_p2p1_1_finite_element_1_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_1_dof_map_0_0_0: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_1_dof_map_0_0_0() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_dof_map_0_0_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -13267,8 +13274,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 6;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 6;
}
@@ -13364,38 +13377,38 @@ public:
/// Create a new dof_map for sub dof map i (for a mixed element)
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
{
- return new UFC_Stokes_P2P1LinearForm_dof_map_0_0_0();
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1LinearForm_dof_map_0_0_1: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_dof_map_0_0_1() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_dof_map_0_0_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for FiniteElement('Lagrange', 'triangle', 2)";
+ return new stokes_p2p1_1_dof_map_0_0_0();
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_1_dof_map_0_0_1: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_1_dof_map_0_0_1() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_dof_map_0_0_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -13442,8 +13455,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 6;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 6;
}
@@ -13539,38 +13558,38 @@ public:
/// Create a new dof_map for sub dof map i (for a mixed element)
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
{
- return new UFC_Stokes_P2P1LinearForm_dof_map_0_0_1();
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1LinearForm_dof_map_0_0: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_dof_map_0_0() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_dof_map_0_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)])";
+ return new stokes_p2p1_1_dof_map_0_0_1();
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_1_dof_map_0_0: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_1_dof_map_0_0() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_dof_map_0_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -13617,8 +13636,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 12;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 12;
}
@@ -13746,44 +13771,44 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1LinearForm_dof_map_0_0_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1LinearForm_dof_map_0_0_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1LinearForm_dof_map_0_1: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_dof_map_0_1() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_dof_map_0_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for FiniteElement('Lagrange', 'triangle', 1)";
+ return new stokes_p2p1_1_dof_map_0_0_0();
+ break;
+ case 1:
+ return new stokes_p2p1_1_dof_map_0_0_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_1_dof_map_0_1: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_1_dof_map_0_1() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_dof_map_0_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -13830,122 +13855,128 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
- {
- return 3;
- }
-
- // Return the geometric dimension of the coordinates this dof map provides
- virtual unsigned int geometric_dimension() const
- {
- return 2;
- }
-
- /// Return the number of dofs on each cell facet
- virtual unsigned int num_facet_dofs() const
- {
- return 2;
- }
-
- /// Return the number of dofs associated with each cell entity of dimension d
- virtual unsigned int num_entity_dofs(unsigned int d) const
- {
- throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
- }
-
- /// Tabulate the local-to-global mapping of dofs on a cell
- virtual void tabulate_dofs(unsigned int* dofs,
- const ufc::mesh& m,
- const ufc::cell& c) const
- {
- dofs[0] = c.entity_indices[0][0];
- dofs[1] = c.entity_indices[0][1];
- dofs[2] = c.entity_indices[0][2];
- }
-
- /// Tabulate the local-to-local mapping from facet dofs to cell dofs
- virtual void tabulate_facet_dofs(unsigned int* dofs,
- unsigned int facet) const
- {
- switch ( facet )
- {
- case 0:
- dofs[0] = 1;
- dofs[1] = 2;
- break;
- case 1:
- dofs[0] = 0;
- dofs[1] = 2;
- break;
- case 2:
- dofs[0] = 0;
- dofs[1] = 1;
- break;
- }
- }
-
- /// Tabulate the local-to-local mapping of dofs on entity (d, i)
- virtual void tabulate_entity_dofs(unsigned int* dofs,
- unsigned int d, unsigned int i) const
- {
- throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
- }
-
- /// Tabulate the coordinates of all dofs on a cell
- virtual void tabulate_coordinates(double** coordinates,
- const ufc::cell& c) const
- {
- const double * const * x = c.coordinates;
- coordinates[0][0] = x[0][0];
- coordinates[0][1] = x[0][1];
- coordinates[1][0] = x[1][0];
- coordinates[1][1] = x[1][1];
- coordinates[2][0] = x[2][0];
- coordinates[2][1] = x[2][1];
- }
-
- /// Return the number of sub dof maps (for a mixed element)
- virtual unsigned int num_sub_dof_maps() const
- {
- return 1;
- }
-
- /// Create a new dof_map for sub dof map i (for a mixed element)
- virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
- {
- return new UFC_Stokes_P2P1LinearForm_dof_map_0_1();
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1LinearForm_dof_map_0: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_dof_map_0() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_dof_map_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for MixedElement([MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)]), FiniteElement('Lagrange', 'triangle', 1)])";
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 3;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
+ {
+ return 3;
+ }
+
+ // Return the geometric dimension of the coordinates this dof map provides
+ virtual unsigned int geometric_dimension() const
+ {
+ return 2;
+ }
+
+ /// Return the number of dofs on each cell facet
+ virtual unsigned int num_facet_dofs() const
+ {
+ return 2;
+ }
+
+ /// Return the number of dofs associated with each cell entity of dimension d
+ virtual unsigned int num_entity_dofs(unsigned int d) const
+ {
+ throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
+ }
+
+ /// Tabulate the local-to-global mapping of dofs on a cell
+ virtual void tabulate_dofs(unsigned int* dofs,
+ const ufc::mesh& m,
+ const ufc::cell& c) const
+ {
+ dofs[0] = c.entity_indices[0][0];
+ dofs[1] = c.entity_indices[0][1];
+ dofs[2] = c.entity_indices[0][2];
+ }
+
+ /// Tabulate the local-to-local mapping from facet dofs to cell dofs
+ virtual void tabulate_facet_dofs(unsigned int* dofs,
+ unsigned int facet) const
+ {
+ switch ( facet )
+ {
+ case 0:
+ dofs[0] = 1;
+ dofs[1] = 2;
+ break;
+ case 1:
+ dofs[0] = 0;
+ dofs[1] = 2;
+ break;
+ case 2:
+ dofs[0] = 0;
+ dofs[1] = 1;
+ break;
+ }
+ }
+
+ /// Tabulate the local-to-local mapping of dofs on entity (d, i)
+ virtual void tabulate_entity_dofs(unsigned int* dofs,
+ unsigned int d, unsigned int i) const
+ {
+ throw std::runtime_error("Not implemented (introduced in UFC v1.1).");
+ }
+
+ /// Tabulate the coordinates of all dofs on a cell
+ virtual void tabulate_coordinates(double** coordinates,
+ const ufc::cell& c) const
+ {
+ const double * const * x = c.coordinates;
+ coordinates[0][0] = x[0][0];
+ coordinates[0][1] = x[0][1];
+ coordinates[1][0] = x[1][0];
+ coordinates[1][1] = x[1][1];
+ coordinates[2][0] = x[2][0];
+ coordinates[2][1] = x[2][1];
+ }
+
+ /// Return the number of sub dof maps (for a mixed element)
+ virtual unsigned int num_sub_dof_maps() const
+ {
+ return 1;
+ }
+
+ /// Create a new dof_map for sub dof map i (for a mixed element)
+ virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
+ {
+ return new stokes_p2p1_1_dof_map_0_1();
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_1_dof_map_0: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_1_dof_map_0() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_dof_map_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) })";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -13992,8 +14023,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 15;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 15;
}
@@ -14137,44 +14174,44 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1LinearForm_dof_map_0_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1LinearForm_dof_map_0_1();
- break;
- }
- return 0;
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1LinearForm_dof_map_1_0: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_dof_map_1_0() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_dof_map_1_0()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for FiniteElement('Lagrange', 'triangle', 2)";
+ return new stokes_p2p1_1_dof_map_0_0();
+ break;
+ case 1:
+ return new stokes_p2p1_1_dof_map_0_1();
+ break;
+ }
+ return 0;
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_1_dof_map_1_0: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_1_dof_map_1_0() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_dof_map_1_0()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -14221,8 +14258,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 6;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 6;
}
@@ -14318,38 +14361,38 @@ public:
/// Create a new dof_map for sub dof map i (for a mixed element)
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
{
- return new UFC_Stokes_P2P1LinearForm_dof_map_1_0();
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1LinearForm_dof_map_1_1: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_dof_map_1_1() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_dof_map_1_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for FiniteElement('Lagrange', 'triangle', 2)";
+ return new stokes_p2p1_1_dof_map_1_0();
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_1_dof_map_1_1: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_1_dof_map_1_1() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_dof_map_1_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 2)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -14396,8 +14439,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 6;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 6;
}
@@ -14493,38 +14542,38 @@ public:
/// Create a new dof_map for sub dof map i (for a mixed element)
virtual ufc::dof_map* create_sub_dof_map(unsigned int i) const
{
- return new UFC_Stokes_P2P1LinearForm_dof_map_1_1();
- }
-
-};
-
-/// This class defines the interface for a local-to-global mapping of
-/// degrees of freedom (dofs).
-
-class UFC_Stokes_P2P1LinearForm_dof_map_1: public ufc::dof_map
-{
-private:
-
- unsigned int __global_dimension;
-
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_dof_map_1() : ufc::dof_map()
- {
- __global_dimension = 0;
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_dof_map_1()
- {
- // Do nothing
- }
-
- /// Return a string identifying the dof map
- virtual const char* signature() const
- {
- return "FFC dof map for MixedElement([FiniteElement('Lagrange', 'triangle', 2), FiniteElement('Lagrange', 'triangle', 2)])";
+ return new stokes_p2p1_1_dof_map_1_1();
+ }
+
+};
+
+/// This class defines the interface for a local-to-global mapping of
+/// degrees of freedom (dofs).
+
+class stokes_p2p1_1_dof_map_1: public ufc::dof_map
+{
+private:
+
+ unsigned int __global_dimension;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_1_dof_map_1() : ufc::dof_map()
+ {
+ __global_dimension = 0;
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_dof_map_1()
+ {
+ // Do nothing
+ }
+
+ /// Return a string identifying the dof map
+ virtual const char* signature() const
+ {
+ return "FFC dof map for VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2)";
}
/// Return true iff mesh entities of topological dimension d are needed
@@ -14571,8 +14620,14 @@ public:
return __global_dimension;
}
- /// Return the dimension of the local finite element function space
- virtual unsigned int local_dimension() const
+ /// Return the dimension of the local finite element function space for a cell
+ virtual unsigned int local_dimension(const ufc::cell& c) const
+ {
+ return 12;
+ }
+
+ /// Return the maximum dimension of the local finite element function space
+ virtual unsigned int max_local_dimension() const
{
return 12;
}
@@ -14700,10 +14755,10 @@ public:
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1LinearForm_dof_map_1_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1LinearForm_dof_map_1_1();
+ return new stokes_p2p1_1_dof_map_1_0();
+ break;
+ case 1:
+ return new stokes_p2p1_1_dof_map_1_1();
break;
}
return 0;
@@ -14715,18 +14770,18 @@ public:
/// tensor corresponding to the local contribution to a form from
/// the integral over a cell.
-class UFC_Stokes_P2P1LinearForm_cell_integral_0: public ufc::cell_integral
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm_cell_integral_0() : ufc::cell_integral()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm_cell_integral_0()
+class stokes_p2p1_1_cell_integral_0_quadrature: public ufc::cell_integral
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_1_cell_integral_0_quadrature() : ufc::cell_integral()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_cell_integral_0_quadrature()
{
// Do nothing
}
@@ -14744,62 +14799,117 @@ public:
const double J_01 = x[2][0] - x[0][0];
const double J_10 = x[1][1] - x[0][1];
const double J_11 = x[2][1] - x[0][1];
-
+
// Compute determinant of Jacobian
double detJ = J_00*J_11 - J_01*J_10;
-
+
// Compute inverse of Jacobian
// Set scale factor
const double det = std::abs(detJ);
- // Number of operations to compute element tensor = 96
- // Compute coefficients
- const double c0_0_0_0 = w[0][0];
- const double c0_0_0_1 = w[0][1];
- const double c0_0_0_2 = w[0][2];
- const double c0_0_0_3 = w[0][3];
- const double c0_0_0_4 = w[0][4];
- const double c0_0_0_5 = w[0][5];
- const double c0_0_0_6 = w[0][6];
- const double c0_0_0_7 = w[0][7];
- const double c0_0_0_8 = w[0][8];
- const double c0_0_0_9 = w[0][9];
- const double c0_0_0_10 = w[0][10];
- const double c0_0_0_11 = w[0][11];
-
- // Compute geometry tensors
- // Number of operations to compute decalrations = 12
- const double G0_0 = det*c0_0_0_0;
- const double G0_1 = det*c0_0_0_1;
- const double G0_2 = det*c0_0_0_2;
- const double G0_3 = det*c0_0_0_3;
- const double G0_4 = det*c0_0_0_4;
- const double G0_5 = det*c0_0_0_5;
- const double G0_6 = det*c0_0_0_6;
- const double G0_7 = det*c0_0_0_7;
- const double G0_8 = det*c0_0_0_8;
- const double G0_9 = det*c0_0_0_9;
- const double G0_10 = det*c0_0_0_10;
- const double G0_11 = det*c0_0_0_11;
-
- // Compute element tensor
- // Number of operations to compute tensor = 84
- A[0] = 0.0166666666666666*G0_0 - 0.00277777777777777*G0_1 - 0.00277777777777778*G0_2 - 0.0111111111111111*G0_3;
- A[1] = -0.00277777777777777*G0_0 + 0.0166666666666666*G0_1 - 0.00277777777777777*G0_2 - 0.0111111111111111*G0_4;
- A[2] = -0.00277777777777778*G0_0 - 0.00277777777777777*G0_1 + 0.0166666666666666*G0_2 - 0.0111111111111111*G0_5;
- A[3] = -0.0111111111111111*G0_0 + 0.0888888888888888*G0_3 + 0.0444444444444444*G0_4 + 0.0444444444444444*G0_5;
- A[4] = -0.0111111111111111*G0_1 + 0.0444444444444444*G0_3 + 0.0888888888888888*G0_4 + 0.0444444444444444*G0_5;
- A[5] = -0.0111111111111111*G0_2 + 0.0444444444444444*G0_3 + 0.0444444444444444*G0_4 + 0.0888888888888888*G0_5;
- A[6] = 0.0166666666666666*G0_6 - 0.00277777777777777*G0_7 - 0.00277777777777778*G0_8 - 0.0111111111111111*G0_9;
- A[7] = -0.00277777777777777*G0_6 + 0.0166666666666666*G0_7 - 0.00277777777777777*G0_8 - 0.0111111111111111*G0_10;
- A[8] = -0.00277777777777778*G0_6 - 0.00277777777777777*G0_7 + 0.0166666666666666*G0_8 - 0.0111111111111111*G0_11;
- A[9] = -0.0111111111111111*G0_6 + 0.0888888888888888*G0_9 + 0.0444444444444444*G0_10 + 0.0444444444444444*G0_11;
- A[10] = -0.0111111111111111*G0_7 + 0.0444444444444444*G0_9 + 0.0888888888888888*G0_10 + 0.0444444444444444*G0_11;
- A[11] = -0.0111111111111111*G0_8 + 0.0444444444444444*G0_9 + 0.0444444444444444*G0_10 + 0.0888888888888888*G0_11;
- A[12] = 0;
- A[13] = 0;
- A[14] = 0;
+
+ // Array of quadrature weights
+ static const double W9[9] = {0.0558144204830443, 0.063678085099885, 0.0193963833059595, 0.0893030727728709, 0.101884936159816, 0.0310342132895351, 0.0558144204830443, 0.063678085099885, 0.0193963833059595};
+ // Quadrature points on the UFC reference element: (0.102717654809626, 0.088587959512704), (0.0665540678391645, 0.409466864440735), (0.0239311322870806, 0.787659461760847), (0.455706020243648, 0.088587959512704), (0.295266567779633, 0.409466864440735), (0.106170269119576, 0.787659461760847), (0.80869438567767, 0.088587959512704), (0.523979067720101, 0.409466864440735), (0.188409405952072, 0.787659461760847)
+
+ // Value of basis functions at quadrature points.
+ static const double FE0_C0[9][6] = \
+ {{0.499278833175498, -0.0816158215904472, -0.072892306371455, 0.0363981897820602, 0.286562341986258, 0.332268763018087},
+ {0.0251290590975511, -0.0576951799472843, -0.0741406382908807, 0.109006741895515, 0.858208263567716, 0.139491753677383},
+ {-0.117413197449647, -0.0227857341019971, 0.453155393641927, 0.0753983311062782, 0.593609805131561, 0.0180354016718773},
+ {-0.0403700664710398, -0.0403700664710398, -0.072892306371455, 0.161480265884159, 0.161480265884159, 0.830671907545216},
+ {-0.120901875682904, -0.120901875682904, -0.0741406382908807, 0.483607502731615, 0.483607502731615, 0.348729384193458},
+ {-0.0836260170297299, -0.0836260170297299, 0.453155393641927, 0.33450406811892, 0.33450406811892, 0.0450885041796933},
+ {-0.0816158215904472, 0.499278833175498, -0.072892306371455, 0.286562341986258, 0.0363981897820602, 0.332268763018087},
+ {-0.0576951799472842, 0.0251290590975512, -0.0741406382908807, 0.858208263567716, 0.109006741895515, 0.139491753677383},
+ {-0.0227857341019971, -0.117413197449647, 0.453155393641927, 0.593609805131561, 0.0753983311062783, 0.0180354016718774}};
+
+ // Array of non-zero columns
+ static const unsigned int nzc2[6] = {0, 1, 2, 3, 4, 5};
+ // Array of non-zero columns
+ static const unsigned int nzc3[6] = {6, 7, 8, 9, 10, 11};
+ // Array of non-zero columns
+ static const unsigned int nzc1[6] = {6, 7, 8, 9, 10, 11};
+ // Array of non-zero columns
+ static const unsigned int nzc0[6] = {0, 1, 2, 3, 4, 5};
+
+ // Compute element tensor using UFL quadrature representation
+ // Optimisations: ('simplify expressions', True), ('ignore zero tables', True), ('non zero columns', True), ('remove zero terms', True), ('ignore ones', True)
+ // Total number of operations to compute element tensor: 468
+
+ // Loop quadrature points for integral
+ // Number of operations to compute element tensor for following IP loop = 468
+ for (unsigned int ip = 0; ip < 9; ip++)
+ {
+
+ // Function declarations
+ double F0 = 0;
+ double F1 = 0;
+
+ // Total number of operations to compute function values = 24
+ for (unsigned int r = 0; r < 6; r++)
+ {
+ F0 += FE0_C0[ip][r]*w[0][nzc0[r]];
+ F1 += FE0_C0[ip][r]*w[0][nzc1[r]];
+ }// end loop over 'r'
+
+ // Number of operations to compute ip constants: 4
+ // Number of operations: 2
+ const double Gip0 = F1*W9[ip]*det;
+
+ // Number of operations: 2
+ const double Gip1 = F0*W9[ip]*det;
+
+
+ // Number of operations for primary indices: 24
+ for (unsigned int j = 0; j < 6; j++)
+ {
+ // Number of operations to compute entry: 2
+ A[nzc3[j]] += FE0_C0[ip][j]*Gip0;
+ // Number of operations to compute entry: 2
+ A[nzc2[j]] += FE0_C0[ip][j]*Gip1;
+ }// end loop over 'j'
+ }// end loop over 'ip'
+ }
+
+};
+
+/// This class defines the interface for the tabulation of the cell
+/// tensor corresponding to the local contribution to a form from
+/// the integral over a cell.
+
+class stokes_p2p1_1_cell_integral_0: public ufc::cell_integral
+{
+private:
+
+ stokes_p2p1_1_cell_integral_0_quadrature integral_0_quadrature;
+
+public:
+
+ /// Constructor
+ stokes_p2p1_1_cell_integral_0() : ufc::cell_integral()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_1_cell_integral_0()
+ {
+ // Do nothing
+ }
+
+ /// Tabulate the tensor for the contribution from a local cell
+ virtual void tabulate_tensor(double* A,
+ const double * const * w,
+ const ufc::cell& c) const
+ {
+ // Reset values of the element tensor block
+ for (unsigned int j = 0; j < 15; j++)
+ A[j] = 0;
+
+ // Add all contributions to element tensor
+ integral_0_quadrature.tabulate_tensor(A, w, c);
}
};
@@ -14819,18 +14929,18 @@ public:
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
/// fixed functions (coefficients).
-class UFC_Stokes_P2P1LinearForm: public ufc::form
-{
-public:
-
- /// Constructor
- UFC_Stokes_P2P1LinearForm() : ufc::form()
- {
- // Do nothing
- }
-
- /// Destructor
- virtual ~UFC_Stokes_P2P1LinearForm()
+class stokes_p2p1_form_1: public ufc::form
+{
+public:
+
+ /// Constructor
+ stokes_p2p1_form_1() : ufc::form()
+ {
+ // Do nothing
+ }
+
+ /// Destructor
+ virtual ~stokes_p2p1_form_1()
{
// Do nothing
}
@@ -14838,7 +14948,7 @@ public:
/// Return a string identifying the form
virtual const char* signature() const
{
- return "w0_a0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] | vi0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14][b0[0, 1]]*va0[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11][b0[0, 1]]*dX(0)";
+ return "Form([Integral(IndexSum(Product(Indexed(Function(VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), 0), MultiIndex((Index(0),), {Index(0): 2})), Indexed(ListTensor(Indexed(BasisFunction(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((FixedIndex(0),), {FixedIndex(0): 3})), Indexed(BasisFunction(MixedElement(*[VectorElement('Lagrange', Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange', Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), 0), MultiIndex((FixedIndex(1),), {FixedIndex(1): 3}))), MultiIndex((Index(0),), {Index(0): 2}))), MultiIndex((Index(0),), {Index(0): 2})), Measure('cell', 0, None))])";
}
/// Return the rank of the global tensor (r)
@@ -14858,44 +14968,44 @@ public:
{
return 1;
}
-
+
/// Return the number of exterior facet integrals
virtual unsigned int num_exterior_facet_integrals() const
{
return 0;
}
-
+
/// Return the number of interior facet integrals
virtual unsigned int num_interior_facet_integrals() const
{
return 0;
}
-
+
/// Create a new finite element for argument function i
virtual ufc::finite_element* create_finite_element(unsigned int i) const
{
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1LinearForm_finite_element_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1LinearForm_finite_element_1();
- break;
- }
- return 0;
- }
-
+ return new stokes_p2p1_1_finite_element_0();
+ break;
+ case 1:
+ return new stokes_p2p1_1_finite_element_1();
+ break;
+ }
+ return 0;
+ }
+
/// Create a new dof map for argument function i
virtual ufc::dof_map* create_dof_map(unsigned int i) const
{
switch ( i )
{
case 0:
- return new UFC_Stokes_P2P1LinearForm_dof_map_0();
- break;
- case 1:
- return new UFC_Stokes_P2P1LinearForm_dof_map_1();
+ return new stokes_p2p1_1_dof_map_0();
+ break;
+ case 1:
+ return new stokes_p2p1_1_dof_map_1();
break;
}
return 0;
@@ -14904,7 +15014,7 @@ public:
/// Create a new cell integral on sub domain i
virtual ufc::cell_integral* create_cell_integral(unsigned int i) const
{
- return new UFC_Stokes_P2P1LinearForm_cell_integral_0();
+ return new stokes_p2p1_1_cell_integral_0();
}
/// Create a new exterior facet integral on sub domain i
@@ -14923,317 +15033,454 @@ public:
// DOLFIN wrappers
-#include <dolfin/fem/Form.h>
+// Standard library includes
+#include <string>
+
+// DOLFIN includes
+#include <dolfin/common/NoDeleter.h>
#include <dolfin/fem/FiniteElement.h>
#include <dolfin/fem/DofMap.h>
-#include <dolfin/function/Coefficient.h>
-#include <dolfin/function/Function.h>
+#include <dolfin/fem/Form.h>
#include <dolfin/function/FunctionSpace.h>
-
- class Stokes_P2P1BilinearFormFunctionSpace0 : public dolfin::FunctionSpace
- {
- public:
-
- Stokes_P2P1BilinearFormFunctionSpace0(const dolfin::Mesh& mesh)
- : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
- boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Stokes_P2P1LinearForm_finite_element_0()))),
- boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Stokes_P2P1LinearForm_dof_map_0()), mesh)))
- {
- // Do nothing
- }
-
- };
-
- class Stokes_P2P1BilinearFormFunctionSpace1 : public dolfin::FunctionSpace
- {
- public:
-
- Stokes_P2P1BilinearFormFunctionSpace1(const dolfin::Mesh& mesh)
- : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
- boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Stokes_P2P1LinearForm_finite_element_0()))),
- boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Stokes_P2P1LinearForm_dof_map_0()), mesh)))
- {
- // Do nothing
- }
-
- };
-
- class Stokes_P2P1BilinearFormCoefficientSpace0 : public dolfin::FunctionSpace
- {
- public:
-
- Stokes_P2P1BilinearFormCoefficientSpace0(const dolfin::Mesh& mesh)
- : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
- boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Stokes_P2P1BilinearForm_finite_element_2()))),
- boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Stokes_P2P1BilinearForm_dof_map_2()), mesh)))
- {
- // Do nothing
- }
-
- };
-
- class Stokes_P2P1LinearFormFunctionSpace0 : public dolfin::FunctionSpace
- {
- public:
-
- Stokes_P2P1LinearFormFunctionSpace0(const dolfin::Mesh& mesh)
- : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
- boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Stokes_P2P1LinearForm_finite_element_0()))),
- boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Stokes_P2P1LinearForm_dof_map_0()), mesh)))
- {
- // Do nothing
- }
-
- };
-
- class Stokes_P2P1LinearFormCoefficientSpace0 : public dolfin::FunctionSpace
- {
- public:
-
- Stokes_P2P1LinearFormCoefficientSpace0(const dolfin::Mesh& mesh)
- : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
- boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Stokes_P2P1LinearForm_finite_element_1()))),
- boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Stokes_P2P1LinearForm_dof_map_1()), mesh)))
- {
- // Do nothing
- }
-
- };
-
- class Stokes_P2P1TestSpace : public dolfin::FunctionSpace
- {
- public:
-
- Stokes_P2P1TestSpace(const dolfin::Mesh& mesh)
- : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
- boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Stokes_P2P1LinearForm_finite_element_0()))),
- boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Stokes_P2P1LinearForm_dof_map_0()), mesh)))
- {
- // Do nothing
- }
-
- };
-
- class Stokes_P2P1TrialSpace : public dolfin::FunctionSpace
- {
- public:
-
- Stokes_P2P1TrialSpace(const dolfin::Mesh& mesh)
- : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
- boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Stokes_P2P1LinearForm_finite_element_0()))),
- boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Stokes_P2P1LinearForm_dof_map_0()), mesh)))
- {
- // Do nothing
- }
-
- };
-
- class Stokes_P2P1FunctionSpace : public dolfin::FunctionSpace
- {
- public:
-
- Stokes_P2P1FunctionSpace(const dolfin::Mesh& mesh)
- : dolfin::FunctionSpace(boost::shared_ptr<const dolfin::Mesh>(&mesh, dolfin::NoDeleter<const dolfin::Mesh>()),
- boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new UFC_Stokes_P2P1LinearForm_finite_element_0()))),
- boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new UFC_Stokes_P2P1LinearForm_dof_map_0()), mesh)))
- {
- // Do nothing
- }
-
- };
-
-class Stokes_P2P1BilinearFormCoefficient0 : public dolfin::Coefficient
+#include <dolfin/function/GenericFunction.h>
+#include <dolfin/function/CoefficientAssigner.h>
+
+namespace Stokes_P2P1
+{
+
+class CoefficientSpace_alpha: public dolfin::FunctionSpace
+{
+public:
+
+ CoefficientSpace_alpha(const dolfin::Mesh& mesh):
+ dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_0_finite_element_2()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_0_dof_map_2()), mesh)))
+ {
+ // Do nothing
+ }
+
+ CoefficientSpace_alpha(dolfin::Mesh& mesh):
+ dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_0_finite_element_2()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_0_dof_map_2()), mesh)))
+ {
+ // Do nothing
+ }
+
+ CoefficientSpace_alpha(boost::shared_ptr<dolfin::Mesh> mesh):
+ dolfin::FunctionSpace(mesh,
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_0_finite_element_2()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_0_dof_map_2()), *mesh)))
+ {
+ // Do nothing
+ }
+
+ CoefficientSpace_alpha(boost::shared_ptr<const dolfin::Mesh> mesh):
+ dolfin::FunctionSpace(mesh,
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_0_finite_element_2()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_0_dof_map_2()), *mesh)))
+ {
+ // Do nothing
+ }
+
+
+ ~CoefficientSpace_alpha()
+ {
+ }
+
+};
+
+class CoefficientSpace_f: public dolfin::FunctionSpace
+{
+public:
+
+ CoefficientSpace_f(const dolfin::Mesh& mesh):
+ dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_1_finite_element_1()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_1_dof_map_1()), mesh)))
+ {
+ // Do nothing
+ }
+
+ CoefficientSpace_f(dolfin::Mesh& mesh):
+ dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_1_finite_element_1()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_1_dof_map_1()), mesh)))
+ {
+ // Do nothing
+ }
+
+ CoefficientSpace_f(boost::shared_ptr<dolfin::Mesh> mesh):
+ dolfin::FunctionSpace(mesh,
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_1_finite_element_1()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_1_dof_map_1()), *mesh)))
+ {
+ // Do nothing
+ }
+
+ CoefficientSpace_f(boost::shared_ptr<const dolfin::Mesh> mesh):
+ dolfin::FunctionSpace(mesh,
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_1_finite_element_1()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_1_dof_map_1()), *mesh)))
+ {
+ // Do nothing
+ }
+
+
+ ~CoefficientSpace_f()
+ {
+ }
+
+};
+
+class Form_0_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
+
+ Form_0_FunctionSpace_0(const dolfin::Mesh& mesh):
+ dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_0_finite_element_0()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_0_dof_map_0()), mesh)))
+ {
+ // Do nothing
+ }
+
+ Form_0_FunctionSpace_0(dolfin::Mesh& mesh):
+ dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_0_finite_element_0()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_0_dof_map_0()), mesh)))
+ {
+ // Do nothing
+ }
+
+ Form_0_FunctionSpace_0(boost::shared_ptr<dolfin::Mesh> mesh):
+ dolfin::FunctionSpace(mesh,
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_0_finite_element_0()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_0_dof_map_0()), *mesh)))
+ {
+ // Do nothing
+ }
+
+ Form_0_FunctionSpace_0(boost::shared_ptr<const dolfin::Mesh> mesh):
+ dolfin::FunctionSpace(mesh,
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_0_finite_element_0()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_0_dof_map_0()), *mesh)))
+ {
+ // Do nothing
+ }
+
+
+ ~Form_0_FunctionSpace_0()
+ {
+ }
+
+};
+
+class Form_0_FunctionSpace_1: public dolfin::FunctionSpace
+{
+public:
+
+ Form_0_FunctionSpace_1(const dolfin::Mesh& mesh):
+ dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_0_finite_element_1()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_0_dof_map_1()), mesh)))
+ {
+ // Do nothing
+ }
+
+ Form_0_FunctionSpace_1(dolfin::Mesh& mesh):
+ dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_0_finite_element_1()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_0_dof_map_1()), mesh)))
+ {
+ // Do nothing
+ }
+
+ Form_0_FunctionSpace_1(boost::shared_ptr<dolfin::Mesh> mesh):
+ dolfin::FunctionSpace(mesh,
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_0_finite_element_1()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_0_dof_map_1()), *mesh)))
+ {
+ // Do nothing
+ }
+
+ Form_0_FunctionSpace_1(boost::shared_ptr<const dolfin::Mesh> mesh):
+ dolfin::FunctionSpace(mesh,
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_0_finite_element_1()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_0_dof_map_1()), *mesh)))
+ {
+ // Do nothing
+ }
+
+
+ ~Form_0_FunctionSpace_1()
+ {
+ }
+
+};
+
+typedef CoefficientSpace_alpha Form_0_FunctionSpace_2;
+
+class Form_0: public dolfin::Form
{
public:
// Constructor
- Stokes_P2P1BilinearFormCoefficient0(dolfin::Form& form) : dolfin::Coefficient(form) {}
-
- // Destructor
- ~Stokes_P2P1BilinearFormCoefficient0() {}
-
- // Attach function to coefficient
- const Stokes_P2P1BilinearFormCoefficient0& operator= (dolfin::Function& v)
- {
- attach(v);
- return *this;
- }
-
- /// Create function space for coefficient
- const dolfin::FunctionSpace* create_function_space() const
- {
- return new Stokes_P2P1BilinearFormCoefficientSpace0(form.mesh());
- }
-
- /// Return coefficient number
- dolfin::uint number() const
- {
- return 0;
- }
-
- /// Return coefficient name
- virtual std::string name() const
- {
- return "alpha";
- }
-
-};
-class Stokes_P2P1BilinearForm : public dolfin::Form
-{
-public:
-
- // Create form on given function space(s)
- Stokes_P2P1BilinearForm(const dolfin::FunctionSpace& V0, const dolfin::FunctionSpace& V1) : dolfin::Form(), alpha(*this)
- {
- boost::shared_ptr<const dolfin::FunctionSpace> _V0(&V0, dolfin::NoDeleter<const dolfin::FunctionSpace>());
- _function_spaces.push_back(_V0);
- boost::shared_ptr<const dolfin::FunctionSpace> _V1(&V1, dolfin::NoDeleter<const dolfin::FunctionSpace>());
- _function_spaces.push_back(_V1);
-
- _coefficients.push_back(boost::shared_ptr<const dolfin::Function>(static_cast<const dolfin::Function*>(0)));
-
- _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Stokes_P2P1BilinearForm());
- }
-
- // Create form on given function space(s) (shared data)
- Stokes_P2P1BilinearForm(boost::shared_ptr<const dolfin::FunctionSpace> V0, boost::shared_ptr<const dolfin::FunctionSpace> V1) : dolfin::Form(), alpha(*this)
- {
- _function_spaces.push_back(V0);
- _function_spaces.push_back(V1);
-
- _coefficients.push_back(boost::shared_ptr<const dolfin::Function>(static_cast<const dolfin::Function*>(0)));
-
- _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Stokes_P2P1BilinearForm());
- }
-
- // Create form on given function space(s) with given coefficient(s)
- Stokes_P2P1BilinearForm(const dolfin::FunctionSpace& V0, const dolfin::FunctionSpace& V1, dolfin::Function& w0) : dolfin::Form(), alpha(*this)
- {
- boost::shared_ptr<const dolfin::FunctionSpace> _V0(&V0, dolfin::NoDeleter<const dolfin::FunctionSpace>());
- _function_spaces.push_back(_V0);
- boost::shared_ptr<const dolfin::FunctionSpace> _V1(&V1, dolfin::NoDeleter<const dolfin::FunctionSpace>());
- _function_spaces.push_back(_V1);
-
- _coefficients.push_back(boost::shared_ptr<const dolfin::Function>(static_cast<const dolfin::Function*>(0)));
-
- this->alpha = w0;
-
- _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Stokes_P2P1BilinearForm());
- }
-
- // Create form on given function space(s) with given coefficient(s) (shared data)
- Stokes_P2P1BilinearForm(boost::shared_ptr<const dolfin::FunctionSpace> V0, boost::shared_ptr<const dolfin::FunctionSpace> V1, dolfin::Function& w0) : dolfin::Form(), alpha(*this)
- {
- _function_spaces.push_back(V0);
- _function_spaces.push_back(V1);
-
- _coefficients.push_back(boost::shared_ptr<const dolfin::Function>(static_cast<const dolfin::Function*>(0)));
-
- this->alpha = w0;
-
- _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Stokes_P2P1BilinearForm());
+ Form_0(const dolfin::FunctionSpace& V0, const dolfin::FunctionSpace& V1):
+ dolfin::Form(2, 1), alpha(*this, 0)
+ {
+ _function_spaces[0] = reference_to_no_delete_pointer(V0);
+ _function_spaces[1] = reference_to_no_delete_pointer(V1);
+
+ _ufc_form = boost::shared_ptr<const ufc::form>(new stokes_p2p1_form_0());
+ }
+
+ // Constructor
+ Form_0(const dolfin::FunctionSpace& V0, const dolfin::FunctionSpace& V1, const dolfin::GenericFunction& alpha):
+ dolfin::Form(2, 1), alpha(*this, 0)
+ {
+ _function_spaces[0] = reference_to_no_delete_pointer(V0);
+ _function_spaces[1] = reference_to_no_delete_pointer(V1);
+
+ this->alpha = alpha;
+
+ _ufc_form = boost::shared_ptr<const ufc::form>(new stokes_p2p1_form_0());
+ }
+
+ // Constructor
+ Form_0(const dolfin::FunctionSpace& V0, const dolfin::FunctionSpace& V1, boost::shared_ptr<const dolfin::GenericFunction> alpha):
+ dolfin::Form(2, 1), alpha(*this, 0)
+ {
+ _function_spaces[0] = reference_to_no_delete_pointer(V0);
+ _function_spaces[1] = reference_to_no_delete_pointer(V1);
+
+ this->alpha = *alpha;
+
+ _ufc_form = boost::shared_ptr<const ufc::form>(new stokes_p2p1_form_0());
+ }
+
+ // Constructor
+ Form_0(boost::shared_ptr<const dolfin::FunctionSpace> V0, boost::shared_ptr<const dolfin::FunctionSpace> V1):
+ dolfin::Form(2, 1), alpha(*this, 0)
+ {
+ _function_spaces[0] = V0;
+ _function_spaces[1] = V1;
+
+ _ufc_form = boost::shared_ptr<const ufc::form>(new stokes_p2p1_form_0());
+ }
+
+ // Constructor
+ Form_0(boost::shared_ptr<const dolfin::FunctionSpace> V0, boost::shared_ptr<const dolfin::FunctionSpace> V1, const dolfin::GenericFunction& alpha):
+ dolfin::Form(2, 1), alpha(*this, 0)
+ {
+ _function_spaces[0] = V0;
+ _function_spaces[1] = V1;
+
+ this->alpha = alpha;
+
+ _ufc_form = boost::shared_ptr<const ufc::form>(new stokes_p2p1_form_0());
+ }
+
+ // Constructor
+ Form_0(boost::shared_ptr<const dolfin::FunctionSpace> V0, boost::shared_ptr<const dolfin::FunctionSpace> V1, boost::shared_ptr<const dolfin::GenericFunction> alpha):
+ dolfin::Form(2, 1), alpha(*this, 0)
+ {
+ _function_spaces[0] = V0;
+ _function_spaces[1] = V1;
+
+ this->alpha = *alpha;
+
+ _ufc_form = boost::shared_ptr<const ufc::form>(new stokes_p2p1_form_0());
}
// Destructor
- ~Stokes_P2P1BilinearForm() {}
+ ~Form_0()
+ {}
+
+ /// Return the number of the coefficient with this name
+ virtual dolfin::uint coefficient_number(const std::string& name) const
+ {
+ if (name == "alpha")
+ return 0;
+
+ dolfin::error("Invalid coefficient.");
+ return 0;
+ }
+
+ /// Return the name of the coefficient with this number
+ virtual std::string coefficient_name(dolfin::uint i) const
+ {
+ switch (i)
+ {
+ case 0:
+ return "alpha";
+ }
+
+ dolfin::error("Invalid coefficient.");
+ return "unnamed";
+ }
+
+ // Typedefs
+ typedef Form_0_FunctionSpace_0 TestSpace;
+ typedef Form_0_FunctionSpace_1 TrialSpace;
+ typedef Form_0_FunctionSpace_2 CoefficientSpace_alpha;
// Coefficients
- Stokes_P2P1BilinearFormCoefficient0 alpha;
-
-};
-
-class Stokes_P2P1LinearFormCoefficient0 : public dolfin::Coefficient
+ dolfin::CoefficientAssigner alpha;
+};
+
+class Form_1_FunctionSpace_0: public dolfin::FunctionSpace
+{
+public:
+
+ Form_1_FunctionSpace_0(const dolfin::Mesh& mesh):
+ dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_1_finite_element_0()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_1_dof_map_0()), mesh)))
+ {
+ // Do nothing
+ }
+
+ Form_1_FunctionSpace_0(dolfin::Mesh& mesh):
+ dolfin::FunctionSpace(dolfin::reference_to_no_delete_pointer(mesh),
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_1_finite_element_0()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_1_dof_map_0()), mesh)))
+ {
+ // Do nothing
+ }
+
+ Form_1_FunctionSpace_0(boost::shared_ptr<dolfin::Mesh> mesh):
+ dolfin::FunctionSpace(mesh,
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_1_finite_element_0()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_1_dof_map_0()), *mesh)))
+ {
+ // Do nothing
+ }
+
+ Form_1_FunctionSpace_0(boost::shared_ptr<const dolfin::Mesh> mesh):
+ dolfin::FunctionSpace(mesh,
+ boost::shared_ptr<const dolfin::FiniteElement>(new dolfin::FiniteElement(boost::shared_ptr<ufc::finite_element>(new stokes_p2p1_1_finite_element_0()))),
+ boost::shared_ptr<const dolfin::DofMap>(new dolfin::DofMap(boost::shared_ptr<ufc::dof_map>(new stokes_p2p1_1_dof_map_0()), *mesh)))
+ {
+ // Do nothing
+ }
+
+
+ ~Form_1_FunctionSpace_0()
+ {
+ }
+
+};
+
+typedef CoefficientSpace_f Form_1_FunctionSpace_1;
+
+class Form_1: public dolfin::Form
{
public:
// Constructor
- Stokes_P2P1LinearFormCoefficient0(dolfin::Form& form) : dolfin::Coefficient(form) {}
-
- // Destructor
- ~Stokes_P2P1LinearFormCoefficient0() {}
-
- // Attach function to coefficient
- const Stokes_P2P1LinearFormCoefficient0& operator= (dolfin::Function& v)
- {
- attach(v);
- return *this;
- }
-
- /// Create function space for coefficient
- const dolfin::FunctionSpace* create_function_space() const
- {
- return new Stokes_P2P1LinearFormCoefficientSpace0(form.mesh());
- }
-
- /// Return coefficient number
- dolfin::uint number() const
- {
- return 0;
- }
-
- /// Return coefficient name
- virtual std::string name() const
- {
- return "f";
- }
-
-};
-class Stokes_P2P1LinearForm : public dolfin::Form
-{
-public:
-
- // Create form on given function space(s)
- Stokes_P2P1LinearForm(const dolfin::FunctionSpace& V0) : dolfin::Form(), f(*this)
- {
- boost::shared_ptr<const dolfin::FunctionSpace> _V0(&V0, dolfin::NoDeleter<const dolfin::FunctionSpace>());
- _function_spaces.push_back(_V0);
-
- _coefficients.push_back(boost::shared_ptr<const dolfin::Function>(static_cast<const dolfin::Function*>(0)));
-
- _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Stokes_P2P1LinearForm());
- }
-
- // Create form on given function space(s) (shared data)
- Stokes_P2P1LinearForm(boost::shared_ptr<const dolfin::FunctionSpace> V0) : dolfin::Form(), f(*this)
- {
- _function_spaces.push_back(V0);
-
- _coefficients.push_back(boost::shared_ptr<const dolfin::Function>(static_cast<const dolfin::Function*>(0)));
-
- _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Stokes_P2P1LinearForm());
- }
-
- // Create form on given function space(s) with given coefficient(s)
- Stokes_P2P1LinearForm(const dolfin::FunctionSpace& V0, dolfin::Function& w0) : dolfin::Form(), f(*this)
- {
- boost::shared_ptr<const dolfin::FunctionSpace> _V0(&V0, dolfin::NoDeleter<const dolfin::FunctionSpace>());
- _function_spaces.push_back(_V0);
-
- _coefficients.push_back(boost::shared_ptr<const dolfin::Function>(static_cast<const dolfin::Function*>(0)));
-
- this->f = w0;
-
- _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Stokes_P2P1LinearForm());
- }
-
- // Create form on given function space(s) with given coefficient(s) (shared data)
- Stokes_P2P1LinearForm(boost::shared_ptr<const dolfin::FunctionSpace> V0, dolfin::Function& w0) : dolfin::Form(), f(*this)
- {
- _function_spaces.push_back(V0);
-
- _coefficients.push_back(boost::shared_ptr<const dolfin::Function>(static_cast<const dolfin::Function*>(0)));
-
- this->f = w0;
-
- _ufc_form = boost::shared_ptr<const ufc::form>(new UFC_Stokes_P2P1LinearForm());
+ Form_1(const dolfin::FunctionSpace& V0):
+ dolfin::Form(1, 1), f(*this, 0)
+ {
+ _function_spaces[0] = reference_to_no_delete_pointer(V0);
+
+ _ufc_form = boost::shared_ptr<const ufc::form>(new stokes_p2p1_form_1());
+ }
+
+ // Constructor
+ Form_1(const dolfin::FunctionSpace& V0, const dolfin::GenericFunction& f):
+ dolfin::Form(1, 1), f(*this, 0)
+ {
+ _function_spaces[0] = reference_to_no_delete_pointer(V0);
+
+ this->f = f;
+
+ _ufc_form = boost::shared_ptr<const ufc::form>(new stokes_p2p1_form_1());
+ }
+
+ // Constructor
+ Form_1(const dolfin::FunctionSpace& V0, boost::shared_ptr<const dolfin::GenericFunction> f):
+ dolfin::Form(1, 1), f(*this, 0)
+ {
+ _function_spaces[0] = reference_to_no_delete_pointer(V0);
+
+ this->f = *f;
+
+ _ufc_form = boost::shared_ptr<const ufc::form>(new stokes_p2p1_form_1());
+ }
+
+ // Constructor
+ Form_1(boost::shared_ptr<const dolfin::FunctionSpace> V0):
+ dolfin::Form(1, 1), f(*this, 0)
+ {
+ _function_spaces[0] = V0;
+
+ _ufc_form = boost::shared_ptr<const ufc::form>(new stokes_p2p1_form_1());
+ }
+
+ // Constructor
+ Form_1(boost::shared_ptr<const dolfin::FunctionSpace> V0, const dolfin::GenericFunction& f):
+ dolfin::Form(1, 1), f(*this, 0)
+ {
+ _function_spaces[0] = V0;
+
+ this->f = f;
+
+ _ufc_form = boost::shared_ptr<const ufc::form>(new stokes_p2p1_form_1());
+ }
+
+ // Constructor
+ Form_1(boost::shared_ptr<const dolfin::FunctionSpace> V0, boost::shared_ptr<const dolfin::GenericFunction> f):
+ dolfin::Form(1, 1), f(*this, 0)
+ {
+ _function_spaces[0] = V0;
+
+ this->f = *f;
+
+ _ufc_form = boost::shared_ptr<const ufc::form>(new stokes_p2p1_form_1());
}
// Destructor
- ~Stokes_P2P1LinearForm() {}
+ ~Form_1()
+ {}
+
+ /// Return the number of the coefficient with this name
+ virtual dolfin::uint coefficient_number(const std::string& name) const
+ {
+ if (name == "f")
+ return 0;
+
+ dolfin::error("Invalid coefficient.");
+ return 0;
+ }
+
+ /// Return the name of the coefficient with this number
+ virtual std::string coefficient_name(dolfin::uint i) const
+ {
+ switch (i)
+ {
+ case 0:
+ return "f";
+ }
+
+ dolfin::error("Invalid coefficient.");
+ return "unnamed";
+ }
+
+ // Typedefs
+ typedef Form_1_FunctionSpace_0 TestSpace;
+ typedef Form_1_FunctionSpace_1 CoefficientSpace_f;
// Coefficients
- Stokes_P2P1LinearFormCoefficient0 f;
-
-};
+ dolfin::CoefficientAssigner f;
+};
+
+// Class typedefs
+typedef Form_0 BilinearForm;
+typedef Form_1 LinearForm;
+typedef Form_0::TestSpace FunctionSpace;
+
+} // namespace Stokes_P2P1
#endif
diff -r 0b9832b2bf6b -r 4a13310e1545 MADDs-5/MADDs-5a/cpp/Stokes_P2P1.ufl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MADDs-5/MADDs-5a/cpp/Stokes_P2P1.ufl Sun Dec 06 21:52:19 2009 -0500
@@ -0,0 +1,1 @@
+../../../MADDs-1/cpp/Stokes_P2P1.ufl
\ No newline at end of file
diff -r 0b9832b2bf6b -r 4a13310e1545 MADDs-5/MADDs-5a/cpp/forms/Stokes_P2P1.ufl
--- a/MADDs-5/MADDs-5a/cpp/forms/Stokes_P2P1.ufl Sun Dec 06 14:03:20 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-../../../MADDs-1/cpp/Stokes_P2P1.ufl
\ No newline at end of file
diff -r 0b9832b2bf6b -r 4a13310e1545 MADDs-5/MADDs-5a/cpp/main.cpp
--- a/MADDs-5/MADDs-5a/cpp/main.cpp Sun Dec 06 14:03:20 2009 -0500
+++ b/MADDs-5/MADDs-5a/cpp/main.cpp Sun Dec 06 21:52:19 2009 -0500
@@ -15,7 +15,6 @@
#include <dolfin.h>
-#include <dolfin/fem/SparsityPatternBuilder.h>
#include <math.h>
#include <string.h>
#include "Stokes_P2P1.h"
@@ -25,18 +24,19 @@
#include "MeltFlux.h"
#include "petscsnes.h"
#include "PetscFunctions.h"
+#include "PetscUtilities.h"
#include "PETScMagmaFSSNESInitialize.h"
#include "utils.h"
using namespace dolfin;
// user-defined initial condition currently starts at zero but
-// can be extended
-class InitialCondition : public Function, public Parametrized
+// can be extended (if just zero could also use Constant )
+class InitialCondition : public Expression
{
public:
- InitialCondition(FunctionSpace& V): Function(V)
+ InitialCondition(): Expression(2)
{
//do nothing
}
@@ -46,32 +46,20 @@ class InitialCondition : public Function
//do nothing
}
- void eval(double *values, const double* x) const
+ void eval(double *values, const Data& data) const
{
values[0] = 0.0; //pressure
values[1] = 0.0; // porosity
}
-
- unsigned int rank() const
- {
- return 1;
- }
-
- unsigned int dim( unsigned int i) const
- {
- return 2;
- }
-
-
};
// user-defined melt production rate dFdz
-class ProductionRate : public Function
+class ProductionRate : public Expression
{
public:
- ProductionRate(FunctionSpace& V, const double phi0, const double Fmax, const double lambda, const double z0): Function(V), phi0(phi0), Fmax(Fmax), lambda(lambda), z0(z0)
+ ProductionRate(const double phi0, const double Fmax, const double lambda, const double z0): Expression(), phi0(phi0), Fmax(Fmax), lambda(lambda), z0(z0)
{
//do nothing
}
@@ -81,7 +69,7 @@ class ProductionRate : public Function
//do nothing
}
-void eval(double *values, const double *x) const
+void eval(double *values, const std::vector<double>& x) const
{
double zz = (x[1] - z0)/lambda;
const double Fonphi = Fmax/phi0;
@@ -103,83 +91,63 @@ private:
};
-// Variable time step
-class TimeStep : public Function
-{
-public:
-
- TimeStep( double& dt) : dt(dt) {}
-
- void eval(double* values, const double* x) const
- {
- values[0]=dt;
- }
-private:
-
- double& dt;
-};
-
// user-defined SemiLagrangianSource
// takes a function u, and velocity and returns g*, the value of the source term at the take off point
-class SemiLagrangianSource : public Function, public Parametrized
+class SemiLagrangianFunction : public Function
{
public:
// Constructor
- SemiLagrangianSource(Function& u, Function& Velocity, Function& Gamma, Function& iEta, double& delta_t, const double& h2) :
- u(u), Velocity(Velocity), Gamma(Gamma), iEta(iEta), delta_t(delta_t), h2(h2)
+ SemiLagrangianFunction(FunctionSpace& V, Function& u, Function& Velocity, Function& Gamma, Function& iEta, double& delta_t, const double& h2) :
+ Function(V), u(u), Velocity(Velocity), Gamma(Gamma), iEta(iEta), delta_t(delta_t), h2(h2)
{
- // create new intersection_dectector
- intersection_detector = new IntersectionDetector(u.function_space().mesh());
- printf("Creating Semi-Lagrangian Source Function: dt=%g, h2=%g\n", delta_t, h2);
+ // Initialize intersection detector if not done before
+ if (!intersection_detector)
+ intersection_detector.reset(new IntersectionDetector(V.mesh()));
+
+ // create new ufc_cell
+ ufc_cell_star = new UFCCell(u.function_space().mesh());
+
+ // initialize vector x_star
+ x_star.reserve(2);
+
}
// Destructor
- ~SemiLagrangianSource()
+ ~SemiLagrangianFunction()
{
- delete intersection_detector;
+ delete ufc_cell_star;
}
void eval(double *values, const Data& data) const
{
- double xStar[2], values0[2];
+ double values0[2];
double hdt = 0.5*delta_t;
bool outside = false;
- // initialize ufccell to current cell
- UFCCell ufc_cell_star(data.cell());
- dolfin::uint index=data.cell().index();
-
- //cout << index << endl;
-
- //Find take off point xStar, and new cell, given data
- findpoint(xStar, ufc_cell_star, index, outside, data);
+ //Find take off point x_star
+ outside = findpoint(data);
if (outside) { // if takeoff point out of bounds set to zero (should only be bottom inflow boundary)
- values0[0]=0.;
- values0[1]=0.;
+ values[0]=0.;
}
- else { // if takeoff point out of bounds set to zero (should only be bottom inflow boundary)
- u.eval(values0, xStar, ufc_cell_star, index); // get solution u* at take off point
+ else {
+ const Cell cell_star(this->function_space().mesh(), cell_star_index);
+ ufc_cell_star->update(cell_star);
+
+ u.eval(values0, x_star, cell_star, *ufc_cell_star);
+ double pStar = values0[0], fStar = values0[1];
+
+ // get viscosity and gamma at x* (this assumes all discrete functions share the same mesh as u, fragile!)
+ double iEtaStar, GammaStar;
+ iEta.eval(values0,x_star, cell_star, *ufc_cell_star);
+ iEtaStar = values0[0];
+ Gamma.eval(values0,x_star,cell_star, *ufc_cell_star);
+ GammaStar = values0[0];
+
+ values[0] = fStar + hdt*(h2*iEtaStar*pStar + GammaStar);
}
- double pStar, fStar;
- pStar = values0[0];
- fStar = values0[1];
-
- // get viscosity and gamma at x* (this assumes all discrete functions have the same mesh as u, fragile!)
- double iEtaStar, GammaStar;
- if (iEta.has_function_space()) {
- iEta.eval(values0,xStar, ufc_cell_star, index);
- }
- else {
- iEta.eval(values0,xStar);
- }
- iEtaStar = values0[0];
- Gamma.eval(values0,xStar,ufc_cell_star, index);
- GammaStar = values0[0];
-
- values[0] = fStar + hdt*(h2*iEtaStar*pStar + GammaStar);
}
private:
@@ -192,66 +160,86 @@ private:
Function& iEta;
double& delta_t; // timestep
const double& h2; // (h/del)^2 parameter
- // Intersection detector, used for evaluation at arbitrary points
- mutable IntersectionDetector* intersection_detector;
- // find takeoff point and cell data using a modified midpoint method
- void findpoint(double* xStar, UFCCell& ufc_cell_star, dolfin::uint& index, bool& outside, const Data& data) const
+ // Intersection Detector and local cell for semi-lagrangian update
+ mutable boost::scoped_ptr<IntersectionDetector> intersection_detector;
+ UFCCell* ufc_cell_star;
+
+ //take off point and cell index
+ mutable std::vector<double> x_star;
+ mutable dolfin::uint cell_star_index;
+
+
+// modified midpoint method
+ bool findpoint(const Data& data) const
{
- double const dts = delta_t, hdts = 0.5*delta_t;
- dolfin::uint i,k, kMax = 2;
- dolfin::uint const dim = 2;
+ dolfin::uint const dim = data.x.size();
double V[dim];
-
+ unsigned int i, k, kMax = 2;
+ bool outside = false;
+
+ //evaluate Velocity at quadrature point
+ Velocity.eval(V, data);
- for (i = 0; i < dim; i++ )
- xStar[i] = data.x[i];
+ //set current cell and index
+ cell_star_index = data.cell().index();
- //evaluate Velocity at current cell (which on entry should be data.cell...check)
- Velocity.eval(V, data.x, ufc_cell_star, index);
+ for (k=0; k< kMax; ++k) //iterated mid-point rule
+ {
+ for(i=0; i< dim; i++ )
+ x_star[i] = data.x[i] - 0.5*delta_t*V[i];
+
+ outside = checkpoint();
- //iterated mid-point rule
- for (k=0; k< kMax; ++k)
- {
- for (i = 0; i < dim; i++ )
- xStar[i] = data.x[i] - hdts*V[i];
- checkpoint(xStar, ufc_cell_star, index, outside, data);
- if (outside)
- break;
- Velocity.eval(V, data.x, ufc_cell_star, index);
+ //update cell_star (FixMe: need something better than a new Cell constructor)
+ if (outside) {
+ printf("Warning: point outside mesh in Findpoint");
+ return outside;
+ }
+ else {
+ const Cell cell_star(this->function_space().mesh(), cell_star_index);
+ ufc_cell_star->update(cell_star);
+ Velocity.eval(V, x_star, cell_star, *ufc_cell_star);
+ }
}
- for (i = 0; i < dim; i++ )
- xStar[i] = data.x[i] - dts*V[i];
- checkpoint(xStar, ufc_cell_star, index, outside, data);
+ for(i=0; i< dim; i++ )
+ x_star[i] = data.x[i] - delta_t*V[i];
+
+ outside = checkpoint();
+
+ return outside;
}
- //for point xStar: Find current cell or flag outside the domain
- void checkpoint(double* xStar, UFCCell& ufc_cell_star, dolfin::uint& index, bool& outside, const Data& data) const
+ //for point x_star: Find current cell or flag outside the domain
+ bool checkpoint() const
{
- Point point(u.function_space().mesh().geometry().dim(), xStar);
- std::vector<dolfin::uint> cells;
+ // set current point and cell
+ const double* _x = &x_star[0];
+ Point point(this->function_space().mesh().geometry().dim(), _x);
+ Cell cell_star(this->function_space().mesh(), cell_star_index);
+
+ bool outside;
- // check if xStar is in the original cell
- if ( data.cell().intersects(point) ) {
+ // check if x_star is in the current cell
+ if ( cell_star.intersects(point) ) {
outside = false;
- index = data.cell().index();
- ufc_cell_star.update(data.cell());
+ cell_star_index = cell_star.index();
}
else { // use the intersection_detector to find the current cell
+ std::vector<dolfin::uint> cells;
intersection_detector->intersection(point, cells);
- //if no cells found then its outside the domain
+ //if no cells found then it's outside the domain
if (cells.size() < 1) {
outside = true;
}
else {
outside = false;
- index = cells[0];
- const Cell cellstar(u.function_space().mesh(), index);
- ufc_cell_star.update(cellstar);
+ cell_star_index = cells[0];
}
}
+ return outside;
}
};
@@ -269,115 +257,13 @@ public:
};
-//User defined nonlinear problem
-class MagmaMigration : public NonlinearProblem, public Parametrized
-{
- public:
-
- // Constructor
- MagmaMigration(FunctionSpace& V, Function& u,Constant& iEta, Function& Gamma, Function& PStar, Constant& eps, Vector& bStar, Function& dt, Constant& hsquared, FacetNormal& n, std::vector<DirichletBC*>& bcs)
- : V(V), bcs(bcs), bStar(bStar), initialize_rows(true), reset_Jacobian(true)
- {
-
- a = new MagmaEquationsBilinearForm(V, V);
- MagmaEquationsBilinearForm* _a = dynamic_cast<MagmaEquationsBilinearForm*>(a);
- if (!_a) error("Problem in downcast of MagmaEquationsBilinearForm");
- _a->w0 = u;
- _a->dt = dt;
- _a->hsquared = hsquared;
- _a-> n = n;
- _a->iEta = iEta;
- _a->PStar = PStar;
- _a->eps = eps;
-
-
- L = new MagmaEquationsLinearForm(V);
- MagmaEquationsLinearForm* _L = dynamic_cast<MagmaEquationsLinearForm*>(L);
- if (!_L) error("Problem in downcast of MagmaEquationsLinearForm");
- _L->w7 =u;
- _L->dt = dt;
- _L->hsquared = hsquared;
- _L-> n = n;
- _L->iEta = iEta;
- _L->Gamma = Gamma;
- _L->PStar = PStar;
- _L->eps = eps;
- }
- // Destructor
- ~MagmaMigration()
- {
- //delete V;
- delete a;
- delete L;
- delete [] values;
- delete [] irows;
- }
-
- // User defined assemble of residual function vector
- void F(GenericVector& b, const GenericVector& x)
- {
- // Assemble system and RHS (Neumann boundary conditions)
- assemble(b, *L);
-
- //add in RHS vector
- unsigned int size = bStar.size();
-
- if (initialize_rows) { //allocate space for values and irows
- printf("initialize_rows=%d\n",initialize_rows);
- values = new double[size];
- irows = new unsigned int[size];
- for ( unsigned int i=0; i< size; ++i) //set rows to point to second vector
- {
- irows[i] = i+size;
- }
- initialize_rows = false;
- printf("initialize_rows=%d\n",initialize_rows);
- }
-
-
- bStar.get(values);
- b.add(values, size, irows);
- b.apply();
- for(dolfin::uint i = 0; i < bcs.size(); ++i)
- bcs[i]->apply(b, x);
-
- }
- // User defined assemble of Jacobian and residual vector
- void J(GenericMatrix& A, const GenericVector& x)
- {
- // Assemble system matrix
- assemble(A, *a,reset_Jacobian);
- reset_Jacobian = false;
- for(dolfin::uint i = 0; i < bcs.size(); ++i)
- bcs[i]->apply(A);
- }
-
- private:
-
- // Pointers to function space, forms and bcs
- FunctionSpace& V;
- Form *a;
- Form *L;
- std::vector<DirichletBC*>& bcs;
-
- // RHS vector
- Vector& bStar;
-
- // Variables for vector update
- double* values;
- unsigned int* irows;
- bool initialize_rows;
- bool reset_Jacobian;
-
-
-};
void ClipPorosity(GenericVector& x)
{
//super hack: remove negative porosities from x
dolfin::uint size = x.size();
double* values = new double[size]; //need more efficient than constant malloc
- x.get(values);
+ x.get_local(values);
for(dolfin::uint i=size/2; i< size; ++i)
{
if ( values[i] < 0.0 )
@@ -385,7 +271,7 @@ void ClipPorosity(GenericVector& x)
values[i] = 0.;
}
}
- x.set(values);
+ x.set_local(values);
delete [] values;
}
@@ -402,20 +288,13 @@ void calculateDelta(Function& delta, Fun
double* values = new double[size];
double* iVisc = new double[size];
- delta.vector().get(values);
- if (iEta.has_vector()) {
- iEta.vector().get(iVisc);
- }
- else {
- Vector one(size);
- one = 1.;
- one.get(iVisc);
- }
+ delta.vector().get_local(values);
+ iEta.vector().get_local(iVisc);
for ( unsigned int i=0; i< size; ++i)
values[i] = std::sqrt(values[i]/(1.+eps)/iVisc[i]);
- delta.vector().set(values);
+ delta.vector().set_local(values);
delta.vector() /= h_on_delta;
delta.vector().apply();
@@ -436,13 +315,13 @@ int main(int argc, char* argv[])
mesh.order();
//Set function spaces for Stokes solutions
- Stokes_P2P1FunctionSpace W(mesh);
+ Stokes_P2P1::FunctionSpace W(mesh);
SubSpace W0(W, 0); //velocity
SubSpace W01(W0,1); //vertical velocity
SubSpace W1(W, 1); //pressure
//set FunctionSpace for PressurePorosity
- MagmaEquationsFunctionSpace V(mesh);
+ MagmaEquations::FunctionSpace V(mesh);
SubSpace V0(V,0); // melt pressure
//input pre-computed Stokes fields
@@ -451,9 +330,8 @@ int main(int argc, char* argv[])
GetFilename("-P_dofs",filename);
Function Pressure(W1,filename);
- MeshSize mesh_size(W);
- double dh = mesh_size.min();
- double dh_max = mesh_size.max();
+ double dh = mesh.hmin();
+ double dh_max = mesh.hmax();
printf("Mesh size: min=%g, max=%g\n",dh, dh_max);
@@ -495,32 +373,28 @@ int main(int argc, char* argv[])
//set variable timestep function
double delta_t = 0.;
- TimeStep dt(delta_t);
+ Constant dt(delta_t);
//regularization and other functions
Constant eps(epsilon);
- FacetNormal n;
//set the melting rate Gamma = W*dFdz
Function Velocity_W = Velocity[1];
- Function Gamma(W01,Velocity_W.vector());
- ProductionRate dFdz(W01,phi0, Fmax, z_lambda, z_solidus);
- dFdz.interpolate();
- //Gamma.vector() *= dFdz.vector(); //FixME, this won't work in 0.9.2, needs dev)
- //temporary PetscVector hack
- PETScVector v1, v2;
- v1 = Gamma.vector();
- v2 = dFdz.vector();
- VecPointwiseMult(*v1.vec(),*v1.vec(),*v2.vec());
- Gamma.vector() = v1;
+ Function Gamma(W01);
+ ProductionRate dFdz(phi0, Fmax, z_lambda, z_solidus);
+ Gamma.interpolate(dFdz);
+ Gamma.vector() *= Velocity_W.vector();
+
// inverse viscosity function (use constant for the moment)
- Constant iEta(1.);
+ Function iEta(W1);
+ iEta.vector()=1.;
-
// Solution functions
Function u(V), u0(V), uWork(V);
- InitialCondition uinit(V);
+ InitialCondition uinit;
+ //interpolate initial condition
+ u0.interpolate(uinit);
//Boundary Conditions
DirichletBoundary boundaries;
@@ -530,63 +404,30 @@ int main(int argc, char* argv[])
std::vector<DirichletBC*> bcs(1);
bcs[0] = &bc;
- // project initial condition onto u0
- ProjectionBilinearForm a(V,V);
- ProjectionLinearForm L(V);
- L.f = uinit;
- VariationalProblem initialize(a,L,bc);
- initialize.solve(u0);
- //alternate interpolation of initial condition
- // uinit.interpolate();
- // u0.vector() = uinit.vector()
-
//set SemiLagrangian source function
- SemiLagrangianRHSFunctionSpace VStar(mesh);
- SemiLagrangianSource gStar(u0, Velocity, Gamma, iEta, delta_t, h2);
- SemiLagrangianRHSLinearForm LStar(VStar, gStar);
+ SemiLagrangianRHS::FunctionSpace VStar(mesh);
+ SemiLagrangianFunction gStar(VStar, u0, Velocity, Gamma, iEta, delta_t, h2);
+ SemiLagrangianRHS::LinearForm LStar(VStar, gStar);
Vector bStar;
//initialize MeltFlux Projection problem
- MeltFluxFunctionSpace v(mesh);
- MeltFluxBilinearForm am(v,v);
- MeltFluxLinearForm Lm(v);
+ MeltFlux::FunctionSpace v(mesh);
+ MeltFlux::BilinearForm am(v,v);
+ MeltFlux::LinearForm Lm(v);
Lm.pstar = Pressure;
Lm.V = Velocity;
Lm.eps = eps;
VariationalProblem qmelt(am,Lm);
Function melt_flux(v);
- // Create user-defined nonlinear problems
- MagmaMigration magma_migration(V, u, iEta, Gamma, Pressure, eps, bStar, dt, hsquared, n, bcs);
-
-
- //Choose to use either Dolfin or PETScs non linear solvers
- PetscErrorCode ierr;
- PetscTruth use_SNES=PETSC_FALSE;
- ierr = PetscOptionsGetTruth(PETSC_NULL,"-use_snes",&use_SNES,PETSC_NULL);
-
- // Create dolfin linear and nonlinear solver and set parameters
- // Create linear solver for use in Newton solver
- DefaultFactory factory;
- KrylovSolver solver(gmres,amg_hypre);
- solver.set("Krylov relative tolerance", 5e-5);
- solver.set("Krylov absolute tolerance", 1e-14);
-
- NewtonSolver newton_solver(solver,factory);
- //NewtonSolver newton_solver(lu);
- newton_solver.set("Newton convergence criterion", "incremental");
- newton_solver.set("Newton maximum iterations", 10);
- newton_solver.set("Newton relative tolerance", 1e-10);
- newton_solver.set("Newton absolute tolerance", 1e-16);
-
//Create PETSc SNES nonlinear Solver
SNES snes;
//set Forms for Snes
- MagmaEquationsBilinearForm aSNES(V,V,uWork,dt,hsquared,n,iEta,Pressure,eps);
- MagmaEquationsLinearForm LSNES(V,uWork,dt,hsquared,n,iEta,Gamma,Pressure,eps);
+ MagmaEquations::BilinearForm aSNES(V,V,uWork,dt,hsquared,iEta,Pressure,eps);
+ MagmaEquations::LinearForm LSNES(V,uWork,dt,hsquared,iEta,Gamma,Pressure,eps);
//Create user context for SNES
SNESCtx ctx = { aSNES,
@@ -601,10 +442,7 @@ int main(int argc, char* argv[])
PETScVector x(xSize), r(xSize);
// pre-allocate memory for sparse Jacobian matrix
PETScMatrix J;
- UFC ufc(ctx.a); //create UFC from bilinear form
- SparsityPattern pattern; //create empty sparsity pattern
- SparsityPatternBuilder::build(pattern, ufc, ctx.a); // build sparsity pattern for jacobian
- J.init(pattern); // allocate memory for given sparsity pattern
+ Assembler::assemble(J,ctx.a,true); //Assemble matrix once to set sparsity pattern
//create SNES and attach call-back functions
SNESCreate(PETSC_COMM_WORLD, &snes);
@@ -616,14 +454,13 @@ int main(int argc, char* argv[])
// IO
- File Vfile("Velocity.pvd");
- File vfile("MeltFlux.pvd");
- File Gammafile("Gamma.pvd");
- File deltafile("delta.pvd");
- Function p;
- Function f;
- Function f0;
- Function delta;
+ File Vfile("Velocity.pvd","compressed");
+ File vfile("MeltFlux.pvd","compressed");
+ File Gammafile("Gamma.pvd","compressed");
+ File deltafile("delta.pvd","compressed");
+ Function p=u[0], f = u[1];
+ Function f0(f.function_space());
+ Function delta(f.function_space());
Vfile << Velocity;
Gammafile << Gamma;
@@ -631,13 +468,13 @@ int main(int argc, char* argv[])
//set time stepping parameters
PetscReal T=1.; //maximum run time
- PetscReal dtPlot = .001; // plotting interval
+ PetscReal dt_plot = .001; // plotting interval
PetscOptionsGetReal(PETSC_NULL,"-t_max",&T,PETSC_NULL);
- PetscOptionsGetReal(PETSC_NULL,"-t_plot",&dtPlot,PETSC_NULL);
+ PetscOptionsGetReal(PETSC_NULL,"-t_plot",&dt_plot,PETSC_NULL);
double t = 0.0;
- double tPlot = 0.0;
- unsigned int nStep = 0, nPlot = 0;
+ double t_plot = 0.0;
+ unsigned int n_step = 0, n_plot = 0;
char namestr[100];
@@ -650,7 +487,7 @@ int main(int argc, char* argv[])
//adaptive time stepping parameters
PetscReal dt_check, alpha = 1.04;
- dolfin::uint ncheck = 10;
+ dolfin::uint n_check = 10;
double max_mag_v = U0onw0;
//calculate advective time step at zero porosity
@@ -662,7 +499,7 @@ int main(int argc, char* argv[])
double delta_t_gamma = dphi_max/gamma_max;
//choose smaller time step as initial timestep
- delta_t0 = min(delta_t_gamma, delta_t_adv);
+ delta_t0 = std::min(delta_t_gamma, delta_t_adv);
printf("\nInitial delta_t_gamma=%g, delta_t_adv=%g, delta_t0=%g\n",delta_t_gamma, delta_t_adv, delta_t0);
// timing functtions
@@ -681,14 +518,11 @@ int main(int argc, char* argv[])
//Initialize(u.vector()); // zero out pressure on each solve
- //choose non-linear solver
- if (use_SNES) {
- x = u.vector();
- SNESSolve(snes, PETSC_NULL, *x.vec());
- u.vector() = x;
- } else {
- newton_solver.solve(magma_migration, u.vector());
- }
+ //solve the non-linear problem at each time step
+ x = u.vector();
+ SNESSolve(snes, PETSC_NULL, *x.vec());
+ u.vector() = x;
+
//check for negative porosities
f = u[1];
@@ -700,22 +534,19 @@ int main(int argc, char* argv[])
VecGetValues(*(fp0.vec()),1,&iMin,&fMin0);
if (fMin < 0.0 ) {
ClipPorosity (u.vector());
- //delta_t = dt_check*(fMin0-fClip)/(fMin0 - fMin);
- //printf("negative porosity < %g: adjusting time-step to %g \n",fClip,delta_t);
printf("Warning: clipping negative porosity - minimum porosity = %g at dof %d, was %g \n",fMin,iMin,fMin0);
}
- //check timestep every ncheck steps
- if ( nStep%ncheck == 0) {
+ //check timestep every n_check steps
+ if ( n_step%n_check == 0) {
//calculate melt flux
p = u[0];
f = u[1];
- Lm.f = f;
- Lm.p = p;
+ Lm.p = u[0];
+ Lm.f = u[1];
qmelt.solve(melt_flux);
- FindMaxVelocity(max_mag_v, melt_flux, f, U0onw0, epsilon);
- //max_mag_v = U0onw0 + fMax;
- dt_check = min(delta_t0, cfl*dh/max_mag_v);
+ FindMaxMeltVelocity(max_mag_v, melt_flux, f, U0onw0, epsilon);
+ dt_check = std::min(delta_t0, cfl*dh/max_mag_v);
//crude adaptive time stepping
if (t == 0 || dt_check < delta_t) { // if initial or shrinking time-step
@@ -726,37 +557,36 @@ int main(int argc, char* argv[])
delta_t = alpha*delta_t;
cout << "increasing delta_t=" << delta_t << endl;
}
+ dt = delta_t;
}
- if ( t >= tPlot) // Save function to file
+ if ( t >= t_plot) // Save function to file
{
PetscGetTime(&t2);
elapsedTime = t2-t1;
- printf("\n**************Writing output files:n=%d t=%g dt=%g (Wall clock=%g s, %g s/time_step)*********************\n\n",nStep,t,delta_t,elapsedTime,elapsedTime/nStep);
- sprintf(namestr,"u_vector_t%f_%4.4d.xml",t,nPlot);
+ printf("\n**************Writing output files:n=%d t=%g dt=%g (Wall clock=%g s, %g s/time_step)*********************\n\n",n_step,t,delta_t,elapsedTime,elapsedTime/n_step);
+ sprintf(namestr,"u_vector_t%f_%4.4d.xml",t,n_plot);
filename.assign(namestr);
File uFile(filename);
uFile << u.vector();
- //project out melt velocity
- p = u[0];
- f = u[1];
- Lm.f = f;
- Lm.p = p;
+ //project melt flux and save
+ Lm.f = u[1];
+ Lm.p = u[0];
qmelt.solve(melt_flux);
vfile << melt_flux;
// calculate compaction length
calculateDelta( delta, u, iEta, epsilon, h_on_delta);
deltafile << delta;
- tPlot += dtPlot;
- nPlot += 1;
+ t_plot += dt_plot;
+ n_plot += 1;
}
//set for next time step
u0 = u;
t += delta_t;
- nStep += 1;
+ n_step += 1;
}
return 0;
}
More information about the CIG-COMMITS
mailing list